diff --git a/util/js_textdecoder.cpp b/util/js_textdecoder.cpp index 05e574f..c98f368 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 bc74fda..4214469 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 2acd9bd..45bb434 100755 --- a/util/js_textencoder.cpp +++ b/util/js_textencoder.cpp @@ -72,7 +72,7 @@ namespace OHOS::Util { char *writeResult = static_cast(resultData) + byteOffset; int32_t nchars = 0; - int32_t written = 0; + uint32_t written = 0; NativeEngine *engine = reinterpret_cast(env_); NativeValue *nativeValue = reinterpret_cast(src); engine->EncodeToUtf8(nativeValue, writeResult, &written, length, &nchars); diff --git a/util/native_module_util.cpp b/util/native_module_util.cpp index d932b28..22ceda4 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;