From 6e5dccbba2faed092cbd136aed37d5116eacc447 Mon Sep 17 00:00:00 2001 From: marius851000 Date: Thu, 13 Jun 2019 13:39:02 +0200 Subject: [PATCH 1/2] corrected a problem where major and minor where understood as function, preventing compilation with glibc. --- src/ppmdu/pmd2/pmd2.hpp | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/src/ppmdu/pmd2/pmd2.hpp b/src/ppmdu/pmd2/pmd2.hpp index 28a491f..4bcc55f 100644 --- a/src/ppmdu/pmd2/pmd2.hpp +++ b/src/ppmdu/pmd2/pmd2.hpp @@ -51,12 +51,15 @@ namespace pmd2 Meant to store the ppmdu lib's internal version, which differs from each utility's version. */ struct toolkitversion_t - { - unsigned int major, minor, patch; + { + unsigned int major, minor, patch; toolkitversion_t(unsigned int maj=0, unsigned int min=0, unsigned int ptch=0) - :major(maj), minor(min),patch(ptch) - {} + { + major = maj; + minor = min; + patch = ptch; + } inline bool operator==( const toolkitversion_t& other )const { return major == other.major && minor == other.minor && patch == other.patch; } inline bool operator!=( const toolkitversion_t& other )const { return !operator==(other); } @@ -80,7 +83,7 @@ namespace pmd2 eGameVersion Unique IDs for each versions of the PMD2 games. *******************************************************************************/ - enum struct eGameVersion : size_t + enum struct eGameVersion : size_t { EoS = 0, //Explorers of Sky EoT, //Explorers of Time @@ -93,10 +96,10 @@ namespace pmd2 /******************************************************************************* eGameRegion - Locale of the game. Used mainly for determining offsets differences + Locale of the game. Used mainly for determining offsets differences between versions. *******************************************************************************/ - enum struct eGameRegion : size_t + enum struct eGameRegion : size_t { Japan = 0, NorthAmerica, @@ -111,7 +114,7 @@ namespace pmd2 List of the different possible languages. Each language's value is the letter suffix for its text_*.str file name. *******************************************************************************/ - enum struct eGameLanguages : size_t + enum struct eGameLanguages : size_t { english = 0, japanese, @@ -152,7 +155,7 @@ namespace pmd2 const std::string ResourcePrefix_G = "g"; //Guild const std::string ResourcePrefix_H = "h"; //Home? const std::string ResourcePrefix_M = "m"; //Main - const std::string ResourcePrefix_N = "n"; + const std::string ResourcePrefix_N = "n"; const std::string ResourcePrefix_P = "p"; //Part?/Path? const std::string ResourcePrefix_S = "s"; const std::string ResourcePrefix_T = "t"; //Town @@ -190,12 +193,12 @@ namespace pmd2 Language file names text_e.str for example - !#FIXME: Its probably not a good idea to have those static in here, + !#FIXME: Its probably not a good idea to have those static in here, when we can query the text_*.str filename from the xml file instead. *******************************************************************************/ //!#FIXME: Should use GameLangLoader instead! - const std::string FName_TextPref = "text"; + const std::string FName_TextPref = "text"; const std::string FName_TextEngSufx = "e"; const std::string FName_TextJapSufx = "j"; const std::string FName_TextFreSufx = "f"; @@ -205,7 +208,7 @@ namespace pmd2 /******************************************************************************* GameLanguagesNames - + *******************************************************************************/ extern const std::array(eGameLanguages::NbLang)> GameLanguagesNames; @@ -222,7 +225,7 @@ namespace pmd2 return GameLanguagesNames[static_cast(lang)]; else return Generic_Invalid; - } + } /******************************************************************************* GameVersionNames @@ -250,7 +253,7 @@ namespace pmd2 /******************************************************************************* GameRegionNames - + *******************************************************************************/ extern const std::array(eGameRegion::NBRegions)> GameRegionNames; @@ -300,4 +303,4 @@ namespace pmd2 }; -#endif \ No newline at end of file +#endif -- 2.21.0 From 399b5cd2119932d44246401499b6a91e78521473 Mon Sep 17 00:00:00 2001 From: marius851000 Date: Thu, 13 Jun 2019 13:51:47 +0200 Subject: [PATCH 2/2] corrected problem in gbyteutils.hpp, that prevent compilation with clang and glibc. --- src/utils/gbyteutils.hpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/utils/gbyteutils.hpp b/src/utils/gbyteutils.hpp index b9e713e..d6a0ab0 100644 --- a/src/utils/gbyteutils.hpp +++ b/src/utils/gbyteutils.hpp @@ -15,6 +15,7 @@ A bunch of simple tools for doing common tasks when manipulating bytes. #include #include #include +#include namespace utils { @@ -270,7 +271,7 @@ namespace utils template inline _init ReadIntFromBytes( T & dest, _init itin, _init itend, bool basLittleEndian = true ) { - dest = ReadIntFromBytes( itin, itend, basLittleEndian ); + dest = ReadIntFromBytes( itin, itend, basLittleEndian ); return itin; } @@ -437,7 +438,7 @@ namespace utils result.push_back(*beg); if( beg == pastend ) - throw runtime_error("String went past expected end!"); + throw std::runtime_error("String went past expected end!"); return std::move(result); } @@ -455,7 +456,7 @@ namespace utils for(; beg != pastend && (*beg) != 0; ++cntchar, ++beg ); if( beg == pastend ) - throw runtime_error("String went past expected end!"); + throw std::runtime_error("String went past expected end!"); return cntchar; } @@ -470,7 +471,7 @@ namespace utils auto itstr = itfbeg; std::advance( itstr, fileoffset ); size_t strlength = safestrlen(itstr, itfend); - string dest; + std::string dest; dest.resize(strlength); for( size_t cntchar = 0; cntchar < strlength; ++cntchar, ++itstr ) -- 2.21.0