[Freeswitch-svn] [commit] r7648 - freeswitch/trunk/libs/voipcodecs/src

Freeswitch SVN mikej at freeswitch.org
Sat Feb 16 22:39:25 EST 2008


Author: mikej
Date: Sat Feb 16 22:39:25 2008
New Revision: 7648

Modified:
   freeswitch/trunk/libs/voipcodecs/src/gsm0610_encode.c
   freeswitch/trunk/libs/voipcodecs/src/ima_adpcm.c

Log:
cast to uint8_t

Modified: freeswitch/trunk/libs/voipcodecs/src/gsm0610_encode.c
==============================================================================
--- freeswitch/trunk/libs/voipcodecs/src/gsm0610_encode.c	(original)
+++ freeswitch/trunk/libs/voipcodecs/src/gsm0610_encode.c	Sat Feb 16 22:39:25 2008
@@ -169,87 +169,87 @@
 	sr = 0;
 	sr = (sr >> 6) | (s->LARc[0] << 10);
 	sr = (sr >> 6) | (s->LARc[1] << 10);
-	*c++ = sr >> 4;
+	*c++ = (uint8_t)(sr >> 4);
 	sr = (sr >> 5) | (s->LARc[2] << 11);
-	*c++ = sr >> 7;
+	*c++ = (uint8_t)(sr >> 7);
 	sr = (sr >> 5) | (s->LARc[3] << 11);
 	sr = (sr >> 4) | (s->LARc[4] << 12);
-	*c++ = sr >> 6;
+	*c++ = (uint8_t)(sr >> 6);
 	sr = (sr >> 4) | (s->LARc[5] << 12);
 	sr = (sr >> 3) | (s->LARc[6] << 13);
-	*c++ = sr >> 7;
+	*c++ = (uint8_t)(sr >> 7);
 	sr = (sr >> 3) | (s->LARc[7] << 13);
 
     for (i = 0;  i < 4;  i++)
     {
     	sr = (sr >> 7) | (s->Nc[i] << 9);
-    	*c++ = sr >> 5;
+    	*c++ = (uint8_t)(sr >> 5);
     	sr = (sr >> 2) | (s->bc[i] << 14);
     	sr = (sr >> 2) | (s->Mc[i] << 14);
     	sr = (sr >> 6) | (s->xmaxc[i] << 10);
-    	*c++ = sr >> 3;
+    	*c++ = (uint8_t)(sr >> 3);
     	sr = (sr >> 3) | (s->xMc[i][0] << 13);
     	*c++ = sr >> 8;
     	sr = (sr >> 3) | (s->xMc[i][1] << 13);
     	sr = (sr >> 3) | (s->xMc[i][2] << 13);
         sr = (sr >> 3) | (s->xMc[i][3] << 13);
-        *c++ = sr >> 7;
+        *c++ = (uint8_t)(sr >> 7);
         sr = (sr >> 3) | (s->xMc[i][4] << 13);
         sr = (sr >> 3) | (s->xMc[i][5] << 13);
         sr = (sr >> 3) | (s->xMc[i][6] << 13);
-        *c++ = sr >> 6;
+        *c++ = (uint8_t)(sr >> 6);
         sr = (sr >> 3) | (s->xMc[i][7] << 13);
         sr = (sr >> 3) | (s->xMc[i][8] << 13);
-        *c++ = sr >> 8;
+        *c++ = (uint8_t)(sr >> 8);
         sr = (sr >> 3) | (s->xMc[i][9] << 13);
         sr = (sr >> 3) | (s->xMc[i][10] << 13);
         sr = (sr >> 3) | (s->xMc[i][11] << 13);
-        *c++ = sr >> 7;
+        *c++ = (uint8_t)(sr >> 7);
         sr = (sr >> 3) | (s->xMc[i][12] << 13);
     }
     /*endfor*/
 
     s++;
     sr = (sr >> 6) | (s->LARc[0] << 10);
-    *c++ = sr >> 6;
+    *c++ = (uint8_t)(sr >> 6);
     sr = (sr >> 6) | (s->LARc[1] << 10);
-    *c++ = sr >> 8;
+    *c++ = (uint8_t)(sr >> 8);
     sr = (sr >> 5) | (s->LARc[2] << 11);
     sr = (sr >> 5) | (s->LARc[3] << 11);
-    *c++ = sr >> 6;
+    *c++ = (uint8_t)(sr >> 6);
     sr = (sr >> 4) | (s->LARc[4] << 12);
     sr = (sr >> 4) | (s->LARc[5] << 12);
