Signed-off-by: lifansheng <lifansheng1@huawei.com>

On branch master
 Your branch is up to date with 'origin/master'.
This commit is contained in:
lifansheng
2021-10-14 16:48:14 +08:00
parent 4d5af398ce
commit 3ab87f08ef
2 changed files with 10 additions and 10 deletions
+7 -7
View File
@@ -293,7 +293,7 @@ namespace OHOS::Util {
NAPI_CALL(env, napi_get_typedarray_info(env, src, &type, &length, &resultData, &resultBuffer, &byteOffset));
unsigned char *inputEncode = nullptr;
inputEncode = static_cast<unsigned char*>(resultData) + byteOffset;
CreatePromise(inputEncode, length);
CreateEncodePromise(inputEncode, length);
return stdEncodeInfo_->promise;
}
@@ -307,11 +307,11 @@ namespace OHOS::Util {
NAPI_CALL(env, napi_get_typedarray_info(env, src, &type, &length, &resultData, &resultBuffer, &byteOffset));
unsigned char *inputEncode = nullptr;
inputEncode = static_cast<unsigned char*>(resultData) + byteOffset;
CreatePromise01(inputEncode, length);
CreateEncodeToStringPromise(inputEncode, length);
return stdEncodeInfo_->promise;
}
void Base64::CreatePromise(unsigned char *inputDecode, size_t length)
void Base64::CreateEncodePromise(unsigned char *inputDecode, size_t length)
{
napi_value resourceName = nullptr;
stdEncodeInfo_ = new EncodeInfo();
@@ -325,7 +325,7 @@ namespace OHOS::Util {
napi_queue_async_work(env, stdEncodeInfo_->worker);
}
void Base64::CreatePromise01(unsigned char *inputDecode, size_t length)
void Base64::CreateEncodeToStringPromise(unsigned char *inputDecode, size_t length)
{
napi_value resourceName = nullptr;
stdEncodeInfo_ = new EncodeInfo();
@@ -457,16 +457,16 @@ namespace OHOS::Util {
napi_throw_error(env, "-2", "prolen is error !");
}
napi_get_value_string_utf8(env, src, inputString, prolen+1, &prolen);
CreatePromise02(inputString, prolen);
CreateDecodePromise(inputString, prolen);
} else if (type == napi_typedarray_type::napi_uint8_array) {
inputDecode = static_cast<char*>(resultData) + byteOffset;
CreatePromise02(inputDecode, length);
CreateDecodePromise(inputDecode, length);
}
return stdDecodeInfo_->promise;
delete[] inputString;
}
void Base64::CreatePromise02(char *inputDecode, size_t length)
void Base64::CreateDecodePromise(char *inputDecode, size_t length)
{
napi_value resourceName = nullptr;
stdDecodeInfo_ = new DecodeInfo();
+3 -3
View File
@@ -82,9 +82,9 @@ namespace OHOS::Util {
const char *inputDecode_ = nullptr;
unsigned char *retDecode = nullptr;
void CreatePromise(unsigned char *inputDecode, size_t length);
void CreatePromise01(unsigned char *inputDecode, size_t length);
void CreatePromise02(char *inputDecode, size_t length);
void CreateEncodePromise(unsigned char *inputDecode, size_t length);
void CreateEncodeToStringPromise(unsigned char *inputDecode, size_t length);
void CreateDecodePromise(char *inputDecode, size_t length);
EncodeInfo *stdEncodeInfo_ = nullptr;
DecodeInfo *stdDecodeInfo_ = nullptr;
static void ReadStdEncode(napi_env env, void *data);