From acf6f16d026d02d68123a405efc634e7b6d773f1 Mon Sep 17 00:00:00 2001 From: Justin Maggard Date: Wed, 1 Sep 2010 00:33:43 +0000 Subject: [PATCH] * Fix big-endian issue with XING header parsing. --- tagutils/tagutils-mp3.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tagutils/tagutils-mp3.c b/tagutils/tagutils-mp3.c index 142af72..9a57612 100644 --- a/tagutils/tagutils-mp3.c +++ b/tagutils/tagutils-mp3.c @@ -729,15 +729,19 @@ _get_mp3fileinfo(char *file, struct song_metadata *psong) psong->vbr_scale = -1; if(!strncasecmp((char*)&buffer[index + fi.xing_offset + 4], "XING", 4)) { - xing_flags = *((int*)&buffer[index + fi.xing_offset + 4 + 4]); - xing_flags = ntohs(xing_flags); + xing_flags = buffer[index+fi.xing_offset+4+4] << 24 | + buffer[index+fi.xing_offset+4+5] << 16 | + buffer[index+fi.xing_offset+4+6] << 8 | + buffer[index+fi.xing_offset+4+7]; psong->vbr_scale = 78; if(xing_flags & 0x1) { /* Frames field is valid... */ - fi.number_of_frames = *((int*)&buffer[index + fi.xing_offset + 4 + 8]); - fi.number_of_frames = ntohs(fi.number_of_frames); + fi.number_of_frames = buffer[index+fi.xing_offset+4+8] << 24 | + buffer[index+fi.xing_offset+4+9] << 16 | + buffer[index+fi.xing_offset+4+10] << 8 | + buffer[index+fi.xing_offset+4+11]; } }