From 34e0d636accaeda6feeca33034b13b394e8e9413 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Sun, 3 May 2020 11:25:00 +1000 Subject: [PATCH] Fix a few warnings when compiled with more warnings enabled --- src/Audio.c | 1 - src/Formats.c | 1 - src/Graphics.c | 2 +- src/HeldBlockRenderer.c | 2 +- src/Picking.c | 2 +- src/Server.c | 4 ++-- src/Widgets.c | 6 ++---- src/Window.c | 2 +- 8 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/Audio.c b/src/Audio.c index f8d45874e..ef4a0a9f8 100644 --- a/src/Audio.c +++ b/src/Audio.c @@ -255,7 +255,6 @@ static ALenum Audio_FreeSource(struct AudioContext* ctx) { } void Audio_Open(AudioHandle* handle, int buffers) { - ALenum err; int i, j; Mutex_Lock(&audio_lock); diff --git a/src/Formats.c b/src/Formats.c index 81e58780e..65a36a52a 100644 --- a/src/Formats.c +++ b/src/Formats.c @@ -54,7 +54,6 @@ IMapImporter Map_FindImporter(const String* path) { } void Map_LoadFrom(const String* path) { - struct LocalPlayer* p = &LocalPlayer_Instance; IMapImporter importer; struct Stream stream; cc_result res; diff --git a/src/Graphics.c b/src/Graphics.c index 8b41b4103..6e20a1703 100644 --- a/src/Graphics.c +++ b/src/Graphics.c @@ -80,7 +80,7 @@ static void CommonInit(void) { static void LimitFPS(void) { /* Can't use Thread_Sleep on the web. (spinwaits instead of sleeping) */ - /* However this is not a problem, because GLContext_SetVsync + /* However this is not a problem, because GLContext_SetVsync */ /* gets the browser to automatically handle the timing instead. */ #ifndef CC_BUILD_WEB cc_uint64 frameEnd = Stopwatch_Measure(); diff --git a/src/HeldBlockRenderer.c b/src/HeldBlockRenderer.c index 683a3dbb5..eae9897ad 100644 --- a/src/HeldBlockRenderer.c +++ b/src/HeldBlockRenderer.c @@ -229,7 +229,7 @@ void HeldBlockRenderer_Render(double delta) { Gfx_LoadMatrix(MATRIX_PROJECTION, &Gfx.Projection); } -const static struct EntityVTABLE heldEntity_VTABLE = { +static const struct EntityVTABLE heldEntity_VTABLE = { NULL, NULL, NULL, HeldBlockRenderer_GetCol, NULL, NULL }; diff --git a/src/Picking.c b/src/Picking.c index f093bf6b8..1dc892570 100644 --- a/src/Picking.c +++ b/src/Picking.c @@ -217,7 +217,7 @@ static cc_bool ClipBlock(struct RayTracer* t) { return true; } -const static Vec3 picking_adjust = { 0.1f, 0.1f, 0.1f }; +static const Vec3 picking_adjust = { 0.1f, 0.1f, 0.1f }; static cc_bool ClipCamera(struct RayTracer* t) { Vec3 intersect; float t0, t1; diff --git a/src/Server.c b/src/Server.c index ef50ef195..0225a0b10 100644 --- a/src/Server.c +++ b/src/Server.c @@ -363,12 +363,12 @@ static void MPConnection_CheckDisconnection(void) { } static void DisconnectInvalidOpcode(cc_uint8 opcode) { - static const String title_disc = String_FromConst("Disconnected"); + static const String title = String_FromConst("Disconnected"); String tmp; char tmpBuffer[STRING_SIZE]; String_InitArray(tmp, tmpBuffer); String_Format1(&tmp, "Server sent invalid packet %b!", &opcode); - Game_Disconnect(&title_disc, &tmp); return; + Game_Disconnect(&title, &tmp); return; } static void MPConnection_Tick(struct ScheduledTask* task) { diff --git a/src/Widgets.c b/src/Widgets.c index e3ce7ba6d..0becd011c 100644 --- a/src/Widgets.c +++ b/src/Widgets.c @@ -2650,9 +2650,8 @@ static void SpecialInputWidget_DrawTitles(struct SpecialInputWidget* w, Bitmap* static int SpecialInputWidget_MeasureContent(struct SpecialInputWidget* w, struct SpecialInputTab* tab) { struct DrawTextArgs args; int textWidth, textHeight; - int i, rows; - - int maxWidth = 0; + int i, maxWidth = 0; + DrawTextArgs_MakeEmpty(&args, w->font, false); args.text.length = tab->charsPerItem; textHeight = Drawer2D_TextHeight(&args); @@ -2665,7 +2664,6 @@ static int SpecialInputWidget_MeasureContent(struct SpecialInputWidget* w, struc w->elementWidth = maxWidth + SPECIAL_CONTENT_SPACING; w->elementHeight = textHeight + SPECIAL_CONTENT_SPACING; - rows = Math_CeilDiv(tab->contents.length / tab->charsPerItem, tab->itemsPerRow); return w->elementWidth * tab->itemsPerRow; } diff --git a/src/Window.c b/src/Window.c index 364c77571..b183d4814 100644 --- a/src/Window.c +++ b/src/Window.c @@ -997,7 +997,7 @@ static int MapNativeKey(KeySym key, unsigned int state) { /* tilde - "Unknown key press: (8000060, 800007E) */ /* quote - "Unknown key press: (8000027, 8000022) */ /* Note if 8000 is stripped, you get '0060' (XK_grave) and 0027 (XK_apostrophe) */ - /* ChromeOS seems to also mask to 0xFFFF, so I also do so here + /* ChromeOS seems to also mask to 0xFFFF, so I also do so here */ /* https://chromium.googlesource.com/chromium/src/+/lkgr/ui/events/keycodes/keyboard_code_conversion_x.cc */ key &= 0xFFFF;