From 9808c71e0cab38adab72521c6ed64e26e8628466 Mon Sep 17 00:00:00 2001 From: lifansheng Date: Mon, 27 Sep 2021 17:43:46 +0800 Subject: [PATCH 1/5] Signed-off-by: lifansheng On branch OpenHarmony-3.0-LTS Your branch is up to date with 'origin/OpenHarmony-3.0-LTS'. Changes to be committed: modified: convertxml/BUILD.gn new file: convertxml/build_ts_js.py modified: convertxml/native_module_convertxml.cpp renamed: convertxml/js_convertxml.js -> convertxml/src/js_convertxml.ts new file: convertxml/tsconfig.json --- convertxml/BUILD.gn | 32 ++++++++++++------- convertxml/build_ts_js.py | 21 ++++++++++++ convertxml/native_module_convertxml.cpp | 16 +++++----- .../js_convertxml.ts} | 8 ++--- convertxml/tsconfig.json | 14 ++++++++ 5 files changed, 68 insertions(+), 23 deletions(-) create mode 100644 convertxml/build_ts_js.py rename convertxml/{js_convertxml.js => src/js_convertxml.ts} (95%) mode change 100755 => 100644 create mode 100644 convertxml/tsconfig.json diff --git a/convertxml/BUILD.gn b/convertxml/BUILD.gn index ebace873..5e130653 100755 --- a/convertxml/BUILD.gn +++ b/convertxml/BUILD.gn @@ -16,6 +16,21 @@ import("//build/ohos.gni") import("//build/ohos/ace/ace.gni") import("//foundation/ace/ace_engine/ace_config.gni") +# compile .ts to .js. +action("build_ts_js") { + script = "//base/compileruntime/js_api_module/convertxml/build_ts_js.py" + depfile = "$target_gen_dir/$target_name.d" + outputs = [ target_out_dir + "/js_convertxml.js" ] +} + +base_output_path = get_label_info(":js_convertxml", "target_out_dir") +js_xml_obj_path = base_output_path + "/convertxml.o" +gen_js_obj("js_convertxml") { + input = "$target_out_dir/js_convertxml.js" + output = js_xml_obj_path + dep = ":build_ts_js" +} + # compile .js to .abc. action("gen_convertxml_abc") { visibility = [ ":*" ] @@ -23,7 +38,7 @@ action("gen_convertxml_abc") { args = [ "--src-js", - rebase_path("//base/compileruntime/js_api_module/convertxml/js_convertxml.js"), + rebase_path(target_out_dir + "/js_convertxml.js"), "--dst-file", rebase_path(target_out_dir + "/convertxml.abc"), "--node", @@ -33,20 +48,15 @@ action("gen_convertxml_abc") { "--node-modules", rebase_path("${node_modules}"), ] - deps = [ "//ark/ts2abc/ts2panda:ark_ts2abc_build" ] + deps = [ + ":build_ts_js", + "//ark/ts2abc/ts2panda:ark_ts2abc_build", + ] - inputs = [ "//base/compileruntime/js_api_module/convertxml/js_convertxml.js" ] + inputs = [ target_out_dir + "/js_convertxml.js" ] outputs = [ target_out_dir + "/convertxml.abc" ] } -base_output_path = get_label_info(":js_convertxml", "target_out_dir") -js_xml_obj_path = base_output_path + "/convertxml.o" - -gen_js_obj("js_convertxml") { - input = "//base/compileruntime/js_api_module/convertxml/js_convertxml.js" - output = js_xml_obj_path -} - abc_output_path = get_label_info(":convertxml_abc", "target_out_dir") convertxml_abc_obj_path = abc_output_path + "/convertxml_abc.o" gen_js_obj("convertxml_abc") { diff --git a/convertxml/build_ts_js.py b/convertxml/build_ts_js.py new file mode 100644 index 00000000..76b3fb1d --- /dev/null +++ b/convertxml/build_ts_js.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import os + +if __name__ == '__main__': + + build_path = os.path.abspath(os.path.join(os.getcwd(), "../..")) + os.chdir("%s/base/compileruntime/js_api_module/convertxml" % build_path) + os.system('../../../../developtools/ace-ets2bundle/compiler/node_modules/typescript/bin/tsc') \ No newline at end of file diff --git a/convertxml/native_module_convertxml.cpp b/convertxml/native_module_convertxml.cpp index 05ca3943..01909055 100755 --- a/convertxml/native_module_convertxml.cpp +++ b/convertxml/native_module_convertxml.cpp @@ -98,15 +98,15 @@ __attribute__((visibility("default"))) void NAPI_convertxml_GetJSCode(const char } } extern "C" -__attribute__((visibility("default"))) void NAPI_convertxml_GetABCCode(const char** buf, int* buflen) -{ - if (buf != nullptr) { - *buf = _binary_convertxml_abc_start; + __attribute__((visibility("default"))) void NAPI_convertxml_GetABCCode(const char** buf, int* buflen) + { + if (buf != nullptr) { + *buf = _binary_convertxml_abc_start; + } + if (buflen != nullptr) { + *buflen = _binary_convertxml_abc_end - _binary_convertxml_abc_start; + } } - if (buflen != nullptr) { - *buflen = _binary_convertxml_abc_end - _binary_convertxml_abc_start; - } -} static napi_module ConvertXmlModule = { .nm_version = 1, diff --git a/convertxml/js_convertxml.js b/convertxml/src/js_convertxml.ts old mode 100755 new mode 100644 similarity index 95% rename from convertxml/js_convertxml.js rename to convertxml/src/js_convertxml.ts index e045ea7a..93ebb980 --- a/convertxml/js_convertxml.js +++ b/convertxml/src/js_convertxml.ts @@ -13,14 +13,14 @@ * limitations under the License. */ -'use strict'; +declare function requireInternal(s : string) : any; const convertXml = requireInternal("ConvertXML"); class ConvertXml { convertxmlclass; constructor() { this.convertxmlclass = new convertXml.ConvertXml(); } - convert(strXml, options) { + convert(strXml : string, options : any) { strXml = DealXml(strXml); let converted = this.convertxmlclass.convert(strXml, options); let space = 0; @@ -43,7 +43,7 @@ class ConvertXml { } } -function DealXml(strXml) +function DealXml(strXml : string) { var idx = 0; var idxSec = 0; @@ -88,7 +88,7 @@ function DealXml(strXml) return strXml; } -function DealReplace(strXml, idx, idxThir) +function DealReplace(strXml : string, idx : any, idxThir : any) { var i = idx + 1; for (; i < idxThir ; i++) { diff --git a/convertxml/tsconfig.json b/convertxml/tsconfig.json new file mode 100644 index 00000000..e61c432f --- /dev/null +++ b/convertxml/tsconfig.json @@ -0,0 +1,14 @@ +{ +"compilerOptions": { + "target": "es6", + "module": "es6", + "rootDir": "./src", + //"outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. */ + "outDir": "../../../../out/ohos-arm-release/obj/base/compileruntime/js_api_module/convertxml/", /* Specify an output folder for all emitted files. */ + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "strict": true, + "skipLibCheck": true, + "noImplicitThis": false, + } +} -- Gitee From 2375d2b925f391ceb325eb1dc8d778d881e92983 Mon Sep 17 00:00:00 2001 From: lifansheng Date: Mon, 27 Sep 2021 18:28:03 +0800 Subject: [PATCH 2/5] Signed-off-by: lifansheng On branch OpenHarmony-3.0-LTS Your branch is up to date with 'origin/OpenHarmony-3.0-LTS'. Changes to be committed: modified: convertxml/build_ts_js.py --- convertxml/build_ts_js.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 convertxml/build_ts_js.py diff --git a/convertxml/build_ts_js.py b/convertxml/build_ts_js.py old mode 100644 new mode 100755 -- Gitee From f93ee6c07b229cd46b05fd75acc3ab121768be18 Mon Sep 17 00:00:00 2001 From: lifansheng Date: Tue, 28 Sep 2021 10:07:14 +0800 Subject: [PATCH 3/5] Signed-off-by: lifansheng On branch OpenHarmony-3.0-LTS Your branch is up to date with 'origin/OpenHarmony-3.0-LTS'. Changes to be committed: modified: convertxml/build_ts_js.py --- convertxml/build_ts_js.py | 1 + 1 file changed, 1 insertion(+) diff --git a/convertxml/build_ts_js.py b/convertxml/build_ts_js.py index 76b3fb1d..aed2b91b 100755 --- a/convertxml/build_ts_js.py +++ b/convertxml/build_ts_js.py @@ -18,4 +18,5 @@ if __name__ == '__main__': build_path = os.path.abspath(os.path.join(os.getcwd(), "../..")) os.chdir("%s/base/compileruntime/js_api_module/convertxml" % build_path) + os.system('npm install --prefix ../../../../developtools/ace-ets2bundle/compiler/') os.system('../../../../developtools/ace-ets2bundle/compiler/node_modules/typescript/bin/tsc') \ No newline at end of file -- Gitee From bb1cf861d558946ae47055e56e2ee36cbb073d0f Mon Sep 17 00:00:00 2001 From: lifansheng Date: Tue, 28 Sep 2021 11:28:05 +0800 Subject: [PATCH 4/5] Signed-off-by: lifansheng On branch OpenHarmony-3.0-LTS Your branch is up to date with 'origin/OpenHarmony-3.0-LTS'. Changes to be committed: modified: convertxml/build_ts_js.py --- convertxml/build_ts_js.py | 1 - 1 file changed, 1 deletion(-) diff --git a/convertxml/build_ts_js.py b/convertxml/build_ts_js.py index aed2b91b..76b3fb1d 100755 --- a/convertxml/build_ts_js.py +++ b/convertxml/build_ts_js.py @@ -18,5 +18,4 @@ if __name__ == '__main__': build_path = os.path.abspath(os.path.join(os.getcwd(), "../..")) os.chdir("%s/base/compileruntime/js_api_module/convertxml" % build_path) - os.system('npm install --prefix ../../../../developtools/ace-ets2bundle/compiler/') os.system('../../../../developtools/ace-ets2bundle/compiler/node_modules/typescript/bin/tsc') \ No newline at end of file -- Gitee From b7b4afe2625ad8350a9339aea3aec8b1460c5905 Mon Sep 17 00:00:00 2001 From: lifansheng Date: Tue, 28 Sep 2021 15:52:02 +0800 Subject: [PATCH 5/5] Signed-off-by: lifansheng On branch OpenHarmony-3.0-LTS Your branch is up to date with 'origin/OpenHarmony-3.0-LTS'. Changes to be committed: modified: convertxml/BUILD.gn deleted: convertxml/build_ts_js.py modified: convertxml/js_convertxml.cpp renamed: convertxml/src/js_convertxml.ts -> convertxml/js_convertxml.js modified: convertxml/native_module_convertxml.cpp deleted: convertxml/tsconfig.json modified: uri/native_module_uri.cpp modified: url/native_module_url.cpp --- convertxml/BUILD.gn | 32 +++------ convertxml/build_ts_js.py | 21 ------ convertxml/js_convertxml.cpp | 34 +++++---- .../js_convertxml.ts => js_convertxml.js} | 8 +-- convertxml/native_module_convertxml.cpp | 20 +++--- convertxml/tsconfig.json | 14 ---- uri/native_module_uri.cpp | 32 ++++----- url/native_module_url.cpp | 72 +++++++++---------- 8 files changed, 98 insertions(+), 135 deletions(-) delete mode 100755 convertxml/build_ts_js.py rename convertxml/{src/js_convertxml.ts => js_convertxml.js} (95%) delete mode 100644 convertxml/tsconfig.json diff --git a/convertxml/BUILD.gn b/convertxml/BUILD.gn index 5e130653..ebace873 100755 --- a/convertxml/BUILD.gn +++ b/convertxml/BUILD.gn @@ -16,21 +16,6 @@ import("//build/ohos.gni") import("//build/ohos/ace/ace.gni") import("//foundation/ace/ace_engine/ace_config.gni") -# compile .ts to .js. -action("build_ts_js") { - script = "//base/compileruntime/js_api_module/convertxml/build_ts_js.py" - depfile = "$target_gen_dir/$target_name.d" - outputs = [ target_out_dir + "/js_convertxml.js" ] -} - -base_output_path = get_label_info(":js_convertxml", "target_out_dir") -js_xml_obj_path = base_output_path + "/convertxml.o" -gen_js_obj("js_convertxml") { - input = "$target_out_dir/js_convertxml.js" - output = js_xml_obj_path - dep = ":build_ts_js" -} - # compile .js to .abc. action("gen_convertxml_abc") { visibility = [ ":*" ] @@ -38,7 +23,7 @@ action("gen_convertxml_abc") { args = [ "--src-js", - rebase_path(target_out_dir + "/js_convertxml.js"), + rebase_path("//base/compileruntime/js_api_module/convertxml/js_convertxml.js"), "--dst-file", rebase_path(target_out_dir + "/convertxml.abc"), "--node", @@ -48,15 +33,20 @@ action("gen_convertxml_abc") { "--node-modules", rebase_path("${node_modules}"), ] - deps = [ - ":build_ts_js", - "//ark/ts2abc/ts2panda:ark_ts2abc_build", - ] + deps = [ "//ark/ts2abc/ts2panda:ark_ts2abc_build" ] - inputs = [ target_out_dir + "/js_convertxml.js" ] + inputs = [ "//base/compileruntime/js_api_module/convertxml/js_convertxml.js" ] outputs = [ target_out_dir + "/convertxml.abc" ] } +base_output_path = get_label_info(":js_convertxml", "target_out_dir") +js_xml_obj_path = base_output_path + "/convertxml.o" + +gen_js_obj("js_convertxml") { + input = "//base/compileruntime/js_api_module/convertxml/js_convertxml.js" + output = js_xml_obj_path +} + abc_output_path = get_label_info(":convertxml_abc", "target_out_dir") convertxml_abc_obj_path = abc_output_path + "/convertxml_abc.o" gen_js_obj("convertxml_abc") { diff --git a/convertxml/build_ts_js.py b/convertxml/build_ts_js.py deleted file mode 100755 index 76b3fb1d..00000000 --- a/convertxml/build_ts_js.py +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# Copyright (c) 2021 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -import os - -if __name__ == '__main__': - - build_path = os.path.abspath(os.path.join(os.getcwd(), "../..")) - os.chdir("%s/base/compileruntime/js_api_module/convertxml" % build_path) - os.system('../../../../developtools/ace-ets2bundle/compiler/node_modules/typescript/bin/tsc') \ No newline at end of file diff --git a/convertxml/js_convertxml.cpp b/convertxml/js_convertxml.cpp index 65a40944..505e06d4 100755 --- a/convertxml/js_convertxml.cpp +++ b/convertxml/js_convertxml.cpp @@ -113,22 +113,24 @@ void ConvertXml::GetPrevNodeList(xmlNodePtr curNode) napi_create_object(env_, &elementsObject); if (curNode->type == xmlElementType::XML_PI_NODE && !m_Options.ignoreInstruction) { SetKeyValue(elementsObject, m_Options.type, GetNodeType(curNode->type)); - SetKeyValue(elementsObject, m_Options.name, (char*)curNode->name); + SetKeyValue(elementsObject, m_Options.name, reinterpret_cast(curNode->name)); if (xmlNodeGetContent(curNode) != nullptr) { - SetKeyValue(elementsObject, m_Options.instruction, (const char*)xmlNodeGetContent(curNode)); + SetKeyValue(elementsObject, m_Options.instruction, + reinterpret_cast(xmlNodeGetContent(curNode))); } m_prevObj.push_back(elementsObject); } if (curNode->type == xmlElementType::XML_COMMENT_NODE && !m_Options.ignoreComment) { SetKeyValue(elementsObject, m_Options.type, GetNodeType(curNode->type)); if (xmlNodeGetContent(curNode) != nullptr) { - SetKeyValue(elementsObject, m_Options.comment, (const char*)xmlNodeGetContent(curNode)); + SetKeyValue(elementsObject, m_Options.comment, + reinterpret_cast(xmlNodeGetContent(curNode))); } m_prevObj.push_back(elementsObject); } if (curNode->type == xmlElementType::XML_DTD_NODE && !m_Options.ignoreDoctype) { SetKeyValue(elementsObject, m_Options.type, GetNodeType(curNode->type)); - SetKeyValue(elementsObject, m_Options.doctype, (char*)curNode->name); + SetKeyValue(elementsObject, m_Options.doctype, reinterpret_cast(curNode->name)); m_prevObj.push_back(elementsObject); } } @@ -141,7 +143,8 @@ void ConvertXml::SetAttributes(xmlNodePtr curNode, napi_value &elementsObject) napi_value attrTitleObj = nullptr; napi_create_object(env_, &attrTitleObj); while (attr) { - SetKeyValue(attrTitleObj, (const char*)attr->name, (const char*)attr->children->content); + SetKeyValue(attrTitleObj, reinterpret_cast(attr->name), + reinterpret_cast(attr->children->content)); attr = attr->next; } napi_set_named_property(env_, elementsObject, m_Options.attributes.c_str(), attrTitleObj); @@ -152,17 +155,20 @@ void ConvertXml::SetXmlElementType(xmlNodePtr curNode, napi_value &elementsObjec { if (curNode->type == xmlElementType::XML_PI_NODE && !m_Options.ignoreInstruction) { if (xmlNodeGetContent(curNode) != nullptr) { - SetKeyValue(elementsObject, m_Options.instruction.c_str(), (const char*)xmlNodeGetContent(curNode)); + SetKeyValue(elementsObject, m_Options.instruction.c_str(), + reinterpret_cast(xmlNodeGetContent(curNode))); bFlag = true; } } else if (curNode->type == xmlElementType::XML_COMMENT_NODE && !m_Options.ignoreComment) { if (xmlNodeGetContent(curNode) != nullptr) { - SetKeyValue(elementsObject, m_Options.comment.c_str(), (const char*)xmlNodeGetContent(curNode)); + SetKeyValue(elementsObject, m_Options.comment.c_str(), + reinterpret_cast(xmlNodeGetContent(curNode))); bFlag = true; } } else if (curNode->type == xmlElementType::XML_CDATA_SECTION_NODE && !m_Options.ignoreCdata) { if (xmlNodeGetContent(curNode) != nullptr) { - SetKeyValue(elementsObject, m_Options.cdata, (const char*)xmlNodeGetContent(curNode)); + SetKeyValue(elementsObject, m_Options.cdata, + reinterpret_cast(xmlNodeGetContent(curNode))); bFlag = true; } } @@ -182,7 +188,7 @@ void ConvertXml::SetNodeInfo(xmlNodePtr curNode, napi_value &elementsObject) if ((curNode->type != xmlElementType::XML_COMMENT_NODE) && (curNode->type != xmlElementType::XML_CDATA_SECTION_NODE)) { if (!(curNode->type == xmlElementType::XML_PI_NODE && m_Options.ignoreInstruction)) { - SetKeyValue(elementsObject, m_Options.name, (char*)curNode->name); + SetKeyValue(elementsObject, m_Options.name, reinterpret_cast(curNode->name)); } } } @@ -192,16 +198,18 @@ void ConvertXml::SetEndInfo(xmlNodePtr curNode, napi_value &elementsObject, bool { SetKeyValue(elementsObject, m_Options.type, GetNodeType(curNode->type)); if (curNode->type == xmlElementType::XML_ELEMENT_NODE) { - SetKeyValue(elementsObject, m_Options.name.c_str(), (const char*)curNode->name); + SetKeyValue(elementsObject, m_Options.name.c_str(), reinterpret_cast(curNode->name)); bFlag = true; } else if (curNode->type == xmlElementType::XML_TEXT_NODE) { if (m_Options.trim) { if (xmlNodeGetContent(curNode) != nullptr) { - SetKeyValue(elementsObject, m_Options.text, Trim((const char*)xmlNodeGetContent(curNode))); + SetKeyValue(elementsObject, m_Options.text, + Trim(reinterpret_cast(xmlNodeGetContent(curNode)))); } } else { if (xmlNodeGetContent(curNode) != nullptr) { - SetKeyValue(elementsObject, m_Options.text, (const char*)xmlNodeGetContent(curNode)); + SetKeyValue(elementsObject, m_Options.text, + reinterpret_cast(xmlNodeGetContent(curNode))); } } if (!m_Options.ignoreText) { @@ -567,7 +575,7 @@ void ConvertXml::DealCDataInfo(bool bCData, xmlNodePtr &curNode) curNode->next && curNode->next->type == xmlElementType::XML_TEXT_NODE && curNode->next->next && curNode->next->next->type == xmlElementType::XML_CDATA_SECTION_NODE) { if (xmlNodeGetContent(curNode->next) != nullptr) { - std::string strTemp = (char*)xmlNodeGetContent(curNode->next); + std::string strTemp = reinterpret_cast(xmlNodeGetContent(curNode->next)); Replace(strTemp, " ", ""); Replace(strTemp, "\v", ""); Replace(strTemp, "\t", ""); diff --git a/convertxml/src/js_convertxml.ts b/convertxml/js_convertxml.js similarity index 95% rename from convertxml/src/js_convertxml.ts rename to convertxml/js_convertxml.js index 93ebb980..e045ea7a 100644 --- a/convertxml/src/js_convertxml.ts +++ b/convertxml/js_convertxml.js @@ -13,14 +13,14 @@ * limitations under the License. */ -declare function requireInternal(s : string) : any; +'use strict'; const convertXml = requireInternal("ConvertXML"); class ConvertXml { convertxmlclass; constructor() { this.convertxmlclass = new convertXml.ConvertXml(); } - convert(strXml : string, options : any) { + convert(strXml, options) { strXml = DealXml(strXml); let converted = this.convertxmlclass.convert(strXml, options); let space = 0; @@ -43,7 +43,7 @@ class ConvertXml { } } -function DealXml(strXml : string) +function DealXml(strXml) { var idx = 0; var idxSec = 0; @@ -88,7 +88,7 @@ function DealXml(strXml : string) return strXml; } -function DealReplace(strXml : string, idx : any, idxThir : any) +function DealReplace(strXml, idx, idxThir) { var i = idx + 1; for (; i < idxThir ; i++) { diff --git a/convertxml/native_module_convertxml.cpp b/convertxml/native_module_convertxml.cpp index 01909055..ec877c16 100755 --- a/convertxml/native_module_convertxml.cpp +++ b/convertxml/native_module_convertxml.cpp @@ -31,7 +31,7 @@ static napi_value ConvertXmlConstructor(napi_env env, napi_callback_info info) napi_wrap( env, thisVar, objectInfo, [](napi_env env, void *data, void *hint) { - auto obj = (ConvertXml*)data; + auto obj = reinterpret_cast(data); if (obj != nullptr) { delete obj; } @@ -53,7 +53,7 @@ static napi_value Convert(napi_env env, napi_callback_info info) std::string strXml; napi_valuetype valuetype; ConvertXml *object = nullptr; - NAPI_CALL(env, napi_unwrap(env, thisVar, (void**)&object)); + NAPI_CALL(env, napi_unwrap(env, thisVar, reinterpret_cast(&object))); if (args[0] == nullptr) { NAPI_CALL(env, napi_throw_error(env, "", "parameter is empty")); } else { @@ -98,15 +98,15 @@ __attribute__((visibility("default"))) void NAPI_convertxml_GetJSCode(const char } } extern "C" - __attribute__((visibility("default"))) void NAPI_convertxml_GetABCCode(const char** buf, int* buflen) - { - if (buf != nullptr) { - *buf = _binary_convertxml_abc_start; - } - if (buflen != nullptr) { - *buflen = _binary_convertxml_abc_end - _binary_convertxml_abc_start; - } +__attribute__((visibility("default"))) void NAPI_convertxml_GetABCCode(const char** buf, int* buflen) +{ + if (buf != nullptr) { + *buf = _binary_convertxml_abc_start; } + if (buflen != nullptr) { + *buflen = _binary_convertxml_abc_end - _binary_convertxml_abc_start; + } +} static napi_module ConvertXmlModule = { .nm_version = 1, diff --git a/convertxml/tsconfig.json b/convertxml/tsconfig.json deleted file mode 100644 index e61c432f..00000000 --- a/convertxml/tsconfig.json +++ /dev/null @@ -1,14 +0,0 @@ -{ -"compilerOptions": { - "target": "es6", - "module": "es6", - "rootDir": "./src", - //"outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. */ - "outDir": "../../../../out/ohos-arm-release/obj/base/compileruntime/js_api_module/convertxml/", /* Specify an output folder for all emitted files. */ - "esModuleInterop": true, - "forceConsistentCasingInFileNames": true, - "strict": true, - "skipLibCheck": true, - "noImplicitThis": false, - } -} diff --git a/uri/native_module_uri.cpp b/uri/native_module_uri.cpp index 96107d99..23eb1c6f 100755 --- a/uri/native_module_uri.cpp +++ b/uri/native_module_uri.cpp @@ -52,7 +52,7 @@ namespace OHOS::Uri { } NAPI_CALL(env, napi_wrap(env, thisVar, object, [](napi_env env, void *data, void *hint) { - auto obj = (Uri*)data; + auto obj = reinterpret_cast(data); if (obj != nullptr) { delete obj; } @@ -65,7 +65,7 @@ namespace OHOS::Uri { napi_value thisVar = nullptr; NAPI_CALL(env, napi_get_cb_info(env, info, nullptr, nullptr, &thisVar, nullptr)); Uri *muri = nullptr; - NAPI_CALL(env, napi_unwrap(env, thisVar, (void**)&muri)); + NAPI_CALL(env, napi_unwrap(env, thisVar, reinterpret_cast(&muri))); std::string normalizeUri = muri->Normalize(); napi_value result = nullptr; size_t tempLen = normalizeUri.size(); @@ -82,9 +82,9 @@ namespace OHOS::Uri { NAPI_CALL(env, napi_get_cb_info(env, info, &argc, argv, &thisVar, nullptr)); Uri *muri = nullptr; - NAPI_CALL(env, napi_unwrap(env, thisVar, (void**)&muri)); + NAPI_CALL(env, napi_unwrap(env, thisVar, reinterpret_cast(&muri))); Uri *other = nullptr; - NAPI_CALL(env, napi_unwrap(env, argv[0], (void**)&other)); + NAPI_CALL(env, napi_unwrap(env, argv[0], reinterpret_cast(&other))); bool flag = muri->Equals(*other); NAPI_CALL(env, napi_get_boolean(env, flag, &result)); @@ -97,7 +97,7 @@ namespace OHOS::Uri { napi_value result = nullptr; NAPI_CALL(env, napi_get_cb_info(env, info, nullptr, nullptr, &thisVar, nullptr)); Uri *muri = nullptr; - NAPI_CALL(env, napi_unwrap(env, thisVar, (void**)&muri)); + NAPI_CALL(env, napi_unwrap(env, thisVar, reinterpret_cast(&muri))); bool flag = muri->IsAbsolute(); NAPI_CALL(env, napi_get_boolean(env, flag, &result)); return result; @@ -109,7 +109,7 @@ namespace OHOS::Uri { napi_value result = nullptr; NAPI_CALL(env, napi_get_cb_info(env, info, nullptr, nullptr, &thisVar, nullptr)); Uri *muri = nullptr; - NAPI_CALL(env, napi_unwrap(env, thisVar, (void**)&muri)); + NAPI_CALL(env, napi_unwrap(env, thisVar, reinterpret_cast(&muri))); std::string temp = muri->IsFailed(); size_t templen = temp.size(); NAPI_CALL(env, napi_create_string_utf8(env, temp.c_str(), templen, &result)); @@ -122,7 +122,7 @@ namespace OHOS::Uri { napi_value result = nullptr; NAPI_CALL(env, napi_get_cb_info(env, info, nullptr, nullptr, &thisVar, nullptr)); Uri *muri = nullptr; - NAPI_CALL(env, napi_unwrap(env, thisVar, (void**)&muri)); + NAPI_CALL(env, napi_unwrap(env, thisVar, reinterpret_cast(&muri))); std::string temp = muri->ToString(); size_t templen = temp.size(); NAPI_CALL(env, napi_create_string_utf8(env, temp.c_str(), templen, &result)); @@ -135,7 +135,7 @@ namespace OHOS::Uri { napi_value result = nullptr; NAPI_CALL(env, napi_get_cb_info(env, info, nullptr, nullptr, &thisVar, nullptr)); Uri *muri = nullptr; - NAPI_CALL(env, napi_unwrap(env, thisVar, (void**)&muri)); + NAPI_CALL(env, napi_unwrap(env, thisVar, reinterpret_cast(&muri))); std::string temp = muri->GetScheme(); size_t templen = temp.size(); NAPI_CALL(env, napi_create_string_utf8(env, temp.c_str(), templen, &result)); @@ -148,7 +148,7 @@ namespace OHOS::Uri { napi_value result = nullptr; NAPI_CALL(env, napi_get_cb_info(env, info, nullptr, nullptr, &thisVar, nullptr)); Uri *muri = nullptr; - NAPI_CALL(env, napi_unwrap(env, thisVar, (void**)&muri)); + NAPI_CALL(env, napi_unwrap(env, thisVar, reinterpret_cast(&muri))); std::string temp = muri->GetAuthority(); size_t templen = temp.size(); NAPI_CALL(env, napi_create_string_utf8(env, temp.c_str(), templen, &result)); @@ -161,7 +161,7 @@ namespace OHOS::Uri { napi_value result = nullptr; NAPI_CALL(env, napi_get_cb_info(env, info, nullptr, nullptr, &thisVar, nullptr)); Uri *muri = nullptr; - NAPI_CALL(env, napi_unwrap(env, thisVar, (void**)&muri)); + NAPI_CALL(env, napi_unwrap(env, thisVar, reinterpret_cast(&muri))); std::string temp = muri->GetSsp(); size_t templen = temp.size(); NAPI_CALL(env, napi_create_string_utf8(env, temp.c_str(), templen, &result)); @@ -174,7 +174,7 @@ namespace OHOS::Uri { napi_value result = nullptr; NAPI_CALL(env, napi_get_cb_info(env, info, nullptr, nullptr, &thisVar, nullptr)); Uri *muri = nullptr; - NAPI_CALL(env, napi_unwrap(env, thisVar, (void**)&muri)); + NAPI_CALL(env, napi_unwrap(env, thisVar, reinterpret_cast(&muri))); std::string temp = muri->GetUserinfo(); size_t templen = temp.size(); NAPI_CALL(env, napi_create_string_utf8(env, temp.c_str(), templen, &result)); @@ -187,7 +187,7 @@ namespace OHOS::Uri { napi_value result = nullptr; NAPI_CALL(env, napi_get_cb_info(env, info, nullptr, nullptr, &thisVar, nullptr)); Uri *muri = nullptr; - NAPI_CALL(env, napi_unwrap(env, thisVar, (void**)&muri)); + NAPI_CALL(env, napi_unwrap(env, thisVar, reinterpret_cast(&muri))); std::string temp = muri->GetHost(); size_t templen = temp.size(); NAPI_CALL(env, napi_create_string_utf8(env, temp.c_str(), templen, &result)); @@ -200,7 +200,7 @@ namespace OHOS::Uri { napi_value result = nullptr; NAPI_CALL(env, napi_get_cb_info(env, info, nullptr, nullptr, &thisVar, nullptr)); Uri *muri = nullptr; - NAPI_CALL(env, napi_unwrap(env, thisVar, (void**)&muri)); + NAPI_CALL(env, napi_unwrap(env, thisVar, reinterpret_cast(&muri))); std::string temp = muri->GetPort(); size_t templen = temp.size(); NAPI_CALL(env, napi_create_string_utf8(env, temp.c_str(), templen, &result)); @@ -213,7 +213,7 @@ namespace OHOS::Uri { napi_value result = nullptr; NAPI_CALL(env, napi_get_cb_info(env, info, nullptr, nullptr, &thisVar, nullptr)); Uri *muri = nullptr; - NAPI_CALL(env, napi_unwrap(env, thisVar, (void**)&muri)); + NAPI_CALL(env, napi_unwrap(env, thisVar, reinterpret_cast(&muri))); std::string temp = muri->GetPath(); size_t templen = temp.size(); NAPI_CALL(env, napi_create_string_utf8(env, temp.c_str(), templen, &result)); @@ -226,7 +226,7 @@ namespace OHOS::Uri { napi_value result = nullptr; NAPI_CALL(env, napi_get_cb_info(env, info, nullptr, nullptr, &thisVar, nullptr)); Uri *muri = nullptr; - NAPI_CALL(env, napi_unwrap(env, thisVar, (void**)&muri)); + NAPI_CALL(env, napi_unwrap(env, thisVar, reinterpret_cast(&muri))); std::string temp = muri->GetQuery(); size_t templen = temp.size(); NAPI_CALL(env, napi_create_string_utf8(env, temp.c_str(), templen, &result)); @@ -239,7 +239,7 @@ namespace OHOS::Uri { napi_value result = nullptr; NAPI_CALL(env, napi_get_cb_info(env, info, nullptr, nullptr, &thisVar, nullptr)); Uri *muri = nullptr; - NAPI_CALL(env, napi_unwrap(env, thisVar, (void**)&muri)); + NAPI_CALL(env, napi_unwrap(env, thisVar, reinterpret_cast(&muri))); std::string temp = muri->GetFragment(); size_t templen = temp.size(); NAPI_CALL(env, napi_create_string_utf8(env, temp.c_str(), templen, &result)); diff --git a/url/native_module_url.cpp b/url/native_module_url.cpp index 57fc077d..75cf918a 100755 --- a/url/native_module_url.cpp +++ b/url/native_module_url.cpp @@ -60,7 +60,7 @@ namespace OHOS::Url { object = new URL(env, input, base); } else if (valuetype2 == napi_object) { URL *temp = nullptr; - napi_unwrap(env, argv[1], (void**)&temp); + napi_unwrap(env, argv[1], reinterpret_cast(&temp)); object = new URL(env, input, *temp); } else { HILOG_INFO("secondParameter error"); @@ -118,7 +118,7 @@ namespace OHOS::Url { napi_value thisVar = nullptr; NAPI_CALL(env, napi_get_cb_info(env, info, nullptr, nullptr, &thisVar, nullptr)); URL *murl = nullptr; - NAPI_CALL(env, napi_unwrap(env, thisVar, (void**)&murl)); + NAPI_CALL(env, napi_unwrap(env, thisVar, reinterpret_cast(&murl))); napi_value retVal = murl->GetHostname(); return retVal; } @@ -128,7 +128,7 @@ namespace OHOS::Url { napi_value thisVar = nullptr; NAPI_CALL(env, napi_get_cb_info(env, info, nullptr, nullptr, &thisVar, nullptr)); URL *murl = nullptr; - NAPI_CALL(env, napi_unwrap(env, thisVar, (void**)&murl)); + NAPI_CALL(env, napi_unwrap(env, thisVar, reinterpret_cast(&murl))); napi_value retVal = murl->GetSearch(); return retVal; } @@ -138,7 +138,7 @@ namespace OHOS::Url { napi_value thisVar = nullptr; NAPI_CALL(env, napi_get_cb_info(env, info, nullptr, nullptr, &thisVar, nullptr)); URL *murl = nullptr; - NAPI_CALL(env, napi_unwrap(env, thisVar, (void**)&murl)); + NAPI_CALL(env, napi_unwrap(env, thisVar, reinterpret_cast(&murl))); napi_value retVal = murl->GetUsername(); return retVal; } @@ -148,7 +148,7 @@ namespace OHOS::Url { napi_value thisVar = nullptr; NAPI_CALL(env, napi_get_cb_info(env, info, nullptr, nullptr, &thisVar, nullptr)); URL *murl = nullptr; - NAPI_CALL(env, napi_unwrap(env, thisVar, (void**)&murl)); + NAPI_CALL(env, napi_unwrap(env, thisVar, reinterpret_cast(&murl))); napi_value retVal = murl->GetPassword(); return retVal; } @@ -158,7 +158,7 @@ namespace OHOS::Url { napi_value thisVar = nullptr; NAPI_CALL(env, napi_get_cb_info(env, info, nullptr, nullptr, &thisVar, nullptr)); URL *murl = nullptr; - NAPI_CALL(env, napi_unwrap(env, thisVar, (void**)&murl)); + NAPI_CALL(env, napi_unwrap(env, thisVar, reinterpret_cast(&murl))); napi_value retVal = murl->GetFragment(); return retVal; } @@ -168,7 +168,7 @@ namespace OHOS::Url { napi_value thisVar = nullptr; NAPI_CALL(env, napi_get_cb_info(env, info, nullptr, nullptr, &thisVar, nullptr)); URL *murl = nullptr; - NAPI_CALL(env, napi_unwrap(env, thisVar, (void**)&murl)); + NAPI_CALL(env, napi_unwrap(env, thisVar, reinterpret_cast(&murl))); napi_value retVal = murl->GetScheme(); return retVal; } @@ -178,7 +178,7 @@ namespace OHOS::Url { napi_value thisVar = nullptr; NAPI_CALL(env, napi_get_cb_info(env, info, nullptr, nullptr, &thisVar, nullptr)); URL *murl = nullptr; - NAPI_CALL(env, napi_unwrap(env, thisVar, (void**)&murl)); + NAPI_CALL(env, napi_unwrap(env, thisVar, reinterpret_cast(&murl))); napi_value retVal = murl->GetPort(); return retVal; } @@ -188,7 +188,7 @@ namespace OHOS::Url { napi_value thisVar = nullptr; NAPI_CALL(env, napi_get_cb_info(env, info, nullptr, nullptr, &thisVar, nullptr)); URL *murl = nullptr; - NAPI_CALL(env, napi_unwrap(env, thisVar, (void**)&murl)); + NAPI_CALL(env, napi_unwrap(env, thisVar, reinterpret_cast(&murl))); napi_value retVal = murl->GetHost(); return retVal; } @@ -198,7 +198,7 @@ namespace OHOS::Url { napi_value thisVar = nullptr; NAPI_CALL(env, napi_get_cb_info(env, info, nullptr, nullptr, &thisVar, nullptr)); URL *murl = nullptr; - NAPI_CALL(env, napi_unwrap(env, thisVar, (void**)&murl)); + NAPI_CALL(env, napi_unwrap(env, thisVar, reinterpret_cast(&murl))); napi_value retVal = murl->GetPath(); return retVal; } @@ -208,7 +208,7 @@ namespace OHOS::Url { napi_value thisVar = nullptr; NAPI_CALL(env, napi_get_cb_info(env, info, nullptr, nullptr, &thisVar, nullptr)); URL *murl = nullptr; - NAPI_CALL(env, napi_unwrap(env, thisVar, (void**)&murl)); + NAPI_CALL(env, napi_unwrap(env, thisVar, reinterpret_cast(&murl))); napi_value retVal = murl->GetOnOrOff(); return retVal; } @@ -218,7 +218,7 @@ namespace OHOS::Url { napi_value thisVar = nullptr; NAPI_CALL(env, napi_get_cb_info(env, info, nullptr, nullptr, &thisVar, nullptr)); URL *murl = nullptr; - NAPI_CALL(env, napi_unwrap(env, thisVar, (void**)&murl)); + NAPI_CALL(env, napi_unwrap(env, thisVar, reinterpret_cast(&murl))); napi_value retVal = murl->GetIsIpv6(); return retVal; } @@ -243,7 +243,7 @@ namespace OHOS::Url { type = nullptr; } URL *murl = nullptr; - NAPI_CALL(env, napi_unwrap(env, thisVar, (void**)&murl)); + NAPI_CALL(env, napi_unwrap(env, thisVar, reinterpret_cast(&murl))); murl->SetHref(input); napi_value result = nullptr; NAPI_CALL(env, napi_get_undefined(env, &result)); @@ -270,7 +270,7 @@ namespace OHOS::Url { type = nullptr; } URL *murl = nullptr; - NAPI_CALL(env, napi_unwrap(env, thisVar, (void**)&murl)); + NAPI_CALL(env, napi_unwrap(env, thisVar, reinterpret_cast(&murl))); murl->SetHostname(input); napi_value result = nullptr; NAPI_CALL(env, napi_get_undefined(env, &result)); @@ -297,7 +297,7 @@ namespace OHOS::Url { type = nullptr; } URL *murl = nullptr; - NAPI_CALL(env, napi_unwrap(env, thisVar, (void**)&murl)); + NAPI_CALL(env, napi_unwrap(env, thisVar, reinterpret_cast(&murl))); murl->SetPort(input); napi_value result = nullptr; NAPI_CALL(env, napi_get_undefined(env, &result)); @@ -324,7 +324,7 @@ namespace OHOS::Url { type = nullptr; } URL *murl = nullptr; - NAPI_CALL(env, napi_unwrap(env, thisVar, (void**)&murl)); + NAPI_CALL(env, napi_unwrap(env, thisVar, reinterpret_cast(&murl))); murl->SetHost(input); napi_value result = nullptr; NAPI_CALL(env, napi_get_undefined(env, &result)); @@ -351,7 +351,7 @@ namespace OHOS::Url { type = nullptr; } URL *murl = nullptr; - NAPI_CALL(env, napi_unwrap(env, thisVar, (void**)&murl)); + NAPI_CALL(env, napi_unwrap(env, thisVar, reinterpret_cast(&murl))); murl->SetSearch(input); napi_value result = nullptr; NAPI_CALL(env, napi_get_undefined(env, &result)); @@ -378,7 +378,7 @@ namespace OHOS::Url { type = nullptr; } URL *murl = nullptr; - NAPI_CALL(env, napi_unwrap(env, thisVar, (void**)&murl)); + NAPI_CALL(env, napi_unwrap(env, thisVar, reinterpret_cast(&murl))); murl->SetScheme(input); napi_value result = nullptr; NAPI_CALL(env, napi_get_undefined(env, &result)); @@ -405,7 +405,7 @@ namespace OHOS::Url { type = nullptr; } URL *murl = nullptr; - NAPI_CALL(env, napi_unwrap(env, thisVar, (void**)&murl)); + NAPI_CALL(env, napi_unwrap(env, thisVar, reinterpret_cast(&murl))); murl->SetFragment(input); napi_value result = nullptr; NAPI_CALL(env, napi_get_undefined(env, &result)); @@ -432,7 +432,7 @@ namespace OHOS::Url { type = nullptr; } URL *murl = nullptr; - NAPI_CALL(env, napi_unwrap(env, thisVar, (void**)&murl)); + NAPI_CALL(env, napi_unwrap(env, thisVar, reinterpret_cast(&murl))); murl->SetUsername(input); napi_value result = nullptr; NAPI_CALL(env, napi_get_undefined(env, &result)); @@ -459,7 +459,7 @@ namespace OHOS::Url { type = nullptr; } URL *murl = nullptr; - NAPI_CALL(env, napi_unwrap(env, thisVar, (void**)&murl)); + NAPI_CALL(env, napi_unwrap(env, thisVar, reinterpret_cast(&murl))); murl->SetPath(input); napi_value result = nullptr; NAPI_CALL(env, napi_get_undefined(env, &result)); @@ -486,7 +486,7 @@ namespace OHOS::Url { type = nullptr; } URL *murl = nullptr; - NAPI_CALL(env, napi_unwrap(env, thisVar, (void**)&murl)); + NAPI_CALL(env, napi_unwrap(env, thisVar, reinterpret_cast(&murl))); murl->SetPassword(input); napi_value result = nullptr; NAPI_CALL(env, napi_get_undefined(env, &result)); @@ -537,7 +537,7 @@ namespace OHOS::Url { } } URLSearchParams *murl = nullptr; - NAPI_CALL(env, napi_unwrap(env, thisVar, (void**)&murl)); + NAPI_CALL(env, napi_unwrap(env, thisVar, reinterpret_cast(&murl))); murl->SetArray(vec); napi_value result = nullptr; NAPI_CALL(env, napi_get_undefined(env, &result)); @@ -549,7 +549,7 @@ namespace OHOS::Url { napi_value thisVar = nullptr; NAPI_CALL(env, napi_get_cb_info(env, info, nullptr, nullptr, &thisVar, nullptr)); URLSearchParams *murl = nullptr; - NAPI_CALL(env, napi_unwrap(env, thisVar, (void**)&murl)); + NAPI_CALL(env, napi_unwrap(env, thisVar, reinterpret_cast(&murl))); napi_value retVal = murl->GetArray(); return retVal; } @@ -565,7 +565,7 @@ namespace OHOS::Url { return nullptr; } URLSearchParams *object = nullptr; - napi_unwrap(env, thisVar, (void**)&object); + napi_unwrap(env, thisVar, reinterpret_cast(&object)); napi_value result = object->Get(args); return result; } @@ -581,7 +581,7 @@ namespace OHOS::Url { return nullptr; } URLSearchParams *object = nullptr; - napi_unwrap(env, thisVar, (void**)&object); + napi_unwrap(env, thisVar, reinterpret_cast(&object)); napi_value result = object->GetAll(args); return result; } @@ -598,7 +598,7 @@ namespace OHOS::Url { return nullptr; } URLSearchParams *object = nullptr; - napi_unwrap(env, thisVar, (void**)&object); + napi_unwrap(env, thisVar, reinterpret_cast(&object)); object->Append(args[0], args[1]); return nullptr; } @@ -614,7 +614,7 @@ namespace OHOS::Url { return nullptr; } URLSearchParams *object = nullptr; - napi_unwrap(env, thisVar, (void**)&object); + napi_unwrap(env, thisVar, reinterpret_cast(&object)); object->Delete(args); return nullptr; } @@ -626,7 +626,7 @@ namespace OHOS::Url { napi_value args = nullptr; napi_get_cb_info(env, info, &argc, &args, &thisVar, nullptr); URLSearchParams *object = nullptr; - napi_unwrap(env, thisVar, (void**)&object); + napi_unwrap(env, thisVar, reinterpret_cast(&object)); object->ForEach(args, thisVar); return nullptr; } @@ -638,7 +638,7 @@ namespace OHOS::Url { napi_value args = nullptr; napi_get_cb_info(env, info, &argc, &args, &thisVar, nullptr); URLSearchParams *object = nullptr; - napi_unwrap(env, thisVar, (void**)&object); + napi_unwrap(env, thisVar, reinterpret_cast(&object)); napi_value result = object->Entries(); return result; } @@ -650,7 +650,7 @@ namespace OHOS::Url { napi_value args = nullptr; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, &args, &thisVar, nullptr)); URLSearchParams *object = nullptr; - NAPI_CALL(env, napi_unwrap(env, thisVar, (void**)&object)); + NAPI_CALL(env, napi_unwrap(env, thisVar, reinterpret_cast(&object))); napi_value result = object->IsHas(args); return result; } @@ -662,7 +662,7 @@ namespace OHOS::Url { napi_value args[2] = { 0 }; napi_get_cb_info(env, info, &argc, args, &thisVar, nullptr); URLSearchParams *object = nullptr; - napi_unwrap(env, thisVar, (void**)&object); + napi_unwrap(env, thisVar, reinterpret_cast(&object)); object->Set(args[0], args[1]); return nullptr; } @@ -674,7 +674,7 @@ namespace OHOS::Url { napi_value args = nullptr; napi_get_cb_info(env, info, &argc, &args, &thisVar, nullptr); URLSearchParams *object = nullptr; - napi_unwrap(env, thisVar, (void**)&object); + napi_unwrap(env, thisVar, reinterpret_cast(&object)); object->Sort(); return nullptr; } @@ -686,7 +686,7 @@ namespace OHOS::Url { napi_value args = nullptr; napi_get_cb_info(env, info, &argc, &args, &thisVar, nullptr); URLSearchParams *object = nullptr; - napi_unwrap(env, thisVar, (void**)&object); + napi_unwrap(env, thisVar, reinterpret_cast(&object)); napi_value result = object->ToString(); return result; } @@ -698,7 +698,7 @@ namespace OHOS::Url { napi_value args = nullptr; napi_get_cb_info(env, info, &argc, &args, &thisVar, nullptr); URLSearchParams *object = nullptr; - napi_unwrap(env, thisVar, (void**)&object); + napi_unwrap(env, thisVar, reinterpret_cast(&object)); napi_value result = object->IterByKeys(); return result; } @@ -710,7 +710,7 @@ namespace OHOS::Url { napi_value args = nullptr; napi_get_cb_info(env, info, &argc, &args, &thisVar, nullptr); URLSearchParams *object = nullptr; - napi_unwrap(env, thisVar, (void**)&object); + napi_unwrap(env, thisVar, reinterpret_cast(&object)); napi_value result = object->IterByValues(); return result; } -- Gitee