diff --git a/aegisub/libaegisub/common/charset.cpp b/aegisub/libaegisub/common/charset.cpp index 9a5fefbea..3e1e961f0 100644 --- a/aegisub/libaegisub/common/charset.cpp +++ b/aegisub/libaegisub/common/charset.cpp @@ -18,14 +18,12 @@ /// @brief Character set detection and manipulation utilities. /// @ingroup libaegisub - -#include "libaegisub/charset.h" #include "charset_ucd.h" namespace agi { namespace charset { -const std::string Detect(const std::string file) { +std::string Detect(const std::string &file) { UCDetect ucd(file); return ucd.Single(); } diff --git a/aegisub/libaegisub/common/charset_ucd.cpp b/aegisub/libaegisub/common/charset_ucd.cpp index 5bb1f91e6..b46a5c75f 100644 --- a/aegisub/libaegisub/common/charset_ucd.cpp +++ b/aegisub/libaegisub/common/charset_ucd.cpp @@ -18,23 +18,18 @@ /// @brief Character set detection using Universalchardet /// @ingroup libaegisub +#include "charset_ucd.h" #ifndef LAGI_PRE -#include -#include -#include - #include "../../universalchardet/nsCharSetProber.h" #endif -#include "libaegisub/charset.h" -#include "charset_ucd.h" #include "libaegisub/io.h" namespace agi { namespace charset { -UCDetect::UCDetect(const std::string file): nsUniversalDetector(NS_FILTER_ALL) { +UCDetect::UCDetect(const std::string &file): nsUniversalDetector(NS_FILTER_ALL) { { std::ifstream *fp; fp = io::Open(file); diff --git a/aegisub/libaegisub/common/charset_ucd.h b/aegisub/libaegisub/common/charset_ucd.h index b21e43c2b..a9d59323b 100644 --- a/aegisub/libaegisub/common/charset_ucd.h +++ b/aegisub/libaegisub/common/charset_ucd.h @@ -18,15 +18,21 @@ /// @brief Character set detection using Universalchardet /// @ingroup libaegisub +#include "libaegisub/charset.h" + #ifndef LAGI_PRE +#include + #ifndef _WIN32 #define _X86_ 1 #endif + #include "../../universalchardet/nscore.h" #include "../../universalchardet/nsUniversalDetector.h" #include "../../universalchardet/nsMBCSGroupProber.h" #endif + namespace agi { namespace charset { @@ -45,7 +51,7 @@ public: /// @brief Detect character set of a file using UniversalCharDetect /// @param file File to check - UCDetect(const std::string file); + UCDetect(const std::string &file); /// @brief Detect character set of a file using UniversalCharDet /// @param out[out] Map to load list into ordered by confidence diff --git a/aegisub/libaegisub/include/libaegisub/charset.h b/aegisub/libaegisub/include/libaegisub/charset.h index 71c9cb169..fca82fa68 100644 --- a/aegisub/libaegisub/include/libaegisub/charset.h +++ b/aegisub/libaegisub/include/libaegisub/charset.h @@ -19,8 +19,11 @@ /// @ingroup libaegisub #ifndef LAGI_PRE -#endif +#include +#include #include +#include +#endif #include namespace agi { @@ -34,13 +37,13 @@ typedef std::map > CharsetListDete /// @brief Return a complete list of detected character sets ordered by precidence. /// @param file File to check -/// @param[in] list Map to load detected list into. +/// @param[out] list Map to load detected list into. void DetectAll(const std::string file, CharsetListDetected &list); /// @brief Returns the character set with the highest confidence /// @param file File to check /// @return Detected character set. -const std::string Detect(const std::string file); +std::string Detect(const std::string &file); } // namespace util diff --git a/aegisub/libaegisub/include/libaegisub/io.h b/aegisub/libaegisub/include/libaegisub/io.h index f23548e10..399164ee2 100644 --- a/aegisub/libaegisub/include/libaegisub/io.h +++ b/aegisub/libaegisub/include/libaegisub/io.h @@ -19,6 +19,8 @@ /// @ingroup libaegisub #ifndef LAGI_PRE +#include +#include #endif #include diff --git a/aegisub/libaegisub/include/libaegisub/types.h b/aegisub/libaegisub/include/libaegisub/types.h index 909eea76e..ba5fbeecc 100644 --- a/aegisub/libaegisub/include/libaegisub/types.h +++ b/aegisub/libaegisub/include/libaegisub/types.h @@ -20,6 +20,8 @@ #ifndef LAGI_PRE +#include "config.h" + #ifdef HAVE_SYS_TIME_H # include #else