From 14763dc0cb3a0a5f98b626345068db0d4a7302e0 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Tue, 19 Feb 2013 17:05:58 +0800 Subject: [PATCH] Usermode/libimage_sif - Cleanups --- Usermode/Libraries/libimage_sif.so_src/main.c | 25 ++++++------------- 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/Usermode/Libraries/libimage_sif.so_src/main.c b/Usermode/Libraries/libimage_sif.so_src/main.c index 014a316c..180668a5 100644 --- a/Usermode/Libraries/libimage_sif.so_src/main.c +++ b/Usermode/Libraries/libimage_sif.so_src/main.c @@ -150,33 +150,22 @@ tImage *Image_SIF_Parse(void *Buffer, size_t Size) { uint8_t len, val; if( fileOfs + 1 > Size ) return ret; - len = *(uint8_t*)Buffer+fileOfs; fileOfs += 1; + len = ((uint8_t*)Buffer)[fileOfs++]; if(len & 0x80) { len &= 0x7F; while(len--) { if( fileOfs + 1 > Size ) return ret; - val = *(uint8_t*)Buffer+fileOfs; fileOfs += 1; - if(i == 0) - ret->Data[ofs] = val; - else - ret->Data[ofs] |= val; + val = ((uint8_t*)Buffer)[fileOfs++]; + ret->Data[ofs] = val; ofs += sampleSize; } } else { if( fileOfs + 1 > Size ) return ret; - val = *(uint8_t*)Buffer+fileOfs; fileOfs += 1; - if(i == 0) { - while(len--) { - ret->Data[ofs] = val; - ofs += sampleSize; - } - } - else { - while(len--) { - ret->Data[ofs] |= val; - ofs += sampleSize; - } + val = ((uint8_t*)Buffer)[fileOfs++]; + while(len--) { + ret->Data[ofs] = val; + ofs += sampleSize; } } } -- 2.20.1