Slience some Visual Studio warnings.

Change-Id: I62078af80bfcaa82bdc165fc2fc8fce2d2aad862
This commit is contained in:
Mikolaj Zalewski 2011-06-28 16:02:56 +02:00
parent 4cbbb2901b
commit 2aa6b80efe
4 changed files with 21 additions and 15 deletions

View File

@ -724,6 +724,7 @@ static const char* const kErrorMessages[] = {
"in the manual (`man cwebp`)",
"PARTITION_OVERFLOW: Partition is too big to fit 16M",
"BAD_WRITE: Picture writer returned an I/O error"
"FILE_TOO_BIG: File would be too big to fit in 4G"
};
//------------------------------------------------------------------------------
@ -776,11 +777,11 @@ int main(int argc, const char *argv[]) {
} else if (!strcmp(argv[c], "-m") && c < argc - 1) {
config.method = strtol(argv[++c], NULL, 0);
} else if (!strcmp(argv[c], "-q") && c < argc - 1) {
config.quality = strtod(argv[++c], NULL);
config.quality = (float)strtod(argv[++c], NULL);
} else if (!strcmp(argv[c], "-size") && c < argc - 1) {
config.target_size = strtol(argv[++c], NULL, 0);
} else if (!strcmp(argv[c], "-psnr") && c < argc - 1) {
config.target_PSNR = strtod(argv[++c], NULL);
config.target_PSNR = (float)strtod(argv[++c], NULL);
} else if (!strcmp(argv[c], "-sns") && c < argc - 1) {
config.sns_strength = strtol(argv[++c], NULL, 0);
} else if (!strcmp(argv[c], "-f") && c < argc - 1) {

View File

@ -268,7 +268,7 @@ static void ExportRow(int32_t* frow, int32_t* irow, uint8_t* dst, int dst_width,
int x_out;
for (x_out = 0; x_out < dst_width; ++x_out) {
const int frac = MULT(frow[x_out], yscale);
const int v = MULT(irow[x_out] - frac, fxy_scale);
const int v = (int)(MULT(irow[x_out] - frac, fxy_scale));
dst[x_out] = (!(v & ~0xff)) ? v : (v < 0) ? 0 : 255;
irow[x_out] = frac; // new fractional start
}

View File

@ -50,16 +50,20 @@ static int PutHeader(int profile, size_t size0, size_t total_size,
return WebPEncodingSetError(pic, VP8_ENC_ERROR_PARTITION0_OVERFLOW);
}
PutLE32(RIFF + 4, total_size + KSIZE_OFFSET);
PutLE32(RIFF + 16, total_size);
if (total_size > 0xfffffffeU - KRIFF_SIZE) {
return WebPEncodingSetError(pic, VP8_ENC_ERROR_FILE_TOO_BIG);
}
PutLE32(RIFF + 4, (uint32_t)(total_size + KSIZE_OFFSET));
PutLE32(RIFF + 16, (uint32_t)total_size);
if (!pic->writer(RIFF, sizeof(RIFF), pic)) {
return WebPEncodingSetError(pic, VP8_ENC_ERROR_BAD_WRITE);
}
bits = 0 // keyframe (1b)
| (profile << 1) // profile (3b)
| (1 << 4) // visible (1b)
| (size0 << 5); // partition length (19b)
bits = 0 // keyframe (1b)
| (profile << 1) // profile (3b)
| (1 << 4) // visible (1b)
| ((uint32_t)size0 << 5); // partition length (19b)
buf[0] = bits & 0xff;
buf[1] = (bits >> 8) & 0xff;
buf[2] = (bits >> 16) & 0xff;
@ -240,8 +244,8 @@ static size_t GeneratePartition0(VP8Encoder* const enc) {
if (enc->pic_->stats) {
enc->pic_->stats->header_bytes[0] = (int)((pos2 - pos1 + 7) >> 3);
enc->pic_->stats->header_bytes[1] = (int)((pos3 - pos2 + 7) >> 3);
enc->pic_->stats->alpha_data_size = enc->alpha_data_size_;
enc->pic_->stats->layer_data_size = enc->layer_data_size_;
enc->pic_->stats->alpha_data_size = (int)enc->alpha_data_size_;
enc->pic_->stats->layer_data_size = (int)enc->layer_data_size_;
}
return !bw->error_;
}
@ -254,7 +258,7 @@ int VP8EncWrite(VP8Encoder* const enc) {
int p;
// Partition #0 with header and partition sizes
ok = GeneratePartition0(enc);
ok = !!GeneratePartition0(enc);
// Compute total size (for the RIFF header)
coded_size = KHEADER_SIZE + VP8BitWriterSize(bw) + 3 * (enc->num_parts_ - 1);
@ -289,7 +293,7 @@ int VP8EncWrite(VP8Encoder* const enc) {
ok = pic->writer(pad_byte, 1, pic);
}
enc->coded_size_ = coded_size + KRIFF_SIZE;
enc->coded_size_ = (int)coded_size + KRIFF_SIZE;
return ok;
}

View File

@ -161,9 +161,10 @@ typedef enum {
VP8_ENC_ERROR_NULL_PARAMETER, // a pointer parameter is NULL
VP8_ENC_ERROR_INVALID_CONFIGURATION, // configuration is invalid
VP8_ENC_ERROR_BAD_DIMENSION, // picture has invalid width/height
VP8_ENC_ERROR_PARTITION0_OVERFLOW, // partition is too bigger than 16M
VP8_ENC_ERROR_PARTITION_OVERFLOW, // partition is too bigger than 512k
VP8_ENC_ERROR_PARTITION0_OVERFLOW, // partition is bigger than 512k
VP8_ENC_ERROR_PARTITION_OVERFLOW, // partition is bigger than 16M
VP8_ENC_ERROR_BAD_WRITE, // error while flushing bytes
VP8_ENC_ERROR_FILE_TOO_BIG, // file is bigger than 4G
} WebPEncodingError;
struct WebPPicture {