Patchwork qga: cast to int for DWORD type

login
register
mail settings
Submitter Lei Li
Date Jan. 28, 2013, 4:49 a.m.
Message ID <1359348549-30077-1-git-send-email-lilei@linux.vnet.ibm.com>
Download mbox | patch
Permalink /patch/216107/
State New
Headers show

Comments

Lei Li - Jan. 28, 2013, 4:49 a.m.
This patch fixes a compiler warning when cross-build:

qga/service-win32.c: In function 'printf_win_error':
qga/service-win32.c:32:5: warning: format '%d' expects argument of type 'int',
                          but argument 3 has type 'DWORD' [-Wformat]

Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com>
---
 qga/service-win32.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Michael Roth - Feb. 20, 2013, 4:35 p.m.
On Mon, Jan 28, 2013 at 12:49:09PM +0800, Lei Li wrote:
> This patch fixes a compiler warning when cross-build:
> 
> qga/service-win32.c: In function 'printf_win_error':
> qga/service-win32.c:32:5: warning: format '%d' expects argument of type 'int',
>                           but argument 3 has type 'DWORD' [-Wformat]
> 
> Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com>

Thanks, applied to qga branch.

> ---
>  qga/service-win32.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/qga/service-win32.c b/qga/service-win32.c
> index 0905456..843398a 100644
> --- a/qga/service-win32.c
> +++ b/qga/service-win32.c
> @@ -29,7 +29,7 @@ static int printf_win_error(const char *text)
>          MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
>          (char *)&message, 0,
>          NULL);
> -    n = printf("%s. (Error: %d) %s", text, err, message);
> +    n = printf("%s. (Error: %d) %s", text, (int)err, message);
>      LocalFree(message);
> 
>      return n;
> -- 
> 1.7.7.6
>

Patch

diff --git a/qga/service-win32.c b/qga/service-win32.c
index 0905456..843398a 100644
--- a/qga/service-win32.c
+++ b/qga/service-win32.c
@@ -29,7 +29,7 @@  static int printf_win_error(const char *text)
         MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
         (char *)&message, 0,
         NULL);
-    n = printf("%s. (Error: %d) %s", text, err, message);
+    n = printf("%s. (Error: %d) %s", text, (int)err, message);
     LocalFree(message);
 
     return n;