History

Use intptr_t instead of long for casting pointers to integers

This fixes building on mingw-w64. Include stdint.h on everything except MSVC for definitions of common standard types, include stddef.h on MSVC instead, since MSVC doesn't have stdint.h in all older versions that are supposed to be supported, but MSVC always defines intptr_t via stddef.h.

Martin Storsjö committed 12 years ago

Commit 41a25161 parent eeb11572 files · +7 −10Browse files

Showing the changes to codec/processing/src (2 of 2 files). Show all

Unified · Split

2 files
  1. codec/processing/src/common/typedef.h +6 −9
  2. codec/processing/src/common/util.h +1 −1
codec/processing/src/common/typedef.h+6−9
@@ -50,6 +50,12 @@ · 49 unmodified lines
5050 #define WELSVP_NAMESPACE_BEGIN namespace nsWelsVP {
5151 #define WELSVP_NAMESPACE_END }
5252
53+#ifdef _MSC_VER
54+#include <stddef.h>
55+#else
56+#include <stdint.h>
57+#endif
58+
5359 WELSVP_NAMESPACE_BEGIN
5460
5561 #if ( defined(_WIN32) || defined(_WIN32) ) && defined(_MSC_VER)
@@ -66,15 +72,6 @@ typedef unsigned __int64 uint64_t ; · 10 unmodified lines
6672
6773 #else // GCC
6874
69−typedef signed char int8_t
70−; // [comment]: some compilers may identify the type "char" as "unsigned char" as default, so declare it explicit
71−typedef unsigned char uint8_t ;
72−typedef signed short int16_t ;
73−typedef unsigned short uint16_t ;
74−typedef signed int int32_t ;
75−typedef unsigned int uint32_t ;
76−typedef long long int64_t ;
77−typedef unsigned long long uint64_t ;
7875 #define inline_t inline
7976
8077 #endif
codec/processing/src/common/util.h+1−1
@@ -77,7 +77,7 @@ WELSVP_NAMESPACE_BEGIN · 76 unmodified lines
7777 #define WELS_ALIGN4(iInput) ((iInput+3) & ~3)
7878 #define WELS_ALIGN8(iInput) ((iInput+7) & ~7)
7979
80−#define WelsCastFromPointer(p) (reinterpret_cast<long_t>(p))
80+#define WelsCastFromPointer(p) (reinterpret_cast<intptr_t>(p))
8181 #define WelsStaticCast(type, p) (static_cast<type>(p))
8282 #define WelsDynamicCast(type, p) (dynamic_cast<type>(p))
8383

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t