On 5/24/22 8:00 AM, Johannes Schindelin wrote:
Hi Jeff,
On Mon, 23 May 2022, Jeff Hostetler via GitGitGadget wrote:
1: 8b7c5f4e23 ! 1: 26144c5865 fsm-listen-win32: handle shortnames
[...]
@@ compat/fsmonitor/fsm-listen-win32.c: static int normalize_path_in_utf8(FILE_NOTI
+{
+ wchar_t buf_in[MAX_PATH + 1];
+ wchar_t buf_out[MAX_PATH + 1];
-+ wchar_t *last_slash = NULL;
-+ wchar_t *last_bslash = NULL;
+ wchar_t *last;
++ wchar_t *p;
+
+ /* build L"<wt-root-path>/.git" */
-+ wcscpy(buf_in, watch->wpath_longname);
-+ wcscpy(buf_in + watch->wpath_longname_len, L".git");
++ swprintf(buf_in, ARRAY_SIZE(buf_in) - 1, L"%s.git",
++ watch->wpath_longname);
+
-+ if (!GetShortPathNameW(buf_in, buf_out, MAX_PATH))
++ if (!GetShortPathNameW(buf_in, buf_out, ARRAY_SIZE(buf_out)))
Nice touch using `ARRAY_SIZE()` here!
Thanks. And hopefully it will make the GFW downstream MAX_LONG_PATH
fixups easier too.
The changes look good to me, from my side this is good to go.
Thank you so much!
Dscho
Thanks for all your reviews.
Jeff