From ed8618c8811bee06438966f405de7a8ce12507a8 Mon Sep 17 00:00:00 2001 From: liuhaikang Date: Thu, 20 Feb 2025 16:14:52 +0800 Subject: [PATCH] =?UTF-8?q?ohos=5Fmsgpack=EF=BC=9A=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E7=BC=96=E8=AF=91=E6=9E=84=E5=BB=BA=E5=91=8A=E8=AD=A6=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liuhaikang --- ohos_msgpack/AppScope/app.json5 | 2 +- ohos_msgpack/CHANGELOG.md | 3 +++ ohos_msgpack/entry/oh-package.json5 | 2 +- .../entry/src/main/ets/pages/Encoding64DemoFour.ets | 11 +++++++++-- ohos_msgpack/entry/src/main/ets/pages/Index.ets | 2 +- .../entry/src/main/ets/pages/MultiDecodePage.ets | 2 +- ohos_msgpack/library/oh-package.json5 | 2 +- ohos_msgpack/library/src/main/ets/utils/utf8.ts | 2 +- ohos_msgpack/oh-package.json5 | 2 +- 9 files changed, 19 insertions(+), 9 deletions(-) diff --git a/ohos_msgpack/AppScope/app.json5 b/ohos_msgpack/AppScope/app.json5 index 9ac9e451..796e4f3e 100644 --- a/ohos_msgpack/AppScope/app.json5 +++ b/ohos_msgpack/AppScope/app.json5 @@ -3,7 +3,7 @@ "bundleName": "cn.openharmony.msgpack", "vendor": "example", "versionCode": 1000000, - "versionName": "1.0.1", + "versionName": "1.0.2-rc.0", "icon": "$media:app_icon", "label": "$string:app_name" } diff --git a/ohos_msgpack/CHANGELOG.md b/ohos_msgpack/CHANGELOG.md index 98345052..b36556ff 100644 --- a/ohos_msgpack/CHANGELOG.md +++ b/ohos_msgpack/CHANGELOG.md @@ -1,3 +1,6 @@ +## 1.0.2-rc.0 +- Clear build WARN + ## 1.0.1 - 发布正式版本1.0.1 diff --git a/ohos_msgpack/entry/oh-package.json5 b/ohos_msgpack/entry/oh-package.json5 index f9689448..8ee8c30a 100644 --- a/ohos_msgpack/entry/oh-package.json5 +++ b/ohos_msgpack/entry/oh-package.json5 @@ -5,7 +5,7 @@ "name": "entry", "description": "Please describe the basic information.", "main": "", - "version": "1.0.1", + "version": "1.0.2-rc.0", "dependencies": { "@ohos/msgpack": "file:../library" } diff --git a/ohos_msgpack/entry/src/main/ets/pages/Encoding64DemoFour.ets b/ohos_msgpack/entry/src/main/ets/pages/Encoding64DemoFour.ets index 9512acc9..1d2ac753 100644 --- a/ohos_msgpack/entry/src/main/ets/pages/Encoding64DemoFour.ets +++ b/ohos_msgpack/entry/src/main/ets/pages/Encoding64DemoFour.ets @@ -85,8 +85,15 @@ struct Encoding64DemoFour { } } -function data(): ESObject { - let data: ESObject = + +interface CustomData { + ints: number[]; + nums: number[]; + bigints: bigint[]; +} + +function data() { + let data: CustomData = { ints: [0, Number.MAX_SAFE_INTEGER, Number.MIN_SAFE_INTEGER], nums: [Number.NaN, Math.PI, Math.E, Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY], diff --git a/ohos_msgpack/entry/src/main/ets/pages/Index.ets b/ohos_msgpack/entry/src/main/ets/pages/Index.ets index 41b838e9..5b69dd1b 100644 --- a/ohos_msgpack/entry/src/main/ets/pages/Index.ets +++ b/ohos_msgpack/entry/src/main/ets/pages/Index.ets @@ -54,7 +54,7 @@ struct Index { Button($r('app.string.Complex_encoding_decoding')) .margin({ top: 10 }) .onClick(() => { - router.push({ url: 'pages/MultiDecodePage' }) + router.pushUrl({ url: 'pages/MultiDecodePage' }) }) Button($r('app.string.Special_Character')) .margin({ top: 10 }) diff --git a/ohos_msgpack/entry/src/main/ets/pages/MultiDecodePage.ets b/ohos_msgpack/entry/src/main/ets/pages/MultiDecodePage.ets index 1c7ee089..1722b562 100644 --- a/ohos_msgpack/entry/src/main/ets/pages/MultiDecodePage.ets +++ b/ohos_msgpack/entry/src/main/ets/pages/MultiDecodePage.ets @@ -61,7 +61,7 @@ struct MultiDecodePage { bar, [1, 2, 3], ] - let encodedItems: Uint8Array[] = items.map((item: ESObject): Uint8Array => encode(item)); + let encodedItems: Uint8Array[] = items.map((item): Uint8Array => encode(item)); let encoded = new Uint8Array(encodedItems.reduce((p: number, c: Uint8Array) => p + c.byteLength, 0)); let offset = 0; for (let encodedItem of encodedItems) { diff --git a/ohos_msgpack/library/oh-package.json5 b/ohos_msgpack/library/oh-package.json5 index 0cd46613..5e1d7cfd 100644 --- a/ohos_msgpack/library/oh-package.json5 +++ b/ohos_msgpack/library/oh-package.json5 @@ -10,7 +10,7 @@ "main": "Index.ts", "type": "module", "repository": "https://gitee.com/openharmony-tpc/openharmony_tpc_samples/tree/master/ohos_msgpack", - "version": "1.0.1", + "version": "1.0.2-rc.0", "tags": [ "Tool" ], diff --git a/ohos_msgpack/library/src/main/ets/utils/utf8.ts b/ohos_msgpack/library/src/main/ets/utils/utf8.ts index b10106f9..291edb53 100644 --- a/ohos_msgpack/library/src/main/ets/utils/utf8.ts +++ b/ohos_msgpack/library/src/main/ets/utils/utf8.ts @@ -167,7 +167,7 @@ const TEXT_DECODER_THRESHOLD = 200; export function utf8DecodeTD(bytes: Uint8Array, inputOffset: number, byteLength: number): string { const stringBytes = bytes.subarray(inputOffset, inputOffset + byteLength); - return sharedTextDecoder.decodeWithStream(stringBytes); + return sharedTextDecoder.decodeToString(stringBytes); } export function utf8Decode(bytes: Uint8Array, inputOffset: number, byteLength: number): string { diff --git a/ohos_msgpack/oh-package.json5 b/ohos_msgpack/oh-package.json5 index 1bbfbc86..d3994631 100644 --- a/ohos_msgpack/oh-package.json5 +++ b/ohos_msgpack/oh-package.json5 @@ -7,6 +7,6 @@ "name": "ohos_msgpack", "description": "Please describe the basic information.", "main": "", - "version": "1.0.1", + "version": "1.0.2-rc.0", "dependencies": {} } -- Gitee