From 53ee7cfc7babd1b604d33ea09767745466e6fb06 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 15 Sep 2018 12:27:14 +0200 Subject: [PATCH] - fixed some warnings in OBJ model code. (This clearly shows that using 'long' as parameters in any interface must be stopped. It is fundamentally unsafe to have a type whose size is not reliable - it's either an int-sized nor a pointer sized value, depending on the platform, and essentially worthless.) --- src/r_data/models/models_obj.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/r_data/models/models_obj.cpp b/src/r_data/models/models_obj.cpp index a3124539b..4cc5ffa17 100644 --- a/src/r_data/models/models_obj.cpp +++ b/src/r_data/models/models_obj.cpp @@ -54,7 +54,7 @@ bool FOBJModel::Load(const char* fn, int lumpnum, const char* buffer, int length } if (nlpos == -1) { - nlpos = objBuf.Len(); + nlpos = (long)objBuf.Len(); } FString lineStr(objBuf.GetChars() + bpos, nlpos - bpos); mtlUsages.Push(lineStr); @@ -72,7 +72,7 @@ bool FOBJModel::Load(const char* fn, int lumpnum, const char* buffer, int length nlpos = objBuf.IndexOf('\n', bpos); if (nlpos == -1) { - nlpos = objBuf.Len(); + nlpos = (long)objBuf.Len(); } memcpy(wObjBuf + bpos, mtlUsages[i].GetChars(), nlpos - bpos); } @@ -384,10 +384,10 @@ void FOBJModel::BuildVertexBuffer(FModelRenderer *renderer) { // https://www.khronos.org/opengl/wiki/Calculating_a_Surface_Normal // Find other sides of triangle - int nextSidx = side + 2; + auto nextSidx = side + 2; if (nextSidx >= 3) nextSidx -= 3; - int lastSidx = side + 1; + auto lastSidx = side + 1; if (lastSidx >= 3) lastSidx -= 3; OBJFaceSide &nextSide = surfaces[i].tris[j].sides[nextSidx];