GIFTranslator: rename cs and size to codeSize

This commit is contained in:
John Scipione 2014-03-03 19:30:14 -05:00
parent 4389d32381
commit 9504d99506
2 changed files with 12 additions and 14 deletions

View File

@ -336,27 +336,25 @@ bool
GIFLoad::ReadGIFImageData() GIFLoad::ReadGIFImageData()
{ {
unsigned char newEntry[ENTRY_COUNT]; unsigned char newEntry[ENTRY_COUNT];
unsigned char codeSize;
fInput->Read(&codeSize, 1);
unsigned char cs; if (codeSize > fPalette->size_in_bits) {
fInput->Read(&cs, 1);
if (cs == fPalette->size_in_bits) {
if (!InitFrame(fPalette->size_in_bits))
return false;
} else if (cs > fPalette->size_in_bits) {
if (debug) { if (debug) {
syslog(LOG_ERR, "GIFLoad::ReadGIFImageData() - " syslog(LOG_ERR, "GIFLoad::ReadGIFImageData() - "
"Code_size should be %d, not %d, allowing it\n", "Code_size should be %d, not %d, allowing it\n",
fCodeSize, cs); fCodeSize, codeSize);
} }
if (!InitFrame(cs)) if (!InitFrame(codeSize))
return false; return false;
} else if (cs < fPalette->size_in_bits) { } else if (codeSize < fPalette->size_in_bits) {
if (debug) { if (debug) {
syslog(LOG_ERR, "GIFLoad::ReadGIFImageData() - " syslog(LOG_ERR, "GIFLoad::ReadGIFImageData() - "
"Code_size should be %d, not %d\n", fCodeSize, cs); "Code_size should be %d, not %d\n", fCodeSize, codeSize);
} }
return false; return false;
} } else if (!InitFrame(fPalette->size_in_bits))
return false;
if (debug) if (debug)
syslog(LOG_INFO, "GIFLoad::ReadGIFImageData() - Starting LZW\n"); syslog(LOG_INFO, "GIFLoad::ReadGIFImageData() - Starting LZW\n");
@ -507,9 +505,9 @@ GIFLoad::ResetTable()
bool bool
GIFLoad::InitFrame(int size) GIFLoad::InitFrame(int codeSize)
{ {
fCodeSize = size; fCodeSize = codeSize;
if (fCodeSize == 1) if (fCodeSize == 1)
fCodeSize++; fCodeSize++;

View File

@ -57,7 +57,7 @@ private:
bool ReadGIFCommentBlock(); bool ReadGIFCommentBlock();
bool ReadGIFUnknownBlock(unsigned char c); bool ReadGIFUnknownBlock(unsigned char c);
bool InitFrame(int size); bool InitFrame(int codeSize);
short NextCode(); short NextCode();
void ResetTable(); void ResetTable();