mirror of
https://github.com/zeldaret/tp
synced 2026-07-08 22:44:44 -04:00
More GCC compatibility/warning fixes (#3118)
* Wrap >4-char literals in a MULTI_CHAR macro Modern compilers do not support CW's non-standard behavior with >4 char literals. We can, however, use a constexpr function to compute the u64 values directly. This leaves <=4 char literals unchanged. * Replace non-pointer usages of NULL with 0 * Define NULL to nullptr on C++11 and above * Fix more -Wpointer-arith and -Woverflow warnings * Replace u32/s32 with uintptr_t/intptr_t where appropriate * JSUOutputStream: Overload all standard int types
This commit is contained in:
@@ -18,30 +18,24 @@ public:
|
||||
s32 write(const void*, s32);
|
||||
void write(const char*);
|
||||
|
||||
JSUOutputStream& operator<<(u32 param_0) {
|
||||
write(¶m_0, sizeof(u32));
|
||||
return *this;
|
||||
#define JSU_OUTPUTSTREAM_OPERATOR(T) \
|
||||
JSUOutputStream& operator<<(T val) { \
|
||||
write(&val, sizeof(T)); \
|
||||
return *this; \
|
||||
}
|
||||
|
||||
JSUOutputStream& operator<<(s32 param_0) {
|
||||
write(¶m_0, sizeof(s32));
|
||||
return *this;
|
||||
}
|
||||
JSU_OUTPUTSTREAM_OPERATOR(signed char)
|
||||
JSU_OUTPUTSTREAM_OPERATOR(unsigned char)
|
||||
JSU_OUTPUTSTREAM_OPERATOR(signed short)
|
||||
JSU_OUTPUTSTREAM_OPERATOR(unsigned short)
|
||||
JSU_OUTPUTSTREAM_OPERATOR(int)
|
||||
JSU_OUTPUTSTREAM_OPERATOR(unsigned int)
|
||||
JSU_OUTPUTSTREAM_OPERATOR(signed long)
|
||||
JSU_OUTPUTSTREAM_OPERATOR(unsigned long)
|
||||
JSU_OUTPUTSTREAM_OPERATOR(signed long long)
|
||||
JSU_OUTPUTSTREAM_OPERATOR(unsigned long long)
|
||||
|
||||
JSUOutputStream& operator<<(s16 param_0) {
|
||||
write(¶m_0, sizeof(s16));
|
||||
return *this;
|
||||
}
|
||||
|
||||
JSUOutputStream& operator<<(u16 param_0) {
|
||||
write(¶m_0, sizeof(u16));
|
||||
return *this;
|
||||
}
|
||||
|
||||
JSUOutputStream& operator<<(u8 param_0) {
|
||||
write(¶m_0, sizeof(u8));
|
||||
return *this;
|
||||
}
|
||||
#undef JSU_OUTPUTSTREAM_OPERATOR
|
||||
|
||||
JSUOutputStream& operator<<(const char* param_0) {
|
||||
write(param_0);
|
||||
|
||||
@@ -20,7 +20,7 @@ T* JSUConvertOffsetToPtr(const void* ptr, uintptr_t offset) {
|
||||
template <typename T>
|
||||
T* JSUConvertOffsetToPtr(const void* ptr, const void* offset) {
|
||||
T* ret;
|
||||
if (offset == NULL) {
|
||||
if (offset == 0) {
|
||||
ret = NULL;
|
||||
} else {
|
||||
ret = (T*)((intptr_t)ptr + (intptr_t)offset);
|
||||
|
||||
Reference in New Issue
Block a user