shithub: libvpx

Download patch

ref: ac980b71cff73a80c2ea020aeed3520731cb37cf
parent: f71e5246f214353fea1d14a1d10fcc38859db58d
author: Johann <johann.koenig@duck.com>
date: Tue Apr 23 05:55:03 EDT 2013

Improve sign consistency.

Fix warning on windows: signed/unsigned mismatch on lines 415, 454

Comparison was between size_t data_sz >= int index_sz on 415 and
unsigned int data_sz >= int index_sz on 454. Both might be changed to
size_t but that would be tracing and replacing all comparisons is
outside the scope of this change.

In the rest of these two functions ensure unsigned values are used
consistently.

Change-Id: I922b399ceca612a92f44b9d1d331c1c6bae9d768

--- a/vp9/vp9_dx_iface.c
+++ b/vp9/vp9_dx_iface.c
@@ -408,9 +408,9 @@
   *count = 0;
 
   if ((marker & 0xe0) == 0xc0) {
-    const int frames = (marker & 0x7) + 1;
-    const int mag = ((marker >> 3) & 3) + 1;
-    const int index_sz = 2 + mag  * frames;
+    const uint32_t frames = (marker & 0x7) + 1;
+    const uint32_t mag = ((marker >> 3) & 0x3) + 1;
+    const size_t index_sz = 2 + mag * frames;
 
     if (data_sz >= index_sz && data[data_sz - index_sz] == marker) {
       // found a valid superframe index
@@ -418,7 +418,7 @@
       const uint8_t *x = data + data_sz - index_sz + 1;
 
       for (i = 0; i < frames; i++) {
-        int this_sz = 0;
+        uint32_t this_sz = 0;
 
         for (j = 0; j < mag; j++)
           this_sz |= (*x++) << (j * 8);
@@ -447,9 +447,9 @@
     // Skip over the superframe index, if present
     if (data_sz && (*data_start & 0xe0) == 0xc0) {
       const uint8_t marker = *data_start;
-      const int frames = (marker & 0x7) + 1;
-      const int mag = ((marker >> 3) & 3) + 1;
-      const int index_sz = 2 + mag  * frames;
+      const uint32_t frames = (marker & 0x7) + 1;
+      const uint32_t mag = ((marker >> 3) & 0x3) + 1;
+      const uint32_t index_sz = 2 + mag * frames;
 
       if (data_sz >= index_sz && data_start[index_sz - 1] == marker) {
         data_start += index_sz;