# HG changeset patch # User Yoshiki Yazawa # Date 1203070415 -32400 # Node ID 7d1411f80023589d0c5ba2d1486e5a5c49101d21 # Parent bd9673d8b7d58c090d27d64e7426f2d8933b3d48 imported 2b561aa49580 by Eugene Zagidullin. - removed unneeded exponential transformation + little out-of-buffer fix diff -r bd9673d8b7d5 -r 7d1411f80023 src/madplug/replaygain.c --- 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); }