fix warnings

This commit is contained in:
Thomas Fussell 2016-07-20 19:16:51 -04:00
parent dec6aaa49a
commit e222e1b268
2 changed files with 11 additions and 6 deletions

View File

@ -168,7 +168,7 @@ public:
auto period = xlnt::timedelta(1, 2, 3, 4, 5); auto period = xlnt::timedelta(1, 2, 3, 4, 5);
auto period_number = period.to_number(); auto period_number = period.to_number();
xlnt::number_format nf = xlnt::number_format::number_format("[mm]:ss"); xlnt::number_format nf("[mm]:ss");
auto formatted = nf.format(period_number, xlnt::calendar::windows_1900); auto formatted = nf.format(period_number, xlnt::calendar::windows_1900);
TS_ASSERT_EQUALS(formatted, "1563:04"); TS_ASSERT_EQUALS(formatted, "1563:04");
@ -179,7 +179,7 @@ public:
auto time = xlnt::time(1, 2, 3, 400000); auto time = xlnt::time(1, 2, 3, 400000);
auto time_number = time.to_number(); auto time_number = time.to_number();
xlnt::number_format nf = xlnt::number_format::number_format("ss.0"); xlnt::number_format nf("ss.0");
auto formatted = nf.format(time_number, xlnt::calendar::windows_1900); auto formatted = nf.format(time_number, xlnt::calendar::windows_1900);
TS_ASSERT_EQUALS(formatted, "03.4"); TS_ASSERT_EQUALS(formatted, "03.4");
@ -190,7 +190,7 @@ public:
auto time = xlnt::time(1, 2, 3, 400000); auto time = xlnt::time(1, 2, 3, 400000);
auto time_number = time.to_number(); auto time_number = time.to_number();
xlnt::number_format nf = xlnt::number_format::number_format("s.0"); xlnt::number_format nf("s.0");
auto formatted = nf.format(time_number, xlnt::calendar::windows_1900); auto formatted = nf.format(time_number, xlnt::calendar::windows_1900);
TS_ASSERT_EQUALS(formatted, "3.4"); TS_ASSERT_EQUALS(formatted, "3.4");
@ -201,7 +201,7 @@ public:
auto period = xlnt::timedelta(1, 2, 3, 4, 5); auto period = xlnt::timedelta(1, 2, 3, 4, 5);
auto period_number = period.to_number(); auto period_number = period.to_number();
xlnt::number_format nf = xlnt::number_format::number_format("[ss]"); xlnt::number_format nf("[ss]");
auto formatted = nf.format(period_number, xlnt::calendar::windows_1900); auto formatted = nf.format(period_number, xlnt::calendar::windows_1900);
TS_ASSERT_EQUALS(formatted, "93784"); TS_ASSERT_EQUALS(formatted, "93784");

View File

@ -94,8 +94,13 @@ public:
std::basic_string<TCHAR> working_directory(buffer); std::basic_string<TCHAR> working_directory(buffer);
return windows_to_universal_path(std::string(working_directory.begin(), working_directory.end())); return windows_to_universal_path(std::string(working_directory.begin(), working_directory.end()));
#else #else
char buffer[2048]; char buffer[PATH_MAX];
getcwd(buffer, 2048);
if (getcwd(buffer, 2048) == nullptr)
{
throw std::runtime_error("getcwd failed");
}
return std::string(buffer); return std::string(buffer);
#endif #endif
} }