[filesystem][archive][messaging] Fixing SVACE issues 45/289545/1
authorPiotr Kosko/Tizen API (PLT) /SRPOL/Engineer/Samsung Electronics <p.kosko@samsung.com>
Thu, 9 Mar 2023 10:17:05 +0000 (11:17 +0100)
committerPiotr Kosko/Tizen API (PLT) /SRPOL/Engineer/Samsung Electronics <p.kosko@samsung.com>
Thu, 9 Mar 2023 10:17:05 +0000 (11:17 +0100)
Change-Id: If87b2063207dd3773587ca73b1c6410f26b7b926

src/archive/filesystem_node.cc
src/archive/zip_add_request.cc
src/filesystem/filesystem_instance.cc
src/filesystem/filesystem_stat.cc
src/messaging/message.cc

index 1d8048c..be80823 100644 (file)
@@ -359,7 +359,7 @@ PlatformResult Node::getCreated(std::time_t* time) const {
     LoggerE("Fail: stat()");
     return result;
   }
-  *time = info.st_ctime;
+  *time = static_cast<std::time_t>(info.st_ctime);
   return PlatformResult(ErrorCode::NO_ERROR);
 }
 
index 78840c6..3fb25a5 100644 (file)
@@ -337,7 +337,7 @@ PlatformResult ZipAddRequest::addToZipArchive(filesystem::NodePtr src_file_node)
   if (result.error_code() != ErrorCode::NO_ERROR) {
     return result;
   }
-  cur_afentry->setModified(time);
+  cur_afentry->setModified(static_cast<time_t>(time));
 
   auto entry = m_callback->getFileEntry();
   cur_afentry->setDestination(entry->getDestination());
index a07c7ce..9b844d8 100644 (file)
@@ -649,7 +649,7 @@ void FilesystemInstance::FileReadString(const picojson::value& args, picojson::o
   CHECK_EXIST(args, "offset", out)
 
   const std::string& location = args.get("location").get<std::string>();
-  size_t offset = static_cast<size_t>(args.get("offset").get<double>());
+  long offset = static_cast<long>(args.get("offset").get<double>());
   size_t length = args.contains("length") ? (size_t)args.get("length").get<double>() : NPOS;
   const std::string& encoding =
       args.contains("encoding") ? args.get("encoding").get<std::string>() : "utf-8";
@@ -685,7 +685,7 @@ void FilesystemInstance::FileReadBytes(const picojson::value& args, picojson::ob
   CHECK_EXIST(args, "length", out)
 
   const std::string& location = args.get("location").get<std::string>();
-  size_t offset = static_cast<size_t>(args.get("offset").get<double>());
+  long offset = static_cast<long>(args.get("offset").get<double>());
   size_t length = static_cast<size_t>(args.get("length").get<double>());
 
   try {
@@ -715,7 +715,7 @@ void FilesystemInstance::FileWriteString(const picojson::value& args, picojson::
 
   const std::string& location = args.get("location").get<std::string>();
   const std::string& str = args.get("data").get<std::string>();
-  size_t offset = static_cast<size_t>(args.get("offset").get<double>());
+  long offset = static_cast<long>(args.get("offset").get<double>());
   bool truncate = static_cast<bool>(args.get("truncate").get<bool>());
   const char* mode = truncate ? "w" : "r+";
   const std::string& encoding =
@@ -755,7 +755,7 @@ void FilesystemInstance::FileWriteBytes(const picojson::value& args, picojson::o
 
   const std::string& location = args.get("location").get<std::string>();
   const std::string& str = args.get("data").get<std::string>();
-  size_t offset = static_cast<size_t>(args.get("offset").get<double>());
+  long offset = static_cast<long>(args.get("offset").get<double>());
   bool truncate = static_cast<bool>(args.get("truncate").get<bool>());
   const char* mode = truncate ? "w" : "r+";
 
@@ -788,7 +788,7 @@ void FilesystemInstance::FileWriteBase64(const picojson::value& args, picojson::
 
   const std::string& location = args.get("location").get<std::string>();
   const std::string& str = args.get("data").get<std::string>();
-  size_t offset = static_cast<size_t>(args.get("offset").get<double>());
+  long offset = static_cast<long>(args.get("offset").get<double>());
   bool truncate = static_cast<bool>(args.get("truncate").get<bool>());
   const char* mode = truncate ? "w" : "r+";
 
@@ -1951,7 +1951,7 @@ void FilesystemInstance::FileHandleReadString(const picojson::value& args, picoj
   auto logic = [handle, count, encoding, whole_file](decltype(out) out) {
     try {
       size_t read_bytes = 0;
-      std::vector<std::uint8_t> buf = read_file(handle->file_handle, count, &read_bytes);
+      std::vector<std::uint8_t> buf = read_file(handle->file_handle, static_cast<long>(count), &read_bytes);
       buf.resize(read_bytes);          // this protects from reporting too big arrays to JS
       if (encoding == kISOEncoding) {  // for iso-8859-1 1 byte is equal to 1 character
         out["result"] = picojson::value(picojson::string_type, true);
index feb7bed..1cddd3f 100644 (file)
@@ -99,8 +99,8 @@ FilesystemStat FilesystemStat::getStat(const std::string& path) {
 
   _result.isDirectory = S_ISDIR(aStatObj.st_mode);
   _result.isFile = S_ISREG(aStatObj.st_mode);
-  _result.ctime = aStatObj.st_ctim.tv_sec;
-  _result.mtime = aStatObj.st_mtim.tv_sec;
+  _result.ctime = static_cast<std::time_t>(aStatObj.st_ctim.tv_sec);
+  _result.mtime = static_cast<std::time_t>(aStatObj.st_mtim.tv_sec);
   _result.size = aStatObj.st_size;
   _result.nlink = 0;
   if (_result.isDirectory) {
index dde3491..0ce12c1 100644 (file)
@@ -1005,7 +1005,7 @@ PlatformResult Message::convertPlatformShortMessageToStruct(Message* message, ms
   }
   // Set message timestamp
   if (message->is_timestamp_set()) {
-    msg_set_int_value(msg, MSG_MESSAGE_DISPLAY_TIME_INT, message->getTimestamp());
+    msg_set_int_value(msg, MSG_MESSAGE_DISPLAY_TIME_INT, static_cast<int>(message->getTimestamp()));
   }
   // Set message from
   if (message->is_from_set()) {