diff --git a/src/helpers.cpp b/src/helpers.cpp index 28534007..356ad5f7 100644 --- a/src/helpers.cpp +++ b/src/helpers.cpp @@ -268,8 +268,12 @@ bool CaseInsensitiveSorting::operator()(const MPD::Item &a, const MPD::Item &b) std::string Timestamp(time_t t) { char result[32]; +# ifdef WIN32 + result[strftime(result, 31, "%x %X", localtime(&t))] = 0; +# else tm info; result[strftime(result, 31, "%x %X", localtime_r(&t, &info))] = 0; +# endif // WIN32 return result; } diff --git a/src/window.cpp b/src/window.cpp index 9d073c84..f6e3c5cb 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -940,7 +940,11 @@ std::wstring ToWString(const std::string &s) size_t Window::Length(const std::wstring &ws) { +# ifdef WIN32 + return ws.length(); +# else int len = wcswidth(ws.c_str(), -1); return len < 0 ? ws.length() : len; +# endif // WIN32 }