Fixed warning C4090: 'function': different 'const' qualifiers

This commit is contained in:
Sam Lantinga 2024-07-19 15:38:41 -07:00
parent 64cb431ead
commit aafbbe4ebc
4 changed files with 7 additions and 7 deletions

View file

@ -745,7 +745,7 @@ const SDL_CameraSpec * const *SDL_GetCameraSupportedFormats(SDL_CameraID instanc
int i; int i;
int num_specs = device->num_specs; int num_specs = device->num_specs;
const SDL_CameraSpec **retval = (const SDL_CameraSpec **) SDL_malloc(((num_specs + 1) * sizeof(*retval)) + (num_specs * sizeof (**retval))); SDL_CameraSpec **retval = (SDL_CameraSpec **) SDL_malloc(((num_specs + 1) * sizeof(*retval)) + (num_specs * sizeof (**retval)));
if (retval) { if (retval) {
SDL_CameraSpec *specs = (SDL_CameraSpec *)(retval + (num_specs + 1)); SDL_CameraSpec *specs = (SDL_CameraSpec *)(retval + (num_specs + 1));
SDL_memcpy(specs, device->all_specs, num_specs * sizeof(*specs)); SDL_memcpy(specs, device->all_specs, num_specs * sizeof(*specs));

View file

@ -762,7 +762,7 @@ int SDL_SendEditingText(const char *text, int start, int length)
static const char * const *CreateCandidatesForEvent(char **candidates, int num_candidates) static const char * const *CreateCandidatesForEvent(char **candidates, int num_candidates)
{ {
const char **event_candidates; char **event_candidates;
int i; int i;
char *ptr; char *ptr;
size_t total_length = (num_candidates + 1) * sizeof(*event_candidates); size_t total_length = (num_candidates + 1) * sizeof(*event_candidates);
@ -773,7 +773,7 @@ static const char * const *CreateCandidatesForEvent(char **candidates, int num_c
total_length += length; total_length += length;
} }
event_candidates = (const char **)SDL_malloc(total_length); event_candidates = (char **)SDL_malloc(total_length);
if (!event_candidates) { if (!event_candidates) {
return NULL; return NULL;
} }

View file

@ -29,7 +29,7 @@ static const SDL_Locale * const *build_locales_from_csv_string(char *csv, int *c
size_t alloclen; size_t alloclen;
char *ptr; char *ptr;
SDL_Locale *loc; SDL_Locale *loc;
const SDL_Locale **retval; SDL_Locale **retval;
if (count) { if (count) {
*count = 0; *count = 0;
@ -52,7 +52,7 @@ static const SDL_Locale * const *build_locales_from_csv_string(char *csv, int *c
slen = ((size_t)(ptr - csv)) + 1; /* SDL_strlen(csv) + 1 */ slen = ((size_t)(ptr - csv)) + 1; /* SDL_strlen(csv) + 1 */
alloclen = (num_locales * sizeof(SDL_Locale *)) + (num_locales * sizeof(SDL_Locale)) + slen; alloclen = (num_locales * sizeof(SDL_Locale *)) + (num_locales * sizeof(SDL_Locale)) + slen;
retval = (const SDL_Locale **)SDL_calloc(1, alloclen); retval = (SDL_Locale **)SDL_calloc(1, alloclen);
if (!retval) { if (!retval) {
return NULL; /* oh well */ return NULL; /* oh well */
} }

View file

@ -1222,7 +1222,7 @@ const SDL_DisplayMode * const *SDL_GetFullscreenDisplayModes(SDL_DisplayID displ
{ {
int i; int i;
int num_modes; int num_modes;
const SDL_DisplayMode **retval; SDL_DisplayMode **retval;
SDL_VideoDisplay *display = SDL_GetVideoDisplay(displayID); SDL_VideoDisplay *display = SDL_GetVideoDisplay(displayID);
if (count) { if (count) {
@ -1236,7 +1236,7 @@ const SDL_DisplayMode * const *SDL_GetFullscreenDisplayModes(SDL_DisplayID displ
} }
num_modes = display->num_fullscreen_modes; num_modes = display->num_fullscreen_modes;
retval = (const SDL_DisplayMode **)SDL_malloc((num_modes + 1) * sizeof(*retval) + num_modes * sizeof(**retval)); retval = (SDL_DisplayMode **)SDL_malloc((num_modes + 1) * sizeof(*retval) + num_modes * sizeof(**retval));
if (retval) { if (retval) {
SDL_DisplayMode *modes = (SDL_DisplayMode *)((Uint8 *)retval + ((num_modes + 1) * sizeof(*retval))); SDL_DisplayMode *modes = (SDL_DisplayMode *)((Uint8 *)retval + ((num_modes + 1) * sizeof(*retval)));
SDL_memcpy(modes, display->fullscreen_modes, num_modes * sizeof(*modes)); SDL_memcpy(modes, display->fullscreen_modes, num_modes * sizeof(*modes));