Skip to content

Commit

Permalink
[any, time_t] fix mingw build
Browse files Browse the repository at this point in the history
  • Loading branch information
iboB committed Aug 22, 2024
1 parent 8be5db8 commit 857c54e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions include/itlib/any.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ namespace anyimpl {
struct default_allocator {
void* allocate_bytes(std::size_t n, std::size_t a) {
void* ret =
#if defined(_MSC_VER)
#if defined(_WIN32)
_aligned_malloc(n, a);
#else
aligned_alloc(a, n);
Expand All @@ -76,7 +76,7 @@ struct default_allocator {
return ret;
}
void deallocate_bytes(void* p, std::size_t /*n*/, std::size_t /*a*/) noexcept {
#if defined(_MSC_VER)
#if defined(_WIN32)
_aligned_free(p);
#else
free(p);
Expand Down
4 changes: 2 additions & 2 deletions include/itlib/time_t.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ class time_t
{
std::tm ret = {};
auto mt = std::time_t(*this);
#if defined(_MSC_VER)
#if defined(_WIN32)
gmtime_s(&ret, &mt);
#else
gmtime_r(&mt, &ret);
Expand All @@ -147,7 +147,7 @@ class time_t
{
std::tm ret = {};
auto mt = std::time_t(*this);
#if defined(_MSC_VER)
#if defined(_WIN32)
localtime_s(&ret, &mt);
#else
localtime_r(&mt, &ret);
Expand Down
2 changes: 1 addition & 1 deletion test/t-time_t-11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ TEST_CASE("[time_t] tm")
CHECK(lt.tm_year == 101);
CHECK((lt.tm_wday == 0 || lt.tm_wday == 1));

#if !defined(__APPLE__)
#if !defined(__APPLE__) && !defined(__MINGW32__)
// macs have some weird problem with std::locale
// but I don't have the time (or patience) to debug it now :)
std::locale::global(std::locale("en_US.UTF8"));
Expand Down

0 comments on commit 857c54e

Please sign in to comment.