From: Piotr Kosko/Tizen API (PLT) /SRPOL/Engineer/Samsung Electronics
Date: Thu, 9 Mar 2023 10:17:05 +0000 (+0100)
Subject: [filesystem][archive][messaging] Fixing SVACE issues
X-Git-Tag: accepted/tizen/unified/20230313.022901~1
X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b488be2299c89e08becae482f33dfa24f045182b;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git
[filesystem][archive][messaging] Fixing SVACE issues
Change-Id: If87b2063207dd3773587ca73b1c6410f26b7b926
---
diff --git a/src/archive/filesystem_node.cc b/src/archive/filesystem_node.cc
index 1d8048c2..be808236 100644
--- a/src/archive/filesystem_node.cc
+++ b/src/archive/filesystem_node.cc
@@ -359,7 +359,7 @@ PlatformResult Node::getCreated(std::time_t* time) const {
LoggerE("Fail: stat()");
return result;
}
- *time = info.st_ctime;
+ *time = static_cast(info.st_ctime);
return PlatformResult(ErrorCode::NO_ERROR);
}
diff --git a/src/archive/zip_add_request.cc b/src/archive/zip_add_request.cc
index 78840c6d..3fb25a52 100644
--- a/src/archive/zip_add_request.cc
+++ b/src/archive/zip_add_request.cc
@@ -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));
auto entry = m_callback->getFileEntry();
cur_afentry->setDestination(entry->getDestination());
diff --git a/src/filesystem/filesystem_instance.cc b/src/filesystem/filesystem_instance.cc
index a07c7cef..9b844d82 100644
--- a/src/filesystem/filesystem_instance.cc
+++ b/src/filesystem/filesystem_instance.cc
@@ -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();
- size_t offset = static_cast(args.get("offset").get());
+ long offset = static_cast(args.get("offset").get());
size_t length = args.contains("length") ? (size_t)args.get("length").get() : NPOS;
const std::string& encoding =
args.contains("encoding") ? args.get("encoding").get() : "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();
- size_t offset = static_cast(args.get("offset").get());
+ long offset = static_cast(args.get("offset").get());
size_t length = static_cast(args.get("length").get());
try {
@@ -715,7 +715,7 @@ void FilesystemInstance::FileWriteString(const picojson::value& args, picojson::
const std::string& location = args.get("location").get();
const std::string& str = args.get("data").get();
- size_t offset = static_cast(args.get("offset").get());
+ long offset = static_cast(args.get("offset").get());
bool truncate = static_cast(args.get("truncate").get());
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();
const std::string& str = args.get("data").get();
- size_t offset = static_cast(args.get("offset").get());
+ long offset = static_cast(args.get("offset").get());
bool truncate = static_cast(args.get("truncate").get());
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();
const std::string& str = args.get("data").get();
- size_t offset = static_cast(args.get("offset").get());
+ long offset = static_cast(args.get("offset").get());
bool truncate = static_cast(args.get("truncate").get());
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 buf = read_file(handle->file_handle, count, &read_bytes);
+ std::vector buf = read_file(handle->file_handle, static_cast(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);
diff --git a/src/filesystem/filesystem_stat.cc b/src/filesystem/filesystem_stat.cc
index feb7bed6..1cddd3f9 100644
--- a/src/filesystem/filesystem_stat.cc
+++ b/src/filesystem/filesystem_stat.cc
@@ -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(aStatObj.st_ctim.tv_sec);
+ _result.mtime = static_cast(aStatObj.st_mtim.tv_sec);
_result.size = aStatObj.st_size;
_result.nlink = 0;
if (_result.isDirectory) {
diff --git a/src/messaging/message.cc b/src/messaging/message.cc
index dde3491d..0ce12c16 100644
--- a/src/messaging/message.cc
+++ b/src/messaging/message.cc
@@ -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(message->getTimestamp()));
}
// Set message from
if (message->is_from_set()) {