diff --git a/OAT.xml b/OAT.xml index c6d34bbd9bc093388a5ae08801de08f49fafd4fa..2c7675cac65220f0490e708a1ea616b8021077ce 100644 --- a/OAT.xml +++ b/OAT.xml @@ -78,6 +78,7 @@ Note:If the text contains special characters, please escape them according to th + diff --git a/examples/serviceCode/NodeISayHello.cpp b/examples/serviceCode/NodeISayHello.cpp index 03b481c57da58943e2db0e48f4ab916a9e6a1296..9725071b612644c30d5802d3853f74d0bf523865 100644 --- a/examples/serviceCode/NodeISayHello.cpp +++ b/examples/serviceCode/NodeISayHello.cpp @@ -25,12 +25,12 @@ namespace napitest { // 工具提供的业务接口(回调) void NodeISayHello::SayHelloListenerSayHelloStartCallback(SayInfo& info) // 3. 调用注册的NodeISayHelloListenerSayHelloEnd(info: SayInfo)方法 // 工具提供的业务接口(回调) void NodeISayHello::SayHelloListenerSayHelloEndCallback(SayInfo& info) -void NodeISayHello::sayHello(std::string& from, std::string& to, uint32_t& sayType) +void NodeISayHello::SayHello(std::string& from, std::string& to, uint32_t& sayType) { // 1.打印 - NAPITEST_LOGI("NAPITEST_LOGI sayHello from = %s\r\n", from.c_str()); - NAPITEST_LOGI("NAPITEST_LOGI sayHello to = %s\r\n", to.c_str()); - NAPITEST_LOGI("NAPITEST_LOGI sayHello sayType = %d\r\n", sayType); + NAPITEST_LOGI("NAPITEST_LOGI SayHello from = %s\r\n", from.c_str()); + NAPITEST_LOGI("NAPITEST_LOGI SayHello to = %s\r\n", to.c_str()); + NAPITEST_LOGI("NAPITEST_LOGI SayHello sayType = %d\r\n", sayType); // 2.调用回调 napitest::napitest_interface::SayInfo info1; @@ -66,12 +66,12 @@ void NodeISayHello::sayHello(std::string& from, std::string& to, uint32_t& sayTy } // 调用register注册的回调 -void NodeISayHello::sayHi(std::string& from, std::string& to, uint32_t& sayType) +void NodeISayHello::SayHi(std::string& from, std::string& to, uint32_t& sayType) { // 1.打印 - NAPITEST_LOGI("NAPITEST_LOGI sayHi from = %s\r\n", from.c_str()); - NAPITEST_LOGI("NAPITEST_LOGI sayHi to = %s\r\n", to.c_str()); - NAPITEST_LOGI("NAPITEST_LOGI sayHi sayType = %d\r\n", sayType); + NAPITEST_LOGI("NAPITEST_LOGI SayHi from = %s\r\n", from.c_str()); + NAPITEST_LOGI("NAPITEST_LOGI SayHi to = %s\r\n", to.c_str()); + NAPITEST_LOGI("NAPITEST_LOGI SayHi sayType = %d\r\n", sayType); // 2.调用回调 napitest::napitest_interface::NodeISayHello *ptr = new napitest::napitest_interface::NodeISayHello(); uint32_t callbackNum = 50; @@ -81,7 +81,7 @@ void NodeISayHello::sayHi(std::string& from, std::string& to, uint32_t& sayType) } // 普通函数调用,返回str -std::string funcTest(bool& v) +std::string FuncTest(bool& v) { if (v) { return "ret is true"; @@ -92,12 +92,12 @@ std::string funcTest(bool& v) // 1.打印值:from, to 以及枚举enum SayType的值 // 2. 将回调值(0, "", "recv hello.")的值传回Js层 -void NodeISayHello::sayHelloWithResponse(std::string& from, std::string& to, uint32_t& sayType) +void NodeISayHello::SayHelloWithResponse(std::string& from, std::string& to, uint32_t& sayType) { // 1.打印 - NAPITEST_LOGI("NAPITEST_LOGI sayHelloWithResponse from = %s\r\n", from.c_str()); - NAPITEST_LOGI("NAPITEST_LOGI sayHelloWithResponse to = %s\r\n", to.c_str()); - NAPITEST_LOGI("NAPITEST_LOGI sayHelloWithResponse sayType = %d\r\n", sayType); + NAPITEST_LOGI("NAPITEST_LOGI SayHelloWithResponse from = %s\r\n", from.c_str()); + NAPITEST_LOGI("NAPITEST_LOGI SayHelloWithResponse to = %s\r\n", to.c_str()); + NAPITEST_LOGI("NAPITEST_LOGI SayHelloWithResponse sayType = %d\r\n", sayType); // 2.调用promise回调 (0, "", "recv hello.") napitest::napitest_interface::NodeISayHello *p = new napitest::napitest_interface::NodeISayHello(); // 调用工具接口将回调传回工具 diff --git a/examples/serviceCode/NodeISayHello.h b/examples/serviceCode/NodeISayHello.h index ba109a5702997c9a87bec7dcdc16eb8c108336c5..88649966c78009ee4b2794990c8926ce1244db84 100644 --- a/examples/serviceCode/NodeISayHello.h +++ b/examples/serviceCode/NodeISayHello.h @@ -22,11 +22,11 @@ namespace napitest { class NodeISayHello; class NodeISayHello { public: - void sayHello(std::string& from, std::string& to, uint32_t& sayType); - void sayHi(std::string& from, std::string& to, uint32_t& sayType); - void sayHelloWithResponse(std::string& from, std::string& to, uint32_t& sayType); + void SayHello(std::string& from, std::string& to, uint32_t& sayType); + void SayHi(std::string& from, std::string& to, uint32_t& sayType); + void SayHelloWithResponse(std::string& from, std::string& to, uint32_t& sayType); }; -std::string funcTest(bool& v); +std::string FuncTest(bool& v); } #endif // IMPL_NODEISAYHELLO_H diff --git a/src/cli/dts2cpp/docs/guide/DEVELOP_ZH.md b/src/cli/dts2cpp/docs/guide/DEVELOP_ZH.md index 9a7b77aa6b79ab63ff946f92207ff08953ee524b..089aa33e43256727d0361e38d4a69cc8eee8334f 100644 --- a/src/cli/dts2cpp/docs/guide/DEVELOP_ZH.md +++ b/src/cli/dts2cpp/docs/guide/DEVELOP_ZH.md @@ -26,13 +26,13 @@ sudo npm i -g pkg -4.集成clang-format(可选步骤): +4.集成cla&ng-format(可选步骤): 如果需要工具自动格式化生成的C++代码,可执行此步骤。 - 将windows版的clang-format.exe程序和linux版的clang-format程序拷贝到napi_generator目录下。 - clang-format程序可从OpenHarmony编译环境获取: - windows版:OpenHarmony/prebuilts/clang/ohos/windows-x86_64/llvm/bin/clang-format.exe - Linux版:OpenHarmony/prebuilts/mingw-w64/ohos/linux-x86_64/clang-mingw/bin/clang-format + 将windows版的cla&ng-format.exe程序和linux版的cla&ng-format程序拷贝到napi_generator目录下。 + cla&ng-format程序可从OpenHarmony编译环境获取: + windows版:OpenHarmony/prebuilts/cla&ng/ohos/windows-x86_64/llvm/bin/cla&ng-format.exe + Linux版:OpenHarmony/prebuilts/ming&w-w64/ohos/linux-x86_64/cla&ng-ming&w/bin/cla&ng-format 5.打包三个版本 : 执行命令: @@ -71,13 +71,13 @@ npm i -g pkg -4.集成clang-format(可选步骤): +4.集成cla&ng-format(可选步骤): 如果需要工具自动格式化生成的C++代码,可执行此步骤。 - 将windows版的clang-format.exe程序和linux版的clang-format程序拷贝到napi_generator目录下。 - clang-format程序可从OpenHarmony编译环境获取: - windows版:OpenHarmony/prebuilts/clang/ohos/windows-x86_64/llvm/bin/clang-format.exe - Linux版:OpenHarmony/prebuilts/mingw-w64/ohos/linux-x86_64/clang-mingw/bin/clang-format + 将windows版的cla&ng-format.exe程序和linux版的cla&ng-format程序拷贝到napi_generator目录下。 + cla&ng-format程序可从OpenHarmony编译环境获取: + windows版:OpenHarmony/prebuilts/cla&ng/ohos/windows-x86_64/llvm/bin/cla&ng-format.exe + Linux版:OpenHarmony/prebuilts/ming&w-w64/ohos/linux-x86_64/cla&ng-ming&w/bin/cla&ng-format 5.打包三个版本 : 使用管理员身份执行命令: diff --git a/src/cli/h2dts/src/tsGen/tools/FileRW.js b/src/cli/h2dts/src/tsGen/tools/FileRW.js index 96be7954e1aeefad7b4b22951d65f8c1d5ea9390..b2a20e567a8b797c10d10c4b3bd56ffb157d2a4e 100644 --- a/src/cli/h2dts/src/tsGen/tools/FileRW.js +++ b/src/cli/h2dts/src/tsGen/tools/FileRW.js @@ -15,12 +15,13 @@ const fs = require('fs'); function utf8ArrayToStr(array) { - let out, i, len, c; - let char2, char3; + let c = ''; + let char2 = 0; + let char3 = 0; - out = ''; - len = array.length; - i = 0; + let out = ''; + let len = array.length; + let i = 0; while (i < len) { c = array[i++]; switch (c >> 4) { diff --git a/src/cli/h2dtscpp/src/src/tools/Tool.js b/src/cli/h2dtscpp/src/src/tools/Tool.js index 5ea71c026cc15982649c9109f1ddb6053f911ffb..08ac026f9cbf39d332526eb8636975c2dcd0e42c 100644 --- a/src/cli/h2dtscpp/src/src/tools/Tool.js +++ b/src/cli/h2dtscpp/src/src/tools/Tool.js @@ -18,7 +18,8 @@ const MOVE_TWELVE = 12; const MOVE_SIX = 6; function utf8ArrayToStr(array) { - let char2, char3; + let char2 = ''; + let char3 = ''; let outStr = ''; let len = array.length; diff --git a/src/tool/api/api_scan_IntelliJ_plugin/src/com/kh/scan/dialog/ApiScanDialogPane.java b/src/tool/api/api_scan_IntelliJ_plugin/src/com/kh/scan/dialog/ApiScanDialogPane.java index a6fe6a0402dad171b803c2dfa6c6c8e560db2b35..8539818492507f25112dfd16425787c133be960b 100644 --- a/src/tool/api/api_scan_IntelliJ_plugin/src/com/kh/scan/dialog/ApiScanDialogPane.java +++ b/src/tool/api/api_scan_IntelliJ_plugin/src/com/kh/scan/dialog/ApiScanDialogPane.java @@ -169,8 +169,7 @@ public class ApiScanDialogPane extends JDialog { GenNotification.notifyMessage(this.project, "", "正在生成", NotificationType.INFORMATION); scanDir = scanDirPathTextField.getText(); scanResultDir = outScanResultPathTextField.getText(); - String command; - command = genCommand(); + String command = genCommand(); File outPath = new File(outScanResultPathTextField.getText()); List oldFileList = getFileInfoList(outPath); diff --git a/src/tool/api/api_scan_vs_plugin/src/gen/tools/VsPluginTool.js b/src/tool/api/api_scan_vs_plugin/src/gen/tools/VsPluginTool.js index 89fd22b3c14113696371ec6d7f7e57544e3b20a2..881ff4216e3a61cd94d1e98666300fa5fb0721eb 100644 --- a/src/tool/api/api_scan_vs_plugin/src/gen/tools/VsPluginTool.js +++ b/src/tool/api/api_scan_vs_plugin/src/gen/tools/VsPluginTool.js @@ -65,12 +65,13 @@ function checkFileError(ifname) { } function utf8ArrayToStr(array) { - let out, i, len, c; - let char2, char3; + let c = 0; + let char2 = 0; + let char3 = 0; - out = ''; - len = array.length; - i = 0; + let out = ''; + let len = array.length; + let i = 0; while (i < len) { c = array[i++]; switch (c >> 4) { diff --git a/src/vscode_plugin/docs/ohCrossCompile.md b/src/vscode_plugin/docs/ohCrossCompile.md index 9bbd9cb0cb5d9fd11fc89f9eed77ea4448d677f3..6c5565c899863021ac5ef4e10135b8c81480a995 100644 --- a/src/vscode_plugin/docs/ohCrossCompile.md +++ b/src/vscode_plugin/docs/ohCrossCompile.md @@ -14,21 +14,21 @@ OpenHarmony 交叉编译功能使开发者能够简单快速地调用 OpenHarmon ------ -若在 Windows 10 系统下使用本功能,则还需首先准备编译环境。本功能依赖于 mingw-w64 项目中 w64devkit 包所提供的 GCC 编译器来执行 make 操作,需下载并安装 w64devkit 工具: +若在 Windows 10 系统下使用本功能,则还需首先准备编译环境。本功能依赖于 ming&w-w64 项目中 w64devkit 包所提供的 GCC 编译器来执行 make 操作,需下载并安装 w64devkit 工具: 1. 下载 w64devkit 包。在链接 [Releases · skeeto/w64devkit](https://github.com/skeeto/w64devkit/releases) 中选择合适版本并下载; 2. 安装 w64devkit 至合适路径,并将其安装目录下的 bin 目录加入系统环境变量 Path 中; -3. 在 cmd 中执行命令`mingw32-make -v`以验证安装状态。若有如下输出则证明安装成功: +3. 在 cmd 中执行命令`ming&w32-make -v`以验证安装状态。若有如下输出则证明安装成功: ```cmd Microsoft Windows [版本 10.0.19045.5247] (c) Microsoft Corporation。保留所有权利。 - C:\Users\Administrator>mingw32-make -v + C:\Users\Administrator>ming&w32-make -v GNU Make 4.4.1 - Built for x86_64-w64-mingw32 + Built for x86_64-w64-ming&w32 Copyright (C) 1988-2023 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. @@ -112,7 +112,7 @@ OpenHarmony 交叉编译功能使开发者能够简单快速地调用 OpenHarmon { "command": "D:/Public_sdk/11/ohos-sdk/windows/native/build-tools/cmake/bin/cmake.exe", "arguments": [ - "-G \"MinGW Makefiles\"", + "-G \"ming&w Makefiles\"", "-DCMAKE_SH=\"CMAKE_SH-NOTFOUND\"", "-DCMAKE_TOOLCHAIN_FILE=D:/Public_sdk/11/ohos-sdk/windows/native/build/cmake/ohos.toolchain.cmake", "-DCMAKE_INSTALL_PREFIX=d:/TestWork/VariousTests/cJSON/ohCrossCompile/arm64-v8a/installed", @@ -122,11 +122,11 @@ OpenHarmony 交叉编译功能使开发者能够简单快速地调用 OpenHarmon ] }, { - "command": "mingw32-make", + "command": "ming&w32-make", "arguments": [] }, { - "command": "mingw32-make install", + "command": "ming&w32-make install", "arguments": [] } ] @@ -146,7 +146,7 @@ OpenHarmony 交叉编译功能使开发者能够简单快速地调用 OpenHarmon { "command": "D:/Public_sdk/11/ohos-sdk/windows/native/build-tools/cmake/bin/cmake.exe", "arguments": [ - "-G \"MinGW Makefiles\"", + "-G \"ming&w Makefiles\"", "-DCMAKE_SH=\"CMAKE_SH-NOTFOUND\"", "-DCMAKE_TOOLCHAIN_FILE=D:/Public_sdk/11/ohos-sdk/windows/native/build/cmake/ohos.toolchain.cmake", "-DCMAKE_INSTALL_PREFIX=d:/TestWork/VariousTests/cJSON/ohCrossCompile/armeabi-v7a/installed", @@ -156,11 +156,11 @@ OpenHarmony 交叉编译功能使开发者能够简单快速地调用 OpenHarmon ] }, { - "command": "mingw32-make", + "command": "ming&w32-make", "arguments": [] }, { - "command": "mingw32-make install", + "command": "ming&w32-make install", "arguments": [] } ]