mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-16 14:56:00 +00:00
Fix C89 declaration for macOS modules.
Since Clang 14, `-Wdeclaration-after-statement` is enforced on every standard.
This commit is contained in:

committed by
Sam Lantinga

parent
e4a8087551
commit
6c536afdb7
@@ -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 {
|
||||
|
Reference in New Issue
Block a user