summaryrefslogtreecommitdiff
path: root/core/src/xmake/string
diff options
context:
space:
mode:
authorSaikari <[email protected]>2026-01-17 02:56:38 +0300
committerSaikari <[email protected]>2026-01-17 02:56:38 +0300
commit5af9fbbb34c797bfa626c6f490482751a56c95ad (patch)
tree723702ffdcd83a76048efd08d54011438755e45e /core/src/xmake/string
parent3cf298b854443e7bbb2a96d976e8d79ffc4ddf02 (diff)
windows issue?
Diffstat (limited to 'core/src/xmake/string')
-rw-r--r--core/src/xmake/string/case.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/core/src/xmake/string/case.c b/core/src/xmake/string/case.c
index 4c6fb54ca..e8369f04b 100644
--- a/core/src/xmake/string/case.c
+++ b/core/src/xmake/string/case.c
@@ -31,6 +31,9 @@
#include "prefix.h"
#include "../utils/charset.h"
#include <wctype.h>
+#if defined(TB_CONFIG_OS_WINDOWS)
+# include <windows.h>
+#endif
/* //////////////////////////////////////////////////////////////////////////////////////
* helper
@@ -70,16 +73,16 @@ static tb_int_t xm_string_case(lua_State* lua, tb_bool_t lower) {
// to lower/upper
#if defined(TB_CONFIG_OS_WINDOWS)
- tb_uint16_t* p = (tb_uint16_t*)dst_data;
- tb_size_t n = (tb_size_t)dst_size / 2;
+ if (lower) CharLowerBuffW((LPWSTR)dst_data, (DWORD)(dst_size / 2));
+ else CharUpperBuffW((LPWSTR)dst_data, (DWORD)(dst_size / 2));
#else
tb_uint32_t* p = (tb_uint32_t*)dst_data;
tb_size_t n = (tb_size_t)dst_size / 4;
-#endif
while (n--) {
*p = (tb_wchar_t)(lower? towlower((wint_t)*p) : towupper((wint_t)*p));
p++;
}
+#endif
// convert string back
tb_long_t res_size = 0;