Re: [Mingw-w64-public] [PATCH] rewrite the dirname.c and basename.c without wide character processing

2023-03-25 Thread 傅继晗
Yes, I totally agree with that. In that way, the UTF-8 filename would be processed without errors when the system default is DBCS locale. Alvin Wong 于2023年3月25日周六 12:35写道: > Can we just avoid converting to wide char at all and operate only in > MBCS? IsDBCSLeadByte should be enough to allow t

Re: [Mingw-w64-public] [PATCH] rewrite the dirname.c and basename.c without wide character processing

2023-03-25 Thread LIU Hao
在 2023-03-25 12:35, Alvin Wong 写道: Can we just avoid converting to wide char at all and operate only in MBCS? IsDBCSLeadByte should be enough to allow these functions to skip any false matches on the second byte of double-byte chars. And it does not matter that IsDBCSLeadByte doesn't work with U

Re: [Mingw-w64-public] [PATCH 2/2] headers: Add powersettings.h

2023-03-25 Thread LIU Hao
在 2023-03-25 00:18, Biswapriyo Nath 写道: 0002-headers-Add-powersettings.h.patch From f30a979ddd34b639c3b1b855f8bbf23c993e477d Mon Sep 17 00:00:00 2001 From: Biswapriyo Nath Date: Fri, 24 Mar 2023 21:44:14 +0530 Subject: [PATCH 2/2] headers: Add powersettings.h Signed-off-by: Biswapriyo Nath ---

Re: [Mingw-w64-public] [PATCH] rewrite the dirname.c and basename.c without wide character processing

2023-03-25 Thread Alvin Wong via Mingw-w64-public
On 25/3/2023 17:28, LIU Hao wrote: 在 2023-03-25 12:35, Alvin Wong 写道: Can we just avoid converting to wide char at all and operate only in MBCS? IsDBCSLeadByte should be enough to allow these functions to skip any false matches on the second byte of double-byte chars. And it does not matter th

[Mingw-w64-public] [PATCH] crt: Reimplement `dirname()` and `basename()`

2023-03-25 Thread LIU Hao
It is necessary to re-implement these two functions because 1. They used to change the global locale and were subject to races with almost all stdio functions. 2. The previous `basename()` had a VLA and might effect stack overflows if the argument path was too long. 3. They used to produce

Re: [Mingw-w64-public] [PATCH] crt: Reimplement `dirname()` and `basename()`

2023-03-25 Thread LIU Hao
This is an updated to the third patch. The previous one missed a check for string terminators while looking for a UNC host. -- Best regards, LIU Hao From 7ef8e1f7d49167de3b5b900f98f31788da5c32f9 Mon Sep 17 00:00:00 2001 From: LIU Hao Date: Sun, 26 Mar 2023 02:02:52 +0800 Subject: [PATCH 3/3]