mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-04-29 02:34:23 +00:00
Use consistent style for pointer declarations and casts
This commit is contained in:
@@ -58,13 +58,13 @@ static void ReactivateAfterDialog(void)
|
||||
|
||||
void SDL_SYS_ShowFileDialogWithProperties(SDL_FileDialogType type, SDL_DialogFileCallback callback, void *userdata, SDL_PropertiesID props)
|
||||
{
|
||||
SDL_Window* window = SDL_GetPointerProperty(props, SDL_PROP_FILE_DIALOG_WINDOW_POINTER, NULL);
|
||||
SDL_Window *window = SDL_GetPointerProperty(props, SDL_PROP_FILE_DIALOG_WINDOW_POINTER, NULL);
|
||||
SDL_DialogFileFilter *filters = SDL_GetPointerProperty(props, SDL_PROP_FILE_DIALOG_FILTERS_POINTER, NULL);
|
||||
int nfilters = (int) SDL_GetNumberProperty(props, SDL_PROP_FILE_DIALOG_NFILTERS_NUMBER, 0);
|
||||
bool allow_many = SDL_GetBooleanProperty(props, SDL_PROP_FILE_DIALOG_MANY_BOOLEAN, false);
|
||||
const char* default_location = SDL_GetStringProperty(props, SDL_PROP_FILE_DIALOG_LOCATION_STRING, NULL);
|
||||
const char* title = SDL_GetStringProperty(props, SDL_PROP_FILE_DIALOG_TITLE_STRING, NULL);
|
||||
const char* accept = SDL_GetStringProperty(props, SDL_PROP_FILE_DIALOG_ACCEPT_STRING, NULL);
|
||||
const char *default_location = SDL_GetStringProperty(props, SDL_PROP_FILE_DIALOG_LOCATION_STRING, NULL);
|
||||
const char *title = SDL_GetStringProperty(props, SDL_PROP_FILE_DIALOG_TITLE_STRING, NULL);
|
||||
const char *accept = SDL_GetStringProperty(props, SDL_PROP_FILE_DIALOG_ACCEPT_STRING, NULL);
|
||||
|
||||
if (filters) {
|
||||
const char *msg = validate_filters(filters, nfilters);
|
||||
@@ -170,7 +170,7 @@ void SDL_SYS_ShowFileDialogWithProperties(SDL_FileDialogType type, SDL_DialogFil
|
||||
[dialog beginSheetModalForWindow:w completionHandler:^(NSInteger result) {
|
||||
if (result == NSModalResponseOK) {
|
||||
if (dialog_as_open) {
|
||||
NSArray* urls = [dialog_as_open URLs];
|
||||
NSArray *urls = [dialog_as_open URLs];
|
||||
const char *files[[urls count] + 1];
|
||||
for (int i = 0; i < [urls count]; i++) {
|
||||
files[i] = [[[urls objectAtIndex:i] path] UTF8String];
|
||||
@@ -191,7 +191,7 @@ void SDL_SYS_ShowFileDialogWithProperties(SDL_FileDialogType type, SDL_DialogFil
|
||||
} else {
|
||||
if ([dialog runModal] == NSModalResponseOK) {
|
||||
if (dialog_as_open) {
|
||||
NSArray* urls = [dialog_as_open URLs];
|
||||
NSArray *urls = [dialog_as_open URLs];
|
||||
const char *files[[urls count] + 1];
|
||||
for (int i = 0; i < [urls count]; i++) {
|
||||
files[i] = [[[urls objectAtIndex:i] path] UTF8String];
|
||||
|
||||
@@ -163,7 +163,7 @@ public:
|
||||
case B_CANCEL: // Whenever the dialog is closed (Cancel but also after Open and Save)
|
||||
{
|
||||
nFiles = m_files.size();
|
||||
const char* files[nFiles + 1];
|
||||
const char *files[nFiles + 1];
|
||||
for (int i = 0; i < nFiles; i++) {
|
||||
files[i] = m_files[i].c_str();
|
||||
}
|
||||
@@ -194,14 +194,14 @@ private:
|
||||
|
||||
void SDL_SYS_ShowFileDialogWithProperties(SDL_FileDialogType type, SDL_DialogFileCallback callback, void *userdata, SDL_PropertiesID props)
|
||||
{
|
||||
SDL_Window* window = (SDL_Window*) SDL_GetPointerProperty(props, SDL_PROP_FILE_DIALOG_WINDOW_POINTER, NULL);
|
||||
SDL_DialogFileFilter* filters = (SDL_DialogFileFilter*) SDL_GetPointerProperty(props, SDL_PROP_FILE_DIALOG_FILTERS_POINTER, NULL);
|
||||
SDL_Window *window = (SDL_Window *)SDL_GetPointerProperty(props, SDL_PROP_FILE_DIALOG_WINDOW_POINTER, NULL);
|
||||
SDL_DialogFileFilter *filters = (SDL_DialogFileFilter *)SDL_GetPointerProperty(props, SDL_PROP_FILE_DIALOG_FILTERS_POINTER, NULL);
|
||||
int nfilters = (int) SDL_GetNumberProperty(props, SDL_PROP_FILE_DIALOG_NFILTERS_NUMBER, 0);
|
||||
bool many = SDL_GetBooleanProperty(props, SDL_PROP_FILE_DIALOG_MANY_BOOLEAN, false);
|
||||
const char* location = SDL_GetStringProperty(props, SDL_PROP_FILE_DIALOG_LOCATION_STRING, NULL);
|
||||
const char* title = SDL_GetStringProperty(props, SDL_PROP_FILE_DIALOG_TITLE_STRING, NULL);
|
||||
const char* accept = SDL_GetStringProperty(props, SDL_PROP_FILE_DIALOG_ACCEPT_STRING, NULL);
|
||||
const char* cancel = SDL_GetStringProperty(props, SDL_PROP_FILE_DIALOG_CANCEL_STRING, NULL);
|
||||
const char *location = SDL_GetStringProperty(props, SDL_PROP_FILE_DIALOG_LOCATION_STRING, NULL);
|
||||
const char *title = SDL_GetStringProperty(props, SDL_PROP_FILE_DIALOG_TITLE_STRING, NULL);
|
||||
const char *accept = SDL_GetStringProperty(props, SDL_PROP_FILE_DIALOG_ACCEPT_STRING, NULL);
|
||||
const char *cancel = SDL_GetStringProperty(props, SDL_PROP_FILE_DIALOG_CANCEL_STRING, NULL);
|
||||
|
||||
bool modal = !!window;
|
||||
|
||||
@@ -222,7 +222,7 @@ void SDL_SYS_ShowFileDialogWithProperties(SDL_FileDialogType type, SDL_DialogFil
|
||||
};
|
||||
|
||||
if (!SDL_InitBeApp()) {
|
||||
char* err = SDL_strdup(SDL_GetError());
|
||||
char *err = SDL_strdup(SDL_GetError());
|
||||
SDL_SetError("Couldn't init Be app: %s", err);
|
||||
SDL_free(err);
|
||||
callback(userdata, NULL, -1);
|
||||
|
||||
@@ -288,12 +288,12 @@ void SDL_Portal_ShowFileDialogWithProperties(SDL_FileDialogType type, SDL_Dialog
|
||||
const char *method;
|
||||
const char *method_title;
|
||||
|
||||
SDL_Window* window = SDL_GetPointerProperty(props, SDL_PROP_FILE_DIALOG_WINDOW_POINTER, NULL);
|
||||
SDL_Window *window = SDL_GetPointerProperty(props, SDL_PROP_FILE_DIALOG_WINDOW_POINTER, NULL);
|
||||
SDL_DialogFileFilter *filters = SDL_GetPointerProperty(props, SDL_PROP_FILE_DIALOG_FILTERS_POINTER, NULL);
|
||||
int nfilters = (int) SDL_GetNumberProperty(props, SDL_PROP_FILE_DIALOG_NFILTERS_NUMBER, 0);
|
||||
bool allow_many = SDL_GetBooleanProperty(props, SDL_PROP_FILE_DIALOG_MANY_BOOLEAN, false);
|
||||
const char* default_location = SDL_GetStringProperty(props, SDL_PROP_FILE_DIALOG_LOCATION_STRING, NULL);
|
||||
const char* accept = SDL_GetStringProperty(props, SDL_PROP_FILE_DIALOG_ACCEPT_STRING, NULL);
|
||||
const char *default_location = SDL_GetStringProperty(props, SDL_PROP_FILE_DIALOG_LOCATION_STRING, NULL);
|
||||
const char *accept = SDL_GetStringProperty(props, SDL_PROP_FILE_DIALOG_ACCEPT_STRING, NULL);
|
||||
bool open_folders = false;
|
||||
|
||||
switch (type) {
|
||||
|
||||
@@ -277,7 +277,7 @@ void windows_ShowFileDialog(void *ptr)
|
||||
|
||||
while (*file_ptr) {
|
||||
nfiles++;
|
||||
char **new_cfl = (char **) SDL_realloc(chosen_files_list, sizeof(char*) * (nfiles + 1));
|
||||
char **new_cfl = (char **) SDL_realloc(chosen_files_list, sizeof(char *) * (nfiles + 1));
|
||||
|
||||
if (!new_cfl) {
|
||||
for (size_t i = 0; i < nfiles - 1; i++) {
|
||||
@@ -327,7 +327,7 @@ void windows_ShowFileDialog(void *ptr)
|
||||
// If the user chose only one file, it's all just one string
|
||||
if (nfiles == 0) {
|
||||
nfiles++;
|
||||
char **new_cfl = (char **) SDL_realloc(chosen_files_list, sizeof(char*) * (nfiles + 1));
|
||||
char **new_cfl = (char **) SDL_realloc(chosen_files_list, sizeof(char *) * (nfiles + 1));
|
||||
|
||||
if (!new_cfl) {
|
||||
SDL_free(chosen_files_list);
|
||||
@@ -348,7 +348,7 @@ void windows_ShowFileDialog(void *ptr)
|
||||
}
|
||||
}
|
||||
|
||||
callback(userdata, (const char * const*) chosen_files_list, getFilterIndex(dialog.nFilterIndex));
|
||||
callback(userdata, (const char * const *) chosen_files_list, getFilterIndex(dialog.nFilterIndex));
|
||||
|
||||
for (size_t i = 0; i < nfiles; i++) {
|
||||
SDL_free(chosen_files_list[i]);
|
||||
@@ -443,11 +443,11 @@ void windows_ShowFolderDialog(void *ptr)
|
||||
SHGetPathFromIDListW(lpItem, buffer);
|
||||
char *chosen_file = WIN_StringToUTF8W(buffer);
|
||||
const char *files[2] = { chosen_file, NULL };
|
||||
callback(userdata, (const char * const*) files, -1);
|
||||
callback(userdata, (const char * const *) files, -1);
|
||||
SDL_free(chosen_file);
|
||||
} else {
|
||||
const char *files[1] = { NULL };
|
||||
callback(userdata, (const char * const*) files, -1);
|
||||
callback(userdata, (const char * const *) files, -1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user