From 0f341093e4b43f090c22f66a4f477f299721498e Mon Sep 17 00:00:00 2001 From: factosea <285808407@qq.com> Date: Tue, 12 Nov 2024 10:23:09 +0800 Subject: [PATCH] fix: ucs4_max_len --- source/os/src/osString.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/source/os/src/osString.c b/source/os/src/osString.c index 5545111b52..0ee4f1c496 100644 --- a/source/os/src/osString.c +++ b/source/os/src/osString.c @@ -353,10 +353,10 @@ void taosReleaseConv(int32_t idx, iconv_t conv, ConvType type) { } bool taosMbsToUcs4(const char *mbs, size_t mbsLength, TdUcs4 *ucs4, int32_t ucs4_max_len, int32_t *len) { - if (ucs4_max_len <= 0) { + if (ucs4_max_len == 0) { return true; } - if(mbs == NULL || ucs4 == NULL) { + if(ucs4_max_len < 0 || mbs == NULL || ucs4 == NULL) { terrno = TSDB_CODE_INVALID_PARA; return false; } @@ -398,10 +398,10 @@ bool taosMbsToUcs4(const char *mbs, size_t mbsLength, TdUcs4 *ucs4, int32_t ucs4 // if success, return the number of bytes written to mbs ( >= 0) // otherwise return error code ( < 0) int32_t taosUcs4ToMbs(TdUcs4 *ucs4, int32_t ucs4_max_len, char *mbs) { - if (ucs4_max_len <= 0) { + if (ucs4_max_len == 0) { return 0; } - if(ucs4 == NULL || mbs == NULL) { + if(ucs4_max_len < 0 || ucs4 == NULL || mbs == NULL) { terrno = TSDB_CODE_INVALID_PARA; return terrno; } @@ -436,10 +436,10 @@ int32_t taosUcs4ToMbs(TdUcs4 *ucs4, int32_t ucs4_max_len, char *mbs) { // if success, return the number of bytes written to mbs ( >= 0) // otherwise return error code ( < 0) int32_t taosUcs4ToMbsEx(TdUcs4 *ucs4, int32_t ucs4_max_len, char *mbs, iconv_t conv) { - if (ucs4_max_len <= 0) { + if (ucs4_max_len == 0) { return 0; } - if(ucs4 == NULL || mbs == NULL) { + if(ucs4_max_len < 0 || ucs4 == NULL || mbs == NULL) { terrno = TSDB_CODE_INVALID_PARA; return terrno; }