From 7e3a2370c5eddf605a319c9d0bc79e97cfd53444 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 30 Aug 2019 10:22:53 -0400 Subject: [PATCH] General: Avoid indirect includes Ensures all inclusions are made where necessary. --- include/kabufuda/AsyncIO.hpp | 4 +++- include/kabufuda/BlockAllocationTable.hpp | 3 ++- include/kabufuda/Card.hpp | 15 +++++++-------- include/kabufuda/Constants.hpp | 14 +++++++------- include/kabufuda/Directory.hpp | 3 ++- include/kabufuda/File.hpp | 3 ++- include/kabufuda/SRAM.hpp | 2 +- include/kabufuda/Util.hpp | 16 ++++++++-------- lib/kabufuda/AsyncIOPosix.cpp | 4 ++++ lib/kabufuda/AsyncIOWin32.cpp | 3 +++ lib/kabufuda/BlockAllocationTable.cpp | 7 ++++++- lib/kabufuda/Card.cpp | 6 ++++-- lib/kabufuda/Directory.cpp | 5 ++++- lib/kabufuda/File.cpp | 3 +++ lib/kabufuda/WideStringConvert.cpp | 5 ++++- 15 files changed, 60 insertions(+), 33 deletions(-) diff --git a/include/kabufuda/AsyncIO.hpp b/include/kabufuda/AsyncIO.hpp index 1132b9c..21f0505 100644 --- a/include/kabufuda/AsyncIO.hpp +++ b/include/kabufuda/AsyncIO.hpp @@ -8,9 +8,11 @@ using SizeReturn = ssize_t; using SizeReturn = DWORD; #endif -#include "Util.hpp" +#include #include +#include "kabufuda/Util.hpp" + namespace kabufuda { class AsyncIO { diff --git a/include/kabufuda/BlockAllocationTable.hpp b/include/kabufuda/BlockAllocationTable.hpp index 8fb1634..309388b 100644 --- a/include/kabufuda/BlockAllocationTable.hpp +++ b/include/kabufuda/BlockAllocationTable.hpp @@ -1,6 +1,7 @@ #pragma once -#include "Constants.hpp" +#include +#include "kabufuda/Constants.hpp" namespace kabufuda { class BlockAllocationTable { diff --git a/include/kabufuda/Card.hpp b/include/kabufuda/Card.hpp index f7765ca..5783092 100644 --- a/include/kabufuda/Card.hpp +++ b/include/kabufuda/Card.hpp @@ -1,14 +1,13 @@ #pragma once -#include "BlockAllocationTable.hpp" -#include "Directory.hpp" -#include "File.hpp" -#include "Util.hpp" -#include "AsyncIO.hpp" - +#include #include -#include -#include + +#include "kabufuda/AsyncIO.hpp" +#include "kabufuda/BlockAllocationTable.hpp" +#include "kabufuda/Directory.hpp" +#include "kabufuda/File.hpp" +#include "kabufuda/Util.hpp" #define CARD_FILENAME_MAX 32 #define CARD_ICON_MAX 8 diff --git a/include/kabufuda/Constants.hpp b/include/kabufuda/Constants.hpp index e9ab761..3876a70 100644 --- a/include/kabufuda/Constants.hpp +++ b/include/kabufuda/Constants.hpp @@ -1,14 +1,14 @@ #pragma once -#include -#include "Util.hpp" +#include +#include "kabufuda/Util.hpp" namespace kabufuda { -uint32_t constexpr BlockSize = 0x2000; -uint32_t constexpr MaxFiles = 127; -uint32_t constexpr FSTBlocks = 5; -uint32_t constexpr MbitToBlocks = 0x10; -uint32_t constexpr BATSize = 0xFFB; +constexpr uint32_t BlockSize = 0x2000; +constexpr uint32_t MaxFiles = 127; +constexpr uint32_t FSTBlocks = 5; +constexpr uint32_t MbitToBlocks = 0x10; +constexpr uint32_t BATSize = 0xFFB; /** * @brief The EPermissions enum diff --git a/include/kabufuda/Directory.hpp b/include/kabufuda/Directory.hpp index 8e8f9c4..6b8b16d 100644 --- a/include/kabufuda/Directory.hpp +++ b/include/kabufuda/Directory.hpp @@ -1,6 +1,7 @@ #pragma once -#include "File.hpp" +#include +#include "kabufuda/File.hpp" namespace kabufuda { class Directory { diff --git a/include/kabufuda/File.hpp b/include/kabufuda/File.hpp index ea8e0ab..9586765 100644 --- a/include/kabufuda/File.hpp +++ b/include/kabufuda/File.hpp @@ -1,6 +1,7 @@ #pragma once -#include "Constants.hpp" +#include +#include "kabufuda/Constants.hpp" namespace kabufuda { class File { diff --git a/include/kabufuda/SRAM.hpp b/include/kabufuda/SRAM.hpp index 979e75d..a413e0a 100644 --- a/include/kabufuda/SRAM.hpp +++ b/include/kabufuda/SRAM.hpp @@ -1,6 +1,6 @@ #pragma once -#include +#include // Modified code taken from libogc diff --git a/include/kabufuda/Util.hpp b/include/kabufuda/Util.hpp index a7aebd8..3b0963d 100644 --- a/include/kabufuda/Util.hpp +++ b/include/kabufuda/Util.hpp @@ -1,15 +1,16 @@ #pragma once #ifndef _WIN32 +#include #include -#include #include #include +#include +#include + #include #include #include -#include -#include #else #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN 1 @@ -25,13 +26,12 @@ #endif #endif -#include -#include -#include #include +#include #include -#include -#include "WideStringConvert.hpp" +#include + +#include "kabufuda/WideStringConvert.hpp" #undef bswap16 #undef bswap32 diff --git a/lib/kabufuda/AsyncIOPosix.cpp b/lib/kabufuda/AsyncIOPosix.cpp index 39854c1..3ebd01e 100644 --- a/lib/kabufuda/AsyncIOPosix.cpp +++ b/lib/kabufuda/AsyncIOPosix.cpp @@ -1,5 +1,9 @@ #include "kabufuda/AsyncIO.hpp" +#include +#include +#include + namespace kabufuda { AsyncIO::AsyncIO(SystemStringView filename, bool truncate) { diff --git a/lib/kabufuda/AsyncIOWin32.cpp b/lib/kabufuda/AsyncIOWin32.cpp index e5b2932..b4c55fc 100644 --- a/lib/kabufuda/AsyncIOWin32.cpp +++ b/lib/kabufuda/AsyncIOWin32.cpp @@ -1,5 +1,8 @@ #include "kabufuda/AsyncIO.hpp" +#include +#include + namespace kabufuda { #undef min diff --git a/lib/kabufuda/BlockAllocationTable.cpp b/lib/kabufuda/BlockAllocationTable.cpp index c6bb702..db8bfdf 100644 --- a/lib/kabufuda/BlockAllocationTable.cpp +++ b/lib/kabufuda/BlockAllocationTable.cpp @@ -1,7 +1,12 @@ #include "kabufuda/BlockAllocationTable.hpp" -#include "kabufuda/Util.hpp" + +#include +#include +#include #include +#include "kabufuda/Util.hpp" + namespace kabufuda { void BlockAllocationTable::swapEndian() { m_checksum = SBig(m_checksum); diff --git a/lib/kabufuda/Card.cpp b/lib/kabufuda/Card.cpp index 41f5997..201c171 100644 --- a/lib/kabufuda/Card.cpp +++ b/lib/kabufuda/Card.cpp @@ -1,10 +1,12 @@ #include "kabufuda/Card.hpp" -#include "kabufuda/SRAM.hpp" + +#include #include #include -#include #include +#include "kabufuda/SRAM.hpp" + namespace kabufuda { #define ROUND_UP_8192(val) (((val) + 8191) & ~8191) diff --git a/lib/kabufuda/Directory.cpp b/lib/kabufuda/Directory.cpp index 7234b35..35486c3 100644 --- a/lib/kabufuda/Directory.cpp +++ b/lib/kabufuda/Directory.cpp @@ -1,7 +1,10 @@ #include "kabufuda/Directory.hpp" -#include "kabufuda/Util.hpp" + +#include #include +#include "kabufuda/Util.hpp" + namespace kabufuda { void Directory::swapEndian() { std::for_each(std::begin(m_files), std::end(m_files), [](File& f) { f.swapEndian(); }); diff --git a/lib/kabufuda/File.cpp b/lib/kabufuda/File.cpp index b4abefd..821994f 100644 --- a/lib/kabufuda/File.cpp +++ b/lib/kabufuda/File.cpp @@ -1,4 +1,7 @@ #include "kabufuda/File.hpp" + +#include + #include "kabufuda/Util.hpp" namespace kabufuda { diff --git a/lib/kabufuda/WideStringConvert.cpp b/lib/kabufuda/WideStringConvert.cpp index afa9da9..334c398 100644 --- a/lib/kabufuda/WideStringConvert.cpp +++ b/lib/kabufuda/WideStringConvert.cpp @@ -1,5 +1,8 @@ #include "kabufuda/WideStringConvert.hpp" -#include "utf8proc.h" + +#include + +#include namespace kabufuda { std::string WideToUTF8(std::wstring_view src) {