diff --git a/interfaces/kits/js/src/mod_fs/properties/copy.cpp b/interfaces/kits/js/src/mod_fs/properties/copy.cpp index 6bc6aa29c2abaadeccf897449dc89058769abb92..57a1e4490fe2d0f2e19d81e73a1f849010f6953c 100644 --- a/interfaces/kits/js/src/mod_fs/properties/copy.cpp +++ b/interfaces/kits/js/src/mod_fs/properties/copy.cpp @@ -281,7 +281,7 @@ uint64_t Copy::GetDirSize(std::shared_ptr infos, const std::string &p int num = scandir(path.c_str(), &(pNameList->namelist), FilterFunc, alphasort); pNameList->direntNum = num; - long int size = 0; + uint64_t size = 0; for (int i = 0; i < num; i++) { string dest = path + '/' + string((pNameList->namelist[i])->d_name); if ((pNameList->namelist[i])->d_type == DT_LNK) { @@ -471,7 +471,8 @@ void Copy::ReceiveComplete(uv_work_t *work, int stat) return; } NVal obj = NVal::CreateObject(env); - if (processedSize <= numeric_limits::max() && entry->totalSize <= numeric_limits::max()) { + if (processedSize <= static_cast(numeric_limits::max()) && + entry->totalSize <= static_cast(numeric_limits::max())) { obj.AddProp("processedSize", NVal::CreateInt64(env, processedSize).val_); obj.AddProp("totalSize", NVal::CreateInt64(env, entry->totalSize).val_); } @@ -647,7 +648,7 @@ void Copy::ReadNotifyEvent(std::shared_ptr infos) OnFileReceive(infos); infos->notifyTime = currentTime + NOTIFY_PROGRESS_DELAY; } - index += sizeof(struct inotify_event) + event->len; + index += sizeof(struct inotify_event) + static_cast(event->len); } } @@ -668,11 +669,11 @@ void Copy::GetNotifyEvent(std::shared_ptr infos) while (infos->run && infos->exceptionCode == ERRNO_NOERR && infos->eventFd != -1 && infos->notifyFd != -1) { auto ret = poll(fds, nfds, -1); if (ret > 0) { - if (fds[0].revents & POLLNVAL) { + if (static_cast(fds[0].revents) & POLLNVAL) { infos->run = false; return; } - if (fds[1].revents & POLLIN) { + if (static_cast(fds[1].revents) & POLLIN) { ReadNotifyEvent(infos); } } else if (ret < 0 && errno == EINTR) { diff --git a/interfaces/kits/js/src/mod_fs/properties/copy_listener/trans_listener.cpp b/interfaces/kits/js/src/mod_fs/properties/copy_listener/trans_listener.cpp index c4a8b6169a299ab44727f49029245cf14803ab02..77f5d19aa3d504aca7cfcebc2f7b9a897848a26e 100644 --- a/interfaces/kits/js/src/mod_fs/properties/copy_listener/trans_listener.cpp +++ b/interfaces/kits/js/src/mod_fs/properties/copy_listener/trans_listener.cpp @@ -217,7 +217,7 @@ void TransListener::CallbackComplete(uv_work_t *work, int stat) return; } NVal obj = NVal::CreateObject(env); - if (entry->progressSize <= numeric_limits::max() && + if (entry->progressSize <= static_cast(numeric_limits::max()) && entry->totalSize <= static_cast(numeric_limits::max())) { obj.AddProp("processedSize", NVal::CreateInt64(env, entry->progressSize).val_); obj.AddProp("totalSize", NVal::CreateInt64(env, entry->totalSize).val_);