From 09c5564d5b1123125ba0a7f07f7f8c1dfcdf7a86 Mon Sep 17 00:00:00 2001 From: Matt Pharr Date: Tue, 12 Jan 2021 08:16:08 -0800 Subject: [PATCH] More compiler warnings --- code/Pbrt/PbrtExporter.cpp | 2 +- code/Pbrt/stb_image.h | 13 +++---------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/code/Pbrt/PbrtExporter.cpp b/code/Pbrt/PbrtExporter.cpp index c24b63a08..9e93aa744 100644 --- a/code/Pbrt/PbrtExporter.cpp +++ b/code/Pbrt/PbrtExporter.cpp @@ -836,7 +836,7 @@ void PbrtExporter::WriteMesh(aiMesh* mesh) { auto face = mesh->mFaces[i]; if (face.mNumIndices != 3) throw DeadlyExportError("oh no not a tri!"); - for (int j = 0; j < face.mNumIndices; j++) { + for (unsigned int j = 0; j < face.mNumIndices; j++) { mOutput << face.mIndices[j] << " "; } if ((i % 7) == 6) mOutput << "\n "; diff --git a/code/Pbrt/stb_image.h b/code/Pbrt/stb_image.h index f382c8fcb..65a205f6e 100644 --- a/code/Pbrt/stb_image.h +++ b/code/Pbrt/stb_image.h @@ -6775,8 +6775,6 @@ static void *stbi__load_gif_main(stbi__context *s, int **delays, int *x, int *y, stbi_uc *two_back = 0; stbi__gif g; int stride; - int out_size; - int delays_size; memset(&g, 0, sizeof(g)); if (delays) { *delays = 0; @@ -6793,7 +6791,7 @@ static void *stbi__load_gif_main(stbi__context *s, int **delays, int *x, int *y, stride = g.w * g.h * 4; if (out) { - void *tmp = (stbi_uc*) STBI_REALLOC_SIZED( out, out_size, layers * stride ); + void *tmp = (stbi_uc*) STBI_REALLOC( out, layers * stride ); if (NULL == tmp) { STBI_FREE(g.out); STBI_FREE(g.history); @@ -6802,21 +6800,16 @@ static void *stbi__load_gif_main(stbi__context *s, int **delays, int *x, int *y, } else { out = (stbi_uc*) tmp; - out_size = layers * stride; } if (delays) { - *delays = (int*) STBI_REALLOC_SIZED( *delays, delays_size, sizeof(int) * layers ); - delays_size = layers * sizeof(int); + *delays = (int*) STBI_REALLOC( *delays, sizeof(int) * layers ); } } else { out = (stbi_uc*)stbi__malloc( layers * stride ); - out_size = layers * stride; if (delays) { *delays = (int*) stbi__malloc( layers * sizeof(int) ); - delays_size = layers * sizeof(int); - } else - delays_size = 0; + } } memcpy( out + ((layers - 1) * stride), u, stride ); if (layers >= 2) {