[Spice-commits] 2 commits - server/red-record-qxl.c server/red-replay-qxl.c server/tests

Frediano Ziglio fziglio at kemper.freedesktop.org
Mon Jan 8 10:21:48 UTC 2018


 server/red-record-qxl.c                        |    2 +-
 server/red-replay-qxl.c                        |    2 +-
 server/tests/test-display-resolution-changes.c |    4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 07c7e236fc09f55b62ab57128910d55dd9a39daf
Author: Victor Toso <me at victortoso.com>
Date:   Thu Dec 21 16:18:08 2017 +0100

    clang: remove double promotion
    
    > test-display-resolution-changes.c:55:60: error: implicit conversion
    > increases floating-point precision: 'float' to 'double'
    >       command->create_primary.width = 800 + sin((float)count / 6) * 200;
    >                                             ~~~ ~~~~~~~~~~~~~^~~
    > test-display-resolution-changes.c:56:61: error: implicit conversion
    > increases floating-point precision: 'float' to 'double'
    >       command->create_primary.height = 600 + cos((float)count / 6) * 200;
    >                                              ~~~ ~~~~~~~~~~~~~^~~
    
    Signed-off-by: Victor Toso <victortoso at redhat.com>
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/server/tests/test-display-resolution-changes.c b/server/tests/test-display-resolution-changes.c
index f6bb0839..74e71a7d 100644
--- a/server/tests/test-display-resolution-changes.c
+++ b/server/tests/test-display-resolution-changes.c
@@ -52,8 +52,8 @@ set_primary_params(SPICE_GNUC_UNUSED Test *test, Command *command)
 #endif
     static int count = 0;
 
-    command->create_primary.width = 800 + sin((float)count / 6) * 200;
-    command->create_primary.height = 600 + cos((float)count / 6) * 200;
+    command->create_primary.width = 800 + sin(count / 6.0) * 200;
+    command->create_primary.height = 600 + cos(count / 6.0) * 200;
     count++;
 }
 
commit e005e7017bd23bf0bfdf62852feff61477306cc3
Author: Victor Toso <me at victortoso.com>
Date:   Thu Dec 21 16:18:07 2017 +0100

    clang: Don't compute absolute value of unsigned
    
    Clang's warning on absolute-value.
    
    > red-record-qxl.c:297:39: error: taking the absolute value of unsigned
    > type 'uint32_t' (aka 'unsigned int') has no effect
    >     bitmap_size = qxl->bitmap.y * abs(qxl->bitmap.stride);
    >                                   ^
    > red-record-qxl.c:297:39: note: remove the call to 'abs' since unsigned
    > values cannot be negative
    >     bitmap_size = qxl->bitmap.y * abs(qxl->bitmap.stride);
    >                                   ^~~
    
    > red-replay-qxl.c:471:39: error: taking the absolute value of unsigned type
    > 'uint32_t' (aka 'unsigned int') has no effect
    >     bitmap_size = qxl->bitmap.y * abs(qxl->bitmap.stride);
    >                                   ^
    > red-replay-qxl.c:471:39: note: remove the call to 'abs' since unsigned
    > values cannot be negative
    >     bitmap_size = qxl->bitmap.y * abs(qxl->bitmap.stride);
    >                                   ^~~
    
    Signed-off-by: Victor Toso <victortoso at redhat.com>
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/server/red-record-qxl.c b/server/red-record-qxl.c
index 400d67c4..48b3169f 100644
--- a/server/red-record-qxl.c
+++ b/server/red-record-qxl.c
@@ -294,7 +294,7 @@ static void red_record_image(FILE *fd, RedMemSlotInfo *slots, int group_id,
                 fprintf(fd, "ents %d\n", qp->ents[i]);
             }
         }
-        bitmap_size = qxl->bitmap.y * abs(qxl->bitmap.stride);
+        bitmap_size = qxl->bitmap.y * qxl->bitmap.stride;
         if (qxl_flags & QXL_BITMAP_DIRECT) {
             red_record_image_data_flat(fd, slots, group_id,
                                                          qxl->bitmap.data,
diff --git a/server/red-replay-qxl.c b/server/red-replay-qxl.c
index d389b62e..18f348a1 100644
--- a/server/red-replay-qxl.c
+++ b/server/red-replay-qxl.c
@@ -468,7 +468,7 @@ static QXLImage *red_replay_image(SpiceReplay *replay, uint32_t flags)
         } else {
             qxl->bitmap.palette = 0;
         }
-        bitmap_size = qxl->bitmap.y * abs(qxl->bitmap.stride);
+        bitmap_size = qxl->bitmap.y * qxl->bitmap.stride;
         qxl->bitmap.data = 0;
         if (qxl_flags & QXL_BITMAP_DIRECT) {
             qxl->bitmap.data = QXLPHYSICAL_FROM_PTR(red_replay_image_data_flat(replay, &bitmap_size));


More information about the Spice-commits mailing list