From 3be57b166f0d60bb16b0f8401eebb25cfd12efe9 Mon Sep 17 00:00:00 2001 From: Pascal Massimino Date: Thu, 16 Jun 2011 13:33:07 -0700 Subject: [PATCH] fix MSVC compile for WEBP_EXPERIMENTAL_FEATURES patch by Ismail Keskin (iskeskin at gmail dot com) fixes issue #82 --- src/enc/alpha.c | 3 ++- src/enc/syntax.c | 11 ++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/enc/alpha.c b/src/enc/alpha.c index 3ebaff43..d5d4f882 100644 --- a/src/enc/alpha.c +++ b/src/enc/alpha.c @@ -23,6 +23,8 @@ extern "C" { #ifdef WEBP_EXPERIMENTAL_FEATURES +#define CHUNK_SIZE 8192 + //----------------------------------------------------------------------------- static int CompressAlpha(const uint8_t* data, size_t data_size, @@ -30,7 +32,6 @@ static int CompressAlpha(const uint8_t* data, size_t data_size, int algo) { int ret = Z_OK; z_stream strm; - const int CHUNK_SIZE = 8192; unsigned char chunk[CHUNK_SIZE]; *output = NULL; diff --git a/src/enc/syntax.c b/src/enc/syntax.c index 8ab89338..f6606d10 100644 --- a/src/enc/syntax.c +++ b/src/enc/syntax.c @@ -158,6 +158,8 @@ static int EmitPartitionsSize(const VP8Encoder* const enc, #ifdef WEBP_EXPERIMENTAL_FEATURES +#define KTRAILER_SIZE 8 + static void PutLE24(uint8_t* buf, size_t value) { buf[0] = (value >> 0) & 0xff; buf[1] = (value >> 8) & 0xff; @@ -165,8 +167,7 @@ static void PutLE24(uint8_t* buf, size_t value) { } static int WriteExtensions(VP8Encoder* const enc) { - const int kTrailerSize = 8; - uint8_t buffer[kTrailerSize]; + uint8_t buffer[KTRAILER_SIZE]; VP8BitWriter* const bw = &enc->bw_; WebPPicture* const pic = enc->pic_; @@ -190,8 +191,8 @@ static int WriteExtensions(VP8Encoder* const enc) { } } - buffer[kTrailerSize - 1] = 0x01; // marker - if (!VP8BitWriterAppend(bw, buffer, kTrailerSize)) { + buffer[KTRAILER_SIZE - 1] = 0x01; // marker + if (!VP8BitWriterAppend(bw, buffer, KTRAILER_SIZE)) { return WebPEncodingSetError(pic, VP8_ENC_ERROR_BITSTREAM_OUT_OF_MEMORY); } return 1; @@ -296,4 +297,4 @@ int VP8EncWrite(VP8Encoder* const enc) { #if defined(__cplusplus) || defined(c_plusplus) } // extern "C" -#endif +#endif \ No newline at end of file