From dce64999d3325c5b55499d6ba657066efa48fbff Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Wed, 23 Dec 2020 21:10:54 +0100 Subject: Fix unit-test compilation on windows. --- test/scopedfile.cc | 7 +++++-- test/translationtest.cc | 4 ++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/test/scopedfile.cc b/test/scopedfile.cc index b03a2bc..3c30734 100644 --- a/test/scopedfile.cc +++ b/test/scopedfile.cc @@ -34,6 +34,9 @@ #ifdef _WIN32 #define WIN32_LEAN_AND_MEAN #include +#include +#include +#include #endif struct Pimpl @@ -50,8 +53,8 @@ ScopedFile::ScopedFile(const std::string& data) pimpl->fd = mkstemp(templ); #else char templ[] = "dg-scoped-file-XXXXXX"; // buffer for filename - _mktemp_s(templ); - pimpl->fd = open(templ); + _mktemp_s(templ, sizeof(templ)); + pimpl->fd = open(templ, O_CREAT | O_RDWR); #endif pimpl->filename = templ; auto sz = write(pimpl->fd, data.data(), data.size()); diff --git a/test/translationtest.cc b/test/translationtest.cc index 98cff11..d99c623 100644 --- a/test/translationtest.cc +++ b/test/translationtest.cc @@ -63,7 +63,11 @@ public: void testFromLocale() { +#ifdef _WIN32 + _putenv_s("LANG", "da_DK.UTF-8"); +#else setenv("LANG", "da_DK.UTF-8", 1); +#endif UITranslation t; // Look up translation from .mo file -- cgit v1.2.3