diff src/audio/sdlgenaudiocvt.pl @ 4889:8c9cbb623d55

Fixed crashing loading 48KHz audio, contributed by Terry Welsh
author Sam Lantinga <slouken@libsdl.org>
date Sat, 18 Sep 2010 18:15:08 -0700
parents bfa8d34ce03a
children b530ef003506
line wrap: on
line diff
--- a/src/audio/sdlgenaudiocvt.pl	Sat Sep 18 17:12:19 2010 -0700
+++ b/src/audio/sdlgenaudiocvt.pl	Sat Sep 18 18:15:08 2010 -0700
@@ -38,7 +38,7 @@
 /* DO NOT EDIT!  This file is generated by sdlgenaudiocvt.pl */
 /*
     SDL - Simple DirectMedia Layer
-    Copyright (C) 1997-2009 Sam Lantinga
+    Copyright (C) 1997-2010 Sam Lantinga
 
     This library is free software; you can redistribute it and/or
     modify it under the terms of the GNU Lesser General Public
@@ -400,15 +400,19 @@
     register int eps = 0;
 EOF
 
+    my $endcomparison = '!=';
+
     # Upsampling (growing the buffer) needs to work backwards, since we
     #  overwrite the buffer as we go.
     if ($upsample) {
+        $endcomparison = '>';  # dst > target
         print <<EOF;
     $fctype *dst = (($fctype *) (cvt->buf + dstsize)) - $channels;
     const $fctype *src = (($fctype *) (cvt->buf + cvt->len_cvt)) - $channels;
     const $fctype *target = ((const $fctype *) cvt->buf) - $channels;
 EOF
     } else {
+        $endcomparison = '<';  # dst < target
         print <<EOF;
     $fctype *dst = ($fctype *) cvt->buf;
     const $fctype *src = ($fctype *) cvt->buf;
@@ -432,7 +436,7 @@
     }
 
     print <<EOF;
-    while (dst != target) {
+    while (dst $endcomparison target) {
 EOF
 
     if ($upsample) {