Fixed a slight mistake.

This commit is contained in:
n-a-c-h
2004-11-26 02:51:41 +00:00
parent 7fb29cf524
commit 2f7e252e9b

View File

@@ -32,7 +32,7 @@ namespace JMA
const unsigned int jma_version_length = 1; const unsigned int jma_version_length = 1;
const unsigned int jma_total_header_length = jma_header_length + jma_version_length + UINT_SIZE; 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) time_t uint_to_time(unsigned short date, unsigned short time)
{ {
tm formatted_time; tm formatted_time;
@@ -52,6 +52,7 @@ namespace JMA
void jma_open::retrieve_file_block() throw(jma_errors) void jma_open::retrieve_file_block() throw(jma_errors)
{ {
unsigned char uint_buffer[UINT_SIZE]; unsigned char uint_buffer[UINT_SIZE];
unsigned char ushort_buffer[USHORT_SIZE];
//File block size is the last UINT in the file //File block size is the last UINT in the file
stream.seekg(-UINT_SIZE,ios::end); 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 file name length is 2 bytes, a char and a null
//Minimum comment length is 1 byte, a null //Minimum comment length is 1 byte, a null
//There are currently 2 UINTs and 2 USHORTs per file //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 //First stored in the file block is the file name null terminated
file_info.name = ""; file_info.name = "";
@@ -114,12 +115,12 @@ namespace JMA
file_info.crc32 = charp_to_uint(uint_buffer); file_info.crc32 = charp_to_uint(uint_buffer);
//Special USHORT representation of file's date //Special USHORT representation of file's date
stream.read((char *)uint_buffer, USHORT_SIZE); stream.read((char *)ushort_buffer, USHORT_SIZE);
file_info.date = charp_to_ushort(uint_buffer); file_info.date = charp_to_ushort(ushort_buffer);
//Special USHORT representation of file's time //Special USHORT representation of file's time
stream.read((char *)uint_buffer, USHORT_SIZE); stream.read((char *)ushort_buffer, USHORT_SIZE);
file_info.time = charp_to_ushort(uint_buffer); file_info.time = charp_to_ushort(ushort_buffer);
file_info.buffer = 0; //Pointing to null till we decompress files file_info.buffer = 0; //Pointing to null till we decompress files