add ABI compatibility check

minor revision shouldn't matter, we only check major revision number.
Bumped all version numbers so that incompatibility starts *now*

Change-Id: Id06c20f03039845ae4cfb3fd121807b931d67ee4
This commit is contained in:
Pascal Massimino
2012-07-18 11:53:25 -07:00
parent 2a77557002
commit f7f16a2976
9 changed files with 30 additions and 21 deletions

View File

@ -35,11 +35,14 @@ static void MuxInit(WebPMux* const mux) {
}
WebPMux* WebPNewInternal(int version) {
WebPMux* const mux = (version == WEBP_MUX_ABI_VERSION) ?
(WebPMux*)malloc(sizeof(WebPMux)) : NULL;
// If mux is NULL MuxInit is a noop.
MuxInit(mux);
return mux;
if (WEBP_ABI_IS_INCOMPATIBLE(version, WEBP_MUX_ABI_VERSION)) {
return NULL;
} else {
WebPMux* const mux = (WebPMux*)malloc(sizeof(WebPMux));
// If mux is NULL MuxInit is a noop.
MuxInit(mux);
return mux;
}
}
static void DeleteAllChunks(WebPChunk** const chunk_list) {