JLS_ERROR CheckInput(const void* compressedData, size_t compressedLength, ByteStreamInfo uncompressedStream, const JlsParameters* pparams) { if (pparams == NULL) return InvalidJlsParameters; if (compressedLength == 0) return InvalidJlsParameters; if (compressedData == NULL) return InvalidJlsParameters; if (pparams->width < 1 || pparams->width > 65535) return ParameterValueNotSupported; if (pparams->height < 1 || pparams->height > 65535) return ParameterValueNotSupported; int bytesperline = pparams->bytesperline < 0 ? -pparams->bytesperline : pparams->bytesperline; if (uncompressedStream.rawData != NULL) { if (uncompressedStream.count < size_t(bytesperline * pparams->height)) return UncompressedBufferTooSmall; } else if (uncompressedStream.rawStream == NULL) return InvalidJlsParameters; return CheckParameterCoherent(pparams); }
JLS_ERROR CheckInput(const void* compressedData, size_t compressedLength, const void* uncompressedData, size_t uncompressedLength, const JlsParameters* pparams) { if (pparams == NULL) return InvalidJlsParameters; if (compressedLength == 0) return InvalidJlsParameters; if (compressedData == NULL) return InvalidJlsParameters; if (uncompressedData == NULL) return InvalidJlsParameters; if (pparams->width < 1 || pparams->width > 65535) return ParameterValueNotSupported; if (pparams->height < 1 || pparams->height > 65535) return ParameterValueNotSupported; int bytesperline = pparams->bytesperline < 0 ? -pparams->bytesperline : pparams->bytesperline; if (uncompressedLength < size_t(bytesperline * pparams->height)) return InvalidJlsParameters; return CheckParameterCoherent(pparams); }
// // Read() // void JLSInputStream::Read(void* pvoid, size_t cbyteAvailable) { ReadHeader(); JLS_ERROR error = CheckParameterCoherent(&_info); if (error != OK) throw JlsException(error); ReadPixels(pvoid, cbyteAvailable); }
static JLS_ERROR CheckInput(ByteStreamInfo uncompressedStream, const JlsParameters* pparams) { if (pparams == NULL) return InvalidJlsParameters; if (uncompressedStream.rawStream == NULL && uncompressedStream.rawData == NULL) return InvalidJlsParameters; if (pparams->width < 1 || pparams->width > 65535) return ParameterValueNotSupported; if (pparams->height < 1 || pparams->height > 65535) return ParameterValueNotSupported; if (uncompressedStream.rawData != NULL) { if (uncompressedStream.count < size_t(pparams->height * pparams->width * pparams->components * (pparams->bitspersample > 8 ? 2 : 1))) return UncompressedBufferTooSmall; } else if (uncompressedStream.rawStream == NULL) return InvalidJlsParameters; return CheckParameterCoherent(pparams); }