PS2, VITA: Fix void pointer arithmetic warnings (#14995)

This commit is contained in:
RaceTheMaSe
2026-02-07 18:39:33 +01:00
committed by GitHub
parent 4f183506f6
commit 863912aa03
2 changed files with 20 additions and 20 deletions

View File

@@ -450,7 +450,7 @@ static bool PS2_RenderGeometry(SDL_Renderer *renderer, void *vertices, SDL_Rende
PS2_SetBlendMode(data, cmd->data.draw.blend);
if (cmd->data.draw.texture) {
const GSPRIMUVPOINT *verts = (GSPRIMUVPOINT *) (vertices + cmd->data.draw.first);
const GSPRIMUVPOINT *verts = (GSPRIMUVPOINT *) ((Uint8*)vertices + cmd->data.draw.first);
GSTEXTURE *ps2_tex = (GSTEXTURE *)cmd->data.draw.texture->internal;
switch (cmd->data.draw.texture_scale_mode) {
@@ -467,7 +467,7 @@ static bool PS2_RenderGeometry(SDL_Renderer *renderer, void *vertices, SDL_Rende
gsKit_TexManager_bind(data->gsGlobal, ps2_tex);
gsKit_prim_list_triangle_goraud_texture_uv_3d(data->gsGlobal, ps2_tex, count, verts);
} else {
const GSPRIMPOINT *verts = (GSPRIMPOINT *)(vertices + cmd->data.draw.first);
const GSPRIMPOINT *verts = (GSPRIMPOINT *)((Uint8*)vertices + cmd->data.draw.first);
gsKit_prim_list_triangle_gouraud_3d(data->gsGlobal, count, verts);
}
@@ -478,7 +478,7 @@ static bool PS2_RenderLines(SDL_Renderer *renderer, void *vertices, SDL_RenderCo
{
PS2_RenderData *data = (PS2_RenderData *)renderer->internal;
const size_t count = cmd->data.draw.count;
const GSPRIMPOINT *verts = (GSPRIMPOINT *)(vertices + cmd->data.draw.first);
const GSPRIMPOINT *verts = (GSPRIMPOINT *)((Uint8*)vertices + cmd->data.draw.first);
PS2_SetBlendMode(data, cmd->data.draw.blend);
gsKit_prim_list_line_goraud_3d(data->gsGlobal, count, verts);
@@ -491,7 +491,7 @@ static bool PS2_RenderPoints(SDL_Renderer *renderer, void *vertices, SDL_RenderC
{
PS2_RenderData *data = (PS2_RenderData *)renderer->internal;
const size_t count = cmd->data.draw.count;
const GSPRIMPOINT *verts = (GSPRIMPOINT *)(vertices + cmd->data.draw.first);
const GSPRIMPOINT *verts = (GSPRIMPOINT *)((Uint8*)vertices + cmd->data.draw.first);
PS2_SetBlendMode(data, cmd->data.draw.blend);
gsKit_prim_list_points(data->gsGlobal, count, verts);

View File

@@ -349,25 +349,25 @@ static bool VITA_GXM_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture,
length = rect->w * SDL_BYTESPERPIXEL(texture->format);
if (length == pitch && length == dpitch) {
SDL_memcpy(dst, pixels, length * rect->h);
pixels += pitch * rect->h;
pixels = (const Uint8 *)pixels + pitch * rect->h;
} else {
for (row = 0; row < rect->h; ++row) {
SDL_memcpy(dst, pixels, length);
pixels += pitch;
pixels = (const Uint8 *)pixels + pitch;
dst += dpitch;
}
}
#ifdef SDL_HAVE_YUV
if (vita_texture->yuv) {
void *Udst;
void *Vdst;
Uint8 *Udst;
Uint8 *Vdst;
int uv_pitch = (dpitch + 1) / 2;
int uv_src_pitch = (pitch + 1) / 2;
SDL_Rect UVrect = { rect->x / 2, rect->y / 2, (rect->w + 1) / 2, (rect->h + 1) / 2 };
// skip Y plane
Uint8 *Dpixels = gxm_texture_get_datap(vita_texture->tex) + (vita_texture->pitch * vita_texture->h);
Uint8 *Dpixels = (Uint8*)gxm_texture_get_datap(vita_texture->tex) + (vita_texture->pitch * vita_texture->h);
Udst = Dpixels + (UVrect.y * uv_pitch) + UVrect.x;
Vdst = Dpixels + (uv_pitch * ((vita_texture->h + 1) / 2)) + (UVrect.y * uv_pitch) + UVrect.x;
@@ -377,11 +377,11 @@ static bool VITA_GXM_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture,
// U plane
if (length == uv_src_pitch && length == uv_pitch) {
SDL_memcpy(Udst, pixels, length * UVrect.h);
pixels += uv_src_pitch * UVrect.h;
pixels = (const Uint8 *)pixels + uv_src_pitch * UVrect.h;
} else {
for (row = 0; row < UVrect.h; ++row) {
SDL_memcpy(Udst, pixels, length);
pixels += uv_src_pitch;
pixels = (const Uint8 *)pixels + uv_src_pitch;
Udst += uv_pitch;
}
}
@@ -392,19 +392,19 @@ static bool VITA_GXM_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture,
} else {
for (row = 0; row < UVrect.h; ++row) {
SDL_memcpy(Vdst, pixels, length);
pixels += uv_src_pitch;
pixels = (const Uint8 *)pixels + uv_src_pitch;
Vdst += uv_pitch;
}
}
} else if (vita_texture->nv12) {
void *UVdst;
Uint8 *UVdst;
int uv_pitch = 2 * ((dpitch + 1) / 2);
int uv_src_pitch = 2 * ((pitch + 1) / 2);
SDL_Rect UVrect = { rect->x / 2, rect->y / 2, (rect->w + 1) / 2, (rect->h + 1) / 2 };
// skip Y plane
void *Dpixels = (void *)((Uint8 *)gxm_texture_get_datap(vita_texture->tex) + (vita_texture->pitch * vita_texture->h));
Uint8 *Dpixels = (Uint8 *)gxm_texture_get_datap(vita_texture->tex) + (vita_texture->pitch * vita_texture->h);
UVdst = Dpixels + (UVrect.y * uv_pitch) + UVrect.x;
length = UVrect.w * 2;
@@ -415,7 +415,7 @@ static bool VITA_GXM_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture,
} else {
for (row = 0; row < UVrect.h; ++row) {
SDL_memcpy(UVdst, pixels, length);
pixels += uv_src_pitch;
pixels = (const Uint8 *)pixels + uv_src_pitch;
UVdst += uv_pitch;
}
}
@@ -456,13 +456,13 @@ static bool VITA_GXM_UpdateTextureYUV(SDL_Renderer *renderer, SDL_Texture *textu
// U/V planes
{
void *Udst;
void *Vdst;
Uint8 *Udst;
Uint8 *Vdst;
VITA_GXM_TextureData *vita_texture = (VITA_GXM_TextureData *)texture->internal;
int uv_pitch = (dpitch + 1) / 2;
// skip Y plane
void *pixels = (void *)((Uint8 *)gxm_texture_get_datap(vita_texture->tex) + (vita_texture->pitch * vita_texture->h));
Uint8 *pixels = (Uint8 *)gxm_texture_get_datap(vita_texture->tex) + (vita_texture->pitch * vita_texture->h);
if (texture->format == SDL_PIXELFORMAT_YV12) { // YVU
Vdst = pixels + (UVrect.y * uv_pitch) + UVrect.x;
@@ -529,12 +529,12 @@ static bool VITA_GXM_UpdateTextureNV(SDL_Renderer *renderer, SDL_Texture *textur
// UV plane
{
void *UVdst;
Uint8 *UVdst;
VITA_GXM_TextureData *vita_texture = (VITA_GXM_TextureData *)texture->internal;
int uv_pitch = 2 * ((dpitch + 1) / 2);
// skip Y plane
void *pixels = (void *)((Uint8 *)gxm_texture_get_datap(vita_texture->tex) + (vita_texture->pitch * vita_texture->h));
Uint8 *pixels = (Uint8 *)gxm_texture_get_datap(vita_texture->tex) + (vita_texture->pitch * vita_texture->h);
UVdst = pixels + (UVrect.y * uv_pitch) + UVrect.x;