From acd87db992cdedbadfa92ccc9a468676f715a9e8 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Tue, 10 Dec 2024 07:15:54 +0000 Subject: [PATCH 1/2] fix: compile errors --- include/os/osLocale.h | 6 +++--- source/os/test/osEnvTests.cpp | 5 ++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/include/os/osLocale.h b/include/os/osLocale.h index d7a3540887..78d5f948b0 100644 --- a/include/os/osLocale.h +++ b/include/os/osLocale.h @@ -28,9 +28,9 @@ extern "C" { #define setlocale SETLOCALE_FUNC_TAOS_FORBID #endif -char *taosCharsetReplace(char *charsetstr); -void taosGetSystemLocale(char *outLocale, char *outCharset); -int32_t taosSetSystemLocale(const char *inLocale); +char *taosCharsetReplace(char *charsetstr); +void taosGetSystemLocale(char *outLocale, char *outCharset); +int32_t taosSetSystemLocale(const char *inLocale); #ifdef __cplusplus } diff --git a/source/os/test/osEnvTests.cpp b/source/os/test/osEnvTests.cpp index d5b3cac8a6..6af6f84b68 100644 --- a/source/os/test/osEnvTests.cpp +++ b/source/os/test/osEnvTests.cpp @@ -84,9 +84,8 @@ TEST(osEnvTests, osSufficient) { ret = osTempSpaceSufficient(); EXPECT_EQ(ret, true); - osSetSystemLocale(NULL, NULL); - osSetSystemLocale(NULL, NULL); - osSetSystemLocale("1", "2"); + taosSetSystemLocale(NULL); + taosSetSystemLocale("1"); osSetProcPath(1, NULL); osSetProcPath(0, (char **)&ret); From 85af6a9224a4b9cd5b51efa7eae64a573e90eadd Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Tue, 10 Dec 2024 16:16:38 +0800 Subject: [PATCH 2/2] fix:locale error --- source/os/src/osLocale.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/source/os/src/osLocale.c b/source/os/src/osLocale.c index cb0a2646fd..484436fafe 100644 --- a/source/os/src/osLocale.c +++ b/source/os/src/osLocale.c @@ -87,8 +87,7 @@ int32_t taosSetSystemLocale(const char *inLocale) { return terrno; } - (void)memcpy(tsLocale, inLocale, strlen(inLocale) + 1); - + tstrncpy(tsLocale, locale, TD_LOCALE_LEN); return 0; }