Minor fixes

This commit is contained in:
Jack Andersen 2016-01-25 20:39:49 -10:00
parent 02a7b95606
commit 528b5cad0c
3 changed files with 13 additions and 9 deletions

View File

@ -93,8 +93,10 @@ int main(int argc, char* argv[])
if (NOD::Stat(argv[6], &theStat) || !S_ISREG(theStat.st_mode)) if (NOD::Stat(argv[6], &theStat) || !S_ISREG(theStat.st_mode))
NOD::LogModule.report(LogVisor::FatalError, "unable to stat %s as file", argv[6]); NOD::LogModule.report(LogVisor::FatalError, "unable to stat %s as file", argv[6]);
NOD::SystemUTF8View gameId(argv[2]); NOD::SystemString gameIdSys(argv[2]);
NOD::SystemUTF8View gameTitle(argv[3]); NOD::SystemUTF8View gameId(gameIdSys);
NOD::SystemString gameTitleSys(argv[3]);
NOD::SystemUTF8View gameTitle(gameTitleSys);
size_t lastIdx = -1; size_t lastIdx = -1;
auto progFunc = [&](size_t idx, const NOD::SystemString& name, size_t bytes) auto progFunc = [&](size_t idx, const NOD::SystemString& name, size_t bytes)
{ {
@ -150,8 +152,10 @@ int main(int argc, char* argv[])
if (NOD::Stat(argv[7], &theStat) || !S_ISREG(theStat.st_mode)) if (NOD::Stat(argv[7], &theStat) || !S_ISREG(theStat.st_mode))
NOD::LogModule.report(LogVisor::FatalError, _S("unable to stat %s as file"), argv[7]); NOD::LogModule.report(LogVisor::FatalError, _S("unable to stat %s as file"), argv[7]);
NOD::SystemUTF8View gameId(argv[2]); NOD::SystemString gameIdSys(argv[2]);
NOD::SystemUTF8View gameTitle(argv[3]); NOD::SystemUTF8View gameId(gameIdSys);
NOD::SystemString gameTitleSys(argv[3]);
NOD::SystemUTF8View gameTitle(gameTitleSys);
size_t lastIdx = -1; size_t lastIdx = -1;
auto progFunc = [&](size_t idx, const NOD::SystemString& name, size_t bytes) auto progFunc = [&](size_t idx, const NOD::SystemString& name, size_t bytes)
{ {

View File

@ -83,7 +83,7 @@ class SystemUTF8View
{ {
std::string m_utf8; std::string m_utf8;
public: public:
SystemUTF8View(const SystemString& str) explicit SystemUTF8View(const SystemString& str)
{ {
int len = WideCharToMultiByte(CP_UTF8, 0, str.c_str(), str.size(), nullptr, 0, nullptr, nullptr); int len = WideCharToMultiByte(CP_UTF8, 0, str.c_str(), str.size(), nullptr, 0, nullptr, nullptr);
m_utf8.assign(len, '\0'); m_utf8.assign(len, '\0');
@ -95,7 +95,7 @@ class SystemStringView
{ {
std::wstring m_sys; std::wstring m_sys;
public: public:
SystemStringView(const std::string& str) explicit SystemStringView(const std::string& str)
{ {
int len = MultiByteToWideChar(CP_UTF8, 0, str.c_str(), str.size(), nullptr, 0); int len = MultiByteToWideChar(CP_UTF8, 0, str.c_str(), str.size(), nullptr, 0);
m_sys.assign(len, L'\0'); m_sys.assign(len, L'\0');
@ -118,7 +118,7 @@ class SystemUTF8View
{ {
const std::string& m_utf8; const std::string& m_utf8;
public: public:
SystemUTF8View(const SystemString& str) explicit SystemUTF8View(const SystemString& str)
: m_utf8(str) {} : m_utf8(str) {}
inline const std::string& utf8_str() {return m_utf8;} inline const std::string& utf8_str() {return m_utf8;}
}; };
@ -126,7 +126,7 @@ class SystemStringView
{ {
const std::string& m_sys; const std::string& m_sys;
public: public:
SystemStringView(const std::string& str) explicit SystemStringView(const std::string& str)
: m_sys(str) {} : m_sys(str) {}
inline const std::string& sys_str() {return m_sys;} inline const std::string& sys_str() {return m_sys;}
}; };

View File

@ -30,7 +30,7 @@ public:
if (!fp) if (!fp)
return 0; return 0;
FSeek(fp, 0, SEEK_END); FSeek(fp, 0, SEEK_END);
uint64_t result = ftello(fp); uint64_t result = FTell(fp);
fclose(fp); fclose(fp);
return result; return result;
} }