Huge compile performance refactor

This commit is contained in:
Jack Andersen 2017-12-28 21:55:42 -10:00
parent cee9478773
commit 017a921fdc
65 changed files with 101 additions and 230 deletions

View File

@ -1,4 +1,4 @@
#include <stdio.h> #include <cstdio>
#include <iostream> #include <iostream>
#include "clang/AST/ASTConsumer.h" #include "clang/AST/ASTConsumer.h"
#include "clang/AST/RecursiveASTVisitor.h" #include "clang/AST/RecursiveASTVisitor.h"

View File

@ -1,8 +1,8 @@
#ifndef __AES_HPP__ #ifndef __AES_HPP__
#define __AES_HPP__ #define __AES_HPP__
#include <stdint.h> #include <cstdint>
#include <stdlib.h> #include <cstdlib>
#include <memory> #include <memory>
namespace athena namespace athena

View File

@ -3,13 +3,10 @@
#include "athena/Global.hpp" #include "athena/Global.hpp"
namespace athena namespace athena::Checksums
{
namespace Checksums
{ {
atUint32 crc32(const atUint8* data, atUint64 length, atUint32 mask = 0xFFFFFFFF, atUint32 seed = 0xFFFFFFFF); atUint32 crc32(const atUint8* data, atUint64 length, atUint32 mask = 0xFFFFFFFF, atUint32 seed = 0xFFFFFFFF);
atUint16 crc16CCITT(const atUint8* data, atUint64 length, atUint16 seed = 0xFFFF, atUint16 final = 0); atUint16 crc16CCITT(const atUint8* data, atUint64 length, atUint16 seed = 0xFFFF, atUint16 final = 0);
atUint16 crc16(const atUint8* data, atUint64 length); atUint16 crc16(const atUint8* data, atUint64 length);
} }
}
#endif // CHECKSUMS_HPP #endif // CHECKSUMS_HPP

View File

@ -3,11 +3,7 @@
#include "athena/Global.hpp" #include "athena/Global.hpp"
namespace athena namespace athena::io::Compression
{
namespace io
{
namespace Compression
{ {
// Zlib compression // Zlib compression
atInt32 decompressZlib(const atUint8* src, atUint32 srcLen, atUint8* dst, atUint32 dstLen); atInt32 decompressZlib(const atUint8* src, atUint32 srcLen, atUint8* dst, atUint32 dstLen);
@ -23,6 +19,4 @@ atUint32 yaz0Encode(const atUint8* src, atUint32 srcSize, atUint8* data);
atUint32 decompressLZ77(const atUint8* src, atUint32 srcLen, atUint8** dst); atUint32 decompressLZ77(const atUint8* src, atUint32 srcLen, atUint8** dst);
atUint32 compressLZ77(const atUint8* src, atUint32 srcLen, atUint8** dst, bool extended = false); atUint32 compressLZ77(const atUint8* src, atUint32 srcLen, atUint8** dst, bool extended = false);
} }
}
}
#endif // COMPRESSION_HPP #endif // COMPRESSION_HPP

View File

@ -13,9 +13,7 @@
#include <vector> #include <vector>
#include <memory> #include <memory>
namespace athena namespace athena::io
{
namespace io
{ {
/* forward-declaration dance for recursively-derived types */ /* forward-declaration dance for recursively-derived types */
@ -250,7 +248,6 @@ struct WStringAsString : public DNA<VE>, public std::string
#define DNA_COUNT(cnt) 0 #define DNA_COUNT(cnt) 0
#endif #endif
}
} }
#endif // DNA_HPP #endif // DNA_HPP

View File

@ -7,15 +7,13 @@
* Any changes to the types or namespacing must be reflected in 'atdna/main.cpp' * Any changes to the types or namespacing must be reflected in 'atdna/main.cpp'
*/ */
#include <string.h> #include <cstring>
#include <yaml.h> #include <yaml.h>
#include <utf8proc.h> #include <utf8proc.h>
#include "DNA.hpp" #include "DNA.hpp"
#include "FileReader.hpp" #include "FileReader.hpp"
namespace athena namespace athena::io
{
namespace io
{ {
struct YAMLNode struct YAMLNode
@ -680,6 +678,5 @@ struct WStringAsStringYaml : public DNAYaml<VE>, public std::string
const char* DNATypeV() const {return DNAType();} \ const char* DNATypeV() const {return DNAType();} \
} }
}
#endif // DNAYAML_HPP #endif // DNAYAML_HPP

View File

@ -2,7 +2,7 @@
#define DIR_HPP #define DIR_HPP
#include "athena/FileInfo.hpp" #include "athena/FileInfo.hpp"
#include <stdio.h> #include <cstdio>
#if _WIN32 #if _WIN32
typedef int mode_t; typedef int mode_t;

View File

