more J2c tests for windows

This commit is contained in:
phr0z3nt04st
2010-07-02 23:34:58 -05:00
parent 7d30cea315
commit 093c20cf4b
2 changed files with 12 additions and 9 deletions

View File

@@ -478,7 +478,7 @@ BOOL LLImageJ2C::validate(U8 *data, U32 file_size)
if ( res ) if ( res )
{ {
// Check to make sure that this instance has been initialized with data // Check to make sure that this instance has been initialized with data
if (!getData() || (0 == getDataSize())) if (!getData() || (getDataSize() < 16))
{ {
setLastError("LLImageJ2C uninitialized"); setLastError("LLImageJ2C uninitialized");
res = FALSE; res = FALSE;

View File

@@ -70,14 +70,19 @@ std::vector<U8> LLJ2cParser::GetNextComment()
return content; return content;
} }
/*BOOL LLJ2cParser::validIterator()
{
return (mIter != mData.end());
}*/
//static //static
std::string LLImageMetaDataReader::ExtractEncodedComment(U8* data,int data_size) std::string LLImageMetaDataReader::ExtractEncodedComment(U8* data,int data_size)
{ {
LLJ2cParser* parser = new LLJ2cParser(data,data_size); LLJ2cParser parser = LLJ2cParser(data,data_size);
while(1) //while(1) // I dont think we need to loop
{ {
std::vector<U8> comment = parser->GetNextComment(); std::vector<U8> comment = parser.GetNextComment();
if (comment.empty()) break; //exit loop if (comment.empty()) return ""; //break; //exit loop
if (comment[1] == 0x00 && comment.size() == 130) if (comment[1] == 0x00 && comment.size() == 130)
{ {
//llinfos << "FOUND PAYLOAD" << llendl; //llinfos << "FOUND PAYLOAD" << llendl;
@@ -109,21 +114,19 @@ std::string LLImageMetaDataReader::ExtractEncodedComment(U8* data,int data_size)
} }
else else
{ {
break;//exit loop return "";//break; //exit loop
} }
for (i = 4; i < 128; ++i) for (i = 4; i < 128; ++i)
{ {
if (payload[i] == 0) break; if (payload[i] == 0) break;
} }
if(i < 4) break; if(i < 4) return "";//break; //exit loop
std::string result(payload.begin()+4,payload.begin()+i); std::string result(payload.begin()+4,payload.begin()+i);
//llinfos << "FOUND COMMENT: " << result << llendl; //llinfos << "FOUND COMMENT: " << result << llendl;
delete parser;
return result; return result;
} }
} }
//end of loop //end of loop
delete parser;
return ""; return "";
} }
// </edit> // </edit>