changeset 2391:7d1411f80023

imported 2b561aa49580 by Eugene Zagidullin. - removed unneeded exponential transformation + little out-of-buffer fix
author Yoshiki Yazawa <yaz@cc.rim.or.jp>
date Fri, 15 Feb 2008 19:13:35 +0900
parents bd9673d8b7d5
children 4ad6e7dfb389
files src/madplug/replaygain.c
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/madplug/replaygain.c	Fri Feb 15 19:10:19 2008 +0900
+++ b/src/madplug/replaygain.c	Fri Feb 15 19:13:35 2008 +0900
@@ -53,10 +53,10 @@
 static gdouble
 strgain2double(gchar * s, int len)
 {
+    gchar *strval = g_strndup(s, len);
     gdouble res = g_strtod(s, NULL);    // gain, in dB.
-    if (res == 0)
-        return 1;
-    return pow(10, res / 20);
+    g_free(strval);
+    return res;
 }
 
 // Reads APE v2.0 tag ending at current pos in fp
@@ -136,7 +136,7 @@
                 str = &file_info->replaygain_album_peak_str;
             }
             if (str != NULL) {
-                *scale = g_strtod(p + isize + 1, NULL);
+                *scale = strgain2double(p + isize + 1, vsize);
                 *str = g_strndup(p + isize + 1, vsize);
             }