diff options
Diffstat (limited to 'src/osd/sdl/sdlfile.c')
-rw-r--r-- | src/osd/sdl/sdlfile.c | 108 |
1 files changed, 54 insertions, 54 deletions
diff --git a/src/osd/sdl/sdlfile.c b/src/osd/sdl/sdlfile.c index 6df7615f1ab..5dc2b309cc9 100644 --- a/src/osd/sdl/sdlfile.c +++ b/src/osd/sdl/sdlfile.c @@ -188,7 +188,7 @@ file_error osd_open(const char *path, UINT32 openflags, osd_file **file, UINT64 envstr[i] = '\0'; - const char *envval = osd_getenv(&envstr[1]); + const char *envval = osd_getenv(&envstr[1]); if (envval != NULL) { j = strlen(envval) + strlen(tmpstr) + 1; @@ -505,31 +505,31 @@ int osd_is_absolute_path(const char *path) osd_directory_entry *osd_stat(const char *path) { - int err; - osd_directory_entry *result = NULL; - #if defined(SDLMAME_NO64BITIO) || defined(SDLMAME_BSD) || defined(SDLMAME_DARWIN) - struct stat st; - #else - struct stat64 st; - #endif - - #if defined(SDLMAME_NO64BITIO) || defined(SDLMAME_BSD) || defined(SDLMAME_DARWIN) - err = stat(path, &st); - #else - err = stat64(path, &st); - #endif - - if( err == -1) return NULL; - - // create an osd_directory_entry; be sure to make sure that the caller can - // free all resources by just freeing the resulting osd_directory_entry - result = (osd_directory_entry *) osd_malloc_array(sizeof(*result) + strlen(path) + 1); - strcpy(((char *) result) + sizeof(*result), path); - result->name = ((char *) result) + sizeof(*result); - result->type = S_ISDIR(st.st_mode) ? ENTTYPE_DIR : ENTTYPE_FILE; - result->size = (UINT64)st.st_size; - - return result; + int err; + osd_directory_entry *result = NULL; + #if defined(SDLMAME_NO64BITIO) || defined(SDLMAME_BSD) || defined(SDLMAME_DARWIN) + struct stat st; + #else + struct stat64 st; + #endif + + #if defined(SDLMAME_NO64BITIO) || defined(SDLMAME_BSD) || defined(SDLMAME_DARWIN) + err = stat(path, &st); + #else + err = stat64(path, &st); + #endif + + if( err == -1) return NULL; + + // create an osd_directory_entry; be sure to make sure that the caller can + // free all resources by just freeing the resulting osd_directory_entry + result = (osd_directory_entry *) osd_malloc_array(sizeof(*result) + strlen(path) + 1); + strcpy(((char *) result) + sizeof(*result), path); + result->name = ((char *) result) + sizeof(*result); + result->type = S_ISDIR(st.st_mode) ? ENTTYPE_DIR : ENTTYPE_FILE; + result->size = (UINT64)st.st_size; + + return result; } //============================================================ @@ -538,32 +538,32 @@ osd_directory_entry *osd_stat(const char *path) file_error osd_get_full_path(char **dst, const char *path) { - file_error err; - char path_buffer[512]; - - err = FILERR_NONE; - - if (getcwd(path_buffer, 511) == NULL) - { - printf("osd_get_full_path: failed!\n"); - err = FILERR_FAILURE; - } - else - { - *dst = (char *)osd_malloc_array(strlen(path_buffer)+strlen(path)+3); - - // if it's already a full path, just pass it through - if (path[0] == '/') - { - strcpy(*dst, path); - } - else - { - sprintf(*dst, "%s%s%s", path_buffer, PATH_SEPARATOR, path); - } - } - - return err; + file_error err; + char path_buffer[512]; + + err = FILERR_NONE; + + if (getcwd(path_buffer, 511) == NULL) + { + printf("osd_get_full_path: failed!\n"); + err = FILERR_FAILURE; + } + else + { + *dst = (char *)osd_malloc_array(strlen(path_buffer)+strlen(path)+3); + + // if it's already a full path, just pass it through + if (path[0] == '/') + { + strcpy(*dst, path); + } + else + { + sprintf(*dst, "%s%s%s", path_buffer, PATH_SEPARATOR, path); + } + } + + return err; } //============================================================ @@ -572,8 +572,8 @@ file_error osd_get_full_path(char **dst, const char *path) const char *osd_get_volume_name(int idx) { - if (idx!=0) return NULL; - return "/"; + if (idx!=0) return NULL; + return "/"; } #endif |