Re: [PATCH v7 00/30] Builtin FSMonitor Part 3
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- May 24, 2022, 12:00 UTC
- Message-ID
- <nycvar.QRO.7.76.6.2205241357410.352@tvgsbejvaqbjf.bet>
- In-Reply-To
- <pull.1143.v7.git.1653336765.gitgitgadget@gmail.com>
Hi Jeff,
On Mon, 23 May 2022, Jeff Hostetler via GitGitGadget wrote:
Show 19 quoted lines
> 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!
The changes look good to me, from my side this is good to go.
Thank you so much! Dscho