More raging over j2c on windows

This commit is contained in:
phr0z3nt04st
2010-07-03 00:33:07 -05:00
parent 093c20cf4b
commit 9251a3e71b
2 changed files with 11 additions and 14 deletions

View File

@@ -299,6 +299,9 @@ BOOL LLImageJ2C::decodeChannels(LLImageRaw *raw_imagep, F32 decode_time, S32 fir
// Update the raw discard level
updateRawDiscardLevel();
mDecoding = TRUE;
// <edit>
raw_imagep->decodedImageComment = LLImageMetaDataReader::ExtractEncodedComment(getData(),getDataSize());
// </edit>
res = mImpl->decodeImpl(*this, *raw_imagep, decode_time, first_channel, max_channel_count);
}
@@ -311,9 +314,6 @@ BOOL LLImageJ2C::decodeChannels(LLImageRaw *raw_imagep, F32 decode_time, S32 fir
}
else
{
// <edit>
raw_imagep->decodedImageComment = LLImageMetaDataReader::ExtractEncodedComment(getData(),getDataSize());
// </edit>
mDecoding = FALSE;
}
}

View File

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