mirror of https://github.com/OpenRCT2/OpenRCT2.git
parent
32609791de
commit
f0bd05cf6d
|
@ -24,7 +24,7 @@ static const char* TryLoadAllProcAddresses()
|
|||
{
|
||||
# define OPENGL_PROC(TYPE, PROC) \
|
||||
{ \
|
||||
PROC = (TYPE)SDL_GL_GetProcAddress(#PROC); \
|
||||
PROC = reinterpret_cast<TYPE>(SDL_GL_GetProcAddress(#PROC)); \
|
||||
if (PROC == nullptr) \
|
||||
{ \
|
||||
return #PROC; \
|
||||
|
|
|
@ -266,7 +266,7 @@ void window_guest_list_refresh_list()
|
|||
GuestList.push_back(spriteIndex);
|
||||
}
|
||||
|
||||
std::sort(GuestList.begin(), GuestList.end(), [](const uint16_t a, const uint16_t b) { return peep_compare(&a, &b) < 0; });
|
||||
std::sort(GuestList.begin(), GuestList.end(), [](const uint16_t a, const uint16_t b) { return peep_compare(a, b) < 0; });
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -200,7 +200,7 @@ void WindowStaffListRefresh()
|
|||
StaffList.push_back(spriteIndex);
|
||||
}
|
||||
|
||||
std::sort(StaffList.begin(), StaffList.end(), [](const uint16_t a, const uint16_t b) { return peep_compare(&a, &b) < 0; });
|
||||
std::sort(StaffList.begin(), StaffList.end(), [](const uint16_t a, const uint16_t b) { return peep_compare(a, b) < 0; });
|
||||
}
|
||||
|
||||
static void window_staff_list_cancel_tools(rct_window* w)
|
||||
|
|
|
@ -46,9 +46,8 @@ static void fixup_pointers(paint_session* s, size_t paint_session_entries, size_
|
|||
}
|
||||
else
|
||||
{
|
||||
s[i].PaintStructs[j].basic.next_quadrant_ps = &s[i].PaintStructs
|
||||
[(uintptr_t)s[i].PaintStructs[j].basic.next_quadrant_ps]
|
||||
.basic;
|
||||
auto nextQuadrantPs = reinterpret_cast<uintptr_t>(s[i].PaintStructs[j].basic.next_quadrant_ps);
|
||||
s[i].PaintStructs[j].basic.next_quadrant_ps = &s[i].PaintStructs[nextQuadrantPs].basic;
|
||||
}
|
||||
}
|
||||
for (size_t j = 0; j < quadrant_entries; j++)
|
||||
|
|
|
@ -183,7 +183,7 @@ private:
|
|||
{
|
||||
// Read PEM data via BIO buffer
|
||||
// HACK first parameter is not const on MINGW for some reason
|
||||
auto bio = BIO_new_mem_buf((void*)pem.data(), static_cast<int>(pem.size()));
|
||||
auto bio = BIO_new_mem_buf(static_cast<const void*>(pem.data()), static_cast<int>(pem.size()));
|
||||
if (bio == nullptr)
|
||||
{
|
||||
throw std::runtime_error("BIO_new_mem_buf failed");
|
||||
|
@ -307,7 +307,7 @@ public:
|
|||
status = EVP_DigestVerifyUpdate(mdctx, data, dataLen);
|
||||
OpenSSLThrowOnBadStatus("EVP_DigestVerifyUpdate", status);
|
||||
|
||||
status = EVP_DigestVerifyFinal(mdctx, (uint8_t*)sig, sigLen);
|
||||
status = EVP_DigestVerifyFinal(mdctx, static_cast<const uint8_t*>(sig), sigLen);
|
||||
if (status != 0 && status != 1)
|
||||
{
|
||||
OpenSSLThrowOnBadStatus("EVP_DigestVerifyUpdate", status);
|
||||
|
|
|
@ -24,7 +24,7 @@ MemoryStream::MemoryStream(const MemoryStream& copy)
|
|||
{
|
||||
_data = Memory::Allocate<void>(_dataCapacity);
|
||||
std::memcpy(_data, copy._data, _dataCapacity);
|
||||
_position = (void*)((uintptr_t)_data + copy.GetPosition());
|
||||
_position = reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(_data) + copy.GetPosition());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -115,7 +115,7 @@ uint64_t MemoryStream::GetLength() const
|
|||
|
||||
uint64_t MemoryStream::GetPosition() const
|
||||
{
|
||||
return static_cast<uint64_t>((uintptr_t)_position - (uintptr_t)_data);
|
||||
return static_cast<uint64_t>(reinterpret_cast<uintptr_t>(_position) - reinterpret_cast<uintptr_t>(_data));
|
||||
}
|
||||
|
||||
void MemoryStream::SetPosition(uint64_t position)
|
||||
|
@ -144,7 +144,7 @@ void MemoryStream::Seek(int64_t offset, int32_t origin)
|
|||
{
|
||||
throw IOException("New position out of bounds.");
|
||||
}
|
||||
_position = (void*)((uintptr_t)_data + static_cast<uintptr_t>(newPosition));
|
||||
_position = reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(_data) + static_cast<uintptr_t>(newPosition));
|
||||
}
|
||||
|
||||
void MemoryStream::Read(void* buffer, uint64_t length)
|
||||
|
@ -156,7 +156,7 @@ void MemoryStream::Read(void* buffer, uint64_t length)
|
|||
}
|
||||
|
||||
std::memcpy(buffer, _position, length);
|
||||
_position = (void*)((uintptr_t)_position + length);
|
||||
_position = reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(_position) + length);
|
||||
}
|
||||
|
||||
void MemoryStream::Read1(void* buffer)
|
||||
|
@ -209,7 +209,7 @@ void MemoryStream::Write(const void* buffer, uint64_t length)
|
|||
}
|
||||
|
||||
std::memcpy(_position, buffer, length);
|
||||
_position = (void*)((uintptr_t)_position + length);
|
||||
_position = reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(_position) + length);
|
||||
_dataSize = std::max<size_t>(_dataSize, static_cast<size_t>(nextPosition));
|
||||
}
|
||||
|
||||
|
@ -251,6 +251,6 @@ void MemoryStream::EnsureCapacity(size_t capacity)
|
|||
uint64_t position = GetPosition();
|
||||
_dataCapacity = newCapacity;
|
||||
_data = Memory::Reallocate(_data, _dataCapacity);
|
||||
_position = (void*)((uintptr_t)_data + static_cast<uintptr_t>(position));
|
||||
_position = reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(_data) + static_cast<uintptr_t>(position));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ public:
|
|||
}
|
||||
|
||||
std::memcpy(buffer, _position, N);
|
||||
_position = (void*)((uintptr_t)_position + N);
|
||||
_position = reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(_position) + N);
|
||||
}
|
||||
|
||||
void Write(const void* buffer, uint64_t length) override;
|
||||
|
@ -102,7 +102,7 @@ public:
|
|||
}
|
||||
|
||||
std::memcpy(_position, buffer, N);
|
||||
_position = (void*)((uintptr_t)_position + N);
|
||||
_position = reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(_position) + N);
|
||||
_dataSize = std::max<size_t>(_dataSize, static_cast<size_t>(nextPosition));
|
||||
}
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ namespace String
|
|||
icu::UnicodeString str = icu::UnicodeString::fromUTF32(reinterpret_cast<const UChar32*>(src.data()), src.length());
|
||||
# elif U_SIZEOF_WCHAR_T == 2
|
||||
std::wstring wstr = std::wstring(src);
|
||||
icu::UnicodeString str = icu::UnicodeString((const wchar_t*)wstr.c_str());
|
||||
icu::UnicodeString str = icu::UnicodeString(static_cast<const wchar_t*>(wstr.c_str()));
|
||||
# else
|
||||
# error Unsupported U_SIZEOF_WCHAR_T size
|
||||
# endif
|
||||
|
@ -120,7 +120,7 @@ namespace String
|
|||
|
||||
# elif U_SIZEOF_WCHAR_T == 2
|
||||
const char16_t* buffer = str.getBuffer();
|
||||
std::wstring result = (wchar_t*)buffer;
|
||||
std::wstring result = static_cast<wchar_t*>(buffer);
|
||||
|
||||
# else
|
||||
# error Unsupported U_SIZEOF_WCHAR_T size
|
||||
|
|
|
@ -163,7 +163,7 @@ JNIEXPORT jlong JNICALL Java_io_openrct2_ZipArchive_allocBytes(JNIEnv* env, jcla
|
|||
|
||||
env->ReleaseByteArrayElements(input, bufferPtr, 0);
|
||||
|
||||
return (uintptr_t)data;
|
||||
return reinterpret_cast<uintptr_t>(data);
|
||||
}
|
||||
|
||||
#endif // __ANDROID__
|
||||
|
|
|
@ -103,7 +103,7 @@ static void read_and_convert_gxdat(IStream* stream, size_t count, bool is_rctc,
|
|||
|
||||
// Double cast to silence compiler warning about casting to
|
||||
// pointer from integer of mismatched length.
|
||||
elements[i].offset = (uint8_t*)static_cast<uintptr_t>(src.offset);
|
||||
elements[i].offset = reinterpret_cast<uint8_t*>(static_cast<uintptr_t>(src.offset));
|
||||
elements[i].width = src.width;
|
||||
elements[i].height = src.height;
|
||||
elements[i].x_offset = src.x_offset;
|
||||
|
@ -142,7 +142,7 @@ static void read_and_convert_gxdat(IStream* stream, size_t count, bool is_rctc,
|
|||
|
||||
// Double cast to silence compiler warning about casting to
|
||||
// pointer from integer of mismatched length.
|
||||
elements[i].offset = (uint8_t*)static_cast<uintptr_t>(src.offset);
|
||||
elements[i].offset = reinterpret_cast<uint8_t*>(static_cast<uintptr_t>(src.offset));
|
||||
elements[i].width = src.width;
|
||||
elements[i].height = src.height;
|
||||
elements[i].x_offset = src.x_offset;
|
||||
|
@ -218,7 +218,7 @@ bool gfx_load_g1(const IPlatformEnvironment& env)
|
|||
// Fix entry data offsets
|
||||
for (uint32_t i = 0; i < _g1.header.num_entries; i++)
|
||||
{
|
||||
_g1.elements[i].offset += (uintptr_t)_g1.data;
|
||||
_g1.elements[i].offset += reinterpret_cast<uintptr_t>(_g1.data);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -281,7 +281,7 @@ bool gfx_load_g2()
|
|||
// Fix entry data offsets
|
||||
for (uint32_t i = 0; i < _g2.header.num_entries; i++)
|
||||
{
|
||||
_g2.elements[i].offset += (uintptr_t)_g2.data;
|
||||
_g2.elements[i].offset += reinterpret_cast<uintptr_t>(_g2.data);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -338,7 +338,7 @@ bool gfx_load_csg()
|
|||
// Fix entry data offsets
|
||||
for (uint32_t i = 0; i < _csg.header.num_entries; i++)
|
||||
{
|
||||
_csg.elements[i].offset += (uintptr_t)_csg.data;
|
||||
_csg.elements[i].offset += reinterpret_cast<uintptr_t>(_csg.data);
|
||||
// RCT1 used zoomed offsets that counted from the beginning of the file, rather than from the current sprite.
|
||||
if (_csg.elements[i].flags & G1_FLAG_HAS_ZOOM_SPRITE)
|
||||
{
|
||||
|
|
|
@ -1008,7 +1008,7 @@ void lightfx_render_to_texture(
|
|||
for (uint32_t y = 0; y < height; y++)
|
||||
{
|
||||
uintptr_t dstOffset = static_cast<uintptr_t>(y * dstPitch);
|
||||
uint32_t* dst = (uint32_t*)((uintptr_t)dstPixels + dstOffset);
|
||||
uint32_t* dst = reinterpret_cast<uint32_t*>(reinterpret_cast<uintptr_t>(dstPixels) + dstOffset);
|
||||
for (uint32_t x = 0; x < width; x++)
|
||||
{
|
||||
uint8_t* src = &bits[y * width + x];
|
||||
|
|
|
@ -183,7 +183,7 @@ static void ttf_close_font(TTF_Font* font)
|
|||
|
||||
static uint32_t ttf_surface_cache_hash(TTF_Font* font, const utf8* text)
|
||||
{
|
||||
uint32_t hash = static_cast<uint32_t>((((uintptr_t)font * 23) ^ 0xAAAAAAAA) & 0xFFFFFFFF);
|
||||
uint32_t hash = static_cast<uint32_t>(((reinterpret_cast<uintptr_t>(font) * 23) ^ 0xAAAAAAAA) & 0xFFFFFFFF);
|
||||
for (const utf8* ch = text; *ch != 0; ch++)
|
||||
{
|
||||
hash = ror32(hash, 3) ^ (*ch * 13);
|
||||
|
|
|
@ -205,7 +205,7 @@ static void TTF_initLineMectrics(const TTF_Font* font, const TTFSurface* textbuf
|
|||
uint8_t* dst;
|
||||
int height;
|
||||
|
||||
dst = (uint8_t*)textbuf->pixels;
|
||||
dst = const_cast<uint8_t*>(static_cast<const uint8_t*>(textbuf->pixels));
|
||||
if (row > 0)
|
||||
{
|
||||
dst += row * textbuf->pitch;
|
||||
|
@ -228,7 +228,7 @@ outline into account.
|
|||
static void TTF_drawLine_Solid(const TTF_Font* font, const TTFSurface* textbuf, const int row)
|
||||
{
|
||||
int line;
|
||||
uint8_t* dst_check = (uint8_t*)textbuf->pixels + textbuf->pitch * textbuf->h;
|
||||
uint8_t* dst_check = const_cast<uint8_t*>(static_cast<const uint8_t*>(textbuf->pixels)) + textbuf->pitch * textbuf->h;
|
||||
uint8_t* dst;
|
||||
int height;
|
||||
|
||||
|
@ -250,7 +250,7 @@ static void TTF_drawLine_Solid(const TTF_Font* font, const TTFSurface* textbuf,
|
|||
static void TTF_drawLine_Shaded(const TTF_Font* font, const TTFSurface* textbuf, const int row)
|
||||
{
|
||||
int line;
|
||||
uint8_t* dst_check = (uint8_t*)textbuf->pixels + textbuf->pitch * textbuf->h;
|
||||
uint8_t* dst_check = const_cast<uint8_t*>(static_cast<const uint8_t*>(textbuf->pixels)) + textbuf->pitch * textbuf->h;
|
||||
uint8_t* dst;
|
||||
int height;
|
||||
|
||||
|
@ -1296,7 +1296,7 @@ TTFSurface* TTF_RenderUTF8_Solid(TTF_Font* font, const char* text, [[maybe_unuse
|
|||
|
||||
/* Adding bound checking to avoid all kinds of memory corruption errors
|
||||
that may occur. */
|
||||
dst_check = (uint8_t*)textbuf->pixels + textbuf->pitch * textbuf->h;
|
||||
dst_check = const_cast<uint8_t*>(static_cast<const uint8_t*>(textbuf->pixels)) + textbuf->pitch * textbuf->h;
|
||||
|
||||
/* check kerning */
|
||||
use_kerning = FT_HAS_KERNING(font->face) && font->kerning;
|
||||
|
@ -1355,7 +1355,8 @@ TTFSurface* TTF_RenderUTF8_Solid(TTF_Font* font, const char* text, [[maybe_unuse
|
|||
{
|
||||
continue;
|
||||
}
|
||||
dst = (uint8_t*)textbuf->pixels + (row + glyph->yoffset) * textbuf->pitch + xstart + glyph->minx;
|
||||
dst = const_cast<uint8_t*>(static_cast<const uint8_t*>(textbuf->pixels)) + (row + glyph->yoffset) * textbuf->pitch
|
||||
+ xstart + glyph->minx;
|
||||
src = current->buffer + row * current->pitch;
|
||||
|
||||
for (col = width; col > 0 && dst < dst_check; --col)
|
||||
|
@ -1428,7 +1429,7 @@ TTFSurface* TTF_RenderUTF8_Shaded(TTF_Font* font, const char* text, [[maybe_unus
|
|||
|
||||
/* Adding bound checking to avoid all kinds of memory corruption errors
|
||||
that may occur. */
|
||||
dst_check = (uint8_t*)textbuf->pixels + textbuf->pitch * textbuf->h;
|
||||
dst_check = const_cast<uint8_t*>(static_cast<const uint8_t*>(textbuf->pixels)) + textbuf->pitch * textbuf->h;
|
||||
|
||||
/* check kerning */
|
||||
use_kerning = FT_HAS_KERNING(font->face) && font->kerning;
|
||||
|
@ -1492,7 +1493,8 @@ TTFSurface* TTF_RenderUTF8_Shaded(TTF_Font* font, const char* text, [[maybe_unus
|
|||
continue;
|
||||
}
|
||||
|
||||
dst = (uint8_t*)textbuf->pixels + (row + glyph->yoffset) * textbuf->pitch + xstart + glyph->minx;
|
||||
dst = const_cast<uint8_t*>(static_cast<const uint8_t*>(textbuf->pixels)) + (row + glyph->yoffset) * textbuf->pitch
|
||||
+ xstart + glyph->minx;
|
||||
src = current->buffer + row * current->pitch;
|
||||
|
||||
for (col = width; col > 0 && dst < dst_check; --col)
|
||||
|
|
|
@ -71,7 +71,7 @@ void NetworkPacket::Write(const uint8_t* bytes, size_t size)
|
|||
|
||||
void NetworkPacket::WriteString(const utf8* string)
|
||||
{
|
||||
Write((uint8_t*)string, strlen(string) + 1);
|
||||
Write(reinterpret_cast<const uint8_t*>(string), strlen(string) + 1);
|
||||
}
|
||||
|
||||
const uint8_t* NetworkPacket::Read(size_t size)
|
||||
|
|
|
@ -57,7 +57,7 @@ void ImageTable::Read(IReadObjectContext* context, IStream* stream)
|
|||
}
|
||||
|
||||
// Read g1 element headers
|
||||
uintptr_t imageDataBase = (uintptr_t)data.get();
|
||||
uintptr_t imageDataBase = reinterpret_cast<uintptr_t>(data.get());
|
||||
std::vector<rct_g1_element> newEntries;
|
||||
for (uint32_t i = 0; i < numImages; i++)
|
||||
{
|
||||
|
|
|
@ -3251,10 +3251,10 @@ rct_string_id get_real_name_string_id_from_id(uint32_t id)
|
|||
return dx;
|
||||
}
|
||||
|
||||
int32_t peep_compare(const void* sprite_index_a, const void* sprite_index_b)
|
||||
int32_t peep_compare(const uint16_t sprite_index_a, const uint16_t sprite_index_b)
|
||||
{
|
||||
Peep const* peep_a = GET_PEEP(*(uint16_t*)sprite_index_a);
|
||||
Peep const* peep_b = GET_PEEP(*(uint16_t*)sprite_index_b);
|
||||
Peep const* peep_a = GET_PEEP(sprite_index_a);
|
||||
Peep const* peep_b = GET_PEEP(sprite_index_b);
|
||||
|
||||
// Compare types
|
||||
if (peep_a->type != peep_b->type)
|
||||
|
|
|
@ -1044,7 +1044,7 @@ void peep_window_state_update(Peep* peep);
|
|||
void peep_decrement_num_riders(Peep* peep);
|
||||
|
||||
void peep_set_map_tooltip(Peep* peep);
|
||||
int32_t peep_compare(const void* sprite_index_a, const void* sprite_index_b);
|
||||
int32_t peep_compare(const uint16_t sprite_index_a, const uint16_t sprite_index_b);
|
||||
|
||||
void SwitchToSpecialSprite(Peep* peep, uint8_t special_sprite_id);
|
||||
void peep_update_names(bool realNames);
|
||||
|
|
Loading…
Reference in New Issue