Additional cleanup exposed by building with a C++ compiler

This commit is contained in:
Sam Lantinga
2024-08-25 21:32:29 -07:00
parent f08ac438ed
commit 00c409cff8
26 changed files with 84 additions and 120 deletions

View File

@@ -63,7 +63,7 @@ char *convert_filters(const SDL_DialogFileFilter *filters, int nfilters,
new_length = SDL_strlen(combined) + SDL_strlen(converted)
+ SDL_strlen(terminator) + 1;
new_combined = SDL_realloc(combined, new_length);
new_combined = (char *)SDL_realloc(combined, new_length);
if (!new_combined) {
SDL_free(converted);
@@ -82,7 +82,7 @@ char *convert_filters(const SDL_DialogFileFilter *filters, int nfilters,
if (!filters->name || !filters->pattern) {
new_length = SDL_strlen(combined) + SDL_strlen(suffix) + 1;
new_combined = SDL_realloc(combined, new_length);
new_combined = (char *)SDL_realloc(combined, new_length);
if (!new_combined) {
SDL_free(combined);

View File

@@ -172,8 +172,7 @@ void windows_ShowFileDialog(void *ptr)
}
int filter_wlen = MultiByteToWideChar(CP_UTF8, 0, filterlist, filter_len, NULL, 0);
filter_wchar = SDL_malloc(filter_wlen * sizeof(wchar_t));
filter_wchar = (wchar_t *)SDL_malloc(filter_wlen * sizeof(wchar_t));
if (!filter_wchar) {
SDL_free(filterlist);
callback(userdata, NULL, -1);
@@ -439,7 +438,7 @@ void SDL_ShowOpenFileDialog(SDL_DialogFileCallback callback, void* userdata, SDL
return;
}
args = SDL_malloc(sizeof(winArgs));
args = (winArgs *)SDL_malloc(sizeof(*args));
if (args == NULL) {
callback(userdata, NULL, -1);
return;
@@ -450,7 +449,7 @@ void SDL_ShowOpenFileDialog(SDL_DialogFileCallback callback, void* userdata, SDL
args->nfilters = nfilters;
args->default_file = default_location;
args->parent = window;
args->flags = (allow_many == true) ? OFN_ALLOWMULTISELECT : 0;
args->flags = (allow_many != SDL_FALSE) ? OFN_ALLOWMULTISELECT : 0;
args->callback = callback;
args->userdata = userdata;
@@ -476,7 +475,7 @@ void SDL_ShowSaveFileDialog(SDL_DialogFileCallback callback, void* userdata, SDL
return;
}
args = SDL_malloc(sizeof(winArgs));
args = (winArgs *)SDL_malloc(sizeof(*args));
if (args == NULL) {
callback(userdata, NULL, -1);
return;
@@ -513,7 +512,7 @@ void SDL_ShowOpenFolderDialog(SDL_DialogFileCallback callback, void* userdata, S
return;
}
args = SDL_malloc(sizeof(winFArgs));
args = (winFArgs *)SDL_malloc(sizeof(*args));
if (args == NULL) {
callback(userdata, NULL, -1);
return;