add version getters for decoder and encoder

WebPGetDecoderVersion() and WebPGetEncoderVersion()
will not return 0.1.2 encoded as 0x000102

dwebp and cwebp also have a new "-version" flag

Change-Id: I4fb4b5a8fc4e53681a386ff4b74fffb639fa237a
This commit is contained in:
Pascal Massimino
2011-03-24 16:17:10 -07:00
parent be4867d2f8
commit 650ffa3bbb
8 changed files with 43 additions and 1 deletions

View File

@ -594,6 +594,7 @@ static void HelpLong() {
printf("\n");
printf(" -short ................. condense printed message\n");
printf(" -quiet ................. don't print anything.\n");
printf(" -version ............... print version number and exit.\n");
printf(" -v ..................... verbose, e.g. print encoding/decoding "
"times\n");
printf("\n");
@ -678,6 +679,11 @@ int main(int argc, const char *argv[]) {
crop_y = atoi(argv[++c]);
crop_w = atoi(argv[++c]);
crop_h = atoi(argv[++c]);
} else if (!strcmp(argv[c], "-version")) {
const int version = WebPGetEncoderVersion();
printf("%d.%d.%d\n",
(version >> 16) & 0xff, (version >> 8) & 0xff, version & 0xff);
return 0;
} else if (!strcmp(argv[c], "-quiet")) {
quiet = 1;
} else if (!strcmp(argv[c], "-preset") && c < argc - 1) {