* @param dst Output buffer
* @param n Size of input buffer
* @param compr Compression method
- * @return Number of output bytes. If an output error is encountered, -1 returned
+ * @return Number of output bytes. If an output error is encountered, a negative
+ * value corresponding to an AVERROR error code is returned.
*/
static int encode_strip(TiffEncoderContext *s, const int8_t *src,
uint8_t *dst, int n, int compr)
unsigned long zlen = s->buf_size - (*s->buf - s->buf_start);
if (compress(dst, &zlen, src, n) != Z_OK) {
av_log(s->avctx, AV_LOG_ERROR, "Compressing failed\n");
- return -1;
+ return AVERROR_UNKNOWN;
}
return zlen;
}
#endif
case TIFF_RAW:
if (check_size(s, n))
- return -1;
+ return AVERROR(EINVAL);
memcpy(dst, src, n);
return n;
case TIFF_PACKBITS:
case TIFF_LZW:
return ff_lzw_encode(s->lzws, src, n);
default:
- return -1;
+ return AVERROR(EINVAL);
}
}
default:
av_log(s->avctx, AV_LOG_ERROR,
"This colors format is not supported\n");
- return -1;
+ return AVERROR(EINVAL);
}
if (s->compr == TIFF_DEFLATE ||