Skip to content

Commit

Permalink
Remove excessive includes from porting.h
Browse files Browse the repository at this point in the history
  • Loading branch information
sfan5 committed Jan 14, 2024
1 parent e824e90 commit 1ba26d6
Show file tree
Hide file tree
Showing 16 changed files with 26 additions and 11 deletions.
2 changes: 2 additions & 0 deletions src/client/clientlauncher.cpp
Expand Up @@ -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 <IGUISpriteBank.h>
#include <ICameraSceneNode.h>

#if USE_SOUND
#include "sound/sound_openal.h"
Expand Down
1 change: 1 addition & 0 deletions src/client/game.cpp
Expand Up @@ -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 <IAnimatedMeshSceneNode.h>

#if USE_SOUND
#include "client/sound/sound_openal.h"
Expand Down
2 changes: 1 addition & 1 deletion src/client/renderingengine.cpp
Expand Up @@ -19,7 +19,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
*/

#include <optional>
#include <IrrlichtDevice.h>
#include <irrlicht.h>
#include "fontengine.h"
#include "client.h"
#include "clouds.h"
Expand Down
1 change: 1 addition & 0 deletions src/client/tile.cpp
Expand Up @@ -22,6 +22,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <algorithm>
#include <ICameraSceneNode.h>
#include <IVideoDriver.h>
#include <IFileSystem.h>
#include "util/string.h"
#include "util/container.h"
#include "util/thread.h"
Expand Down
2 changes: 2 additions & 0 deletions src/filesys.cpp
Expand Up @@ -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 <IFileArchive.h>
#include <IFileSystem.h>
#endif

namespace fs
Expand Down
3 changes: 2 additions & 1 deletion src/gui/guiFormSpecMenu.cpp
Expand Up @@ -33,9 +33,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <IGUICheckBox.h>
#include <IGUIComboBox.h>
#include <IGUIEditBox.h>
#include <IGUIStaticText.h>
#include <IGUIFont.h>
#include <IGUITabControl.h>
#include <IGUIImage.h>
#include <IAnimatedMeshSceneNode.h>
#include "client/renderingengine.h"
#include "log.h"
#include "client/tile.h" // ITextureSource
Expand Down
1 change: 1 addition & 0 deletions src/gui/guiFormSpecMenu.h
Expand Up @@ -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 <IGUIStaticText.h>

class InventoryManager;
class ISimpleTextureSource;
Expand Down
2 changes: 2 additions & 0 deletions src/gui/modalMenu.cpp
Expand Up @@ -20,6 +20,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,

#include <cstdlib>
#include <IEventReceiver.h>
#include <IGUIComboBox.h>
#include <IGUIEditBox.h>
#include "client/renderingengine.h"
#include "modalMenu.h"
#include "gettext.h"
Expand Down
1 change: 1 addition & 0 deletions src/gui/touchscreengui.cpp
Expand Up @@ -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 <ISceneCollisionManager.h>

#include <iostream>
#include <algorithm>
Expand Down
6 changes: 2 additions & 4 deletions src/porting.h
Expand Up @@ -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 <string>
#include <vector>
#include "irrlicht.h"
#include "irrlichttypes.h" // u32
#include "irrlichttypes_extrabloated.h"
#include "irrlichttypes.h" // u64
#include "debug.h"
#include "constants.h"
#include "gettime.h"
Expand Down
2 changes: 2 additions & 0 deletions src/porting_android.h
Expand Up @@ -27,6 +27,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <android_native_app_glue.h>
#include <android/log.h>

#include "irrlichttypes_bloated.h"

#include <string>

namespace porting {
Expand Down
2 changes: 2 additions & 0 deletions src/script/cpp_api/s_security.cpp
Expand Up @@ -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 <cerrno>
Expand Down
2 changes: 1 addition & 1 deletion src/terminal_chat_console.cpp
Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions src/util/ieee_float.cpp
Expand Up @@ -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 <limits>
#include <cmath>
#include <cstring>

// Given an unsigned 32-bit integer representing an IEEE-754 single-precision
// float, return the float.
Expand Down
4 changes: 2 additions & 2 deletions src/util/string.cpp
Expand Up @@ -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);
Expand All @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions src/util/string.h
Expand Up @@ -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);
Expand Down

0 comments on commit 1ba26d6

Please sign in to comment.