From 624d291f79fd234e4f0745e0eb7a1253c34d273c Mon Sep 17 00:00:00 2001 From: Tomoaki Kawada Date: Sat, 3 Dec 2016 19:04:58 +0900 Subject: [PATCH] Update `#include`s - Reorder them so that system libraries come first - Use C++-style headers (``) instead of C-style headers (``) --- Sources/Audio/ALDevice.cpp | 9 +++++---- Sources/Audio/ALDevice.h | 3 ++- Sources/Client/ChatWindow.cpp | 2 +- Sources/Client/Client_LocalEnts.cpp | 4 ++-- Sources/Client/GameMap.cpp | 9 +++++---- Sources/Client/HitTestDebugger.cpp | 3 ++- Sources/Client/MumbleLink.cpp | 3 ++- Sources/Client/NetClient.cpp | 3 ++- Sources/Client/PaletteView.h | 3 ++- Sources/Client/ParticleSpriteEntity.h | 1 + Sources/Client/Player.cpp | 1 + Sources/Client/Quake3Font.cpp | 1 + Sources/Client/Quake3Font.h | 1 + Sources/Client/ScoreboardView.cpp | 6 +++--- Sources/Core/CP437.cpp | 1 + Sources/Core/CP437.h | 3 ++- Sources/Core/ConcurrentDispatch.cpp | 16 ++++++++-------- Sources/Core/CpuID.cpp | 5 +++-- Sources/Core/CpuID.h | 2 +- Sources/Core/DirectoryFileSystem.cpp | 10 ++++++---- Sources/Core/DynamicMemoryStream.h | 3 ++- Sources/Core/FltkPreferenceImporter.cpp | 10 +++++----- Sources/Core/IBitmapCodec.cpp | 3 ++- Sources/Core/Math.h | 2 +- Sources/Core/SdlFileStream.h | 3 ++- Sources/Core/SdlImageReader.cpp | 3 ++- Sources/Core/ServerAddress.cpp | 4 ++-- Sources/Core/StdStream.cpp | 6 ++++-- Sources/Core/Stopwatch.cpp | 3 ++- Sources/Core/Thread.cpp | 1 + Sources/Core/ThreadLocalStorage.cpp | 3 ++- Sources/Core/ThreadLocalStorage.h | 3 ++- Sources/Core/VersionInfo.cpp | 4 ++-- Sources/Core/VersionInfo.h | 1 + Sources/Core/ZipFileSystem.cpp | 1 + Sources/Draw/GLModel.h | 3 ++- Sources/Draw/GLProgramUniform.cpp | 3 ++- Sources/Draw/GLShader.h | 3 ++- Sources/Draw/GLSpriteRenderer.h | 5 +++-- Sources/Draw/GLWaterRenderer.h | 3 ++- Sources/Draw/SWFlatMapRenderer.cpp | 3 ++- Sources/Gui/Main.cpp | 10 +++++----- Sources/Gui/SDLGLDevice.cpp | 5 +++-- Sources/Gui/SDLGLDevice.h | 3 ++- Sources/Gui/SDLRunner.cpp | 2 +- Sources/Gui/SDLRunner.h | 3 ++- Sources/Gui/StartupScreen.cpp | 1 + Sources/Gui/StartupScreenHelper.cpp | 1 + Sources/Gui/StartupScreenHelper.h | 2 ++ 49 files changed, 112 insertions(+), 71 deletions(-) diff --git a/Sources/Audio/ALDevice.cpp b/Sources/Audio/ALDevice.cpp index 6328d5bc..3112c612 100644 --- a/Sources/Audio/ALDevice.cpp +++ b/Sources/Audio/ALDevice.cpp @@ -18,6 +18,11 @@ */ +#include +#include +#include +#include + #include "ALDevice.h" #include "ALFuncs.h" #include @@ -28,10 +33,6 @@ #include #include #include -#include -#include -#include -#include DEFINE_SPADES_SETTING(s_maxPolyphonics, "96"); DEFINE_SPADES_SETTING(s_eax, "1"); diff --git a/Sources/Audio/ALDevice.h b/Sources/Audio/ALDevice.h index ce536fe3..49864213 100644 --- a/Sources/Audio/ALDevice.h +++ b/Sources/Audio/ALDevice.h @@ -20,9 +20,10 @@ #pragma once -#include #include +#include + namespace spades { namespace audio { diff --git a/Sources/Client/ChatWindow.cpp b/Sources/Client/ChatWindow.cpp index eab07fcd..36d441d3 100644 --- a/Sources/Client/ChatWindow.cpp +++ b/Sources/Client/ChatWindow.cpp @@ -18,7 +18,7 @@ */ -#include +#include #include "ChatWindow.h" #include "Client.h" diff --git a/Sources/Client/Client_LocalEnts.cpp b/Sources/Client/Client_LocalEnts.cpp index dcfdb6a8..e4e8c03a 100644 --- a/Sources/Client/Client_LocalEnts.cpp +++ b/Sources/Client/Client_LocalEnts.cpp @@ -19,11 +19,11 @@ */ -#include "Client.h" - #include #include +#include "Client.h" + #include #include #include diff --git a/Sources/Client/GameMap.cpp b/Sources/Client/GameMap.cpp index c5ca29d8..b2ea45df 100644 --- a/Sources/Client/GameMap.cpp +++ b/Sources/Client/GameMap.cpp @@ -19,16 +19,17 @@ */ +#include +#include +#include +#include + #include "GameMap.h" #include #include #include #include #include -#include -#include -#include -#include namespace spades { namespace client { diff --git a/Sources/Client/HitTestDebugger.cpp b/Sources/Client/HitTestDebugger.cpp index 2d0031f4..d27f71ad 100644 --- a/Sources/Client/HitTestDebugger.cpp +++ b/Sources/Client/HitTestDebugger.cpp @@ -19,6 +19,8 @@ */ +#include //windows needs this. + #include "HitTestDebugger.h" #include "GameMap.h" #include "Player.h" @@ -30,7 +32,6 @@ #include #include #include -#include //windows needs this. SPADES_SETTING(cg_smp); diff --git a/Sources/Client/MumbleLink.cpp b/Sources/Client/MumbleLink.cpp index 2c09e3ad..5dde98d2 100644 --- a/Sources/Client/MumbleLink.cpp +++ b/Sources/Client/MumbleLink.cpp @@ -1,4 +1,3 @@ -#include "MumbleLink.h" #include #include @@ -11,6 +10,8 @@ #include #endif +#include "MumbleLink.h" + namespace spades { struct MumbleLinkedMemory { uint32_t uiVersion; diff --git a/Sources/Client/NetClient.cpp b/Sources/Client/NetClient.cpp index e235b8b9..679d2113 100644 --- a/Sources/Client/NetClient.cpp +++ b/Sources/Client/NetClient.cpp @@ -23,6 +23,8 @@ #include #include +#include + #include "CTFGameMode.h" #include "Client.h" #include "GameMap.h" @@ -40,7 +42,6 @@ #include #include #include -#include DEFINE_SPADES_SETTING(cg_protocolVersion, "3"); DEFINE_SPADES_SETTING(cg_unicode, "1"); diff --git a/Sources/Client/PaletteView.h b/Sources/Client/PaletteView.h index 42f0ed7f..22183a8f 100644 --- a/Sources/Client/PaletteView.h +++ b/Sources/Client/PaletteView.h @@ -20,9 +20,10 @@ #pragma once -#include #include +#include + namespace spades { namespace client { class Client; diff --git a/Sources/Client/ParticleSpriteEntity.h b/Sources/Client/ParticleSpriteEntity.h index f53a26a5..b52223ab 100644 --- a/Sources/Client/ParticleSpriteEntity.h +++ b/Sources/Client/ParticleSpriteEntity.h @@ -23,6 +23,7 @@ #include #include "Client.h" #include "ILocalEntity.h" + namespace spades { namespace client { class IImage; diff --git a/Sources/Client/Player.cpp b/Sources/Client/Player.cpp index 45635f32..57209d4d 100644 --- a/Sources/Client/Player.cpp +++ b/Sources/Client/Player.cpp @@ -20,6 +20,7 @@ */ #include "Player.h" + #include #include #include diff --git a/Sources/Client/Quake3Font.cpp b/Sources/Client/Quake3Font.cpp index 3bac8ee6..ec42fef9 100644 --- a/Sources/Client/Quake3Font.cpp +++ b/Sources/Client/Quake3Font.cpp @@ -19,6 +19,7 @@ */ #include "Quake3Font.h" + #include "IRenderer.h" #include diff --git a/Sources/Client/Quake3Font.h b/Sources/Client/Quake3Font.h index b7b91fa0..cbc683b1 100644 --- a/Sources/Client/Quake3Font.h +++ b/Sources/Client/Quake3Font.h @@ -21,6 +21,7 @@ #pragma once #include "IFont.h" + #define PROP_SPACE_WIDTH -2 namespace spades { diff --git a/Sources/Client/ScoreboardView.cpp b/Sources/Client/ScoreboardView.cpp index 69c1329a..679aba96 100644 --- a/Sources/Client/ScoreboardView.cpp +++ b/Sources/Client/ScoreboardView.cpp @@ -19,9 +19,9 @@ */ #include -#include -#include -#include +#include +#include +#include #include #include diff --git a/Sources/Core/CP437.cpp b/Sources/Core/CP437.cpp index 6664e7df..6d8469bc 100644 --- a/Sources/Core/CP437.cpp +++ b/Sources/Core/CP437.cpp @@ -7,6 +7,7 @@ #include #include "CP437.h" + #include static const uint16_t cp437map[256] = { diff --git a/Sources/Core/CP437.h b/Sources/Core/CP437.h index bbae5e36..6c803611 100644 --- a/Sources/Core/CP437.h +++ b/Sources/Core/CP437.h @@ -3,10 +3,11 @@ * WTFPL */ -#include #include #include +#include + namespace spades { class CP437 { class ReverseMap; diff --git a/Sources/Core/ConcurrentDispatch.cpp b/Sources/Core/ConcurrentDispatch.cpp index 4714f972..756b819f 100644 --- a/Sources/Core/ConcurrentDispatch.cpp +++ b/Sources/Core/ConcurrentDispatch.cpp @@ -23,14 +23,6 @@ #include -#include "AutoLocker.h" -#include "ConcurrentDispatch.h" -#include "Debug.h" -#include "Exception.h" -#include "Mutex.h" -#include "Settings.h" -#include "Thread.h" -#include #if defined(__APPLE__) #include #else @@ -46,6 +38,14 @@ #endif #endif +#include "AutoLocker.h" +#include "ConcurrentDispatch.h" +#include "Debug.h" +#include "Exception.h" +#include "Mutex.h" +#include "Settings.h" +#include "Thread.h" +#include #include "ThreadLocalStorage.h" DEFINE_SPADES_SETTING(core_numDispatchQueueThreads, "auto"); diff --git a/Sources/Core/CpuID.cpp b/Sources/Core/CpuID.cpp index 2b8614bf..a058f0f9 100644 --- a/Sources/Core/CpuID.cpp +++ b/Sources/Core/CpuID.cpp @@ -1,8 +1,9 @@ // WTFPL -#include "CpuID.h" -#include +#include + +#include "CpuID.h" namespace spades { diff --git a/Sources/Core/CpuID.h b/Sources/Core/CpuID.h index d74db78f..308f1d4f 100644 --- a/Sources/Core/CpuID.h +++ b/Sources/Core/CpuID.h @@ -2,7 +2,7 @@ #pragma once #include -#include +#include #include #if defined(__i386__) || defined(_M_IX86) diff --git a/Sources/Core/DirectoryFileSystem.cpp b/Sources/Core/DirectoryFileSystem.cpp index 8bf1673b..1cfd5973 100644 --- a/Sources/Core/DirectoryFileSystem.cpp +++ b/Sources/Core/DirectoryFileSystem.cpp @@ -18,10 +18,6 @@ */ -#include "DirectoryFileSystem.h" -#include "Debug.h" -#include "Exception.h" -#include "SdlFileStream.h" #include #ifdef WIN32 @@ -35,6 +31,12 @@ #include #endif +#include "DirectoryFileSystem.h" + +#include "Debug.h" +#include "Exception.h" +#include "SdlFileStream.h" + namespace spades { DirectoryFileSystem::DirectoryFileSystem(const std::string &r, bool canWrite) diff --git a/Sources/Core/DynamicMemoryStream.h b/Sources/Core/DynamicMemoryStream.h index 1d683208..0dba0ca9 100644 --- a/Sources/Core/DynamicMemoryStream.h +++ b/Sources/Core/DynamicMemoryStream.h @@ -20,9 +20,10 @@ #pragma once -#include "IStream.h" #include +#include "IStream.h" + namespace spades { class DynamicMemoryStream : public IStream { std::vector memory; diff --git a/Sources/Core/FltkPreferenceImporter.cpp b/Sources/Core/FltkPreferenceImporter.cpp index 3426fefd..2959fd4a 100644 --- a/Sources/Core/FltkPreferenceImporter.cpp +++ b/Sources/Core/FltkPreferenceImporter.cpp @@ -22,11 +22,6 @@ #include -#include "FltkPreferenceImporter.h" -#include "SdlFileStream.h" -#include -#include - #ifdef WIN32 #include #include @@ -34,6 +29,11 @@ #include #endif +#include "FltkPreferenceImporter.h" +#include "SdlFileStream.h" +#include +#include + namespace spades { #ifdef WIN32 diff --git a/Sources/Core/IBitmapCodec.cpp b/Sources/Core/IBitmapCodec.cpp index 1349477b..94754a2b 100644 --- a/Sources/Core/IBitmapCodec.cpp +++ b/Sources/Core/IBitmapCodec.cpp @@ -18,10 +18,11 @@ */ +#include + #include "IBitmapCodec.h" #include "Debug.h" #include "Exception.h" -#include namespace spades { diff --git a/Sources/Core/Math.h b/Sources/Core/Math.h index 83381e56..8261e88a 100644 --- a/Sources/Core/Math.h +++ b/Sources/Core/Math.h @@ -22,7 +22,7 @@ #include // std::max / std::min #include // uint32_t --> msvc -#include +#include #include #include #include diff --git a/Sources/Core/SdlFileStream.h b/Sources/Core/SdlFileStream.h index 1750a014..202ce52b 100644 --- a/Sources/Core/SdlFileStream.h +++ b/Sources/Core/SdlFileStream.h @@ -20,9 +20,10 @@ #pragma once -#include "IStream.h" #include +#include "IStream.h" + namespace spades { class SdlFileStream : public IStream { SDL_RWops *ops; diff --git a/Sources/Core/SdlImageReader.cpp b/Sources/Core/SdlImageReader.cpp index ffcebec8..f884abb9 100644 --- a/Sources/Core/SdlImageReader.cpp +++ b/Sources/Core/SdlImageReader.cpp @@ -21,12 +21,13 @@ #include #include +#include + #include "Bitmap.h" #include "Debug.h" #include "Exception.h" #include "IBitmapCodec.h" #include "IStream.h" -#include namespace spades { class SdlImageReader : public IBitmapCodec { diff --git a/Sources/Core/ServerAddress.cpp b/Sources/Core/ServerAddress.cpp index 0eebe9c8..56a6ba7a 100644 --- a/Sources/Core/ServerAddress.cpp +++ b/Sources/Core/ServerAddress.cpp @@ -18,10 +18,10 @@ */ -#include "ServerAddress.h" - #include +#include "ServerAddress.h" + namespace spades { // unsigned long version of atol, cross-platform (including MSVC) diff --git a/Sources/Core/StdStream.cpp b/Sources/Core/StdStream.cpp index 5b6275f7..71af2b75 100644 --- a/Sources/Core/StdStream.cpp +++ b/Sources/Core/StdStream.cpp @@ -18,8 +18,6 @@ */ -#include "StdStream.h" -#include "Exception.h" #ifndef _MSC_VER #include #else @@ -27,6 +25,10 @@ #define ftruncate _chsize #define fileno _fileno #endif + +#include "StdStream.h" +#include "Exception.h" + #include "Debug.h" namespace spades { diff --git a/Sources/Core/Stopwatch.cpp b/Sources/Core/Stopwatch.cpp index 97e20174..cdc87bcd 100644 --- a/Sources/Core/Stopwatch.cpp +++ b/Sources/Core/Stopwatch.cpp @@ -18,8 +18,9 @@ */ -#include "Stopwatch.h" #include + +#include "Stopwatch.h" #include "Debug.h" #ifdef WIN32 diff --git a/Sources/Core/Thread.cpp b/Sources/Core/Thread.cpp index a524a09e..57fbeb3e 100644 --- a/Sources/Core/Thread.cpp +++ b/Sources/Core/Thread.cpp @@ -21,6 +21,7 @@ #include #include + #include "AutoLocker.h" #include "ConcurrentDispatch.h" #include "Debug.h" diff --git a/Sources/Core/ThreadLocalStorage.cpp b/Sources/Core/ThreadLocalStorage.cpp index d18e37e7..5034e3b7 100644 --- a/Sources/Core/ThreadLocalStorage.cpp +++ b/Sources/Core/ThreadLocalStorage.cpp @@ -18,7 +18,6 @@ */ -#include "ThreadLocalStorage.h" #include #ifdef WIN32 @@ -27,6 +26,8 @@ #include #endif +#include "ThreadLocalStorage.h" + namespace spades { class ThreadLocalStorageImplInternal; diff --git a/Sources/Core/ThreadLocalStorage.h b/Sources/Core/ThreadLocalStorage.h index 24a7b679..def5c910 100644 --- a/Sources/Core/ThreadLocalStorage.h +++ b/Sources/Core/ThreadLocalStorage.h @@ -20,9 +20,10 @@ #pragma once -#include "Exception.h" #include +#include "Exception.h" + namespace spades { class ThreadLocalStorageImpl { diff --git a/Sources/Core/VersionInfo.cpp b/Sources/Core/VersionInfo.cpp index 9cbe2be2..b76ce1bc 100644 --- a/Sources/Core/VersionInfo.cpp +++ b/Sources/Core/VersionInfo.cpp @@ -1,5 +1,3 @@ -#include "VersionInfo.h" - #if __linux__ #define OS_PLATFORM_LINUX #elif TARGET_OS_MAC @@ -10,6 +8,8 @@ #include #endif +#include "VersionInfo.h" + std::string VersionInfo::GetVersionInfo() { #if defined(OS_PLATFORM_LINUX) return std::string("Linux"); diff --git a/Sources/Core/VersionInfo.h b/Sources/Core/VersionInfo.h index bf2c214f..fbc04f53 100644 --- a/Sources/Core/VersionInfo.h +++ b/Sources/Core/VersionInfo.h @@ -1,4 +1,5 @@ #pragma once + #include class VersionInfo { diff --git a/Sources/Core/ZipFileSystem.cpp b/Sources/Core/ZipFileSystem.cpp index 2ad03e3c..19122ece 100644 --- a/Sources/Core/ZipFileSystem.cpp +++ b/Sources/Core/ZipFileSystem.cpp @@ -22,6 +22,7 @@ #include +// ioapi.h must be included after unzip.h #include #include diff --git a/Sources/Draw/GLModel.h b/Sources/Draw/GLModel.h index 9af14e4d..46f74cf3 100644 --- a/Sources/Draw/GLModel.h +++ b/Sources/Draw/GLModel.h @@ -20,10 +20,11 @@ #pragma once +#include + #include #include #include "GLDynamicLight.h" -#include namespace spades { namespace draw { diff --git a/Sources/Draw/GLProgramUniform.cpp b/Sources/Draw/GLProgramUniform.cpp index 3449b39e..ce939509 100644 --- a/Sources/Draw/GLProgramUniform.cpp +++ b/Sources/Draw/GLProgramUniform.cpp @@ -18,9 +18,10 @@ */ +#include + #include "GLProgramUniform.h" #include -#include #include namespace spades { diff --git a/Sources/Draw/GLShader.h b/Sources/Draw/GLShader.h index 99d48748..1e20f56e 100644 --- a/Sources/Draw/GLShader.h +++ b/Sources/Draw/GLShader.h @@ -20,9 +20,10 @@ #pragma once -#include "IGLDevice.h" #include +#include "IGLDevice.h" + namespace spades { namespace draw { class GLShader { diff --git a/Sources/Draw/GLSpriteRenderer.h b/Sources/Draw/GLSpriteRenderer.h index ba611552..ece92483 100644 --- a/Sources/Draw/GLSpriteRenderer.h +++ b/Sources/Draw/GLSpriteRenderer.h @@ -20,12 +20,13 @@ #pragma once +#include +#include + #include #include "GLProgramAttribute.h" #include "GLProgramUniform.h" #include "IGLSpriteRenderer.h" -#include -#include namespace spades { namespace draw { diff --git a/Sources/Draw/GLWaterRenderer.h b/Sources/Draw/GLWaterRenderer.h index 0d7e81cd..b0dac016 100644 --- a/Sources/Draw/GLWaterRenderer.h +++ b/Sources/Draw/GLWaterRenderer.h @@ -20,10 +20,11 @@ #pragma once -#include "IGLDevice.h" #include #include +#include "IGLDevice.h" + namespace spades { namespace client { class GameMap; diff --git a/Sources/Draw/SWFlatMapRenderer.cpp b/Sources/Draw/SWFlatMapRenderer.cpp index 88782cd8..c4a434d3 100644 --- a/Sources/Draw/SWFlatMapRenderer.cpp +++ b/Sources/Draw/SWFlatMapRenderer.cpp @@ -18,6 +18,8 @@ */ +#include + #include "SWFlatMapRenderer.h" #include "SWImage.h" #include "SWMapRenderer.h" @@ -25,7 +27,6 @@ #include #include #include -#include namespace spades { namespace draw { diff --git a/Sources/Gui/Main.cpp b/Sources/Gui/Main.cpp index 21b455f0..fdee9376 100644 --- a/Sources/Gui/Main.cpp +++ b/Sources/Gui/Main.cpp @@ -21,6 +21,11 @@ #include //std::sort #include +#if !defined(__APPLE__) && __unix +#include +#include +#endif + #include #include @@ -50,11 +55,6 @@ #include #include -#if !defined(__APPLE__) && __unix -#include -#include -#endif - #if _MSC_VER >= 1900 // Visual Studio 2015 or higher extern "C" { FILE __iob_func[3] = {*stdin, *stdout, *stderr}; diff --git a/Sources/Gui/SDLGLDevice.cpp b/Sources/Gui/SDLGLDevice.cpp index d456e8dc..4a6780e6 100644 --- a/Sources/Gui/SDLGLDevice.cpp +++ b/Sources/Gui/SDLGLDevice.cpp @@ -18,12 +18,13 @@ */ +#include +#include + #include "SDLGLDevice.h" #include #include #include -#include -#include using namespace spades::draw; diff --git a/Sources/Gui/SDLGLDevice.h b/Sources/Gui/SDLGLDevice.h index d43e085f..f462b038 100644 --- a/Sources/Gui/SDLGLDevice.h +++ b/Sources/Gui/SDLGLDevice.h @@ -20,10 +20,11 @@ #pragma once -#include #include #include +#include + namespace spades { namespace gui { class SDLGLDevice : public draw::IGLDevice { diff --git a/Sources/Gui/SDLRunner.cpp b/Sources/Gui/SDLRunner.cpp index 2772681d..cd758e6b 100644 --- a/Sources/Gui/SDLRunner.cpp +++ b/Sources/Gui/SDLRunner.cpp @@ -18,13 +18,13 @@ */ -#include "SDLGLDevice.h" #include #include #include #include "SDLRunner.h" +#include "SDLGLDevice.h" #include