From 2f7e252e9babeaf5b668885dc15bfef6b4acc712 Mon Sep 17 00:00:00 2001 From: n-a-c-h <> Date: Fri, 26 Nov 2004 02:51:41 +0000 Subject: [PATCH] Fixed a slight mistake. --- zsnes/src/jma/jma.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/zsnes/src/jma/jma.cpp b/zsnes/src/jma/jma.cpp index 5ee2764b..5d6ccf38 100644 --- a/zsnes/src/jma/jma.cpp +++ b/zsnes/src/jma/jma.cpp @@ -32,7 +32,7 @@ namespace JMA const unsigned int jma_version_length = 1; const unsigned int jma_total_header_length = jma_header_length + jma_version_length + UINT_SIZE; - //Convert zip/JMA integer time to to time_t + //Convert DOS/zip/JMA integer time to to time_t time_t uint_to_time(unsigned short date, unsigned short time) { tm formatted_time; @@ -52,6 +52,7 @@ namespace JMA void jma_open::retrieve_file_block() throw(jma_errors) { unsigned char uint_buffer[UINT_SIZE]; + unsigned char ushort_buffer[USHORT_SIZE]; //File block size is the last UINT in the file stream.seekg(-UINT_SIZE,ios::end); @@ -77,7 +78,7 @@ namespace JMA //Minimum file name length is 2 bytes, a char and a null //Minimum comment length is 1 byte, a null //There are currently 2 UINTs and 2 USHORTs per file - while (file_block_size > 2+1+UINT_SIZE*2+USHORT_SIZE*2) //This does allow for a gap, but that's okay + while (file_block_size >= 2+1+UINT_SIZE*2+USHORT_SIZE*2) //This does allow for a gap, but that's okay { //First stored in the file block is the file name null terminated file_info.name = ""; @@ -114,12 +115,12 @@ namespace JMA file_info.crc32 = charp_to_uint(uint_buffer); //Special USHORT representation of file's date - stream.read((char *)uint_buffer, USHORT_SIZE); - file_info.date = charp_to_ushort(uint_buffer); + stream.read((char *)ushort_buffer, USHORT_SIZE); + file_info.date = charp_to_ushort(ushort_buffer); //Special USHORT representation of file's time - stream.read((char *)uint_buffer, USHORT_SIZE); - file_info.time = charp_to_ushort(uint_buffer); + stream.read((char *)ushort_buffer, USHORT_SIZE); + file_info.time = charp_to_ushort(ushort_buffer); file_info.buffer = 0; //Pointing to null till we decompress files