comparison src/vorbis/vorbis.c @ 2210:d0ede319f7b9

be aware of incorrect formatting
author Eugene Zagidullin <e.asphyx@gmail.com>
date Thu, 06 Dec 2007 03:41:16 +0300
parents 201a47338baf
children 2a13a038987c
comparison
equal deleted inserted replaced
2209:190cc25a8510 2210:d0ede319f7b9
536 rg_peak_str = 536 rg_peak_str =
537 vorbis_comment_query(comment, "replaygain_track_peak", 0); 537 vorbis_comment_query(comment, "replaygain_track_peak", 0);
538 if (!rg_peak_str) 538 if (!rg_peak_str)
539 rg_peak_str = vorbis_comment_query(comment, "rg_peak", 0); /* Old */ 539 rg_peak_str = vorbis_comment_query(comment, "rg_peak", 0); /* Old */
540 540
541 if (rg_peak_str) 541 if (rg_peak_str) {
542 rg_peak = atof(rg_peak_str); 542 rg_peak = atof(rg_peak_str);
543 rg_peak = rg_peak == 0.0 ? 1.0 : rg_peak; /* be aware of incorrect formatted strings --eugene */
544 }
543 else 545 else
544 rg_peak = 1; 546 rg_peak = 1;
545 547
546 if (*scale * rg_peak > 1.0) 548 if (*scale * rg_peak > 1.0)
547 *scale = 1.0 / rg_peak; 549 *scale = 1.0 / rg_peak;