-    *c++ = sr >> 6;
+    *c++ = (uint8_t)(sr >> 6);
     sr = (sr >> 3) | (s->LARc[6] << 13);
     sr = (sr >> 3) | (s->LARc[7] << 13);
-    *c++ = sr >> 8;
+    *c++ = (uint8_t)(sr >> 8);
 
     for (i = 0;  i < 4;  i++)
     {
         sr = (sr >> 7) | (s->Nc[i] << 9);
         sr = (sr >> 2) | (s->bc[i] << 14);
-        *c++ = sr >> 7;
+        *c++ = (uint8_t)(sr >> 7);
         sr = (sr >> 2) | (s->Mc[i] << 14);
         sr = (sr >> 6) | (s->xmaxc[i] << 10);
-        *c++ = sr >> 7;
+        *c++ = (uint8_t)(sr >> 7);
         sr = (sr >> 3) | (s->xMc[i][0] << 13);
         sr = (sr >> 3) | (s->xMc[i][1] << 13);
         sr = (sr >> 3) | (s->xMc[i][2] << 13);
-        *c++ = sr >> 6;
+        *c++ = (uint8_t)(sr >> 6);
         sr = (sr >> 3) | (s->xMc[i][3] << 13);
         sr = (sr >> 3) | (s->xMc[i][4] << 13);
-        *c++ = sr >> 8;
+        *c++ = (uint8_t)(sr >> 8);
         sr = (sr >> 3) | (s->xMc[i][5] << 13);
         sr = (sr >> 3) | (s->xMc[i][6] << 13);
         sr = (sr >> 3) | (s->xMc[i][7] << 13);
-        *c++ = sr >> 7;
+        *c++ = (uint8_t)(sr >> 7);
         sr = (sr >> 3) | (s->xMc[i][8] << 13);
         sr = (sr >> 3) | (s->xMc[i][9] << 13);
         sr = (sr >> 3) | (s->xMc[i][10] << 13);
-        *c++ = sr >> 6;
+        *c++ = (uint8_t)(sr >> 6);
         sr = (sr >> 3) | (s->xMc[i][11] << 13);
         sr = (sr >> 3) | (s->xMc[i][12] << 13);
-        *c++ = sr >> 8;
+        *c++ = (uint8_t)(sr >> 8);
     }
     /*endfor*/
     return 65;

Modified: freeswitch/trunk/libs/voipcodecs/src/ima_adpcm.c
==============================================================================
--- freeswitch/trunk/libs/voipcodecs/src/ima_adpcm.c	(original)
+++ freeswitch/trunk/libs/voipcodecs/src/ima_adpcm.c	Sat Feb 16 22:39:25 2008
@@ -423,9 +423,9 @@
         i = 0;
         if (s->chunk_size == 0)
         {
-            ima_data[bytes++] = amp[1];
+            ima_data[bytes++] = (uint8_t)amp[1];
             ima_data[bytes++] = amp[1] >> 8;
-            ima_data[bytes++] = s->step_index;
+            ima_data[bytes++] = (uint8_t)s->step_index;
             ima_data[bytes++] = 0;
             s->last = amp[1];
             s->bits = 0;
@@ -443,9 +443,9 @@
     case IMA_ADPCM_DVI4:
         if (s->chunk_size == 0)
         {
-            ima_data[bytes++] = s->last >> 8;
-            ima_data[bytes++] = s->last;
-            ima_data[bytes++] = s->step_index;
+            ima_data[bytes++] = (uint8_t) (s->last >> 8);
+            ima_data[bytes++] = (uint8_t) s->last;
+            ima_data[bytes++] = (uint8_t) s->step_index;
             ima_data[bytes++] = 0;
         }
         for (i = 0;  i < len;  i++)
@@ -460,9 +460,9 @@
     case IMA_ADPCM_VDVI:
         if (s->chunk_size == 0)
         {
-            ima_data[bytes++] = s->last >> 8;
-            ima_data[bytes++] = s->last;
-            ima_data[bytes++] = s->step_index;
+            ima_data[bytes++] = (uint8_t) (s->last >> 8);
+            ima_data[bytes++] = (uint8_t) s->last;
+            ima_data[bytes++] = (uint8_t) s->step_index;
             ima_data[bytes++] = 0;
         }
         s->bits = 0;



More information about the Freeswitch-svn mailing list