fix code check

Signed-off-by: wangshi <wangshi@kaihong.com>
This commit is contained in:
wangshi 2024-12-19 10:27:37 +08:00
parent 2d6fa03dc1
commit eca875a7ec
9 changed files with 53 additions and 50 deletions

View File

@ -78,6 +78,7 @@ Note:If the text contains special characters, please escape them according to th
<filteritem type="filepath" name="prebuilt/End User License Agreement.md" desc="EULA file"/>
</filefilter>
<filefilter name="defaultPolicyFilter" desc="Files not to check license header polices">
<filteritem type="filename" name="*.md" desc="readme files"/>
<filteritem type="filename" name="*.java" desc="orig files"/>
<filteritem type="filename" name="hvigorfile.ts" desc="hvigor配置文件DevEco Studio自动生成不手动修改"/>
<filteritem type="filename" name="hvigor-wrapper.js" desc="hvigor配置文件DevEco Studio自动生成不手动修改"/>

View File

@ -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();
// 调用工具接口将回调传回工具

View File

@ -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

View File

@ -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.打包三个版本 : 使用管理员身份执行命令:

View File

@ -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) {

View File

@ -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;

View File

@ -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<FileInfo> oldFileList = getFileInfoList(outPath);

View File

@ -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) {

View File

@ -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 <https://gnu.org/licenses/gpl.html>
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": []
}
]