Convert C-style pointer casts to named casts

This commit is contained in:
Tulio Leao 2020-03-28 09:00:33 -03:00
parent 8920c36170
commit 2bb3a34274
8 changed files with 21 additions and 20 deletions

View File

@ -330,7 +330,7 @@ namespace OpenRCT2::Audio
// Finally mix on to destination buffer
size_t dstLength = std::min(length, bufferLen);
SDL_MixAudioFormat(data, (const uint8_t*)buffer, _format.format, (uint32_t)dstLength, mixVolume);
SDL_MixAudioFormat(data, static_cast<const uint8_t*>(buffer), _format.format, (uint32_t)dstLength, mixVolume);
channel->UpdateOldVolume();
}
@ -357,7 +357,7 @@ namespace OpenRCT2::Audio
uint32_t inLen = srcSamples;
uint32_t outLen = dstSamples;
speex_resampler_process_interleaved_int(
resampler, (const spx_int16_t*)srcBuffer, &inLen, (spx_int16_t*)_effectBuffer.data(), &outLen);
resampler, static_cast<const spx_int16_t*>(srcBuffer), &inLen, (spx_int16_t*)_effectBuffer.data(), &outLen);
return outLen * byteRate;
}
@ -369,10 +369,10 @@ namespace OpenRCT2::Audio
switch (_format.format)
{
case AUDIO_S16SYS:
EffectPanS16(channel, (int16_t*)buffer, (int32_t)(len / sampleSize));
EffectPanS16(channel, static_cast<int16_t*>(buffer), (int32_t)(len / sampleSize));
break;
case AUDIO_U8:
EffectPanU8(channel, (uint8_t*)buffer, (int32_t)(len / sampleSize));
EffectPanU8(channel, static_cast<uint8_t*>(buffer), (int32_t)(len / sampleSize));
break;
}
}
@ -417,10 +417,10 @@ namespace OpenRCT2::Audio
switch (_format.format)
{
case AUDIO_S16SYS:
EffectFadeS16((int16_t*)buffer, fadeLength, startVolume, endVolume);
EffectFadeS16(static_cast<int16_t*>(buffer), fadeLength, startVolume, endVolume);
break;
case AUDIO_U8:
EffectFadeU8((uint8_t*)buffer, fadeLength, startVolume, endVolume);
EffectFadeU8(static_cast<uint8_t*>(buffer), fadeLength, startVolume, endVolume);
break;
}
}
@ -494,7 +494,7 @@ namespace OpenRCT2::Audio
{
size_t reqConvertBufferCapacity = len * cvt->len_mult;
_convertBuffer.resize(reqConvertBufferCapacity);
std::copy_n((const uint8_t*)src, len, _convertBuffer.data());
std::copy_n(static_cast<const uint8_t*>(src), len, _convertBuffer.data());
cvt->len = (int32_t)len;
cvt->buf = (uint8_t*)_convertBuffer.data();

View File

@ -264,7 +264,7 @@ private:
int32_t padding = pitch - (width * 4);
if (pitch == width * 4)
{
uint32_t* dst = (uint32_t*)pixels;
uint32_t* dst = static_cast<uint32_t*>(pixels);
for (int32_t i = width * height; i > 0; i--)
{
*dst++ = palette[*src++];
@ -274,7 +274,7 @@ private:
{
if (pitch == (width * 2) + padding)
{
uint16_t* dst = (uint16_t*)pixels;
uint16_t* dst = static_cast<uint16_t*>(pixels);
for (int32_t y = height; y > 0; y--)
{
for (int32_t x = width; x > 0; x--)
@ -288,7 +288,7 @@ private:
}
else if (pitch == width + padding)
{
uint8_t* dst = (uint8_t*)pixels;
uint8_t* dst = static_cast<uint8_t*>(pixels);
for (int32_t y = height; y > 0; y--)
{
for (int32_t x = width; x > 0; x--)

View File

@ -603,7 +603,7 @@ static void widget_checkbox_draw(rct_drawpixelinfo* dpi, rct_window* w, rct_widg
if (widget_is_pressed(w, widgetIndex))
{
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
gfx_draw_string(dpi, (char*)CheckBoxMarkString, NOT_TRANSLUCENT(colour), l, yMid - 5);
gfx_draw_string(dpi, static_cast<const char*>(CheckBoxMarkString), NOT_TRANSLUCENT(colour), l, yMid - 5);
}
// draw the text
@ -701,7 +701,7 @@ static void widget_hscrollbar_draw(
uint8_t flags = (scroll->flags & HSCROLLBAR_LEFT_PRESSED) ? INSET_RECT_FLAG_BORDER_INSET : 0;
gfx_fill_rect_inset(dpi, l, t, l + 9, b, colour, flags);
gfx_draw_string(dpi, (char*)BlackLeftArrowString, COLOUR_BLACK, l + 1, t);
gfx_draw_string(dpi, static_cast<const char*>(BlackLeftArrowString), COLOUR_BLACK, l + 1, t);
}
// Thumb
@ -718,7 +718,7 @@ static void widget_hscrollbar_draw(
uint8_t flags = (scroll->flags & HSCROLLBAR_RIGHT_PRESSED) ? INSET_RECT_FLAG_BORDER_INSET : 0;
gfx_fill_rect_inset(dpi, r - 9, t, r, b, colour, flags);
gfx_draw_string(dpi, (char*)BlackRightArrowString, COLOUR_BLACK, r - 6, t);
gfx_draw_string(dpi, static_cast<const char*>(BlackRightArrowString), COLOUR_BLACK, r - 6, t);
}
}
@ -737,7 +737,7 @@ static void widget_vscrollbar_draw(
// Up button
gfx_fill_rect_inset(
dpi, l, t, r, t + 9, colour, ((scroll->flags & VSCROLLBAR_UP_PRESSED) ? INSET_RECT_FLAG_BORDER_INSET : 0));
gfx_draw_string(dpi, (char*)BlackUpArrowString, COLOUR_BLACK, l + 1, t - 1);
gfx_draw_string(dpi, static_cast<const char*>(BlackUpArrowString), COLOUR_BLACK, l + 1, t - 1);
// Thumb
gfx_fill_rect_inset(
@ -747,7 +747,7 @@ static void widget_vscrollbar_draw(
// Down button
gfx_fill_rect_inset(
dpi, l, b - 9, r, b, colour, ((scroll->flags & VSCROLLBAR_DOWN_PRESSED) ? INSET_RECT_FLAG_BORDER_INSET : 0));
gfx_draw_string(dpi, (char*)BlackDownArrowString, COLOUR_BLACK, l + 1, b - 9);
gfx_draw_string(dpi, static_cast<const char*>(BlackDownArrowString), COLOUR_BLACK, l + 1, b - 9);
}
/**

View File

@ -199,7 +199,7 @@ static void window_changelog_scrollpaint(rct_window* w, rct_drawpixelinfo* dpi,
if (y + lineHeight < dpi->y || y >= dpi->y + dpi->height)
continue;
gfx_draw_string(dpi, (char*)line, w->colours[0], x, y);
gfx_draw_string(dpi, static_cast<const char*>(line), w->colours[0], x, y);
}
}

View File

@ -1147,7 +1147,7 @@ static void window_editor_object_selection_scrollpaint(rct_window* w, rct_drawpi
if (*listItem.flags & (OBJECT_SELECTION_FLAG_IN_USE | OBJECT_SELECTION_FLAG_ALWAYS_REQUIRED))
colour2 |= COLOUR_FLAG_INSET;
gfx_draw_string(dpi, (char*)CheckBoxMarkString, colour2, x, y);
gfx_draw_string(dpi, static_cast<const char*>(CheckBoxMarkString), colour2, x, y);
}
x = gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER ? 0 : 15;

View File

@ -1175,7 +1175,7 @@ static void window_editor_objective_options_rides_scrollpaint(rct_window* w, rct
{
gCurrentFontSpriteBase = stringId == STR_WINDOW_COLOUR_2_STRINGID ? FONT_SPRITE_BASE_MEDIUM_EXTRA_DARK
: FONT_SPRITE_BASE_MEDIUM_DARK;
gfx_draw_string(dpi, (char*)CheckBoxMarkString, w->colours[1] & 0x7F, 2, y);
gfx_draw_string(dpi, static_cast<const char*>(CheckBoxMarkString), w->colours[1] & 0x7F, 2, y);
}
// Ride name

View File

@ -756,7 +756,7 @@ static void window_multiplayer_groups_mouseup(rct_window* w, rct_widgetindex wid
case WIDX_RENAME_GROUP:;
int32_t groupIndex = network_get_group_index(_selectedGroup);
const utf8* groupName = network_get_group_name(groupIndex);
window_text_input_raw_open(w, widgetIndex, STR_GROUP_NAME, STR_ENTER_NEW_NAME_FOR_THIS_GROUP, (utf8*)groupName, 32);
window_text_input_raw_open(w, widgetIndex, STR_GROUP_NAME, STR_ENTER_NEW_NAME_FOR_THIS_GROUP, groupName, 32);
break;
}
}

View File

@ -921,7 +921,8 @@ void window_themes_scrollpaint(rct_window* w, rct_drawpixelinfo* dpi, int32_t sc
{
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM_DARK;
gfx_draw_string(
dpi, (char*)CheckBoxMarkString, w->colours[1] & 0x7F, _button_offset_x + 12 * j, y + _check_offset_y);
dpi, static_cast<const char*>(CheckBoxMarkString), w->colours[1] & 0x7F, _button_offset_x + 12 * j,
y + _check_offset_y);
}
}
}