aboutsummaryrefslogtreecommitdiffstats
path: root/frame.c
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2005-10-31 18:15:02 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2005-10-31 18:15:02 +0000
commite454aed806fe1d1693ddc44fad059f9cf9ecf727 (patch)
treeced7206d241bc688806ee462de1d72cc8d2399d9 /frame.c
parent3b5ed22f129ad87a256092965b6537c8bb86cede (diff)
don't pass short arguments by value, it will cause compiler warnings on most platforms about implicit conversions (thanks Luigi!)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@6901 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'frame.c')
-rwxr-xr-xframe.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/frame.c b/frame.c
index 5952b1d74..63c6c8c9c 100755
--- a/frame.c
+++ b/frame.c
@@ -1257,15 +1257,19 @@ int ast_frame_adjust_volume(struct ast_frame *f, int adjustment)
{
int count;
short *fdata = f->data;
+ short adjust_value = abs(adjustment);
if ((f->frametype != AST_FRAME_VOICE) || (f->subclass != AST_FORMAT_SLINEAR))
return -1;
+ if (!adjustment)
+ return 0;
+
for (count = 0; count < f->samples; count++) {
if (adjustment > 0) {
- ast_slinear_saturated_multiply(&fdata[count], abs(adjustment));
+ ast_slinear_saturated_multiply(&fdata[count], &adjust_value);
} else if (adjustment < 0) {
- ast_slinear_saturated_divide(&fdata[count], abs(adjustment));
+ ast_slinear_saturated_divide(&fdata[count], &adjust_value);
}
}
@@ -1289,7 +1293,7 @@ int ast_frame_slinear_sum(struct ast_frame *f1, struct ast_frame *f2)
for (count = 0, data1 = f1->data, data2 = f2->data;
count < f1->samples;
count++, data1++, data2++)
- ast_slinear_saturated_add(data1, *data2);
+ ast_slinear_saturated_add(data1, data2);
return 0;
}