comparison src/audio/sdlgenaudiocvt.pl @ 2956:1210d5a28e16

Fixed off-by-one in audio converters, when growing a data type's size.
author Ryan C. Gordon <icculus@icculus.org>
date Fri, 02 Jan 2009 08:12:14 +0000
parents 2692999d5271
children 786a48f8309c
comparison
equal deleted inserted replaced
2955:2692999d5271 2956:1210d5a28e16
186 EOF 186 EOF
187 187
188 if ($fsize < $tsize) { 188 if ($fsize < $tsize) {
189 my $mult = $tsize / $fsize; 189 my $mult = $tsize / $fsize;
190 print <<EOF; 190 print <<EOF;
191 src = (const $srctype *) (cvt->buf + cvt->len_cvt); 191 src = ((const $srctype *) (cvt->buf + cvt->len_cvt)) - 1;
192 dst = ($tctype *) (cvt->buf + cvt->len_cvt * $mult); 192 dst = (($tctype *) (cvt->buf + cvt->len_cvt * $mult)) - 1;
193 for (i = cvt->len_cvt / sizeof ($srctype); i; --i, --src, --dst) { 193 for (i = cvt->len_cvt / sizeof ($srctype); i; --i, --src, --dst) {
194 EOF 194 EOF
195 } else { 195 } else {
196 print <<EOF; 196 print <<EOF;
197 src = (const $srctype *) cvt->buf; 197 src = (const $srctype *) cvt->buf;