From e0620c5887a1cd7b390bb72cf9fa9a76c6dcaa63 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Sun, 6 Oct 2019 13:58:10 +1100 Subject: [PATCH] Add a few explicit casts so less errors when compiling as C++ --- src/Graphics.c | 2 +- src/Http.c | 2 +- src/Screens.c | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Graphics.c b/src/Graphics.c index 6ca233081..433d670a4 100644 --- a/src/Graphics.c +++ b/src/Graphics.c @@ -1218,7 +1218,7 @@ ReturnCode Gfx_TakeScreenshot(struct Stream* output) { bmp.Width = vp[2]; bmp.Height = vp[3]; - bmp.Scan0 = Mem_TryAlloc(bmp.Width * bmp.Height, 4); + bmp.Scan0 = (cc_uint8*)Mem_TryAlloc(bmp.Width * bmp.Height, 4); if (!bmp.Scan0) return ERR_OUT_OF_MEMORY; glReadPixels(0, 0, bmp.Width, bmp.Height, PIXEL_FORMAT, GL_UNSIGNED_BYTE, bmp.Scan0); diff --git a/src/Http.c b/src/Http.c index 9e1323eb8..1d334a893 100644 --- a/src/Http.c +++ b/src/Http.c @@ -617,7 +617,7 @@ static void Http_SysFree(void) { static CURL* curl; bool Http_DescribeError(ReturnCode res, String* dst) { - const char* err = curl_easy_strerror(res); + const char* err = curl_easy_strerror((CURLcode)res); if (!err) return false; String_AppendConst(dst, err); diff --git a/src/Screens.c b/src/Screens.c index 98037b518..bc8dee6d1 100644 --- a/src/Screens.c +++ b/src/Screens.c @@ -151,10 +151,10 @@ static bool InventoryScreen_KeyDown(void* screen, Key key) { struct TableWidget* table = &s->table; if (key == KeyBinds[KEYBIND_INVENTORY] && s->releasedInv) { - Gui_Remove(screen); + Gui_Remove((struct Screen*)s); } else if (key == KEY_ENTER && table->selectedIndex != -1) { Inventory_SetSelectedBlock(table->blocks[table->selectedIndex]); - Gui_Remove(screen); + Gui_Remove((struct Screen*)s); } else if (Elem_HandlesKeyDown(table, key)) { } else { struct HUDScreen* hud = (struct HUDScreen*)Gui_HUD; @@ -1364,7 +1364,7 @@ static bool DisconnectScreen_KeyDown(void* s, Key key) { return key < KEY_F1 || static bool DisconnectScreen_PointerDown(void* screen, int id, int x, int y) { struct DisconnectScreen* s = (struct DisconnectScreen*)screen; - struct ButtonWidget* w = &s->reconnect; + struct ButtonWidget* w = &s->reconnect; if (!w->disabled && Widget_Contains(w, x, y)) { Gui_Remove((struct Screen*)s);