summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2017-09-20 20:20:44 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2017-09-22 20:53:30 +0200
commiteef4c133e9649ebd690918bd7b83c2d5dc0dfcff (patch)
tree1a8d084c5b16056a15258770a05b9cd2d53a40bc /sal
parentbb406680cebd6fa1e1bdb9e2de430cd9a1f44da0 (diff)
Windows: avoid dependence on UNICODE define; prefer W functions
Change-Id: I95b90128e93f0d88ed73601bcc5a7ca9279d4cf1 Reviewed-on: https://gerrit.libreoffice.org/42560 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sal')
-rw-r--r--sal/qa/osl/file/osl_File_Const.h1
-rw-r--r--sal/qa/osl/process/osl_process.cxx8
-rw-r--r--sal/qa/osl/process/osl_process_child.cxx15
3 files changed, 6 insertions, 18 deletions
diff --git a/sal/qa/osl/file/osl_File_Const.h b/sal/qa/osl/file/osl_File_Const.h
index 1d3b0bdc5b97..ac9c7aab0a52 100644
--- a/sal/qa/osl/file/osl_File_Const.h
+++ b/sal/qa/osl/file/osl_File_Const.h
@@ -83,7 +83,6 @@ const sal_Char pBuffer_Blank[] = "";
#endif
#if defined(_WIN32) // Windows
-# include <tchar.h>
# include <io.h>
# define PATH_MAX MAX_PATH
# define TEST_PLATFORM "c:/"
diff --git a/sal/qa/osl/process/osl_process.cxx b/sal/qa/osl/process/osl_process.cxx
index 06709c9c6677..b7997209bd09 100644
--- a/sal/qa/osl/process/osl_process.cxx
+++ b/sal/qa/osl/process/osl_process.cxx
@@ -43,13 +43,7 @@
#define RUNNING_ON_VALGRIND false
#endif
-#if defined(_WIN32) // Windows
-#if !defined WIN32_LEAN_AND_MEAN
-# define WIN32_LEAN_AND_MEAN
-#endif
-# include <windows.h>
-# include <tchar.h>
-#else
+#if !defined(_WIN32) // Windows
#include <unistd.h>
#endif
diff --git a/sal/qa/osl/process/osl_process_child.cxx b/sal/qa/osl/process/osl_process_child.cxx
index 36729ee1b968..90d4d6dc4eb0 100644
--- a/sal/qa/osl/process/osl_process_child.cxx
+++ b/sal/qa/osl/process/osl_process_child.cxx
@@ -18,11 +18,8 @@
*/
#if defined(_WIN32) // Windows
-# define UNICODE
-# define _UNICODE
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
-# include <tchar.h>
#else
# include <unistd.h>
#endif
@@ -55,28 +52,26 @@ void wait_for_seconds(char* time)
#ifdef _WIN32
-void w_to_a(LPCTSTR _strW, LPSTR strA, DWORD size)
+void w_to_a(LPCWSTR strW, LPSTR strA, DWORD size)
{
- LPCWSTR strW = reinterpret_cast<LPCWSTR>(_strW);
WideCharToMultiByte(CP_ACP, 0, strW, -1, strA, size, nullptr, nullptr);
}
void dump_env(char* file_path)
{
- LPTSTR env = reinterpret_cast<LPTSTR>(
- GetEnvironmentStrings());
- LPTSTR p = env;
+ LPWSTR env = GetEnvironmentStringsW();
+ LPWSTR p = env;
std::ofstream file(file_path);
char buffer[32767];
- while (size_t l = _tcslen(reinterpret_cast<wchar_t*>(p)))
+ while (size_t l = wcslen(p))
{
w_to_a(p, buffer, sizeof(buffer));
file << buffer << '\0';
p += l + 1;
}
- FreeEnvironmentStrings(env);
+ FreeEnvironmentStringsW(env);
}
#else
void dump_env(char* file_path)