From d7015cf2e9135b6fb18c200b0acaed5ecccc5bb0 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Sat, 25 Jan 2020 17:58:21 +1100 Subject: [PATCH] Fix a few compile errors with metrowerks --- src/EntityComponents.c | 2 +- src/Graphics.c | 11 +++++++---- src/Platform.c | 7 ++++--- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/EntityComponents.c b/src/EntityComponents.c index bdecefa3e..e3c29f10a 100644 --- a/src/EntityComponents.c +++ b/src/EntityComponents.c @@ -413,7 +413,7 @@ void LocalInterpComp_SetLocation(struct InterpComp* interp, struct LocationUpdat LocalInterpComp_Angle(&prev->Pitch, &next->Pitch, update->Pitch, interpolate); } if (flags & LOCATIONUPDATE_YAW) { - LocalInterpComp_Angle(&prev->Yaw, &next->Yaw, update->Yaw, interpolate); + LocalInterpComp_Angle(&prev->Yaw, &next->Yaw, update->Yaw, interpolate); } if (flags & LOCATIONUPDATE_ROTX) { LocalInterpComp_Angle(&prev->RotX, &next->RotX, update->RotX, interpolate); diff --git a/src/Graphics.c b/src/Graphics.c index bf48c1b11..6fea35094 100644 --- a/src/Graphics.c +++ b/src/Graphics.c @@ -1160,9 +1160,12 @@ static GLuint GL_GenAndBind(GLenum target) { } GfxResourceID Gfx_CreateDynamicVb(VertexFormat fmt, int maxVertices) { + GLuint id; + cc_uint32 size; if (Gfx.LostContext) return 0; - GLuint id = GL_GenAndBind(GL_ARRAY_BUFFER); - cc_uint32 size = maxVertices * gfx_strideSizes[fmt]; + + id = GL_GenAndBind(GL_ARRAY_BUFFER); + size = maxVertices * gfx_strideSizes[fmt]; _glBufferData(GL_ARRAY_BUFFER, size, NULL, GL_DYNAMIC_DRAW); return id; } @@ -1230,10 +1233,10 @@ cc_result Gfx_TakeScreenshot(struct Stream* output) { void Gfx_GetApiInfo(String* lines) { static const String memExt = String_FromConst("GL_NVX_gpu_memory_info"); - int totalKb, curKb; + GLint totalKb, curKb, depthBits; float total, cur; String extensions; - int depthBits, pointerSize = sizeof(void*) * 8; + int pointerSize = sizeof(void*) * 8; glGetIntegerv(GL_DEPTH_BITS, &depthBits); String_Format1(&lines[0], "-- Using OpenGL (%i bit) --", &pointerSize); diff --git a/src/Platform.c b/src/Platform.c index a743c6f06..5d7dd1f7c 100644 --- a/src/Platform.c +++ b/src/Platform.c @@ -629,7 +629,7 @@ cc_result File_Length(FileHandle file, cc_uint32* len) { *#########################################################################################################################*/ #if defined CC_BUILD_WIN void Thread_Sleep(cc_uint32 milliseconds) { Sleep(milliseconds); } -DWORD WINAPI Thread_StartCallback(void* param) { +static DWORD WINAPI Thread_StartCallback(void* param) { Thread_StartFunc* func = (Thread_StartFunc*)param; (*func)(); return 0; @@ -711,7 +711,7 @@ void Waitable_Wait(void* handle) { } void Waitable_WaitFor(void* handle, cc_uint32 milliseconds) { } #elif defined CC_BUILD_POSIX void Thread_Sleep(cc_uint32 milliseconds) { usleep(milliseconds * 1000); } -void* Thread_StartCallback(void* lpParam) { +static void* Thread_StartCallback(void* lpParam) { Thread_StartFunc* func = (Thread_StartFunc*)lpParam; (*func)(); return NULL; @@ -1800,6 +1800,7 @@ int Platform_GetCommandLineArgs(int argc, STRING_REF char** argv, String* args) cc_result Platform_SetDefaultCurrentDirectory(int argc, char **argv) { char path[NATIVE_STR_LEN]; int i, len = 0; + cc_result res; for (i = 1; i < argc; ++i) { if (strlen(argv[i]) > 2 && argv[i][0] == '-' && argv[i][1] == 'd') { @@ -1812,7 +1813,7 @@ cc_result Platform_SetDefaultCurrentDirectory(int argc, char **argv) { return chdir(Platform_DefaultDirectory + 2) == -1 ? errno : 0; } - cc_result res = Process_RawGetExePath(path, &len); + res = Process_RawGetExePath(path, &len); if (res) return res; /* get rid of filename at end of directory */