> Am Wed, 9 Sep 2020 22:14:40 +0200 > schrieb Kornel Benko <kor...@lyx.org>: > >> > Since pclose (Unix) returns signed int and GetExitCodeProcess (Windows) >> > returns unsigned DWORD, and then result is compared with -1 in common >> > branch, now I don't see clean way to get rid of the warning in this mix >> > of conditional compilation branches. Let's leave as it is now. >> > >> > There is similar mix of signed/unsigned in ForkedCalls.cpp (setRetValue >> > call) but without compiler warnings. >> > >> > >> > Yuriy >> > >> >> What about this? >> >> Kornel > > Forget it. Maybe this is better. >
Yes, it solves this issue, but adding variable for this is not clean enough as for me :) Here is another not-so-clean solution with reinterpret_cast: diff --git a/src/support/filetools.cpp b/src/support/filetools.cpp index d6b27856cb..52a9ff950a 100644 --- a/src/support/filetools.cpp +++ b/src/support/filetools.cpp @@ -1107,8 +1107,8 @@ cmd_ret const runCommand(string const & cmd) #if defined (_WIN32) WaitForSingleObject(process.hProcess, INFINITE); - DWORD pret; - if (!GetExitCodeProcess(process.hProcess, &pret)) + int pret = 0; + if (!GetExitCodeProcess(process.hProcess, reinterpret_cast<LPDWORD>(&pret))) pret = -1; if (!infile.empty()) CloseHandle(startup.hStdInput); > Kornel > > diff --git a/src/support/filetools.cpp b/src/support/filetools.cpp > index d6b27856cb..9ce6cd1cfc 100644 > --- a/src/support/filetools.cpp > +++ b/src/support/filetools.cpp > @@ -1105,13 +1105,16 @@ cmd_ret const runCommand(string const & cmd) > c = fgetc(inf); > } > > #if defined (_WIN32) > WaitForSingleObject(process.hProcess, INFINITE); > - DWORD pret; > - if (!GetExitCodeProcess(process.hProcess, &pret)) > + DWORD pretw; > + int pret; > + if (!GetExitCodeProcess(process.hProcess, &pretw)) > pret = -1; > + else > + pret = (int) pretw; > if (!infile.empty()) > CloseHandle(startup.hStdInput); > CloseHandle(process.hProcess); > if (fclose(inf) != 0) > pret = -1; -- lyx-devel mailing list lyx-devel@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-devel