Fix a couple of MSVC warnings.
authorTimothy B. Terriberry <tterribe@xiph.org>
Tue, 9 Oct 2012 01:36:46 +0000 (18:36 -0700)
committerTimothy B. Terriberry <tterribe@xiph.org>
Tue, 9 Oct 2012 01:37:27 +0000 (18:37 -0700)
src/internal.h
src/opusfile.c

index fc87a22..36e186b 100644 (file)
@@ -38,11 +38,14 @@ typedef opus_int16 op_sample;
 typedef float      op_sample;
 # endif
 
-/*Disable excessive warnings about the order of operations.*/
 # if OP_GNUC_PREREQ(4,2)
+/*Disable excessive warnings about the order of operations.*/
 #  pragma GCC diagnostic ignored "-Wparentheses"
 # elif defined(_MSC_VER)
+/*Disable excessive warnings about the order of operations.*/
 #  pragma warning(disable:4554)
+/*Disable warnings about "deprecated" POSIX functions.*/
+#  pragma warning(disable:4996)
 # endif
 
 # if OP_GNUC_PREREQ(3,0)
index 293b87c..bd11223 100644 (file)
@@ -1627,7 +1627,7 @@ static opus_int32 op_calc_bitrate(opus_int64 _bytes,ogg_int64_t _samples){
     ogg_int64_t den;
     if(OP_UNLIKELY(_bytes/(0x7FFFFFFFF/(48000*8))>=_samples))return 0x7FFFFFFF;
     den=_samples/(48000*8);
-    return (_bytes+(den>>1))/den;
+    return (opus_int32)((_bytes+(den>>1))/den);
   }
   if(OP_UNLIKELY(_samples<=0))return 0x7FFFFFFF;
   /*This can't actually overflow in normal operation: even with a pre-skip of