changeset 2362:2b561aa49580

removed unneeded exponential transformation + little out-of-buffer fix
author Eugene Zagidullin <e.asphyx@gmail.com>
date Tue, 05 Feb 2008 09:13:41 +0300
parents ead24454f4b7
children 5eb15f6cf71e
files src/madplug_x/replaygain.c
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/madplug_x/replaygain.c	Tue Feb 05 07:37:00 2008 +0300
+++ b/src/madplug_x/replaygain.c	Tue Feb 05 09:13:41 2008 +0300
@@ -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);
             }