From 1ba26d67bdf1b5ca83d22139bf48fe0c62276238 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Thu, 11 Jan 2024 10:37:13 +0100 Subject: [PATCH] Remove excessive includes from porting.h --- src/client/clientlauncher.cpp | 2 ++ src/client/game.cpp | 1 + src/client/renderingengine.cpp | 2 +- src/client/tile.cpp | 1 + src/filesys.cpp | 2 ++ src/gui/guiFormSpecMenu.cpp | 3 ++- src/gui/guiFormSpecMenu.h | 1 + src/gui/modalMenu.cpp | 2 ++ src/gui/touchscreengui.cpp | 1 + src/porting.h | 6 ++---- src/porting_android.h | 2 ++ src/script/cpp_api/s_security.cpp | 2 ++ src/terminal_chat_console.cpp | 2 +- src/util/ieee_float.cpp | 2 ++ src/util/string.cpp | 4 ++-- src/util/string.h | 4 ++-- 16 files changed, 26 insertions(+), 11 deletions(-) diff --git a/src/client/clientlauncher.cpp b/src/client/clientlauncher.cpp index 047338fef..7ab81815f 100644 --- a/src/client/clientlauncher.cpp +++ b/src/client/clientlauncher.cpp @@ -34,6 +34,8 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "version.h" #include "renderingengine.h" #include "network/networkexceptions.h" +#include +#include #if USE_SOUND #include "sound/sound_openal.h" diff --git a/src/client/game.cpp b/src/client/game.cpp index 1c06aab47..ea9972e3d 100644 --- a/src/client/game.cpp +++ b/src/client/game.cpp @@ -74,6 +74,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "script/scripting_client.h" #include "hud.h" #include "clientdynamicinfo.h" +#include #if USE_SOUND #include "client/sound/sound_openal.h" diff --git a/src/client/renderingengine.cpp b/src/client/renderingengine.cpp index 57f658bfb..5277ce6f8 100644 --- a/src/client/renderingengine.cpp +++ b/src/client/renderingengine.cpp @@ -19,7 +19,7 @@ with this program; if not, write to the Free Software Foundation, Inc., */ #include -#include +#include #include "fontengine.h" #include "client.h" #include "clouds.h" diff --git a/src/client/tile.cpp b/src/client/tile.cpp index eb055c2ce..3bd227ae3 100644 --- a/src/client/tile.cpp +++ b/src/client/tile.cpp @@ -22,6 +22,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include #include #include +#include #include "util/string.h" #include "util/container.h" #include "util/thread.h" diff --git a/src/filesys.cpp b/src/filesys.cpp index 416f09da8..4fc51a5da 100644 --- a/src/filesys.cpp +++ b/src/filesys.cpp @@ -30,6 +30,8 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "porting.h" #ifndef SERVER #include "irr_ptr.h" +#include +#include #endif namespace fs diff --git a/src/gui/guiFormSpecMenu.cpp b/src/gui/guiFormSpecMenu.cpp index b268574bf..a93f8c505 100644 --- a/src/gui/guiFormSpecMenu.cpp +++ b/src/gui/guiFormSpecMenu.cpp @@ -33,9 +33,10 @@ with this program; if not, write to the Free Software Foundation, Inc., #include #include #include -#include #include #include +#include +#include #include "client/renderingengine.h" #include "log.h" #include "client/tile.h" // ITextureSource diff --git a/src/gui/guiFormSpecMenu.h b/src/gui/guiFormSpecMenu.h index 9f5685df6..9f88e5df5 100644 --- a/src/gui/guiFormSpecMenu.h +++ b/src/gui/guiFormSpecMenu.h @@ -37,6 +37,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "util/string.h" #include "util/enriched_string.h" #include "StyleSpec.h" +#include class InventoryManager; class ISimpleTextureSource; diff --git a/src/gui/modalMenu.cpp b/src/gui/modalMenu.cpp index b260f17d5..11cb55e1c 100644 --- a/src/gui/modalMenu.cpp +++ b/src/gui/modalMenu.cpp @@ -20,6 +20,8 @@ with this program; if not, write to the Free Software Foundation, Inc., #include #include +#include +#include #include "client/renderingengine.h" #include "modalMenu.h" #include "gettext.h" diff --git a/src/gui/touchscreengui.cpp b/src/gui/touchscreengui.cpp index bf8fc5afe..104dcbf7b 100644 --- a/src/gui/touchscreengui.cpp +++ b/src/gui/touchscreengui.cpp @@ -29,6 +29,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "client/keycode.h" #include "client/renderingengine.h" #include "util/numeric.h" +#include #include #include diff --git a/src/porting.h b/src/porting.h index ad707cebe..0b81a03fb 100644 --- a/src/porting.h +++ b/src/porting.h @@ -27,11 +27,9 @@ with this program; if not, write to the Free Software Foundation, Inc., #define _GNU_SOURCE #endif +// Be mindful of what you include here! #include -#include -#include "irrlicht.h" -#include "irrlichttypes.h" // u32 -#include "irrlichttypes_extrabloated.h" +#include "irrlichttypes.h" // u64 #include "debug.h" #include "constants.h" #include "gettime.h" diff --git a/src/porting_android.h b/src/porting_android.h index 980f43ed1..f7407003a 100644 --- a/src/porting_android.h +++ b/src/porting_android.h @@ -27,6 +27,8 @@ with this program; if not, write to the Free Software Foundation, Inc., #include #include +#include "irrlichttypes_bloated.h" + #include namespace porting { diff --git a/src/script/cpp_api/s_security.cpp b/src/script/cpp_api/s_security.cpp index 3bf8d1044..43b7d9f32 100644 --- a/src/script/cpp_api/s_security.cpp +++ b/src/script/cpp_api/s_security.cpp @@ -22,7 +22,9 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "filesys.h" #include "porting.h" #include "server.h" +#ifndef SERVER #include "client/client.h" +#endif #include "settings.h" #include diff --git a/src/terminal_chat_console.cpp b/src/terminal_chat_console.cpp index 47c9c1d03..b1512d8f3 100644 --- a/src/terminal_chat_console.cpp +++ b/src/terminal_chat_console.cpp @@ -280,7 +280,7 @@ void TerminalChatConsole::handleInput(int ch, bool &complete_redraw_needed) ChatPrompt::CURSOROP_DIR_RIGHT, ChatPrompt::CURSOROP_SCOPE_LINE); break; - case KEY_TAB: + case '\t': // Tab pressed // Nick completion prompt.nickCompletion(m_nicks, false); diff --git a/src/util/ieee_float.cpp b/src/util/ieee_float.cpp index 8b13f043c..b70d4af67 100644 --- a/src/util/ieee_float.cpp +++ b/src/util/ieee_float.cpp @@ -22,11 +22,13 @@ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + #include "ieee_float.h" #include "log.h" #include "porting.h" #include #include +#include // Given an unsigned 32-bit integer representing an IEEE-754 single-precision // float, return the float. diff --git a/src/util/string.cpp b/src/util/string.cpp index 1ac295bb4..b4af7a404 100644 --- a/src/util/string.cpp +++ b/src/util/string.cpp @@ -255,7 +255,7 @@ std::string writeFlagString(u32 flags, const FlagDesc *flagdesc, u32 flagmask) return result; } -size_t mystrlcpy(char *dst, const char *src, size_t size) +size_t mystrlcpy(char *dst, const char *src, size_t size) noexcept { size_t srclen = strlen(src) + 1; size_t copylen = MYMIN(srclen, size); @@ -268,7 +268,7 @@ size_t mystrlcpy(char *dst, const char *src, size_t size) return srclen; } -char *mystrtok_r(char *s, const char *sep, char **lasts) +char *mystrtok_r(char *s, const char *sep, char **lasts) noexcept { char *t; diff --git a/src/util/string.h b/src/util/string.h index 11d32b1ac..5d49cc77d 100644 --- a/src/util/string.h +++ b/src/util/string.h @@ -83,8 +83,8 @@ std::string urlencode(const std::string &str); std::string urldecode(const std::string &str); u32 readFlagString(std::string str, const FlagDesc *flagdesc, u32 *flagmask); std::string writeFlagString(u32 flags, const FlagDesc *flagdesc, u32 flagmask); -size_t mystrlcpy(char *dst, const char *src, size_t size); -char *mystrtok_r(char *s, const char *sep, char **lasts); +size_t mystrlcpy(char *dst, const char *src, size_t size) noexcept; +char *mystrtok_r(char *s, const char *sep, char **lasts) noexcept; u64 read_seed(const char *str); bool parseColorString(const std::string &value, video::SColor &color, bool quiet, unsigned char default_alpha = 0xff);