Am Thu, 10 Sep 2020 15:30:18 +0300
schrieb Yuriy Skalko <yuriy.ska...@gmail.com>:

> > 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);
> 
> 
> 

Yes, but why do you think that 'LPDWORD' and 'int *' are (will be) always 
equivalent?
I am not expert though...

        Kornel

Attachment: pgpQSEILyHgjR.pgp
Description: Digitale Signatur von OpenPGP

-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel

Reply via email to