dwebp: correct sign in format strings

width / height are unsigned; fixes a warning with msvs /analyze:
C6340: Mismatch on sign: 'const unsigned int' passed as _Param_(4) when
some signed type is required in call to 'fprintf'.

(cherry picked from commit 47d26be760)

Change-Id: I5f1fad4c93745baf17d70178a5e66579ccd2b155
This commit is contained in:
James Zern 2015-01-16 15:43:11 -08:00
parent b61ce861f3
commit 90f1ec58a9

View File

@ -244,10 +244,10 @@ static int WritePPM(FILE* fout, const WebPDecBuffer* const buffer, int alpha) {
uint32_t y; uint32_t y;
if (alpha) { if (alpha) {
fprintf(fout, "P7\nWIDTH %d\nHEIGHT %d\nDEPTH 4\nMAXVAL 255\n" fprintf(fout, "P7\nWIDTH %u\nHEIGHT %u\nDEPTH 4\nMAXVAL 255\n"
"TUPLTYPE RGB_ALPHA\nENDHDR\n", width, height); "TUPLTYPE RGB_ALPHA\nENDHDR\n", width, height);
} else { } else {
fprintf(fout, "P6\n%d %d\n255\n", width, height); fprintf(fout, "P6\n%u %u\n255\n", width, height);
} }
for (y = 0; y < height; ++y) { for (y = 0; y < height; ++y) {
if (fwrite(rgb + y * stride, width, bytes_per_px, fout) != bytes_per_px) { if (fwrite(rgb + y * stride, width, bytes_per_px, fout) != bytes_per_px) {
@ -404,7 +404,7 @@ static int WriteAlphaPlane(FILE* fout, const WebPDecBuffer* const buffer) {
const int a_stride = buffer->u.YUVA.a_stride; const int a_stride = buffer->u.YUVA.a_stride;
uint32_t y; uint32_t y;
assert(a != NULL); assert(a != NULL);
fprintf(fout, "P5\n%d %d\n255\n", width, height); fprintf(fout, "P5\n%u %u\n255\n", width, height);
for (y = 0; y < height; ++y) { for (y = 0; y < height; ++y) {
if (fwrite(a + y * a_stride, width, 1, fout) != 1) { if (fwrite(a + y * a_stride, width, 1, fout) != 1) {
return 0; return 0;