[Spice-devel] [PATCH 2/2] Eliminate signed/unsigned warning

Christophe Fergeau cfergeau at redhat.com
Mon Feb 19 12:24:24 UTC 2018


On Fri, Feb 16, 2018 at 04:23:06PM +0100, Christophe de Dinechin wrote:
> From: Christophe de Dinechin <dinechin at redhat.com>
> 
> Without this, GCC complains about signed / unsigned comparisons:
> 
> mjpeg-fallback.cpp:121:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
>      if (win_info.width != last_width || win_info.height != last_height) {
>          ~~~~~~~~~~~~~~~^~~~~~~~~~~~~

Are you getting this using the default CXXFLAGS? Here I seem to be getting
-Wno-sign-compare by default.

Christophe

> 
> Signed-off-by: Christophe de Dinechin <dinechin at redhat.com>
> ---
>  src/mjpeg-fallback.cpp        | 2 +-
>  src/spice-streaming-agent.cpp | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/mjpeg-fallback.cpp b/src/mjpeg-fallback.cpp
> index 634864f..53804d9 100644
> --- a/src/mjpeg-fallback.cpp
> +++ b/src/mjpeg-fallback.cpp
> @@ -57,7 +57,7 @@ private:
>      std::vector<uint8_t> frame;
>  
>      // last frame sizes
> -    uint32_t last_width = ~0u, last_height = ~0u;
> +    int last_width = ~0u, last_height = ~0u;
>      // last time before capture
>      uint64_t last_time = 0;
>  };
> diff --git a/src/spice-streaming-agent.cpp b/src/spice-streaming-agent.cpp
> index 4ec5e42..27b26a4 100644
> --- a/src/spice-streaming-agent.cpp
> +++ b/src/spice-streaming-agent.cpp
> @@ -106,7 +106,7 @@ static int read_command_from_device(void)
>          return 0; // return -1;
>      }
>      n = read(streamfd, &msg, hdr.size);
> -    if (n != hdr.size) {
> +    if (n != (int) hdr.size) {
>          syslog(LOG_WARNING,
>                 "read command from device FAILED -- read %d expected %d\n",
>                 n, hdr.size);
> -- 
> 2.13.5 (Apple Git-94)
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20180219/9921f4fa/attachment.sig>


More information about the Spice-devel mailing list