mirror of
https://github.com/webmproject/libwebp.git
synced 2025-02-12 15:02:53 +01: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:
parent
638528cd1e
commit
fa8bc3dbca
@ -473,7 +473,7 @@ int VP8StatLoop(VP8Encoder* const enc);
|
||||
|
||||
// in webpenc.c
|
||||
// Assign an error code to a picture. Return false for convenience.
|
||||
int WebPEncodingSetError(WebPPicture* const pic, WebPEncodingError error);
|
||||
int WebPEncodingSetError(const WebPPicture* const pic, WebPEncodingError error);
|
||||
int WebPReportProgress(VP8Encoder* const enc, int percent);
|
||||
|
||||
// in analysis.c
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user