From 17aa46be3af07e76f74b99968f0daa273fa5b3c9 Mon Sep 17 00:00:00 2001 From: libenyao Date: Mon, 27 Feb 2023 17:32:56 +0800 Subject: [PATCH] modify warns Signed-off-by: libenyao --- cli/CommandLine.h | 2 +- cli/CommandLineFactory.cpp | 4 ++-- jsapp/rich/JsAppImpl.cpp | 2 +- jsapp/rich/JsAppImpl.h | 2 +- mock/KeyInput.h | 1 + mock/LanguageManager.h | 1 + mock/MouseInput.h | 2 +- mock/VirtualScreen.cpp | 2 +- mock/VirtualScreen.h | 8 ++++---- mock/lite/AsyncWorkManager.cpp | 2 +- mock/lite/AsyncWorkManager.h | 2 +- mock/lite/GeoLocation.cpp | 3 +-- mock/lite/JsAsyncWork.cpp | 2 ++ mock/rich/VirtualScreenImpl.cpp | 16 ++++------------ mock/rich/VirtualScreenImpl.h | 16 +++++++++++----- 15 files changed, 33 insertions(+), 32 deletions(-) diff --git a/cli/CommandLine.h b/cli/CommandLine.h index 57bf12f..13aa67d 100644 --- a/cli/CommandLine.h +++ b/cli/CommandLine.h @@ -22,7 +22,7 @@ class CommandLine { public: - enum class CommandType { SET = 0, GET, ACTION, INVALID }; + enum CommandType { SET = 0, GET, ACTION, INVALID }; CommandLine(CommandType commandType, const Json::Value& arg, const LocalSocket& socket); virtual ~CommandLine(); diff --git a/cli/CommandLineFactory.cpp b/cli/CommandLineFactory.cpp index a3d02b9..67411d9 100644 --- a/cli/CommandLineFactory.cpp +++ b/cli/CommandLineFactory.cpp @@ -21,12 +21,12 @@ #include "PreviewerEngineLog.h" #include "TraceTool.h" -static CommandLineFactory::CommandTypeMap CommandLineFactory::typeMap = CommandLineFactory::CommandTypeMap(); +CommandLineFactory::CommandTypeMap CommandLineFactory::typeMap = CommandLineFactory::CommandTypeMap(); CommandLineFactory::CommandLineFactory() {} using namespace std; -static void CommandLineFactory::InitCommandMap() +void CommandLineFactory::InitCommandMap() { CommandParser& cmdParser = CommandParser::GetInstance(); string deviceType = cmdParser.GetDeviceType(); diff --git a/jsapp/rich/JsAppImpl.cpp b/jsapp/rich/JsAppImpl.cpp index 27d1e3b..6aec8a0 100644 --- a/jsapp/rich/JsAppImpl.cpp +++ b/jsapp/rich/JsAppImpl.cpp @@ -393,7 +393,7 @@ void JsAppImpl::SetArgsColorMode(const string& value) colorMode = value; } -void JsAppImpl::SetArgsAceVersion(const string& aceVersion) +void JsAppImpl::SetArgsAceVersion(const string& value) { aceVersion = value; } diff --git a/jsapp/rich/JsAppImpl.h b/jsapp/rich/JsAppImpl.h index d1a1b25..5b7c78c 100644 --- a/jsapp/rich/JsAppImpl.h +++ b/jsapp/rich/JsAppImpl.h @@ -43,7 +43,7 @@ public: void ResolutionChanged(int32_t changedOriginWidth, int32_t changedOriginHeight, int32_t changedWidth, int32_t changedHeight, int32_t screenDensity) override; void SetArgsColorMode(const std::string& value) override; - void SetArgsAceVersion(const std::string& aceVersion) override; + void SetArgsAceVersion(const std::string& value) override; void SetDeviceOrentation(const std::string& value); std::string GetOrientation() const override; std::string GetColorMode() const override; diff --git a/mock/KeyInput.h b/mock/KeyInput.h index 87ef0c9..031767d 100644 --- a/mock/KeyInput.h +++ b/mock/KeyInput.h @@ -16,6 +16,7 @@ #ifndef KEYINPUT_H #define KEYINPUT_H +#include #include class KeyInput { diff --git a/mock/LanguageManager.h b/mock/LanguageManager.h index 41211ef..6ec78fb 100644 --- a/mock/LanguageManager.h +++ b/mock/LanguageManager.h @@ -17,6 +17,7 @@ #define LANGUAGEMANAGER_H #include +#include class LanguageManager { public: diff --git a/mock/MouseInput.h b/mock/MouseInput.h index 95a5741..0f97968 100644 --- a/mock/MouseInput.h +++ b/mock/MouseInput.h @@ -18,7 +18,7 @@ class MouseInput { public: - enum class MouseStatus { INDEV_STATE_RELEASE = 0, INDEV_STATE_PRESS, INDEV_STATE_MOVE }; + enum MouseStatus { INDEV_STATE_RELEASE = 0, INDEV_STATE_PRESS, INDEV_STATE_MOVE }; double GetMouseXPosition() const; double GetMouseYPosition() const; diff --git a/mock/VirtualScreen.cpp b/mock/VirtualScreen.cpp index 8efa7cd..0bafa4b 100644 --- a/mock/VirtualScreen.cpp +++ b/mock/VirtualScreen.cpp @@ -33,7 +33,7 @@ uint32_t VirtualScreen::inputMethodCountPerMinute = 0; bool VirtualScreen::isWebSocketListening = false; std::string VirtualScreen::webSocketPort = ""; -static std::chrono::system_clock::time_point VirtualScreen::startTime = std::chrono::system_clock::now(); +std::chrono::system_clock::time_point VirtualScreen::startTime = std::chrono::system_clock::now(); bool VirtualScreen::isStartCount = true; bool VirtualScreen::isOutOfSeconds = false; diff --git a/mock/VirtualScreen.h b/mock/VirtualScreen.h index 9bbe0a4..6c7b1ba 100644 --- a/mock/VirtualScreen.h +++ b/mock/VirtualScreen.h @@ -66,14 +66,14 @@ public: int GetJpgQualityValue(int32_t width, int32_t height) const; - enum class LoadDocType { INIT = 3, START = 1, FINISHED = 2, NORMAL = 0 }; + enum LoadDocType { INIT = 3, START = 1, FINISHED = 2, NORMAL = 0 }; void SetLoadDocFlag(VirtualScreen::LoadDocType flag); VirtualScreen::LoadDocType GetLoadDocFlag() const; - enum class ProtocolVersion { LOADNORMAL = 2, LOADDOC = 3 }; + enum ProtocolVersion { LOADNORMAL = 2, LOADDOC = 3 }; - enum class JpgPixCountLevel { LOWCOUNT = 100000, MIDDLECOUNT = 300000, HIGHCOUNT = 500000}; - enum class JpgQualityLevel { HIGHLEVEL = 100, MIDDLELEVEL = 90, LOWLEVEL = 85, DEFAULTLEVEL = 75}; + enum JpgPixCountLevel { LOWCOUNT = 100000, MIDDLECOUNT = 300000, HIGHCOUNT = 500000}; + enum JpgQualityLevel { HIGHLEVEL = 100, MIDDLELEVEL = 90, LOWLEVEL = 85, DEFAULTLEVEL = 75}; static bool isOutOfSeconds; static bool isStartCount; diff --git a/mock/lite/AsyncWorkManager.cpp b/mock/lite/AsyncWorkManager.cpp index d709cfd..b26dac6 100644 --- a/mock/lite/AsyncWorkManager.cpp +++ b/mock/lite/AsyncWorkManager.cpp @@ -41,7 +41,7 @@ void AsyncWorkManager::ClearAllAsyncWork() mutex.unlock(); } -void AsyncWorkManager::AppendAsyncWork(OHOS::ACELite::AsyncWorkHandler work, unsigned char* arg) +void AsyncWorkManager::AppendAsyncWork(OHOS::ACELite::AsyncWorkHandler work, void* arg) { mutex.lock(); workList.push_back(std::make_pair(work, arg)); diff --git a/mock/lite/AsyncWorkManager.h b/mock/lite/AsyncWorkManager.h index c859a92..f9d896f 100644 --- a/mock/lite/AsyncWorkManager.h +++ b/mock/lite/AsyncWorkManager.h @@ -26,7 +26,7 @@ class AsyncWorkManager { public: static AsyncWorkManager& GetInstance(); - void AppendAsyncWork(OHOS::ACELite::AsyncWorkHandler work, unsigned char* arg); + void AppendAsyncWork(OHOS::ACELite::AsyncWorkHandler work, void* arg); void ExecAllAsyncWork(); void ClearAllAsyncWork(); diff --git a/mock/lite/GeoLocation.cpp b/mock/lite/GeoLocation.cpp index ecef065..f4ae49e 100644 --- a/mock/lite/GeoLocation.cpp +++ b/mock/lite/GeoLocation.cpp @@ -40,8 +40,7 @@ const char* GetSupportedGeoCoordTypes() return "wgs84"; } -int32_t GetGeoLocation(LocDataUpdateCallback callback, LocTimeoutCallback timeoutCallback, - unsigned char *arg, uint32_t timeout) +int32_t GetGeoLocation(LocDataUpdateCallback callback, LocTimeoutCallback timeoutCallback, void *arg, uint32_t timeout) { (void)timeoutCallback; (void)arg; diff --git a/mock/lite/JsAsyncWork.cpp b/mock/lite/JsAsyncWork.cpp index 58c6ca4..2344d7c 100644 --- a/mock/lite/JsAsyncWork.cpp +++ b/mock/lite/JsAsyncWork.cpp @@ -15,6 +15,8 @@ #include "js_async_work.h" +#include "AsyncWorkManager.h" + using namespace OHOS::ACELite; bool JsAsyncWork::DispatchAsyncWork(AsyncWorkHandler workHandler, void* data) diff --git a/mock/rich/VirtualScreenImpl.cpp b/mock/rich/VirtualScreenImpl.cpp index 55aea23..68fd12c 100644 --- a/mock/rich/VirtualScreenImpl.cpp +++ b/mock/rich/VirtualScreenImpl.cpp @@ -66,7 +66,7 @@ void VirtualScreenImpl::StartTimer() } } -bool VirtualScreenImpl::LoadDocCallback(const unsigned char* data, +bool VirtualScreenImpl::LoadDocCallback(const void* data, const size_t length, const int32_t width, const int32_t height) @@ -99,7 +99,7 @@ bool VirtualScreenImpl::LoadDocCallback(const unsigned char* data, return true; } -bool VirtualScreenImpl::CallBack(const unsigned char* data, const size_t length, +bool VirtualScreenImpl::CallBack(const void* data, const size_t length, const int32_t width, const int32_t height) { if (VirtualScreenImpl::GetInstance().GetLoadDocFlag() < VirtualScreen::LoadDocType::FINISHED) { @@ -179,7 +179,7 @@ VirtualScreenImpl::~VirtualScreenImpl() } } -void VirtualScreenImpl::Send(const unsigned char* data, int32_t retWidth, int32_t retHeight) +void VirtualScreenImpl::Send(const void* data, int32_t retWidth, int32_t retHeight) { if (CommandParser::GetInstance().GetScreenMode() == CommandParser::ScreenMode::STATIC && VirtualScreen::isOutOfSeconds) { @@ -221,7 +221,7 @@ void VirtualScreenImpl::Send(const unsigned char* data, int32_t retWidth, int32_ FreeJpgMemory(); } -bool VirtualScreenImpl::SendPixmap(const unsigned char* data, size_t length, int32_t retWidth, int32_t retHeight) +bool VirtualScreenImpl::SendPixmap(const void* data, size_t length, int32_t retWidth, int32_t retHeight) { if (data == nullptr) { ELOG("render callback data is null."); @@ -295,11 +295,3 @@ void VirtualScreenImpl::FreeJpgMemory() VirtualScreenImpl::GetInstance().loadDocCopyBuffer = nullptr; } } - -inline void VirtualScreenImpl::WriteBuffer(const T data) -{ - T dataToSend = EndianUtil::ToNetworkEndian(data); - unsigned char* startPos = reinterpret_cast(&dataToSend); - std::copy(startPos, startPos + sizeof(dataToSend), screenBuffer + currentPos); - currentPos += sizeof(dataToSend); -} \ No newline at end of file diff --git a/mock/rich/VirtualScreenImpl.h b/mock/rich/VirtualScreenImpl.h index b0cc6cb..19580da 100644 --- a/mock/rich/VirtualScreenImpl.h +++ b/mock/rich/VirtualScreenImpl.h @@ -24,9 +24,9 @@ public: VirtualScreenImpl& operator=(const VirtualScreenImpl&) = delete; static VirtualScreenImpl& GetInstance(); static void StartTimer(); - static bool LoadDocCallback(const unsigned char* data, const size_t length, + static bool LoadDocCallback(const void* data, const size_t length, const int32_t width, const int32_t height); - static bool CallBack(const unsigned char *data, const size_t length, const int32_t width, const int32_t height); + static bool CallBack(const void* data, const size_t length, const int32_t width, const int32_t height); static bool PageCallBack(const std::string currentRouterPath); static void FastPreviewCallBack(const std::string& jsonStr); void InitAll(std::string pipeName, std::string pipePort); @@ -34,11 +34,17 @@ public: private: VirtualScreenImpl(); ~VirtualScreenImpl(); - void Send(const unsigned char* data, int32_t retWidth, int32_t retHeight); - bool SendPixmap(const unsigned char* data, size_t length, int32_t retWidth, int32_t retHeight); + void Send(const void* data, int32_t retWidth, int32_t retHeight); + bool SendPixmap(const void* data, size_t length, int32_t retWidth, int32_t retHeight); void FreeJpgMemory(); template::value>::type> - void WriteBuffer(const T data); + void WriteBuffer(const T data) + { + T dataToSend = EndianUtil::ToNetworkEndian(data); + unsigned char* startPos = reinterpret_cast(&dataToSend); + std::copy(startPos, startPos + sizeof(dataToSend), screenBuffer + currentPos); + currentPos += sizeof(dataToSend); + } bool isFirstSend; bool isFirstRender;