Fix C89 declaration for macOS modules.

Since Clang 14, `-Wdeclaration-after-statement` is enforced on every
standard.
This commit is contained in:
Pierre Wendling authored and Sam Lantinga committed 2022-06-27 15:19:40 -07:00
1 parent e4a8087551
commit 6c536afdb7
17 files changed
+375 -270

No files matched your search

+8 -4
View File
@@ -36,18 +36,22 @@ FILE* SDL_OpenFPFromBundleOrFallback(const char *file, const char *mode)
{ @autoreleasepool
{
FILE* fp = NULL;
NSFileManager* file_manager;
NSString* resource_path;
NSString* ns_string_file_component;
NSString* full_path_with_file_to_try;
/* If the file mode is writable, skip all the bundle stuff because generally the bundle is read-only. */
if(strcmp("r", mode) && strcmp("rb", mode)) {
return fopen(file, mode);
}
NSFileManager* file_manager = [NSFileManager defaultManager];
NSString* resource_path = [[NSBundle mainBundle] resourcePath];
file_manager = [NSFileManager defaultManager];
resource_path = [[NSBundle mainBundle] resourcePath];
NSString* ns_string_file_component = [file_manager stringWithFileSystemRepresentation:file length:strlen(file)];
ns_string_file_component = [file_manager stringWithFileSystemRepresentation:file length:strlen(file)];
NSString* full_path_with_file_to_try = [resource_path stringByAppendingPathComponent:ns_string_file_component];
full_path_with_file_to_try = [resource_path stringByAppendingPathComponent:ns_string_file_component];
if([file_manager fileExistsAtPath:full_path_with_file_to_try]) {
fp = fopen([full_path_with_file_to_try fileSystemRepresentation], mode);
} else {