@ -7,16 +7,14 @@
#endif #endif
#include <windows.h> #include <windows.h>
#else #else
#include <stdio.h> #include <cstdio>
#endif #endif
#include <string> #include <string>
#include <memory> #include <memory>
#include "athena/IStreamReader.hpp" #include "athena/IStreamReader.hpp"
namespace athena namespace athena::io
{
namespace io
{ {
class FileReader : public IStreamReader class FileReader : public IStreamReader
{ {
@ -75,7 +73,6 @@ protected:
atUint64 m_offset; atUint64 m_offset;
bool m_globalErr; bool m_globalErr;
}; };
} // io
} // Athena } // Athena
#ifndef FILEREADER_BASE #ifndef FILEREADER_BASE

View File

@ -7,13 +7,11 @@
#endif #endif
#include <windows.h> #include <windows.h>
#else #else
#include <stdio.h> #include <cstdio>
#endif #endif
#include "athena/IStreamWriter.hpp" #include "athena/IStreamWriter.hpp"
namespace athena namespace athena::io
{
namespace io
{ {
class FileWriter : public IStreamWriter class FileWriter : public IStreamWriter
{ {
@ -116,7 +114,6 @@ public:
~TransactionalFileWriter() { flush(); } ~TransactionalFileWriter() { flush(); }
}; };
}
} // Athena } // Athena
#ifndef FILEWRITER_BASE #ifndef FILEWRITER_BASE

View File

@ -3,9 +3,7 @@
#include "Global.hpp" #include "Global.hpp"
namespace athena namespace athena::io
{
namespace io
{ {
std::ostream& operator<<(std::ostream& os, Endian& endian); std::ostream& operator<<(std::ostream& os, Endian& endian);
@ -34,5 +32,4 @@ protected:
#endif #endif
}; };
} }
}
#endif // STREAM_HPP #endif // STREAM_HPP

View File

@ -6,9 +6,7 @@
#include "utf8proc.h" #include "utf8proc.h"
#include "IStream.hpp" #include "IStream.hpp"
namespace athena namespace athena::io
{
namespace io
{ {
/** @brief The IStreamReader class defines a basic API for reading from streams, Implementors are provided with one pure virtual /** @brief The IStreamReader class defines a basic API for reading from streams, Implementors are provided with one pure virtual
* function that must be implemented in order to interact with the stream. * function that must be implemented in order to interact with the stream.
@ -1304,6 +1302,5 @@ IStreamReader& operator>>(IStreamReader& lhs, T& rhs)
return lhs; return lhs;
} }
} }
}
#endif // ISTREAMREADER #endif // ISTREAMREADER

View File

@ -5,9 +5,7 @@
#include "IStream.hpp" #include "IStream.hpp"
#include <memory> #include <memory>
namespace athena namespace athena::io
{
namespace io
{ {
class IStreamWriter : public IStream class IStreamWriter : public IStream
{ {
@ -1176,6 +1174,5 @@ IStreamWriter& operator<<(IStreamWriter& lhs, const T& rhs)
return lhs; return lhs;
} }
} }
}
#endif // STREAMWRITER_HPP #endif // STREAMWRITER_HPP

View File

@ -6,9 +6,7 @@
#include <functional> #include <functional>
#include "athena/IStreamReader.hpp" #include "athena/IStreamReader.hpp"
namespace athena namespace athena::io
{
namespace io
{ {
/*! \class MemoryReader /*! \class MemoryReader
* \brief A Stream class for reading data from a memory position * \brief A Stream class for reading data from a memory position
@ -118,7 +116,6 @@ protected:
std::string m_filepath; //!< Path to the target file std::string m_filepath; //!< Path to the target file
}; };
} // io
} // Athena } // Athena

View File

@ -6,9 +6,7 @@
#include <functional> #include <functional>
#include "athena/IStreamWriter.hpp" #include "athena/IStreamWriter.hpp"
namespace athena namespace athena::io
{
namespace io
{ {
/*! @class MemoryWriter /*! @class MemoryWriter
@ -158,7 +156,6 @@ private:
void resize(atUint64 newSize); void resize(atUint64 newSize);
}; };
}
} }
#endif // MEMORYWRITER_HPP #endif // MEMORYWRITER_HPP

View File

@ -5,9 +5,7 @@
#include "athena/Stream.hpp" #include "athena/Stream.hpp"
#include <physfs.h> #include <physfs.h>
namespace athena namespace athena::io
{
namespace io
{ {
class PHYSFSFileReader : public Stream class PHYSFSFileReader : public Stream
{ {
@ -51,7 +49,6 @@ private:
PHYSFS_File* m_handle; PHYSFS_File* m_handle;
}; };
} }
}
#ifndef PHYSFSFILEREADER_BASE #ifndef PHYSFSFILEREADER_BASE
#define PHYSFSFILEREADER_BASE() \ #define PHYSFSFILEREADER_BASE() \

View File

@ -3,9 +3,7 @@
#include "athena/Global.hpp" #include "athena/Global.hpp"
namespace athena namespace athena::Sakura
{
namespace Sakura
{ {
template <typename T> template <typename T>
class Vector2D class Vector2D
@ -30,6 +28,5 @@ public:
typedef Vector2D<int> Vector2Di; typedef Vector2D<int> Vector2Di;
typedef Vector2D<float> Vector2Df; typedef Vector2D<float> Vector2Df;
} // Sakura } // Sakura
} // Athena
#endif // SAKURAGLOBAL_HPP #endif // SAKURAGLOBAL_HPP

View File

@ -8,7 +8,7 @@
#include <arpa/inet.h> #include <arpa/inet.h>
#include <netdb.h> #include <netdb.h>
#include <unistd.h> #include <unistd.h>
#include <errno.h> #include <cerrno>
#else #else
#include <winsock2.h> #include <winsock2.h>
#include <Ws2tcpip.h> #include <Ws2tcpip.h>
@ -21,9 +21,7 @@
#include "Global.hpp" #include "Global.hpp"
namespace athena namespace athena::net
{
namespace net
{ {
/* Define the low-level send/receive flags, which depend on the OS */ /* Define the low-level send/receive flags, which depend on the OS */
@ -371,7 +369,6 @@ public:
SocketTp GetInternalSocket() const { return m_socket; } SocketTp GetInternalSocket() const { return m_socket; }
}; };
}
} }
#endif // ATHENA_SOCKET_HPP #endif // ATHENA_SOCKET_HPP

