fix MSVC compile for WEBP_EXPERIMENTAL_FEATURES

patch by Ismail Keskin (iskeskin at gmail dot com)
fixes issue #82
This commit is contained in:
Pascal Massimino 2011-06-16 13:33:07 -07:00
parent 40a7e347ff
commit 3be57b166f
2 changed files with 8 additions and 6 deletions

View File

@ -23,6 +23,8 @@ extern "C" {
#ifdef WEBP_EXPERIMENTAL_FEATURES #ifdef WEBP_EXPERIMENTAL_FEATURES
#define CHUNK_SIZE 8192
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
static int CompressAlpha(const uint8_t* data, size_t data_size, 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 algo) {
int ret = Z_OK; int ret = Z_OK;
z_stream strm; z_stream strm;
const int CHUNK_SIZE = 8192;
unsigned char chunk[CHUNK_SIZE]; unsigned char chunk[CHUNK_SIZE];
*output = NULL; *output = NULL;

View File

@ -158,6 +158,8 @@ static int EmitPartitionsSize(const VP8Encoder* const enc,
#ifdef WEBP_EXPERIMENTAL_FEATURES #ifdef WEBP_EXPERIMENTAL_FEATURES
#define KTRAILER_SIZE 8
static void PutLE24(uint8_t* buf, size_t value) { static void PutLE24(uint8_t* buf, size_t value) {
buf[0] = (value >> 0) & 0xff; buf[0] = (value >> 0) & 0xff;
buf[1] = (value >> 8) & 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) { static int WriteExtensions(VP8Encoder* const enc) {
const int kTrailerSize = 8; uint8_t buffer[KTRAILER_SIZE];
uint8_t buffer[kTrailerSize];
VP8BitWriter* const bw = &enc->bw_; VP8BitWriter* const bw = &enc->bw_;
WebPPicture* const pic = enc->pic_; WebPPicture* const pic = enc->pic_;
@ -190,8 +191,8 @@ static int WriteExtensions(VP8Encoder* const enc) {
} }
} }
buffer[kTrailerSize - 1] = 0x01; // marker buffer[KTRAILER_SIZE - 1] = 0x01; // marker
if (!VP8BitWriterAppend(bw, buffer, kTrailerSize)) { if (!VP8BitWriterAppend(bw, buffer, KTRAILER_SIZE)) {
return WebPEncodingSetError(pic, VP8_ENC_ERROR_BITSTREAM_OUT_OF_MEMORY); return WebPEncodingSetError(pic, VP8_ENC_ERROR_BITSTREAM_OUT_OF_MEMORY);
} }
return 1; return 1;