*: check defined(_WIN32) instead of defined(WIN32)

Only _WIN32 is defined by the compiler, and WIN32 is not standardized
and may be missing.

Closes #169
This commit is contained in:
Max Kellermann
2017-12-12 10:22:20 +01:00
parent d9552d8a6d
commit dfaf08743c
91 changed files with 226 additions and 225 deletions

View File

@@ -23,14 +23,14 @@
#include <stdio.h>
#include <stdlib.h>
#ifdef WIN32
#ifdef _WIN32
#include <string.h>
#endif
AllocatedString<>
FormatStringV(const char *fmt, va_list args)
{
#ifndef WIN32
#ifndef _WIN32
va_list tmp;
va_copy(tmp, args);
const int length = vsnprintf(NULL, 0, fmt, tmp);

View File

@@ -96,7 +96,7 @@ HugeDiscard(void *p, size_t size) noexcept
#endif
}
#elif defined(WIN32)
#elif defined(_WIN32)
void *
HugeAllocate(size_t size)

View File

@@ -65,7 +65,7 @@ HugeFree(void *p, size_t size) noexcept;
void
HugeDiscard(void *p, size_t size) noexcept;
#elif defined(WIN32)
#elif defined(_WIN32)
#include <windows.h>
gcc_malloc

View File

@@ -105,7 +105,7 @@ gcc_nonnull_all
static inline char *
UnsafeCopyStringP(char *dest, const char *src) noexcept
{
#if defined(WIN32) || defined(__BIONIC__)
#if defined(_WIN32) || defined(__BIONIC__)
/* emulate stpcpy() */
UnsafeCopyString(dest, src);
return dest + StringLength(dest);

View File

@@ -35,7 +35,7 @@
#include <assert.h>
#include <time.h>
#if !defined(__GLIBC__) && !defined(WIN32)
#if !defined(__GLIBC__) && !defined(_WIN32)
/**
* Determine the time zone offset in a portable way.
@@ -59,7 +59,7 @@ ParseTimePoint(const char *s, const char *format)
assert(s != nullptr);
assert(format != nullptr);
#ifdef WIN32
#ifdef _WIN32
/* TODO: emulate strptime()? */
(void)s;
(void)format;
@@ -80,5 +80,5 @@ ParseTimePoint(const char *s, const char *format)
return std::chrono::system_clock::from_time_t(t);
#endif /* !WIN32 */
#endif /* !_WIN32 */
}

View File

@@ -101,7 +101,7 @@ gcc_nonnull_all
static inline wchar_t *
UnsafeCopyStringP(wchar_t *dest, const wchar_t *src) noexcept
{
#if defined(WIN32) || defined(__BIONIC__) || defined(__OpenBSD__) || \
#if defined(_WIN32) || defined(__BIONIC__) || defined(__OpenBSD__) || \
defined(__NetBSD__)
/* emulate wcpcpy() */
UnsafeCopyString(dest, src);