View File

@ -5,9 +5,7 @@
#include <string> #include <string>
#include "athena/SakuraGlobal.hpp" #include "athena/SakuraGlobal.hpp"
namespace athena namespace athena::Sakura
{
namespace Sakura
{ {
class SpriteFile; class SpriteFile;
class SpriteFrame; class SpriteFrame;
@ -69,7 +67,6 @@ private:
atUint32 m_currentFrame; atUint32 m_currentFrame;
}; };
} // Sakura
} // zelda } // zelda
#endif // SSPRITE_HPP #endif // SSPRITE_HPP

View File

@ -7,9 +7,7 @@
#include <string> #include <string>
#include "athena/SakuraGlobal.hpp" #include "athena/SakuraGlobal.hpp"
namespace athena namespace athena::Sakura
{
namespace Sakura
{ {
struct STexture struct STexture
{ {
@ -191,7 +189,6 @@ private:
Vector2Df m_origin; Vector2Df m_origin;
std::unordered_map<std::string, Sprite*> m_sprites; std::unordered_map<std::string, Sprite*> m_sprites;
}; };
} // Sakura
} // Zelda } // Zelda
#endif // SSPRITE_HPP #endif // SSPRITE_HPP

View File

@ -3,9 +3,7 @@
#include "athena/MemoryReader.hpp" #include "athena/MemoryReader.hpp"
namespace athena namespace athena::Sakura
{
namespace Sakura
{ {
class SpriteFile; class SpriteFile;
} // Sakura } // Sakura
@ -21,7 +19,6 @@ public:
Sakura::SpriteFile* readFile(); Sakura::SpriteFile* readFile();
}; };
} // io
} // zelda } // zelda

View File

@ -5,9 +5,7 @@
#include "athena/SakuraGlobal.hpp" #include "athena/SakuraGlobal.hpp"
#include <vector> #include <vector>
namespace athena namespace athena::Sakura
{
namespace Sakura
{ {
class Sprite; class Sprite;
@ -48,7 +46,6 @@ private:
std::vector<SpritePart*> m_parts; std::vector<SpritePart*> m_parts;
}; };
} // Sakura
} // zelda } // zelda
#endif // SSPRITEFRAME_HPP #endif // SSPRITEFRAME_HPP

View File

@ -6,9 +6,7 @@
#include <string> #include <string>
namespace athena namespace athena::Sakura
{
namespace Sakura
{ {
class SpriteFrame; class SpriteFrame;
@ -114,6 +112,5 @@ private:
atUint32 m_frameIndex; atUint32 m_frameIndex;
}; };
} }
}
#endif // SSPRITEPART_HPP #endif // SSPRITEPART_HPP

View File

@ -1,7 +1,7 @@
#ifndef TYPES_HPP #ifndef TYPES_HPP
#define TYPES_HPP #define TYPES_HPP
#include <stdint.h> #include <cstdint>
#include <inttypes.h> #include <cinttypes>
using atInt8 = int8_t; using atInt8 = int8_t;
using atUint8 = uint8_t; using atUint8 = uint8_t;

View File

