blob: a5f0a62719122cd7652ec9d71f30c8a3c8294dd9 [file] [log] [blame]
From c3726c7fcd79cae9de442fd835f28b44e7b40cb7 Mon Sep 17 00:00:00 2001
From: d3x0r <d3x0r@users.noreply.github.com>
Date: Thu, 8 Oct 2015 01:00:15 -0700
Subject: [PATCH 08/14] Remove useless char to wide conversion.
---
examples/OpenGLWindow/Win32Window.cpp | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/examples/OpenGLWindow/Win32Window.cpp b/examples/OpenGLWindow/Win32Window.cpp
index 245ccb7..39192ff 100644
--- a/examples/OpenGLWindow/Win32Window.cpp
+++ b/examples/OpenGLWindow/Win32Window.cpp
@@ -431,15 +431,13 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
void Win32Window::setWindowTitle(const char* titleChar)
{
- wchar_t windowTitle[1024];
- swprintf(windowTitle, 1024, L"%hs", titleChar);
#ifdef _WIN64
- SetWindowTextW(m_data->m_hWnd, windowTitle);
+ SetWindowText(m_data->m_hWnd, titleChar);
#else
DWORD dwResult;
- SendMessageTimeoutW(m_data->m_hWnd, WM_SETTEXT, 0,
- reinterpret_cast<LPARAM>(windowTitle),
+ SendMessageTimeout(m_data->m_hWnd, WM_SETTEXT, 0,
+ reinterpret_cast<LPARAM>(titleChar),
SMTO_ABORTIFHUNG, 2000, &dwResult);
#endif
}
From 53e6906b7d88fb9ac216977d8b11ae2e1167c661 Mon Sep 17 00:00:00 2001
From: d3x0r <d3x0r@users.noreply.github.com>
Date: Thu, 8 Oct 2015 01:01:15 -0700
Subject: [PATCH 09/14] Update macros to pay attention to compiler instead of
platform. Then specific-case COMPILER && PLATFORM to use vsnwprintf instead
of just vsnprintf
---
examples/ThirdPartyLibs/Gwen/Macros.h | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/examples/ThirdPartyLibs/Gwen/Macros.h b/examples/ThirdPartyLibs/Gwen/Macros.h
index 5204a2b..828dd43 100644
--- a/examples/ThirdPartyLibs/Gwen/Macros.h
+++ b/examples/ThirdPartyLibs/Gwen/Macros.h
@@ -4,6 +4,7 @@
#define GWEN_MACROS_H
#include <stdlib.h>
#include <stdarg.h>
+#include <stdio.h> // vsnprintf
#if !defined(__APPLE__) && !defined(__OpenBSD__) && !defined(__FreeBSD__)
#include <malloc.h>
#else
@@ -15,13 +16,18 @@
#define GwenUtil_Max( a, b ) ( ( (a) > (b) ) ? (a) : (b) )
#define GwenUtil_VSWPrintFSafeSized( _DstBuf_ARRAY_, _Format, _ArgList ) GwenUtil_VSWPrintFSafe( _DstBuf_ARRAY_, sizeof( _DstBuf_ARRAY_ ) / sizeof( wchar_t ), _Format, _ArgList )
-#ifdef _WIN32
+#ifdef _MSC_VER
#ifndef NOMINMAX
#define NOMINMAX
#endif
#include <windows.h>
+ /* _TRUNCATE */
+ #if !defined(_TRUNCATE)
+ #define _TRUNCATE ((size_t)-1)
+ #endif
+
#define GwenUtil_VSNPrintFSafe( _DstBuf, _DstSize, _MaxCount, _Format, _ArgList ) vsnprintf_s( _DstBuf, _DstSize, _MaxCount, _Format, _ArgList )
#define GwenUtil_VSWPrintFSafe( _DstBuf, _SizeInWords, _Format, _ArgList ) vswprintf_s( _DstBuf, _SizeInWords, _Format, _ArgList )
#define GwenUtil_OutputDebugCharString( lpOutputString ) OutputDebugStringA( lpOutputString )
@@ -38,10 +44,14 @@
#define GwenUtil_OutputDebugWideString( lpOutputString ) //wprintf( lpOutputString )
#define GwenUtil_WideStringToFloat( _Str ) wcstof(_Str, NULL)
-#elif defined(__linux__) || defined(__OpenBSD__)
+#elif defined(__linux__) || defined(__OpenBSD__) || defined( __GNUC__ )
#define GwenUtil_VSNPrintFSafe( _DstBuf, _DstSize, _MaxCount, _Format, _ArgList ) vsnprintf( _DstBuf, _DstSize, _Format, _ArgList )
- #define GwenUtil_VSWPrintFSafe( _DstBuf, _SizeInWords, _Format, _ArgList ) vswprintf( _DstBuf, _SizeInWords, _Format, _ArgList )
+ #ifdef _WIN32
+ #define GwenUtil_VSWPrintFSafe( _DstBuf, _SizeInWords, _Format, _ArgList ) vsnwprintf( _DstBuf, _SizeInWords, _Format, _ArgList )
+ #else
+ #define GwenUtil_VSWPrintFSafe( _DstBuf, _SizeInWords, _Format, _ArgList ) vswprintf( _DstBuf, _SizeInWords, _Format, _ArgList )
+ #endif
#define GwenUtil_OutputDebugCharString( lpOutputString ) //printf( lpOutputString )
#define GwenUtil_OutputDebugWideString( lpOutputString ) //wprintf( lpOutputString )
#define GwenUtil_WideStringToFloat( _Str ) wcstof(_Str, NULL)
From ef5650b67990814e332bb132efb5461fb8b8ee39 Mon Sep 17 00:00:00 2001
From: d3x0r <d3x0r@users.noreply.github.com>
Date: Thu, 8 Oct 2015 01:01:35 -0700
Subject: [PATCH 10/14] Switch by compiler instead of platform.
---
src/Bullet3Common/b3FileUtils.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Bullet3Common/b3FileUtils.h b/src/Bullet3Common/b3FileUtils.h
index 1a33102..b5e8225 100644
--- a/src/Bullet3Common/b3FileUtils.h
+++ b/src/Bullet3Common/b3FileUtils.h
@@ -36,7 +36,7 @@ struct b3FileUtils
for (int i=0;!f && i<numPrefixes;i++)
{
-#ifdef _WIN32
+#ifdef _MSC_VER
sprintf_s(relativeFileName,maxRelativeFileNameMaxLen,"%s%s",prefix[i],orgFileName);
#else
sprintf(relativeFileName,"%s%s",prefix[i],orgFileName);