[Asterisk-cvs] asterisk/include/asterisk utils.h,1.46,1.47
kpfleming
kpfleming
Fri Oct 28 17:43:20 CDT 2005
Update of /usr/cvsroot/asterisk/include/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv2563/include/asterisk
Modified Files:
utils.h
Log Message:
ensure that SLINEAR volume adjustments don't wrap around short integer maximums
Index: utils.h
===================================================================
RCS file: /usr/cvsroot/asterisk/include/asterisk/utils.h,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -d -r1.46 -r1.47
--- utils.h 24 Oct 2005 20:12:06 -0000 1.46
+++ utils.h 28 Oct 2005 21:35:55 -0000 1.47
@@ -168,7 +168,37 @@
\param s String to be decoded
*/
void ast_uri_decode(char *s);
+
+static inline void ast_slinear_saturated_add(short *input, short value)
+{
+ int res;
+
+ res = *input + value;
+ if (res > 32767)
+ *input = 32767;
+ else if (res < -32767)
+ *input = -32767;
+ else
+ *input = (short) res;
+}
+static inline void ast_slinear_saturated_multiply(short *input, short value)
+{
+ int res;
+
+ res = *input * value;
+ if (res > 32767)
+ *input = 32767;
+ else if (res < -32767)
+ *input = -32767;
+ else
+ *input = (short) res;
+}
+
+static inline void ast_slinear_saturated_divide(short *input, short value)
+{
+ *input /= value;
+}
extern int test_for_thread_safety(void);
More information about the svn-commits
mailing list