More warnings fallout! (actual bitrot fixes to avif_example1.c; it needs a rework)
diff --git a/apps/avifdec.c b/apps/avifdec.c
index 9f0de46..d527f76 100644
--- a/apps/avifdec.c
+++ b/apps/avifdec.c
@@ -6,8 +6,8 @@
#include "avifutil.h"
#include "y4m.h"
-#include <string.h>
#include <stdio.h>
+#include <string.h>
int syntax(void)
{
@@ -27,10 +27,7 @@
return syntax();
}
- avifBool showHelp = AVIF_FALSE;
-
int argIndex = 1;
- const char * filenames[2] = { NULL, NULL };
while (argIndex < argc) {
const char * arg = argv[argIndex];
diff --git a/apps/avifenc.c b/apps/avifenc.c
index 1883652..9c95042 100644
--- a/apps/avifenc.c
+++ b/apps/avifenc.c
@@ -78,9 +78,9 @@
}
if (index == 4) {
- nclx->colourPrimaries = values[0];
- nclx->transferCharacteristics = values[1];
- nclx->matrixCoefficients = values[2];
+ nclx->colourPrimaries = (uint16_t)values[0];
+ nclx->transferCharacteristics = (uint16_t)values[1];
+ nclx->matrixCoefficients = (uint16_t)values[2];
nclx->fullRangeFlag = values[3] ? AVIF_NCLX_FULL_RANGE : AVIF_NCLX_LIMITED_RANGE;
return AVIF_TRUE;
}
@@ -96,7 +96,6 @@
return syntax();
}
- avifBool showHelp = AVIF_FALSE;
int jobs = 1;
int minQuantizer = AVIF_QUANTIZER_BEST_QUALITY;
int maxQuantizer = AVIF_QUANTIZER_BEST_QUALITY;
@@ -105,7 +104,6 @@
avifEncoder * encoder = NULL;
int argIndex = 1;
- const char * filenames[2] = { NULL, NULL };
while (argIndex < argc) {
const char * arg = argv[argIndex];
diff --git a/apps/shared/y4m.c b/apps/shared/y4m.c
index 2ca26f0..091c29a 100644
--- a/apps/shared/y4m.c
+++ b/apps/shared/y4m.c
@@ -88,12 +88,17 @@
return AVIF_FALSE;
}
- strncpy(out, p, formatLen);
+ strncpy(out, (const char *)p, formatLen);
out[formatLen] = 0;
return AVIF_TRUE;
}
-#define ADVANCE(BYTES) { p += BYTES; if (p >= end) goto cleanup; }
+#define ADVANCE(BYTES) \
+ { \
+ p += BYTES; \
+ if (p >= end) \
+ goto cleanup; \
+ }
avifBool y4mRead(avifImage * avif, const char * inputFilename)
{
@@ -146,10 +151,10 @@
while (p != end) {
switch (*p) {
case 'W': // width
- width = atoi(p + 1);
+ width = atoi((const char *)p + 1);
break;
case 'H': // height
- height = atoi(p + 1);
+ height = atoi((const char *)p + 1);
break;
case 'C': // color space
if (!getHeaderString(p, end, tmpBuffer, 31)) {
@@ -212,11 +217,7 @@
}
ADVANCE(1); // advance past newline
- if ((width < 1) ||
- (height < 1) ||
- ((depth != 8) && (depth != 10) && (depth != 12)) ||
- (format == AVIF_PIXEL_FORMAT_NONE))
- {
+ if ((width < 1) || (height < 1) || ((depth != 8) && (depth != 10) && (depth != 12)) || (format == AVIF_PIXEL_FORMAT_NONE)) {
fprintf(stderr, "Failed to parse y4m header (not enough information): %s\n", inputFilename);
goto cleanup;
}
diff --git a/examples/avif_example1.c b/examples/avif_example1.c
index 43f9440..bc30e62 100644
--- a/examples/avif_example1.c
+++ b/examples/avif_example1.c
@@ -3,8 +3,8 @@
#include "avif/avif.h"
-#include <string.h>
#include <stdio.h>
+#include <string.h>
int main(int argc, char * argv[])
{
@@ -37,7 +37,8 @@
avifRawData raw = AVIF_RAW_DATA_EMPTY;
avifEncoder * encoder = avifEncoderCreate();
encoder->maxThreads = 1;
- encoder->quality = AVIF_BEST_QUALITY;
+ encoder->minQuantizer = AVIF_QUANTIZER_BEST_QUALITY;
+ encoder->maxQuantizer = AVIF_QUANTIZER_BEST_QUALITY;
avifResult res = avifEncoderWrite(encoder, image, &raw);
avifEncoderDestroy(encoder);
@@ -78,7 +79,7 @@
}
avifImageDestroy(image);
-#else /* if 1 */
+#else /* if 1 */
FILE * f = fopen("test.avif", "rb");
if (!f)
diff --git a/src/colr.c b/src/colr.c
index a59d606..082bc98 100644
--- a/src/colr.c
+++ b/src/colr.c
@@ -322,6 +322,9 @@
gbMat3 colorants;
gbMat3 chad, invChad;
gbVec3 wtpt;
+ wtpt.e[0] = 0.0f;
+ wtpt.e[1] = 0.0f;
+ wtpt.e[2] = 0.0f;
for (uint32_t tagIndex = 0; tagIndex < tagCount; ++tagIndex) {
uint8_t tagSignature[4];
diff --git a/src/read.c b/src/read.c
index 411d6e3..347c624 100644
--- a/src/read.c
+++ b/src/read.c
@@ -1230,7 +1230,6 @@
avifRawData colorOBU = AVIF_RAW_DATA_EMPTY;
avifRawData alphaOBU = AVIF_RAW_DATA_EMPTY;
avifItem * colorOBUItem = NULL;
- avifItem * alphaOBUItem = NULL;
// Find the colorOBU item
for (uint32_t itemIndex = 0; itemIndex < data->items.count; ++itemIndex) {
@@ -1270,7 +1269,6 @@
}
if (isAlphaURN(item->auxC.auxType) && (item->auxForID == colorOBUItem->id)) {
- alphaOBUItem = item;
alphaOBU.data = data->rawInput.data + item->offset;
alphaOBU.size = item->size;
break;