@ -4,14 +4,12 @@
#include <string> #include <string>
#include <string_view> #include <string_view>
#include <vector> #include <vector>
#include <stdarg.h> #include <cstdarg>
#include <string.h> #include <cstring>
#include "athena/Global.hpp" #include "athena/Global.hpp"
#include "athena/Types.hpp" #include "athena/Types.hpp"
namespace athena namespace athena::utility
{
namespace utility
{ {
inline bool isEmpty(atInt8* buf, atUint32 size) {return !memcmp(buf, buf + 1, size - 1);} inline bool isEmpty(atInt8* buf, atUint32 size) {return !memcmp(buf, buf + 1, size - 1);}
inline bool isSystemBigEndian() {return (*(atUint16*)"\xFE\xFF" == 0xFEFF);} inline bool isSystemBigEndian() {return (*(atUint16*)"\xFE\xFF" == 0xFEFF);}
@ -217,6 +215,5 @@ std::string wideToUtf8(std::wstring_view src);
std::wstring utf8ToWide(std::string_view src); std::wstring utf8ToWide(std::string_view src);
} // utility
} // Athena } // Athena
#endif #endif

View File

@ -97,8 +97,13 @@ enum {false, true};
typedef bool utf8proc_bool; typedef bool utf8proc_bool;
# endif # endif
#else #else
#ifdef __cplusplus
# include <cstdbool>
# include <cinttypes>
#else
# include <stdbool.h> # include <stdbool.h>
# include <inttypes.h> # include <inttypes.h>
#endif
typedef int8_t utf8proc_int8_t; typedef int8_t utf8proc_int8_t;
typedef uint8_t utf8proc_uint8_t; typedef uint8_t utf8proc_uint8_t;
typedef int16_t utf8proc_int16_t; typedef int16_t utf8proc_int16_t;
@ -109,7 +114,11 @@ typedef size_t utf8proc_size_t;
typedef ssize_t utf8proc_ssize_t; typedef ssize_t utf8proc_ssize_t;
typedef bool utf8proc_bool; typedef bool utf8proc_bool;
#endif #endif
#ifdef __cplusplus
# include <climits>
#else
# include <limits.h> # include <limits.h>
#endif
/** @name Error codes /** @name Error codes
* Error codes being returned by almost all functions. * Error codes being returned by almost all functions.

View File

@ -1,7 +1,7 @@
#include "LZ77/LZLookupTable.hpp" #include "LZ77/LZLookupTable.hpp"
#include "LZ77/LZType10.hpp" #include "LZ77/LZType10.hpp"
#include <athena/MemoryWriter.hpp> #include <athena/MemoryWriter.hpp>
#include <string.h> #include <cstring>
LZType10::LZType10(atInt32 MinimumOffset, atInt32 SlidingWindow, atInt32 MinimumMatch, atInt32 BlockSize) LZType10::LZType10(atInt32 MinimumOffset, atInt32 SlidingWindow, atInt32 MinimumMatch, atInt32 BlockSize)
: LZBase(MinimumOffset, SlidingWindow, MinimumMatch, BlockSize) : LZBase(MinimumOffset, SlidingWindow, MinimumMatch, BlockSize)

View File

@ -1,7 +1,7 @@
#include "LZ77/LZLookupTable.hpp" #include "LZ77/LZLookupTable.hpp"
#include "LZ77/LZType11.hpp" #include "LZ77/LZType11.hpp"
#include <athena/MemoryWriter.hpp> #include <athena/MemoryWriter.hpp>
#include <string.h> #include <cstring>
LZType11::LZType11(atInt32 minimumOffset, atInt32 slidingWindow, atInt32 minimumMatch, atInt32 blockSize) LZType11::LZType11(atInt32 minimumOffset, atInt32 slidingWindow, atInt32 minimumMatch, atInt32 blockSize)

View File

@ -1,6 +1,6 @@
#include "aes.hpp" #include "aes.hpp"
#include <stdio.h> #include <cstdio>
#include <string.h> #include <cstring>
#if _WIN32 #if _WIN32
#include <intrin.h> #include <intrin.h>
#elif !GEKKO #elif !GEKKO

View File

@ -4,9 +4,7 @@
#include <iostream> #include <iostream>
#include "athena/Global.hpp" #include "athena/Global.hpp"
namespace athena namespace athena::io
{
namespace io
{ {
ALTTPFileReader::ALTTPFileReader(atUint8* data, atUint64 length) ALTTPFileReader::ALTTPFileReader(atUint8* data, atUint64 length)
@ -236,4 +234,3 @@ ALTTPDungeonItemFlags ALTTPFileReader::readDungeonFlags()
} }
} // io } // io
} // zelda

View File

@ -3,9 +3,7 @@
#include <iostream> #include <iostream>
#include <iomanip> #include <iomanip>
namespace athena namespace athena::Checksums
{
namespace Checksums
{ {
atUint32 crc32(const atUint8* data, atUint64 length, atUint32 mask, atUint32 seed) atUint32 crc32(const atUint8* data, atUint64 length, atUint32 mask, atUint32 seed)
@ -150,4 +148,3 @@ atUint16 crc16(const atUint8* data, atUint64 length)
} }
} // Checksums } // Checksums
} // zelda

View File

@ -5,11 +5,7 @@
#include "LZ77/LZType10.hpp" #include "LZ77/LZType10.hpp"
#include "LZ77/LZType11.hpp" #include "LZ77/LZType11.hpp"
namespace athena namespace athena::io::Compression
{
namespace io
{
namespace Compression
{ {
atInt32 decompressZlib(const atUint8* src, atUint32 srcLen, atUint8* dst, atUint32 dstLen) atInt32 decompressZlib(const atUint8* src, atUint32 srcLen, atUint8* dst, atUint32 dstLen)
@ -357,5 +353,3 @@ atUint32 compressLZ77(const atUint8* src, atUint32 srcLen, atUint8** dst, bool e
} }
} // Compression } // Compression
} // io
} // zelda

View File

@ -1,8 +1,6 @@
#include "athena/DNAYaml.hpp" #include "athena/DNAYaml.hpp"
namespace athena namespace athena::io
{
namespace io
{ {
template <> template <>
@ -1406,4 +1404,3 @@ std::unique_ptr<atUint8[]> base64_decode(std::string_view encoded_string)
} }
} }
}

View File

@ -1,15 +1,15 @@
#include "athena/Dir.hpp" #include "athena/Dir.hpp"
#include <sys/stat.h> #include <sys/stat.h>
#include <stdlib.h> #include <cstdlib>
#include <limits.h> #include <limits.h>
#define __STDC_FORMAT_MACROS #define __STDC_FORMAT_MACROS
#include <inttypes.h> #include <cinttypes>
#ifndef _WIN32 #ifndef _WIN32
#include <dirent.h> #include <dirent.h>
#include <unistd.h> #include <unistd.h>
#else #else
#include <time.h> #include <ctime>
#include <direct.h> #include <direct.h>
#endif #endif

View File

@ -2,10 +2,10 @@
#include "athena/Utility.hpp" #include "athena/Utility.hpp"
#include "athena/FileWriter.hpp" #include "athena/FileWriter.hpp"
#include "athena/FileReader.hpp" #include "athena/FileReader.hpp"
#include <time.h> #include <ctime>
#include <stdio.h> #include <cstdio>
#include <limits.h> #include <limits.h>
#include <stdlib.h> #include <cstdlib>
#ifndef _WIN32 #ifndef _WIN32
#include <sys/time.h> #include <sys/time.h>
@ -20,7 +20,7 @@
#ifdef _WIN32 #ifdef _WIN32
#include <windows.h> #include <windows.h>
#include <wchar.h> #include <cwchar>
#endif #endif
#ifdef _MSC_VER #ifdef _MSC_VER

View File

@ -7,9 +7,7 @@
#include "osx_largefilewrapper.h" #include "osx_largefilewrapper.h"
#endif #endif
namespace athena namespace athena::io
{
namespace io
{ {
FileReader::FileReader(std::string_view filename, atInt32 cacheSize, bool globalErr) FileReader::FileReader(std::string_view filename, atInt32 cacheSize, bool globalErr)
: m_fileHandle(nullptr), : m_fileHandle(nullptr),
@ -206,5 +204,4 @@ void FileReader::setCacheSize(const atInt32 blockSize)
m_cacheData.reset(new atUint8[m_blockSize]); m_cacheData.reset(new atUint8[m_blockSize]);
} }
} // io
} // Athena } // Athena

View File

@ -1,9 +1,7 @@
#include "athena/FileReader.hpp" #include "athena/FileReader.hpp"
#include "win32_largefilewrapper.h" #include "win32_largefilewrapper.h"
namespace athena namespace athena::io
{
namespace io
{ {
FileReader::FileReader(std::string_view filename, atInt32 cacheSize, bool globalErr) FileReader::FileReader(std::string_view filename, atInt32 cacheSize, bool globalErr)
: m_fileHandle(nullptr), : m_fileHandle(nullptr),
@ -232,5 +230,4 @@ void FileReader::setCacheSize(const atInt32 blockSize)
m_cacheData.reset(new atUint8[m_blockSize]); m_cacheData.reset(new atUint8[m_blockSize]);
} }
} // io
} // Athena } // Athena

View File

@ -1,8 +1,6 @@
#include "athena/FileWriter.hpp" #include "athena/FileWriter.hpp"
namespace athena namespace athena::io
{
namespace io
{ {
void TransactionalFileWriter::seek(atInt64 pos, SeekOrigin origin) void TransactionalFileWriter::seek(atInt64 pos, SeekOrigin origin)
{ {
@ -32,4 +30,3 @@ void TransactionalFileWriter::writeUBytes(const atUint8* data, atUint64 len)
m_position += len; m_position += len;
} }
} }
}

View File

@ -7,9 +7,7 @@
#include "osx_largefilewrapper.h" #include "osx_largefilewrapper.h"
#endif #endif
namespace athena namespace athena::io
{
namespace io
{ {
FileWriter::FileWriter(std::string_view filename, bool overwrite, bool globalErr) FileWriter::FileWriter(std::string_view filename, bool overwrite, bool globalErr)
: m_fileHandle(NULL), : m_fileHandle(NULL),
@ -134,5 +132,4 @@ void FileWriter::writeUBytes(const atUint8* data, atUint64 len)
setError(); setError();
} }
} }
}
} // Athena } // Athena

View File

@ -1,9 +1,7 @@
#include "athena/FileWriter.hpp" #include "athena/FileWriter.hpp"
#include "win32_largefilewrapper.h" #include "win32_largefilewrapper.h"
namespace athena namespace athena::io
{
namespace io
{ {
FileWriter::FileWriter(std::string_view filename, bool overwrite, bool globalErr) FileWriter::FileWriter(std::string_view filename, bool overwrite, bool globalErr)
: m_fileHandle(0), : m_fileHandle(0),
@ -141,5 +139,4 @@ void FileWriter::writeUBytes(const atUint8* data, atUint64 len)
} }
} }
}
} // Athena } // Athena

View File

@ -1,7 +1,7 @@
#include "athena/Global.hpp" #include "athena/Global.hpp"
#include <stdio.h> #include <cstdio>
#include <stdarg.h> #include <cstdarg>
#include <stdlib.h> #include <cstdlib>
std::ostream& operator<<(std::ostream& os, const athena::SeekOrigin& origin) std::ostream& operator<<(std::ostream& os, const athena::SeekOrigin& origin)
{ {

View File

@ -1,8 +1,6 @@
#include "athena/MCFileWriter.hpp" #include "athena/MCFileWriter.hpp"
namespace athena namespace athena::io
{
namespace io
{ {
MCFileWriter::MCFileWriter(atUint8* data, atUint64 length) MCFileWriter::MCFileWriter(atUint8* data, atUint64 length)
@ -48,5 +46,4 @@ atUint16 MCFileWriter::calculateChecksum(atUint8* data, atUint32 length)
return sum; return sum;
} }
} // io
} // zelda } // zelda

View File

@ -1,7 +1,7 @@
#include "athena/MemoryReader.hpp" #include "athena/MemoryReader.hpp"
#include <stdio.h> #include <cstdio>
#include <stdlib.h> #include <cstdlib>
#include <vector> #include <vector>
#include <iostream> #include <iostream>
#include <cstring> #include <cstring>
@ -14,9 +14,7 @@
#undef min #undef min
#undef max #undef max
namespace athena namespace athena::io
{
namespace io
{ {
MemoryReader::MemoryReader(const void* data, atUint64 length, bool takeOwnership, bool globalErr) MemoryReader::MemoryReader(const void* data, atUint64 length, bool takeOwnership, bool globalErr)
: m_data(data), : m_data(data),
@ -213,4 +211,3 @@ void MemoryCopyReader::loadData()
} }
} }
}

View File

@ -1,7 +1,7 @@
#include "athena/MemoryWriter.hpp" #include "athena/MemoryWriter.hpp"
#include <stdio.h> #include <cstdio>
#include <string.h> #include <cstring>
#include <vector> #include <vector>
#include <iostream> #include <iostream>
@ -9,9 +9,7 @@
#include <malloc.h> #include <malloc.h>
#endif // HW_RVL #endif // HW_RVL
namespace athena namespace athena::io
{
namespace io
{ {
MemoryWriter::MemoryWriter(atUint8* data, atUint64 length, bool takeOwnership) MemoryWriter::MemoryWriter(atUint8* data, atUint64 length, bool takeOwnership)
@ -316,5 +314,4 @@ void MemoryCopyWriter::resize(atUint64 newSize)
m_length = newSize; m_length = newSize;
} }
} // io
} // Athena } // Athena

View File

@ -3,9 +3,7 @@
#include "athena/FileNotFoundException.hpp" #include "athena/FileNotFoundException.hpp"
#include "athena/IOException.hpp" #include "athena/IOException.hpp"
namespace athena namespace athena::io
{
namespace io
{ {
PHYSFSFileReader::PHYSFSFileReader(const std::string& path) PHYSFSFileReader::PHYSFSFileReader(const std::string& path)
@ -199,7 +197,6 @@ bool PHYSFSFileReader::isLittleEndian() const
return m_endian == Endian::LittleEndian; return m_endian == Endian::LittleEndian;
} }
}
} }
#endif #endif

View File

@ -3,9 +3,7 @@
#include "athena/SkywardSwordQuest.hpp" #include "athena/SkywardSwordQuest.hpp"
#include <iostream> #include <iostream>
namespace athena namespace athena::io
{
namespace io
{ {
SkywardSwordFileReader::SkywardSwordFileReader(atUint8* data, atUint64 length) SkywardSwordFileReader::SkywardSwordFileReader(atUint8* data, atUint64 length)
@ -65,5 +63,4 @@ SkywardSwordFile* SkywardSwordFileReader::read()
return file; return file;
} }
} // io
} // zelda } // zelda

View File

@ -2,9 +2,7 @@
#include "athena/SkywardSwordFile.hpp" #include "athena/SkywardSwordFile.hpp"
#include "athena/SkywardSwordQuest.hpp" #include "athena/SkywardSwordQuest.hpp"
namespace athena namespace athena::io
{
namespace io
{ {
SkywardSwordFileWriter::SkywardSwordFileWriter(atUint8* data, atUint64 len) SkywardSwordFileWriter::SkywardSwordFileWriter(atUint8* data, atUint64 len)
@ -62,5 +60,4 @@ void SkywardSwordFileWriter::write(SkywardSwordFile* file)
save(); save();
} }
} // io
} // zelda } // zelda

View File

@ -7,9 +7,7 @@
#include <QVector> #include <QVector>
#endif #endif
namespace athena namespace athena::Sakura
{
namespace Sakura
{ {
Sprite::Sprite(SpriteFile* root) Sprite::Sprite(SpriteFile* root)
: m_root(root), : m_root(root),
@ -232,4 +230,3 @@ SpriteFile* Sprite::root() const
return m_root; return m_root;
} }
} }
}

View File

@ -3,9 +3,7 @@
#include "athena/Utility.hpp" #include "athena/Utility.hpp"
#include <iostream> #include <iostream>
namespace athena namespace athena::Sakura
{
namespace Sakura
{ {
const atUint32 SpriteFile::Major = 1; const atUint32 SpriteFile::Major = 1;
const atUint32 SpriteFile::Minor = 0; const atUint32 SpriteFile::Minor = 0;
@ -216,5 +214,4 @@ void SpriteFile::setTextures(std::vector<STexture*> textures)
m_textures = textures; m_textures = textures;
} }
} // Sakura
} // zelda } // zelda

View File

@ -5,9 +5,7 @@
#include "athena/SpriteFrame.hpp" #include "athena/SpriteFrame.hpp"
#include "athena/Utility.hpp" #include "athena/Utility.hpp"
namespace athena namespace athena::io
{
namespace io
{ {
SpriteFileReader::SpriteFileReader(atUint8* data, atUint64 length) SpriteFileReader::SpriteFileReader(atUint8* data, atUint64 length)
: MemoryCopyReader(data, length) : MemoryCopyReader(data, length)
@ -204,5 +202,4 @@ Sakura::SpriteFile* SpriteFileReader::readFile()
return ret; return ret;
} }
} // io
} // zelda } // zelda

View File

@ -4,9 +4,7 @@
#include "athena/SpritePart.hpp" #include "athena/SpritePart.hpp"
#include "athena/SpriteFrame.hpp" #include "athena/SpriteFrame.hpp"
namespace athena namespace athena::io
{
namespace io
{ {
SpriteFileWriter::SpriteFileWriter(atUint8* data, atUint64 length) SpriteFileWriter::SpriteFileWriter(atUint8* data, atUint64 length)
: MemoryCopyWriter(data, length) : MemoryCopyWriter(data, length)
@ -78,5 +76,4 @@ void SpriteFileWriter::writeFile(Sakura::SpriteFile* file)
save(); save();
} }
} // io
} // zelda } // zelda

View File

@ -2,9 +2,7 @@
#include "athena/SpritePart.hpp" #include "athena/SpritePart.hpp"
#include "athena/Sprite.hpp" #include "athena/Sprite.hpp"
namespace athena namespace athena::Sakura
{
namespace Sakura
{ {
SpriteFrame::SpriteFrame() SpriteFrame::SpriteFrame()
@ -52,5 +50,4 @@ Sprite* SpriteFrame::root() const
return m_root; return m_root;
} }
} // Sakura
} // zelda } // zelda

View File

@ -3,9 +3,7 @@
#include "athena/Sprite.hpp" #include "athena/Sprite.hpp"
#include <algorithm> #include <algorithm>
namespace athena namespace athena::Sakura
{
namespace Sakura
{ {
SpritePart::SpritePart(SpriteFrame* root) SpritePart::SpritePart(SpriteFrame* root)
@ -115,4 +113,3 @@ SpriteFrame* SpritePart::root() const
return m_root; return m_root;
} }
} }
}

View File

@ -1,10 +1,10 @@
#include "athena/Utility.hpp" #include "athena/Utility.hpp"
#include <iostream> #include <iostream>
#include <string.h> #include <cstring>
#include <stdlib.h> #include <cstdlib>
#include <sstream> #include <sstream>
#include <algorithm> #include <algorithm>
#include <stdarg.h> #include <cstdarg>
#include <iterator> #include <iterator>
#include <cstdio> #include <cstdio>
#include <sys/types.h> #include <sys/types.h>
@ -17,9 +17,7 @@
#include <locale> #include <locale>
#endif #endif
namespace athena namespace athena::utility
{
namespace utility
{ {
void fillRandom(atUint8* rndArea, atUint64 count) void fillRandom(atUint8* rndArea, atUint64 count)
@ -255,5 +253,4 @@ std::wstring utf8ToWide(std::string_view src)
return retval; return retval;
} }
} // utility
} // Athena } // Athena

View File

@ -2,7 +2,7 @@
#include "athena/WiiImage.hpp" #include "athena/WiiImage.hpp"
#include "athena/Utility.hpp" #include "athena/Utility.hpp"
#include <string.h> #include <cstring>
namespace athena namespace athena
{ {

View File

@ -1,7 +1,7 @@
#include "athena/WiiImage.hpp" #include "athena/WiiImage.hpp"
#include "athena/Utility.hpp" #include "athena/Utility.hpp"
#include <string.h> #include <cstring>
#include <stdlib.h> #include <cstdlib>
namespace athena namespace athena
{ {

View File

@ -5,9 +5,9 @@
#include "athena/MemoryWriter.hpp" #include "athena/MemoryWriter.hpp"
#include "athena/Utility.hpp" #include "athena/Utility.hpp"
#include <stdio.h> #include <cstdio>
#include <vector> #include <vector>
#include <string.h> #include <cstring>
#include <sys/stat.h> #include <sys/stat.h>
#include <iostream> #include <iostream>
#include <iomanip> #include <iomanip>

View File

@ -11,7 +11,7 @@
#include "sha1.h" #include "sha1.h"
#include <iostream> #include <iostream>
#include <iomanip> #include <iomanip>
#include <string.h> #include <cstring>
namespace athena namespace athena
{ {

View File

@ -14,9 +14,9 @@
#include "md5.h" #include "md5.h"
#include "sha1.h" #include "sha1.h"
#include <stdio.h> #include <cstdio>
#include <vector> #include <vector>
#include <string.h> #include <cstring>
#include <sys/stat.h> #include <sys/stat.h>
#include <iostream> #include <iostream>
#include <iomanip> #include <iomanip>

View File

@ -1,6 +1,6 @@
#include "athena/ZQuestFile.hpp" #include "athena/ZQuestFile.hpp"
#include <string.h> #include <cstring>
namespace athena namespace athena
{ {

View File

@ -7,9 +7,7 @@
#include <iostream> #include <iostream>
#include <iomanip> #include <iomanip>
namespace athena namespace athena::io
{
namespace io
{ {
ZQuestFileReader::ZQuestFileReader(atUint8* data, atUint64 length) ZQuestFileReader::ZQuestFileReader(atUint8* data, atUint64 length)
@ -107,5 +105,4 @@ ZQuestFile* ZQuestFileReader::read()
return new ZQuestFile(game, BOM == 0xFEFF ? Endian::BigEndian : Endian::LittleEndian, std::move(data), uncompressedLen, gameString); return new ZQuestFile(game, BOM == 0xFEFF ? Endian::BigEndian : Endian::LittleEndian, std::move(data), uncompressedLen, gameString);
} }
} // io
} // zelda } // zelda

View File

@ -3,9 +3,7 @@
#include "athena/Compression.hpp" #include "athena/Compression.hpp"
#include "athena/Checksums.hpp" #include "athena/Checksums.hpp"
namespace athena namespace athena::io
{
namespace io
{ {
ZQuestFileWriter::ZQuestFileWriter(atUint8* data, atUint64 length) ZQuestFileWriter::ZQuestFileWriter(atUint8* data, atUint64 length)
@ -75,5 +73,4 @@ void ZQuestFileWriter::write(ZQuestFile* quest, bool compress)
} }
} }
} // io
} // zelda } // zelda

View File

@ -1,4 +1,4 @@
#include <string.h> #include <cstring>
#include <stdio.h> #include <stdio.h>
#include "bn.hpp" #include "bn.hpp"

View File

@ -1,4 +1,4 @@
#include <string.h> #include <cstring>
#include "athena/Utility.hpp" #include "athena/Utility.hpp"
#include "bn.hpp" #include "bn.hpp"

View File

@ -78,9 +78,9 @@
#include <stdint.h> #include <stdint.h>
#include <stddef.h> #include <stddef.h>
#include <stdlib.h> #include <cstdlib>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <cstring>
#ifndef __APPLE__ #ifndef __APPLE__
#include <malloc.h> #include <malloc.h>
#endif #endif

View File

@ -39,7 +39,7 @@
*/ */
#include "sha1.h" #include "sha1.h"
#include <string.h> #include <cstring>
#include "athena/Utility.hpp" #include "athena/Utility.hpp"
/* /*