diff --git a/lrubuffer/native_module_lrubuffer.cpp b/lrubuffer/native_module_lrubuffer.cpp index eee051c4a9ab9c9f30cead513f9e72cef289ae63..cbd5a66d1938fc2c22e49218d64f54f0cf3d90dc 100755 --- a/lrubuffer/native_module_lrubuffer.cpp +++ b/lrubuffer/native_module_lrubuffer.cpp @@ -22,8 +22,7 @@ static napi_value LruBufferInit(napi_env env, napi_value exports) const char *lruBufferClassName = "lrubuffer"; napi_value lruBufferClass = nullptr; NAPI_CALL(env, napi_define_class(env, lruBufferClassName, strlen(lruBufferClassName), nullptr, - nullptr, 0, nullptr, - &lruBufferClass)); + nullptr, 0, nullptr, &lruBufferClass)); static napi_property_descriptor desc[] = { DECLARE_NAPI_PROPERTY("lrubuffer", lruBufferClass), }; diff --git a/scope/native_module_scope.cpp b/scope/native_module_scope.cpp index c3eff3e6591f28ae99acd013583552552947c976..3dd9411a1ce81ca5d7b2e28cda20943076047c92 100755 --- a/scope/native_module_scope.cpp +++ b/scope/native_module_scope.cpp @@ -22,8 +22,7 @@ static napi_value ScopeInit(napi_env env, napi_value exports) const char *ClassName = "scope"; napi_value scopeClass = nullptr; NAPI_CALL(env, napi_define_class(env, ClassName, strlen(ClassName), nullptr, - nullptr, 0, nullptr, - &scopeClass)); + nullptr, 0, nullptr, &scopeClass)); static napi_property_descriptor desc[] = { DECLARE_NAPI_PROPERTY("scope", scopeClass) }; diff --git a/util/BUILD.gn b/util/BUILD.gn index cc2856c35fb222f7a60e6c145674479d84e59b6e..ea5e47e21e07ea1bba26b2c1a3c2082e3ac36a00 100755 --- a/util/BUILD.gn +++ b/util/BUILD.gn @@ -11,33 +11,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//ark/ts2abc/ts2panda/ts2abc_config.gni") import("//build/ohos.gni") import("//build/ohos/ace/ace.gni") -import("//foundation/ace/ace_engine/ace_config.gni") - -# compile .js to .abc. -action("gen_util_abc") { - visibility = [ ":*" ] - script = "//ark/ts2abc/ts2panda/scripts/generate_js_bytecode.py" - - args = [ - "--src-js", - rebase_path("//base/compileruntime/js_util_module/util/util_js.js"), - "--dst-file", - rebase_path(target_out_dir + "/util.abc"), - "--node", - rebase_path("${node_path}"), - "--frontend-tool-path", - rebase_path("${ts2abc_build_path}"), - "--node-modules", - rebase_path("${node_modules}"), - ] - deps = [ "//ark/ts2abc/ts2panda:ark_ts2abc_build" ] - - inputs = [ "//base/compileruntime/js_util_module/util/util_js.js" ] - outputs = [ target_out_dir + "/util.abc" ] -} base_output_path = get_label_info(":util_js", "target_out_dir") util_js_obj_path = base_output_path + "/util.o" @@ -47,14 +22,6 @@ gen_js_obj("util_js") { output = util_js_obj_path } -abc_output_path = get_label_info(":util_abc", "target_out_dir") -util_abc_obj_path = abc_output_path + "/util_abc.o" -gen_js_obj("util_abc") { - input = "$target_out_dir/util.abc" - output = util_abc_obj_path - dep = ":gen_util_abc" -} - ohos_shared_library("util") { include_dirs = [ "//foundation/ace/napi", @@ -74,7 +41,6 @@ ohos_shared_library("util") { ] deps = [ - ":util_abc", ":util_js", "//base/compileruntime/js_util_module/util/:util_js", "//foundation/ace/napi/:ace_napi", diff --git a/util/js_rational.cpp b/util/js_rational.cpp index 567c26f32e7ae0e537ad6e957a3e980e0338025a..544974093abcc367e4cef881437451d8956f49da 100755 --- a/util/js_rational.cpp +++ b/util/js_rational.cpp @@ -20,11 +20,14 @@ #include "utils/log.h" #include "securec.h" namespace OHOS::Util { - RationalNumber::RationalNumber(napi_env env, int num, int den) + RationalNumber::RationalNumber(napi_env env, int molecule, int denominator) { env_ = env; napi_value result = nullptr; - den < 0 ? num *= -1, den *= -1 : 0; + int num = molecule; + int den = denominator; + num = den < 0 ? num * (-1) : num; + den = den < 0 ? den * (-1) : den; if (den == 0) { if (num > 0) { mnum = 1; diff --git a/util/js_textdecoder.cpp b/util/js_textdecoder.cpp index 4d3c9c6cebd2a528a168bc2eaeb53ee541541096..8f38672f9318202954338916cc9c0d714d36fd5f 100755 --- a/util/js_textdecoder.cpp +++ b/util/js_textdecoder.cpp @@ -73,8 +73,8 @@ namespace OHOS::Util { NAPI_CALL(env_, napi_get_typedarray_info(env_, src, &type, &length, &data1, &arrayBuffer, &byteOffset)); const char *source = static_cast(data1); UErrorCode codeFlag = U_ZERO_ERROR; - size_t limit = GetMinByteSize() *length; - size_t len = limit *sizeof(UChar); + size_t limit = GetMinByteSize() * length; + size_t len = limit * sizeof(UChar); UChar *arr = nullptr; if (limit > 0) { arr = new UChar[limit + 1]; diff --git a/util/native_module_util.cpp b/util/native_module_util.cpp index ed8e51a04005476ce8e05d54e76e5f1bd7b09c3b..dea60e780d6be783a4e98779869a23819f43f9ba 100755 --- a/util/native_module_util.cpp +++ b/util/native_module_util.cpp @@ -27,8 +27,6 @@ extern const char _binary_util_js_js_start[]; extern const char _binary_util_js_js_end[]; -extern const char _binary_util_abc_start[]; -extern const char _binary_util_abc_end[]; namespace OHOS::Util { static std::string temp = "cdfijoOs"; napi_value RationalNumberClass = nullptr; @@ -834,15 +832,4 @@ namespace OHOS::Util { *buflen = _binary_util_js_js_end - _binary_util_js_js_start; } } - // util JS register - extern "C" - __attribute__((visibility("default"))) void NAPI_util_GetABCCode(const char** buf, int* buflen) - { - if (buf != nullptr) { - *buf = _binary_util_abc_start; - } - if (buflen != nullptr) { - *buflen = _binary_util_abc_end - _binary_util_abc_start; - } - } -} +} \ No newline at end of file