mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-05-15 17:28:28 +00:00
Simpler pointer arithmetic
This commit is contained in:
parent
b80784fced
commit
02dceed760
2 changed files with 2 additions and 2 deletions
|
@ -747,7 +747,7 @@ const SDL_CameraSpec * const *SDL_GetCameraSupportedFormats(SDL_CameraID instanc
|
|||
int num_specs = device->num_specs;
|
||||
const SDL_CameraSpec **retval = (const SDL_CameraSpec **) SDL_malloc(((num_specs + 1) * sizeof(*retval)) + (num_specs * sizeof (**retval)));
|
||||
if (retval) {
|
||||
SDL_CameraSpec *specs = (SDL_CameraSpec *)((Uint8 *)retval + ((num_specs + 1) * sizeof(*retval)));
|
||||
SDL_CameraSpec *specs = (SDL_CameraSpec *)(retval + (num_specs + 1));
|
||||
SDL_memcpy(specs, device->all_specs, num_specs * sizeof(*specs));
|
||||
for (i = 0; i < num_specs; ++i) {
|
||||
retval[i] = specs++;
|
||||
|
|
|
@ -56,7 +56,7 @@ static const SDL_Locale * const *build_locales_from_csv_string(char *csv, int *c
|
|||
if (!retval) {
|
||||
return NULL; /* oh well */
|
||||
}
|
||||
loc = (SDL_Locale *)((Uint8 *)retval + ((num_locales + 1) * sizeof(SDL_Locale *)));
|
||||
loc = (SDL_Locale *)(retval + (num_locales + 1));
|
||||
ptr = (char *)(loc + num_locales);
|
||||
SDL_memcpy(ptr, csv, slen);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue