diff --git a/util/js_textdecoder.cpp b/util/js_textdecoder.cpp index 05e574f3c095cd75c38b02eff1330dc7e5729f39..c98f3681f109e4a48876994b6f6157c61cdbabd1 100755 --- a/util/js_textdecoder.cpp +++ b/util/js_textdecoder.cpp @@ -73,7 +73,7 @@ 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; + int32_t limit = GetMinByteSize() * length; size_t len = limit * sizeof(UChar); UChar *arr = nullptr; if (limit > 0) { @@ -146,12 +146,12 @@ namespace OHOS::Util { return result; } - size_t TextDecoder::GetMinByteSize() const + int32_t TextDecoder::GetMinByteSize() const { if (tranTool_ == nullptr) { return -1; } - size_t res = ucnv_getMinCharSize(tranTool_.get()); + int32_t res = ucnv_getMinCharSize(tranTool_.get()); return res; } diff --git a/util/js_textdecoder.h b/util/js_textdecoder.h index bc74fdaa365575239ee558cc7da0d814a63c2d10..4214469f655245156967b0a3c74ff55d109c8a05 100755 --- a/util/js_textdecoder.h +++ b/util/js_textdecoder.h @@ -26,7 +26,7 @@ using TransformToolPointer = std::unique_ptr; namespace OHOS::Util { struct DecodeArr { - DecodeArr(UChar *tarPos, size_t tarStaPos, size_t limLen) + DecodeArr(UChar *tarPos, size_t tarStaPos, int32_t limLen) { this->target = tarPos; this->tarStartPos = tarStaPos; @@ -34,7 +34,7 @@ namespace OHOS::Util { } UChar *target = 0; size_t tarStartPos = 0; - size_t limitLen = 0; + int32_t limitLen = 0; }; class TextDecoder { @@ -53,7 +53,7 @@ namespace OHOS::Util { napi_value GetEncoding() const; napi_value GetFatal() const; napi_value GetIgnoreBOM() const; - size_t GetMinByteSize() const; + int32_t GetMinByteSize() const; void Reset() const; UConverter *GetConverterPtr() const { diff --git a/util/js_textencoder.cpp b/util/js_textencoder.cpp index 2acd9bdc594efc97af414d2b97cc8745b879308f..d81cdde9248af2dbbcb4071fe17f0ddfbed08496 100755 --- a/util/js_textencoder.cpp +++ b/util/js_textencoder.cpp @@ -81,12 +81,12 @@ namespace OHOS::Util { NAPI_CALL(env_, napi_create_object(env_, &result)); napi_value read = nullptr; - NAPI_CALL(env_, napi_create_uint32(env_, nchars, &read)); + NAPI_CALL(env_, napi_create_int32(env_, nchars, &read)); NAPI_CALL(env_, napi_set_named_property(env_, result, "read", read)); napi_value resWritten = nullptr; - NAPI_CALL(env_, napi_create_uint32(env_, written, &resWritten)); + NAPI_CALL(env_, napi_create_int32(env_, written, &resWritten)); NAPI_CALL(env_, napi_set_named_property(env_, result, "written", resWritten)); diff --git a/util/native_module_util.cpp b/util/native_module_util.cpp index d932b2831080f2becafdc2b372d1e26d8688a1f6..22ceda4f7dabac3fad312dff5e93ba2b66402ca9 100755 --- a/util/native_module_util.cpp +++ b/util/native_module_util.cpp @@ -191,8 +191,8 @@ namespace OHOS::Util { size_t argc = 1; napi_value argv = nullptr; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, &argv, &thisVar, nullptr)); - uint32_t err = 0; - NAPI_CALL(env, napi_get_value_uint32(env, argv, &err)); + int32_t err = 0; + NAPI_CALL(env, napi_get_value_int32(env, argv, &err)); errInfo = strerror(err); NAPI_CALL(env, napi_create_string_utf8(env, errInfo.c_str(), errInfo.size(), &result)); return result;