[03/17] Eliminate signed/unsigned warning

Submitted by Christophe de Dinechin on Feb. 16, 2018, 4:15 p.m.

Details

Message ID 20180216161547.28110-4-christophe@dinechin.org
State New
Headers show
Series "WIP: Refactor the streaming agent towards a more standard C++ style" ( rev: 1 ) in Spice

Not browsing as part of any series.

Commit Message

Christophe de Dinechin Feb. 16, 2018, 4:15 p.m.
From: Christophe de Dinechin <dinechin@redhat.com>

Signed-off-by: Christophe de Dinechin <dinechin@redhat.com>
---
 src/mjpeg-fallback.cpp        | 2 +-
 src/spice-streaming-agent.cpp | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

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 6056129..b5c7e24 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);

Comments

On Fri, 2018-02-16 at 17:15 +0100, Christophe de Dinechin wrote:
> From: Christophe de Dinechin <dinechin@redhat.com>
> 
> Signed-off-by: Christophe de Dinechin <dinechin@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;

This is really weird. The ~ negates an unsigned literal and the result
is a signed type? How come? Maybe remove the 'u' from the literals so
that we can pretend everything is normal? :D

>      // last time before capture
>      uint64_t last_time = 0;
>  };
> diff --git a/src/spice-streaming-agent.cpp b/src/spice-streaming-agent.cpp
> index 6056129..b5c7e24 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);