[polypaudio-commits] r610 - /trunk/src/polypcore/memblockq.c

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Mon Feb 27 00:58:29 PST 2006


Author: ossman
Date: Mon Feb 27 09:58:29 2006
New Revision: 610

URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=610&root=polypaudio&view=rev
Log:
Fix some signed/unsigned warnings.

Modified:
    trunk/src/polypcore/memblockq.c

Modified: trunk/src/polypcore/memblockq.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/polypcore/memblockq.c?rev=610&root=polypaudio&r1=609&r2=610&view=diff
==============================================================================
--- trunk/src/polypcore/memblockq.c (original)
+++ trunk/src/polypcore/memblockq.c Mon Feb 27 09:58:29 2006
@@ -76,7 +76,8 @@
     bq->read_index = bq->write_index = idx;
     bq->memblock_stat = s;
 
-    pa_log_debug(__FILE__": memblockq requested: maxlength=%u, tlength=%u, base=%u, prebuf=%u, minreq=%u", maxlength, tlength, base, prebuf, minreq);
+    pa_log_debug(__FILE__": memblockq requested: maxlength=%lu, tlength=%lu, base=%lu, prebuf=%lu, minreq=%lu",
+        (unsigned long)maxlength, (unsigned long)tlength, (unsigned long)base, (unsigned long)prebuf, (unsigned long)minreq);
 
     bq->maxlength = ((maxlength+base-1)/base)*base;
     assert(bq->maxlength >= base);
@@ -98,7 +99,8 @@
     if (!bq->minreq)
         bq->minreq = 1;
     
-    pa_log_debug(__FILE__": memblockq sanitized: maxlength=%u, tlength=%u, base=%u, prebuf=%u, minreq=%u", bq->maxlength, bq->tlength, bq->base, bq->prebuf, bq->minreq);
+    pa_log_debug(__FILE__": memblockq sanitized: maxlength=%lu, tlength=%lu, base=%lu, prebuf=%lu, minreq=%lu",
+        (unsigned long)bq->maxlength, (unsigned long)bq->tlength, (unsigned long)bq->base, (unsigned long)bq->prebuf, (unsigned long)bq->minreq);
 
     bq->state = bq->prebuf ? PREBUF : RUNNING;
     bq->silence = silence ? pa_memblock_ref(silence) : NULL;
@@ -149,7 +151,7 @@
     assert(bq);
 
     if (bq->read_index > bq->write_index) {
-        int64_t d =  bq->read_index - bq->write_index;
+        size_t d =  bq->read_index - bq->write_index;
 
         if (l > d)
             l -= d;
@@ -160,7 +162,7 @@
     end = bq->blocks_tail ? bq->blocks_tail->index + bq->blocks_tail->chunk.length : 0;
 
     /* Make sure that the list doesn't get too long */
-    if (bq->write_index + l > end)
+    if (bq->write_index + (int64_t)l > end)
         if (bq->write_index + l - bq->read_index > bq->maxlength)
             return 0;
 
@@ -191,7 +193,7 @@
         /* We currently have a buffer underflow, we need to drop some
          * incoming data */
 
-        int64_t d = bq->read_index - bq->write_index;
+        size_t d = bq->read_index - bq->write_index;
 
         if (chunk.length > d) {
             chunk.index += d;
@@ -210,10 +212,10 @@
     q = bq->blocks_tail;
     while (q) {
 
-        if (bq->write_index >= q->index + q->chunk.length)
+        if (bq->write_index >= q->index + (int64_t)q->chunk.length)
             /* We found the entry where we need to place the new entry immediately after */
             break;
-        else if (bq->write_index + chunk.length <= q->index) {
+        else if (bq->write_index + (int64_t)chunk.length <= q->index) {
             /* This entry isn't touched at all, let's skip it */
             q = q->prev;
         } else if (bq->write_index <= q->index &&
@@ -272,8 +274,8 @@
         } else {
             size_t d;
 
-            assert(bq->write_index + chunk.length > q->index &&
-                   bq->write_index + chunk.length < q->index + q->chunk.length &&
+            assert(bq->write_index + (int64_t)chunk.length > q->index &&
+                   bq->write_index + (int64_t)chunk.length < q->index + (int64_t)q->chunk.length &&
                    bq->write_index < q->index);
             
             /* The job overwrites the current entry at the end, so let's drop the beginning of this entry */
@@ -289,21 +291,21 @@
     }
 
     if (q) {
-        assert(bq->write_index >=  q->index + q->chunk.length);
-        assert(!q->next || (bq->write_index+chunk.length <= q->next->index));
+        assert(bq->write_index >=  q->index + (int64_t)q->chunk.length);
+        assert(!q->next || (bq->write_index + (int64_t)chunk.length <= q->next->index));
                
         /* Try to merge memory blocks */
         
         if (q->chunk.memblock == chunk.memblock &&
-            q->chunk.index + q->chunk.length == chunk.index &&
-            bq->write_index == q->index + q->chunk.length) {
+            q->chunk.index + (int64_t)q->chunk.length == chunk.index &&
+            bq->write_index == q->index + (int64_t)q->chunk.length) {
             
             q->chunk.length += chunk.length;
             bq->write_index += chunk.length;
             return 0;
         }
     } else
-        assert(!bq->blocks || (bq->write_index+chunk.length <= bq->blocks->index));
+        assert(!bq->blocks || (bq->write_index + (int64_t)chunk.length <= bq->blocks->index));
 
 
     n = pa_xnew(struct memblock_list, 1);
@@ -531,7 +533,7 @@
             bq->write_index = bq->read_index + offset;
             return;
         case PA_SEEK_RELATIVE_END:
-            bq->write_index = (bq->blocks_tail ? bq->blocks_tail->index + bq->blocks_tail->chunk.length : bq->read_index) + offset;
+            bq->write_index = (bq->blocks_tail ? bq->blocks_tail->index + (int64_t)bq->blocks_tail->chunk.length : bq->read_index) + offset;
             return;
     }
 




More information about the pulseaudio-commits mailing list