gzip reader: bad find interface

Find => return int
find => return size_t (behave as STL)

Thanks to gcc for the useful warning

+ a cast to avoid an useless warning
This commit is contained in:
Gregory Hainaut 2016-11-12 18:41:07 +01:00
parent a7e76438b2
commit 5e5b927abd
1 changed files with 3 additions and 3 deletions

View File

@ -120,8 +120,8 @@ static wxString ApplyTemplate(const wxString &name, const wxDirName &base,
wxString key = INDEX_TEMPLATE_KEY; wxString key = INDEX_TEMPLATE_KEY;
tem = tem.Trim(true).Trim(false); // both sides tem = tem.Trim(true).Trim(false); // both sides
int first = tem.find(key); size_t first = tem.find(key);
if (first < 0 // not found if (first == wxString::npos // not found
|| first != tem.rfind(key) // more than one instance || first != tem.rfind(key) // more than one instance
|| !canEndWithKey && first == tem.length() - key.length()) || !canEndWithKey && first == tem.length() - key.length())
{ {
@ -389,7 +389,7 @@ int GzippedFileReader::_ReadSync(void* pBuffer, PX_off_t offset, uint bytesToRea
uint maxInChunk = GZFILE_READ_CHUNK_SIZE - offset % GZFILE_READ_CHUNK_SIZE; uint maxInChunk = GZFILE_READ_CHUNK_SIZE - offset % GZFILE_READ_CHUNK_SIZE;
if (bytesToRead > maxInChunk) { if (bytesToRead > maxInChunk) {
int first = _ReadSync(pBuffer, offset, maxInChunk); int first = _ReadSync(pBuffer, offset, maxInChunk);
if (first != maxInChunk) if (first != (int)maxInChunk)
return first; // EOF or failure return first; // EOF or failure
int rest = _ReadSync((char*)pBuffer + maxInChunk, offset + maxInChunk, bytesToRead - maxInChunk); int rest = _ReadSync((char*)pBuffer + maxInChunk, offset + maxInChunk, bytesToRead - maxInChunk);