add missing ABI compatibility checks

original change:
f7f16a2 add ABI compatibility check

Change-Id: I7cd6508f8d8e0d957a3d62ad52a117876fa5ec29
This commit is contained in:
James Zern 2012-07-18 22:24:33 -07:00
parent 9d45416aa7
commit ce156afccf
3 changed files with 5 additions and 3 deletions

View File

@ -167,7 +167,9 @@ VP8StatusCode WebPAllocateDecBuffer(int w, int h,
// constructors / destructors // constructors / destructors
int WebPInitDecBufferInternal(WebPDecBuffer* buffer, int version) { int WebPInitDecBufferInternal(WebPDecBuffer* buffer, int version) {
if (version != WEBP_DECODER_ABI_VERSION) return 0; // version mismatch if (WEBP_ABI_IS_INCOMPATIBLE(version, WEBP_DECODER_ABI_VERSION)) {
return 0; // version mismatch
}
if (buffer == NULL) return 0; if (buffer == NULL) return 0;
memset(buffer, 0, sizeof(*buffer)); memset(buffer, 0, sizeof(*buffer));
return 1; return 1;

View File

@ -21,7 +21,7 @@ extern "C" {
int WebPConfigInitInternal(WebPConfig* config, int WebPConfigInitInternal(WebPConfig* config,
WebPPreset preset, float quality, int version) { WebPPreset preset, float quality, int version) {
if (version != WEBP_ENCODER_ABI_VERSION) { if (WEBP_ABI_IS_INCOMPATIBLE(version, WEBP_ENCODER_ABI_VERSION)) {
return 0; // caller/system version mismatch! return 0; // caller/system version mismatch!
} }
if (config == NULL) return 0; if (config == NULL) return 0;

View File

@ -47,7 +47,7 @@ static int DummyWriter(const uint8_t* data, size_t data_size,
} }
int WebPPictureInitInternal(WebPPicture* picture, int version) { int WebPPictureInitInternal(WebPPicture* picture, int version) {
if (version != WEBP_ENCODER_ABI_VERSION) { if (WEBP_ABI_IS_INCOMPATIBLE(version, WEBP_ENCODER_ABI_VERSION)) {
return 0; // caller/system version mismatch! return 0; // caller/system version mismatch!
} }
if (picture != NULL) { if (picture != NULL) {