On Sat, 2022-09-24 at 14:17 +0300, Eli Zaretskii wrote: > Here are the proposed patches: > > --- src/function.c~0 2022-09-18 22:06:17.000000000 +0300 > +++ src/function.c 2022-09-24 13:30:01.740875000 +0300 > @@ -823,6 +823,15 @@ func_wordlist (char *o, char **argv, con > stop = parse_numeric (argv[1], > _("invalid second argument to 'wordlist' > function")); > > +#ifdef WINDOWS32 > + if (start < 1) > + ON (fatal, *expanding_var, > + "invalid first argument to 'wordlist' function: '%I64d'", > start); > + > + if (stop < 0) > + ON (fatal, *expanding_var, > + "invalid second argument to 'wordlist' function: '%I64d'", > stop); > +#else > if (start < 1) > ON (fatal, *expanding_var, > "invalid first argument to 'wordlist' function: '%lld'", > start); > @@ -830,6 +839,7 @@ func_wordlist (char *o, char **argv, con > if (stop < 0) > ON (fatal, *expanding_var, > "invalid second argument to 'wordlist' function: '%lld'", > stop); > +#endif > > count = stop - start + 1;
I would prefer to avoid fully duplicating all the code, just to fix the string. I assume that the PR* macros are not portable? Maybe we can create our own and use those? > --- src/w32/pathstuff.c~0 2022-07-07 22:46:05.000000000 +0300 > +++ src/w32/pathstuff.c 2022-09-24 13:45:53.303375000 +0300 > @@ -102,11 +102,11 @@ w32ify(const char *filename, int resolve > if (resolve) > { > char *fp = _fullpath (NULL, filename, sizeof (w32_path)); > - strncpy (w32_path, fp, sizeof (w32_path)); > + strncpy (w32_path, fp, sizeof (w32_path) - 1); > free (fp); > } > else > - strncpy(w32_path, filename, sizeof (w32_path)); > + strncpy(w32_path, filename, sizeof (w32_path) - 1); > > for (p = w32_path; p && *p; p++) > if (*p == '\\') > > > --- src/w32/w32os.c~0 2022-08-31 23:07:28.000000000 +0300 > +++ src/w32/w32os.c 2022-09-24 13:58:43.615875000 +0300 > @@ -22,7 +22,9 @@ this program. If not, see <http://www.g > #include <windows.h> > #include <process.h> > #include <io.h> > +#if _WIN32_WINNT > 0x0601 > #include <synchapi.h> > +#endif > #include "pathstuff.h" > #include "sub_proc.h" > #include "w32err.h" > @@ -429,7 +431,7 @@ osync_get_mutex () > /* Prepare the mutex handle string for our children. > 2 hex digits per byte + 2 characters for "0x" + null. */ > mutex = xmalloc ((2 * sizeof (osync_handle)) + 2 + 1); > - sprintf (mutex, "0x%Ix", (unsigned long long)osync_handle); > + sprintf (mutex, "0x%Ix", (unsigned long long)(DWORD_PTR)osync_handle); > } > > return mutex; > @@ -449,7 +451,7 @@ osync_parse_mutex (const char *mutex) > if (endp[0] != '\0') > OS (fatal, NILF, _("invalid output sync mutex: %s"), mutex); > > - osync_handle = (HANDLE) i; > + osync_handle = (HANDLE) (DWORD_PTR) i; > > return 1; > } Weird, but OK.