]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
casts to shut up msvc warnings.
authorMichael Jerris <mike@jerris.com>
Sun, 17 Feb 2008 05:00:41 +0000 (05:00 +0000)
committerMichael Jerris <mike@jerris.com>
Sun, 17 Feb 2008 05:00:41 +0000 (05:00 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7651 d0543943-73ff-0310-b7d9-9358b9ac24b2

libs/voipcodecs/libvoipcodecs.2008.vcproj
libs/voipcodecs/src/gsm0610_encode.c
libs/voipcodecs/src/gsm0610_local.h
libs/voipcodecs/src/ima_adpcm.c

index 3361c4ca5a76715eddb45b8016a6ff692847a20a..68ffcfd1cda7849db20a2d03720676b5c6821d28 100644 (file)
@@ -49,6 +49,7 @@
                                UsePrecompiledHeader="0"\r
                                WarningLevel="4"\r
                                DebugInformationFormat="3"\r
+                               EnablePREfast="true"\r
                        />\r
                        <Tool\r
                                Name="VCManagedResourceCompilerTool"\r
                                UsePrecompiledHeader="0"\r
                                WarningLevel="4"\r
                                DebugInformationFormat="3"\r
+                               EnablePREfast="true"\r
                        />\r
                        <Tool\r
                                Name="VCManagedResourceCompilerTool"\r
index e336fff0d0313fedea2673c53e00a376be215442..af33eab38fc6a1da9d33e2cbd96ddf632528e74c 100644 (file)
@@ -189,7 +189,7 @@ int gsm0610_pack_wav49(uint8_t c[], const gsm0610_frame_t *s)
        sr = (sr >> 6) | (s->xmaxc[i] << 10);
        *c++ = (uint8_t)(sr >> 3);
        sr = (sr >> 3) | (s->xMc[i][0] << 13);
-       *c++ = sr >> 8;
+       *c++ = (uint8_t)(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);
@@ -260,43 +260,43 @@ int gsm0610_pack_voip(uint8_t c[33], const gsm0610_frame_t *s)
 {
     int i;
 
-    *c++ = ((GSM0610_MAGIC & 0xF) << 4)
-         | ((s->LARc[0] >> 2) & 0xF);
-    *c++ = ((s->LARc[0] & 0x3) << 6)
-         |  (s->LARc[1] & 0x3F);
-    *c++ = ((s->LARc[2] & 0x1F) << 3)
-         | ((s->LARc[3] >> 2) & 0x7);
-    *c++ = ((s->LARc[3] & 0x3) << 6)
+    *c++ = (uint8_t)(((GSM0610_MAGIC & 0xF) << 4)
+         | ((s->LARc[0] >> 2) & 0xF));
+    *c++ = (uint8_t)(((s->LARc[0] & 0x3) << 6)
+         |  (s->LARc[1] & 0x3F));
+    *c++ = (uint8_t)(((s->LARc[2] & 0x1F) << 3)
+         | ((s->LARc[3] >> 2) & 0x7));
+    *c++ = (uint8_t)(((s->LARc[3] & 0x3) << 6)
          | ((s->LARc[4] & 0xF) << 2)
-         | ((s->LARc[5] >> 2) & 0x3);
-    *c++ = ((s->LARc[5] & 0x3) << 6)
+         | ((s->LARc[5] >> 2) & 0x3));
+    *c++ = (uint8_t)(((s->LARc[5] & 0x3) << 6)
          | ((s->LARc[6] & 0x7) << 3)
-         |  (s->LARc[7] & 0x7);
+         |  (s->LARc[7] & 0x7));
 
     for (i = 0;  i < 4;  i++)
     {
-        *c++ = ((s->Nc[i] & 0x7F) << 1)
-             | ((s->bc[i] >> 1) & 0x1);
-        *c++ = ((s->bc[i] & 0x1) << 7)
+        *c++ = (uint8_t)(((s->Nc[i] & 0x7F) << 1)
+             | ((s->bc[i] >> 1) & 0x1));
+        *c++ = (uint8_t)(((s->bc[i] & 0x1) << 7)
              | ((s->Mc[i] & 0x3) << 5)
-             | ((s->xmaxc[i] >> 1) & 0x1F);
-        *c++ = ((s->xmaxc[i] & 0x1) << 7)
+             | ((s->xmaxc[i] >> 1) & 0x1F));
+        *c++ = (uint8_t)(((s->xmaxc[i] & 0x1) << 7)
              | ((s->xMc[i][0] & 0x7) << 4)
              | ((s->xMc[i][1] & 0x7) << 1)
-             | ((s->xMc[i][2] >> 2) & 0x1);
-        *c++ = ((s->xMc[i][2] & 0x3) << 6)
+             | ((s->xMc[i][2] >> 2) & 0x1));
+        *c++ = (uint8_t)(((s->xMc[i][2] & 0x3) << 6)
              | ((s->xMc[i][3] & 0x7) << 3)
-             |  (s->xMc[i][4] & 0x7);
-        *c++ = ((s->xMc[i][5] & 0x7) << 5)
+             |  (s->xMc[i][4] & 0x7));
+        *c++ = (uint8_t)(((s->xMc[i][5] & 0x7) << 5)
              | ((s->xMc[i][6] & 0x7) << 2)
-             | ((s->xMc[i][7] >> 1) & 0x3);
-        *c++ = ((s->xMc[i][7] & 0x1) << 7)
+             | ((s->xMc[i][7] >> 1) & 0x3));
+        *c++ = (uint8_t)(((s->xMc[i][7] & 0x1) << 7)
              | ((s->xMc[i][8] & 0x7) << 4)
              | ((s->xMc[i][9] & 0x7) << 1)
-             | ((s->xMc[i][10] >> 2) & 0x1);
-        *c++ = ((s->xMc[i][10] & 0x3) << 6)
+             | ((s->xMc[i][10] >> 2) & 0x1));
+        *c++ = (uint8_t)(((s->xMc[i][10] & 0x3) << 6)
              | ((s->xMc[i][11] & 0x7) << 3)
-             |  (s->xMc[i][12] & 0x7);
+             |  (s->xMc[i][12] & 0x7));
     }
     /*endfor*/
     return 33;
index 018c4c3ae6a51488780d565194832258050303fb..029c0408ca0d383a5f5b8676ac1b61dc2f506b76 100644 (file)
@@ -140,15 +140,15 @@ static __inline__ int16_t gsm_abs(int16_t a)
 static __inline__ int16_t gsm_asr(int16_t a, int n)
 {
     if (n >= 16)
-        return  -(a < 0);
+        return  (int16_t)(-(a < 0));
     /*endif*/
     if (n <= -16)
         return  0;
     /*endif*/
     if (n < 0)
-        return a << -n;
+        return (int16_t)(a << -n);
     /*endif*/
-    return  a >> n;
+    return  (int16_t)(a >> n);
 }
 /*- End of function --------------------------------------------------------*/
 
@@ -158,12 +158,12 @@ static __inline__ int16_t gsm_asl(int16_t a, int n)
         return  0;
     /*endif*/
     if (n <= -16)
-        return  -(a < 0);
+        return  (int16_t)(-(a < 0));
     /*endif*/
     if (n < 0)
         return  gsm_asr(a, -n);
     /*endif*/
-    return  a << n;
+    return  (int16_t)(a << n);
 }
 /*- End of function --------------------------------------------------------*/
 
index 4b40b09e3f0aafc8fd665f76551f70fd71251393..9d3afc12bf1fdce6e8e7e70738c0220f194e0708 100644 (file)
@@ -424,7 +424,7 @@ int ima_adpcm_encode(ima_adpcm_state_t *s,
         if (s->chunk_size == 0)
         {
             ima_data[bytes++] = (uint8_t)amp[1];
-            ima_data[bytes++] = amp[1] >> 8;
+            ima_data[bytes++] = (uint8_t)(amp[1] >> 8);
             ima_data[bytes++] = (uint8_t)s->step_index;
             ima_data[bytes++] = 0;
             s->last = amp[1];