[Spice-devel] [spice-gtk Win32 v5 03/22] controller/test.c: mingw: fix compiler bad param warning for ReadFile

Marc-André Lureau marcandre.lureau at gmail.com
Mon Jul 9 05:45:30 PDT 2012


ack

On Mon, Jul 9, 2012 at 2:14 PM, Uri Lublin <uril at redhat.com> wrote:
> It seems that ssize_t is int, while DWORD is long
>
> Compiler warning (some whitespaces where added for readability):
>   ../../../gtk/controller/test.c: In function 'read_from_pipe':
>   ../../../gtk/controller/test.c:108:5: warning: passing argument 4 \
>        of 'ReadFile' from incompatible pointer type [enabled by default]
>   In file included from /usr/i686-w64-mingw32/sys-root/mingw/include/windows.h:70:0,
>                    from ../../../gtk/controller/test.c:27:
>   /usr/i686-w64-mingw32/sys-root/mingw/include/winbase.h:1426:29: note: expected \
>        'LPDWORD' but argument is of type 'ssize_t *'
> ---
>  gtk/controller/test.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/gtk/controller/test.c b/gtk/controller/test.c
> index 3f3eb55..f6f3975 100644
> --- a/gtk/controller/test.c
> +++ b/gtk/controller/test.c
> @@ -105,9 +105,11 @@ ssize_t read_from_pipe (void* data, size_t size)
>  {
>      ssize_t read;
>  #ifdef WIN32
> -    if (!ReadFile (pipe, data, size, &read, NULL)) {
> +    DWORD bytes;
> +    if (!ReadFile (pipe, data, size, &bytes, NULL)) {
>          printf ("Read from pipe failed %u\n", GetLastError());
>      }
> +    read = bytes;
>  #else
>      read = recv (sock, data, size, 0);
>      if ((read == -1 || read == 0)) {
> --
> 1.7.1
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel



-- 
Marc-André Lureau


More information about the Spice-devel mailing list