[Github-comments] [geany] Fix warnings about casting pointer from/to different size integer (#773)

zhekov notifications at xxxxx
Mon Nov 30 18:06:56 UTC 2015


> @@ -816,7 +816,7 @@ static FILE *open_std_handle(DWORD handle, const char *mode)
>  	if (hConHandle == -1)
>  	{
>  		gchar *err = g_win32_error_message(GetLastError());
> -		g_warning("_open_osfhandle(%ld, _O_TEXT) failed: %s", (long)lStdHandle, err);
> +		g_warning("_open_osfhandle(handle(%ld), _O_TEXT) failed: %s", (long)handle, err);

Because (a) the lStdHandle value does not carry any useful information, it may be anything, while handle is at least the constant numeric value of STD_INPUT/OUTPUT/ERROR_HANDLE, and (b) if a lStdHandle is used, it should at least be cast properly, with HandleToLong() or something, instead of (long). Only the least significant 32-bits are actually used, so "%ld" is OK.

---
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/773/files#r46179083
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20151130/810019c2/attachment.html>


More information about the Github-comments mailing list