Removed changes by Nicholas. These will need to be re-submitted through Trac and manually validated.

Added BMP (24-bit uncompressed, 8-bit uncompressed, and RLE8) and PNG support to File::ReadImageFile(). So far everything in FileHandler is presumed to be safe with any input file except UTK decompression.

Also started making use of the static keyword in various places to aid the compiler in optimization.
This commit is contained in:
Fatbag 2012-04-06 13:27:40 -05:00
parent 7442579090
commit cb751c0bb8
29 changed files with 692 additions and 1291 deletions

View file

@ -17,7 +17,6 @@
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <stdio.h>
#include "iff.h"
#ifndef __inline
@ -37,11 +36,10 @@ IFFFile * iff_create()
return ptr;
}
int iff_read_header(IFFFile * IFFFileInfo, const uint8_t * Buffer, unsigned FileSize, char *FileName)
int iff_read_header(IFFFile * IFFFileInfo, const uint8_t * Buffer, unsigned FileSize)
{
unsigned offset;
if(!FileSize) FileSize = ~0;
else if(FileSize < 64)
return 0;
@ -49,8 +47,6 @@ int iff_read_header(IFFFile * IFFFileInfo, const uint8_t * Buffer, unsigned File
if(memcmp(Buffer, Header_IFF, 60))
return 0;
memcpy(IFFFileInfo->Header, Buffer, 60);
IFFFileInfo->FileName = FileName;
offset = read_uint32be(Buffer+60);
if(offset > FileSize - 28)
@ -105,8 +101,7 @@ IFFChunkNode * iff_add_chunk(IFFFile * IFFFileInfo, int Position)
node->NextChunk = ptr;
}
}
IFFFileInfo->ChunkCount++;
return ptr;
}
@ -152,20 +147,4 @@ int iff_enumerate_chunks(IFFFile * IFFFileInfo, const uint8_t * Buffer, unsigned
BufferSize -= chunk->Chunk.Size;
}
return 1;
}
IFFChunk *iff_find_first_chunk(IFFFile *IFFFileInfo, const char *type, uint16_t id)
{
IFFChunkNode *currentNode = IFFFileInfo->FirstChunk;
do
{
if (type == NULL || !memcmp(type, currentNode->Chunk.Type, 4) &&
(id == 0 || id == currentNode->Chunk.ChunkID))
return &currentNode->Chunk;
currentNode = currentNode->NextChunk;
}
while (currentNode != IFFFileInfo->LastChunk && currentNode != NULL);
return NULL;
}