mirror of
https://github.com/webmproject/libwebp.git
synced 2025-07-13 14:34:33 +02:00
make WebPEncodingSetError() take a const picture
This is a border-case situation: the picture is not const, because we're change its error status. But taking it non-const forces the caller to carry a non-const picture all around the code just in case (0.00001% of the time?) something bad happen. This pretty much the same as making all objects non-const because we'll eventually call delete or free() on them, which is quite a non-const operation. Well... Better allow constness enforcement for the remaining 99.9999% of the code. Change-Id: I9b93892a189a50feaec1a3a518ebf488eb6ff22f
This commit is contained in:
@ -306,10 +306,11 @@ static void StoreStats(VP8Encoder* const enc) {
|
||||
WebPReportProgress(enc, 100); // done!
|
||||
}
|
||||
|
||||
int WebPEncodingSetError(WebPPicture* const pic, WebPEncodingError error) {
|
||||
int WebPEncodingSetError(const WebPPicture* const pic,
|
||||
WebPEncodingError error) {
|
||||
assert((int)error < VP8_ENC_ERROR_LAST);
|
||||
assert((int)error >= VP8_ENC_OK);
|
||||
pic->error_code = error;
|
||||
((WebPPicture*)pic)->error_code = error;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user