encodings[i] <= pseudoEncodingQualityLevel9) {
noJpeg = false;
qualityLevel = encodings[i] - pseudoEncodingQualityLevel0;
- } else if (encodings[i] <= encodingMax && Encoder::supported(encodings[i]))
+ } else if (Encoder::supported(encodings[i]))
currentEncoding_ = encodings[i];
}
}
bool Encoder::supported(int encoding)
{
- return encoding <= encodingMax && createFns[encoding];
+ return encoding >= 0 && encoding <= encodingMax && createFns[encoding];
}
Encoder* Encoder::createEncoder(int encoding, SMsgWriter* writer)
{
- if (encoding <= encodingMax && createFns[encoding])
+ if (supported(encoding))
return (*createFns[encoding])(writer);
return 0;
}