diff --git a/mk/windoze/shared_lib.vcproj b/mk/windoze/shared_lib.vcproj
index 23ba902a..cb40c283 100644
--- a/mk/windoze/shared_lib.vcproj
+++ b/mk/windoze/shared_lib.vcproj
@@ -121,7 +121,7 @@
FavorSizeOrSpeed="1"
WholeProgramOptimization="false"
AdditionalIncludeDirectories="../../source/shared_lib/include;../../source/shared_lib/include/graphics;../../source/shared_lib/include/graphics/gl;../../source/shared_lib/include/platform;../../source/shared_lib/include/platform/win32;../../source/shared_lib/include/sound;../../source/shared_lib/include/sound/ds8;../../source/shared_lib/include/util;../../source/shared_lib/include/lua;../../source/shared_lib/include/xml;../../source/win32_deps/include;"../../source/win32_deps/xerces-c-3.0.1/src";"../../source/win32_deps/xerces-c-3.0.1/src/xercesc/xinclude";../../source/win32_deps/lpng141;"../../source/win32_deps/jpeg-8a";"../../source/win32_deps/SDL-1.2.x/include";../../source/shared_lib/include/platform/sdl;"../../source/win32_deps/openal-soft-1.12.854/include";../../source/shared_lib/include/sound/openal;../../source/shared_lib/include/platform/posix;../../source/shared_lib/include/streflop;../../source/shared_lib/include/streflop/libm_flt32_source;../../source/shared_lib/include/platform/common;"../../source/win32_deps/curl-7.21.3/include";../../source/shared_lib/include/map;../../source/shared_lib/include/platform/miniupnpc;../../source/shared_lib/include/libircclient/include;../../source/shared_lib/include/feathery_ftp;"../../source/win32_deps/ftgl-2.1.3-rc5/src";"../../source/win32_deps/freetype-2.4.4/include";$(NOINHERIT)"
- PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;USE_PCH=1;USE_STREFLOP;STREFLOP_SSE;STREFLOP_RANDOM_GEN_SIZE=32;LIBM_COMPILING_FLT32;CURL_STATICLIB;UNICODE;USE_FTGL"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;USE_PCH=1;USE_STREFLOP;STREFLOP_SSE;STREFLOP_RANDOM_GEN_SIZE=32;LIBM_COMPILING_FLT32;CURL_STATICLIB;UNICODE;USE_FTGL;TA3D_PLATFORM_MSVC;TA3D_PLATFORM_WINDOWS"
StringPooling="true"
ExceptionHandling="2"
RuntimeLibrary="0"
@@ -388,6 +388,10 @@
RelativePath="..\..\source\shared_lib\sources\streflop\streflopC.cpp"
>
+
+
@@ -762,10 +766,18 @@
RelativePath="..\..\source\shared_lib\include\streflop\streflopC.h"
>
+
+
+
+
diff --git a/source/shared_lib/include/platform/win32/types.h b/source/shared_lib/include/platform/win32/types.h
index 1637cfa9..32c423df 100644
--- a/source/shared_lib/include/platform/win32/types.h
+++ b/source/shared_lib/include/platform/win32/types.h
@@ -37,4 +37,253 @@ typedef uint8 byte;
}}//end namespace
+
+// ISO C9x compliant stdint.h for Microsoft Visual Studio
+// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124
+//
+// Copyright (c) 2006-2008 Alexander Chemeris
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// 3. The name of the author may be used to endorse or promote products
+// derived from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _MSC_VER // [
+#error "Use this header only with Microsoft Visual C++ compilers!"
+#endif // _MSC_VER ]
+
+#ifndef _MSC_STDINT_H_ // [
+#define _MSC_STDINT_H_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif
+
+#include
+
+// For Visual Studio 6 in C++ mode and for many Visual Studio versions when
+// compiling for ARM we should wrap include with 'extern "C++" {}'
+// or compiler give many errors like this:
+// error C2733: second C linkage of overloaded function 'wmemchr' not allowed
+#ifdef __cplusplus
+extern "C" {
+#endif
+# include
+#ifdef __cplusplus
+}
+#endif
+
+// Define _W64 macros to mark types changing their size, like intptr_t.
+#ifndef _W64
+# if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
+# define _W64 __w64
+# else
+# define _W64
+# endif
+#endif
+
+
+// 7.18.1 Integer types
+
+// 7.18.1.1 Exact-width integer types
+
+// Visual Studio 6 and Embedded Visual C++ 4 doesn't
+// realize that, e.g. char has the same size as __int8
+// so we give up on __intX for them.
+#if (_MSC_VER < 1300)
+ typedef signed char int8_t;
+ typedef signed short int16_t;
+ typedef signed int int32_t;
+ typedef unsigned char uint8_t;
+ typedef unsigned short uint16_t;
+ typedef unsigned int uint32_t;
+#else
+ typedef signed __int8 int8_t;
+ typedef signed __int16 int16_t;
+ typedef signed __int32 int32_t;
+ typedef unsigned __int8 uint8_t;
+ typedef unsigned __int16 uint16_t;
+ typedef unsigned __int32 uint32_t;
+#endif
+typedef signed __int64 int64_t;
+typedef unsigned __int64 uint64_t;
+
+
+// 7.18.1.2 Minimum-width integer types
+typedef int8_t int_least8_t;
+typedef int16_t int_least16_t;
+typedef int32_t int_least32_t;
+typedef int64_t int_least64_t;
+typedef uint8_t uint_least8_t;
+typedef uint16_t uint_least16_t;
+typedef uint32_t uint_least32_t;
+typedef uint64_t uint_least64_t;
+
+// 7.18.1.3 Fastest minimum-width integer types
+typedef int8_t int_fast8_t;
+typedef int16_t int_fast16_t;
+typedef int32_t int_fast32_t;
+typedef int64_t int_fast64_t;
+typedef uint8_t uint_fast8_t;
+typedef uint16_t uint_fast16_t;
+typedef uint32_t uint_fast32_t;
+typedef uint64_t uint_fast64_t;
+
+// 7.18.1.4 Integer types capable of holding object pointers
+#ifdef _WIN64 // [
+ typedef signed __int64 intptr_t;
+ typedef unsigned __int64 uintptr_t;
+#else // _WIN64 ][
+ typedef _W64 signed int intptr_t;
+ typedef _W64 unsigned int uintptr_t;
+#endif // _WIN64 ]
+
+// 7.18.1.5 Greatest-width integer types
+typedef int64_t intmax_t;
+typedef uint64_t uintmax_t;
+
+
+// 7.18.2 Limits of specified-width integer types
+
+#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [ See footnote 220 at page 257 and footnote 221 at page 259
+
+// 7.18.2.1 Limits of exact-width integer types
+#define INT8_MIN ((int8_t)_I8_MIN)
+#define INT8_MAX _I8_MAX
+#define INT16_MIN ((int16_t)_I16_MIN)
+#define INT16_MAX _I16_MAX
+#define INT32_MIN ((int32_t)_I32_MIN)
+#define INT32_MAX _I32_MAX
+#define INT64_MIN ((int64_t)_I64_MIN)
+#define INT64_MAX _I64_MAX
+#define UINT8_MAX _UI8_MAX
+#define UINT16_MAX _UI16_MAX
+#define UINT32_MAX _UI32_MAX
+#define UINT64_MAX _UI64_MAX
+
+// 7.18.2.2 Limits of minimum-width integer types
+#define INT_LEAST8_MIN INT8_MIN
+#define INT_LEAST8_MAX INT8_MAX
+#define INT_LEAST16_MIN INT16_MIN
+#define INT_LEAST16_MAX INT16_MAX
+#define INT_LEAST32_MIN INT32_MIN
+#define INT_LEAST32_MAX INT32_MAX
+#define INT_LEAST64_MIN INT64_MIN
+#define INT_LEAST64_MAX INT64_MAX
+#define UINT_LEAST8_MAX UINT8_MAX
+#define UINT_LEAST16_MAX UINT16_MAX
+#define UINT_LEAST32_MAX UINT32_MAX
+#define UINT_LEAST64_MAX UINT64_MAX
+
+// 7.18.2.3 Limits of fastest minimum-width integer types
+#define INT_FAST8_MIN INT8_MIN
+#define INT_FAST8_MAX INT8_MAX
+#define INT_FAST16_MIN INT16_MIN
+#define INT_FAST16_MAX INT16_MAX
+#define INT_FAST32_MIN INT32_MIN
+#define INT_FAST32_MAX INT32_MAX
+#define INT_FAST64_MIN INT64_MIN
+#define INT_FAST64_MAX INT64_MAX
+#define UINT_FAST8_MAX UINT8_MAX
+#define UINT_FAST16_MAX UINT16_MAX
+#define UINT_FAST32_MAX UINT32_MAX
+#define UINT_FAST64_MAX UINT64_MAX
+
+// 7.18.2.4 Limits of integer types capable of holding object pointers
+#ifdef _WIN64 // [
+# define INTPTR_MIN INT64_MIN
+# define INTPTR_MAX INT64_MAX
+# define UINTPTR_MAX UINT64_MAX
+#else // _WIN64 ][
+# define INTPTR_MIN INT32_MIN
+# define INTPTR_MAX INT32_MAX
+# define UINTPTR_MAX UINT32_MAX
+#endif // _WIN64 ]
+
+// 7.18.2.5 Limits of greatest-width integer types
+#define INTMAX_MIN INT64_MIN
+#define INTMAX_MAX INT64_MAX
+#define UINTMAX_MAX UINT64_MAX
+
+// 7.18.3 Limits of other integer types
+
+#ifdef _WIN64 // [
+# define PTRDIFF_MIN _I64_MIN
+# define PTRDIFF_MAX _I64_MAX
+#else // _WIN64 ][
+# define PTRDIFF_MIN _I32_MIN
+# define PTRDIFF_MAX _I32_MAX
+#endif // _WIN64 ]
+
+#define SIG_ATOMIC_MIN INT_MIN
+#define SIG_ATOMIC_MAX INT_MAX
+
+#ifndef SIZE_MAX // [
+# ifdef _WIN64 // [
+# define SIZE_MAX _UI64_MAX
+# else // _WIN64 ][
+# define SIZE_MAX _UI32_MAX
+# endif // _WIN64 ]
+#endif // SIZE_MAX ]
+
+// WCHAR_MIN and WCHAR_MAX are also defined in
+#ifndef WCHAR_MIN // [
+# define WCHAR_MIN 0
+#endif // WCHAR_MIN ]
+#ifndef WCHAR_MAX // [
+# define WCHAR_MAX _UI16_MAX
+#endif // WCHAR_MAX ]
+
+#define WINT_MIN 0
+#define WINT_MAX _UI16_MAX
+
+#endif // __STDC_LIMIT_MACROS ]
+
+
+// 7.18.4 Limits of other integer types
+
+#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [ See footnote 224 at page 260
+
+// 7.18.4.1 Macros for minimum-width integer constants
+
+#define INT8_C(val) val##i8
+#define INT16_C(val) val##i16
+#define INT32_C(val) val##i32
+#define INT64_C(val) val##i64
+
+#define UINT8_C(val) val##ui8
+#define UINT16_C(val) val##ui16
+#define UINT32_C(val) val##ui32
+#define UINT64_C(val) val##ui64
+
+// 7.18.4.2 Macros for greatest-width integer constants
+#define INTMAX_C INT64_C
+#define UINTMAX_C UINT64_C
+
+#endif // __STDC_CONSTANT_MACROS ]
+
+
+#endif // _MSC_STDINT_H_ ]
+
#endif
diff --git a/source/shared_lib/include/util/string_utils.h b/source/shared_lib/include/util/string_utils.h
index d92968d3..b8656f6a 100644
--- a/source/shared_lib/include/util/string_utils.h
+++ b/source/shared_lib/include/util/string_utils.h
@@ -584,7 +584,7 @@ namespace Shared { namespace Util {
return !(iss >> t).fail();
}
- static int ASCIItoUTF8(const byte c, byte *out);
+ static int ASCIItoUTF8(const Shared::Platform::byte c, Shared::Platform::byte *out);
}; // class String
diff --git a/source/shared_lib/sources/util/string_utils.cpp b/source/shared_lib/sources/util/string_utils.cpp
index 94ac0261..095252d4 100644
--- a/source/shared_lib/sources/util/string_utils.cpp
+++ b/source/shared_lib/sources/util/string_utils.cpp
@@ -363,7 +363,7 @@ namespace Shared { namespace Util {
return ConvertToUTF8(s, len, nws);
}
- int String::ASCIItoUTF8(const byte c, byte *out) {
+ int String::ASCIItoUTF8(const Shared::Platform::byte c, Shared::Platform::byte *out) {
if (c < 0x80)
{
*out = c;
@@ -390,17 +390,17 @@ namespace Shared { namespace Util {
*ret = '\0';
return ret;
}
- byte tmp[4];
+ Shared::Platform::byte tmp[4];
newSize = 1;
- for(byte *p = (byte*)s ; *p ; p++)
+ for(Shared::Platform::byte *p = (Shared::Platform::byte*)s ; *p ; p++)
newSize += ASCIItoUTF8(*p, tmp);
char* ret = new char[newSize];
//LOG_ASSERT(NULL != ret);
assert(NULL != ret);
- byte *q = (byte*)ret;
- for(byte *p = (byte*)s ; *p ; p++)
+ Shared::Platform::byte *q = (Shared::Platform::byte*)ret;
+ for(Shared::Platform::byte *p = (Shared::Platform::byte*)s ; *p ; p++)
q += ASCIItoUTF8(*p, q);
*q = '\0'; // A bit paranoid
return ret;
@@ -585,7 +585,7 @@ namespace Shared { namespace Util {
int e = 0;
int prev = -1;
- for(int i = 0 ; i < size() ; i++)
+ for(unsigned int i = 0 ; i < size() ; i++)
if (pattern[e] == '*')
{
if (e + 1 == pattern.size())
@@ -614,10 +614,10 @@ namespace Shared { namespace Util {
String res;
int utf8_pos = 0;
for(; pos > 0 ; pos--)
- if (((byte)(*this)[utf8_pos]) >= 0xC0)
+ if (((Shared::Platform::byte)(*this)[utf8_pos]) >= 0xC0)
{
utf8_pos++;
- while (((byte)(*this)[utf8_pos]) >= 0x80 && ((byte)(*this)[utf8_pos]) < 0xC0)
+ while (((Shared::Platform::byte)(*this)[utf8_pos]) >= 0x80 && ((Shared::Platform::byte)(*this)[utf8_pos]) < 0xC0)
utf8_pos++;
}
else
@@ -625,11 +625,11 @@ namespace Shared { namespace Util {
for(; len > 0 ; len--)
{
- if (((byte)(*this)[utf8_pos]) >= 0x80)
+ if (((Shared::Platform::byte)(*this)[utf8_pos]) >= 0x80)
{
res << (char)(*this)[utf8_pos];
utf8_pos++;
- while (((byte)(*this)[utf8_pos]) >= 0x80 && ((byte)(*this)[utf8_pos]) < 0xC0)
+ while (((Shared::Platform::byte)(*this)[utf8_pos]) >= 0x80 && ((Shared::Platform::byte)(*this)[utf8_pos]) < 0xC0)
{
res << (char)(*this)[utf8_pos];
utf8_pos++;
@@ -647,8 +647,8 @@ namespace Shared { namespace Util {
int String::sizeUTF8() const
{
int len = 0;
- for(int i = 0 ; i < this->size() ; i++)
- if (((byte)(*this)[i]) >= 0xC0 || ((byte)(*this)[i]) < 0x80)
+ for(unsigned int i = 0 ; i < this->size() ; i++)
+ if (((Shared::Platform::byte)(*this)[i]) >= 0xC0 || ((Shared::Platform::byte)(*this)[i]) < 0x80)
len++;
return len;
}
@@ -671,18 +671,18 @@ namespace Shared { namespace Util {
void WString::fromUtf8(const char* str, size_t length)
{
int len = 0;
- for(int i = 0 ; i < length; i++)
+ for(unsigned int i = 0 ; i < length; i++)
{
- if (((byte)str[i]) < 0x80)
+ if (((Shared::Platform::byte)str[i]) < 0x80)
{
- pBuffer[len++] = ((byte)str[i]);
+ pBuffer[len++] = ((Shared::Platform::byte)str[i]);
continue;
}
- if (((byte)str[i]) >= 0xC0)
+ if (((Shared::Platform::byte)str[i]) >= 0xC0)
{
- wchar_t c = ((byte)str[i++]) - 0xC0;
- while(((byte)str[i]) >= 0x80)
- c = (c << 6) | (((byte)str[i++]) - 0x80);
+ wchar_t c = ((Shared::Platform::byte)str[i++]) - 0xC0;
+ while(((Shared::Platform::byte)str[i]) >= 0x80)
+ c = (c << 6) | (((Shared::Platform::byte)str[i++]) - 0x80);
--i;
pBuffer[len++] = c;
continue;