diff options
Diffstat (limited to 'source/blender/blenlib/intern/winstuff.c')
-rw-r--r-- | source/blender/blenlib/intern/winstuff.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/source/blender/blenlib/intern/winstuff.c b/source/blender/blenlib/intern/winstuff.c index 7fc2e52255c..d2c98b7aaf3 100644 --- a/source/blender/blenlib/intern/winstuff.c +++ b/source/blender/blenlib/intern/winstuff.c @@ -60,7 +60,7 @@ int BLI_getInstallationDir( char * str ) GetModuleFileName(NULL,str,FILE_MAX); BLI_split_dir_part(str, dir, sizeof(dir)); /* shouldn't be relative */ a = strlen(dir); - if(dir[a-1] == '\\') dir[a-1]=0; + if (dir[a-1] == '\\') dir[a-1]=0; strcpy(str,dir); @@ -187,7 +187,8 @@ DIR *opendir (const char *path) free(path_16); return newd; - } else { + } + else { free(path_16); return NULL; } @@ -197,7 +198,7 @@ static char * BLI_alloc_utf_8_from_16(wchar_t * in16, size_t add) { size_t bsize = count_utf_8_from_16(in16); char * out8 = NULL; - if(!bsize) return NULL; + if (!bsize) return NULL; out8 = (char*)MEM_mallocN(sizeof(char) * (bsize + add),"UTF-8 String"); conv_utf_16_to_8(in16,out8, bsize); return out8; @@ -207,7 +208,7 @@ static wchar_t * BLI_alloc_utf16_from_8(char * in8, size_t add) { size_t bsize = count_utf_16_from_8(in8); wchar_t * out16 = NULL; - if(!bsize) return NULL; + if (!bsize) return NULL; out16 =(wchar_t*) MEM_mallocN(sizeof(wchar_t) * (bsize + add), "UTF-16 String"); conv_utf_8_to_16(in8,out16, bsize); return out16; @@ -233,11 +234,13 @@ struct dirent *readdir(DIR *dp) { dp->direntry.d_name= BLI_alloc_utf_8_from_16(dp->data.cFileName, 0); return &dp->direntry; - } else if (FindNextFileW (dp->handle, &(dp->data))) { + } + else if (FindNextFileW (dp->handle, &(dp->data))) { dp->direntry.d_name= BLI_alloc_utf_8_from_16(dp->data.cFileName,0); return &dp->direntry; - } else { + } + else { return NULL; } } @@ -264,7 +267,8 @@ void get_default_root(char* root) root[1] = ':'; root[2] = '\\'; root[3] = '\0'; - } else { + } + else { /* if GetWindowsDirectory fails, something has probably gone wrong, * we are trying the blender install dir though */ if (GetModuleFileName(NULL,str,MAX_PATH+1)) { @@ -273,7 +277,8 @@ void get_default_root(char* root) root[1] = ':'; root[2] = '\\'; root[3] = '\0'; - } else { + } + else { DWORD tmp; int i; int rc = 0; @@ -333,15 +338,15 @@ int check_file_chars(char *filename) char* dirname(char *path) { char *p; - if( path == NULL || *path == '\0' ) + if ( path == NULL || *path == '\0' ) return "."; p = path + strlen(path) - 1; - while( *p == '/' ) { - if( p == path ) + while ( *p == '/' ) { + if ( p == path ) return path; *p-- = '\0'; } - while( p >= path && *p != '/' ) + while ( p >= path && *p != '/' ) p--; return p < path ? "." : |