diff --git a/intern/ghost/intern/GHOST_SystemPathsX11.cpp b/intern/ghost/intern/GHOST_SystemPathsX11.cpp index f38b2c99867..30c45de47bc 100644 --- a/intern/ghost/intern/GHOST_SystemPathsX11.cpp +++ b/intern/ghost/intern/GHOST_SystemPathsX11.cpp @@ -65,7 +65,7 @@ const GHOST_TUns8* GHOST_SystemPathsX11::getSystemDir() const const GHOST_TUns8* GHOST_SystemPathsX11::getUserDir() const { - char* env = getenv("HOME"); + const char* env = getenv("HOME"); if(env) { return (GHOST_TUns8*) env; } else { diff --git a/source/blender/blenlib/BLI_path_util.h b/source/blender/blenlib/BLI_path_util.h index b3d657b7323..b3220937e19 100644 --- a/source/blender/blenlib/BLI_path_util.h +++ b/source/blender/blenlib/BLI_path_util.h @@ -40,7 +40,7 @@ extern "C" { struct ListBase; struct direntry; -char *BLI_getDefaultDocumentFolder(void); +const char *BLI_getDefaultDocumentFolder(void); char *BLI_get_folder(int folder_id, const char *subfolder); char *BLI_get_folder_create(int folder_id, const char *subfolder); diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c index 2359a858d51..97712639a6c 100644 --- a/source/blender/blenlib/intern/path_util.c +++ b/source/blender/blenlib/intern/path_util.c @@ -812,12 +812,12 @@ void BLI_getlastdir(const char* dir, char *last, int maxlen) /* This is now only used to really get the user's default document folder */ /* On Windows I chose the 'Users//Documents' since it's used as default location to save documents */ -char *BLI_getDefaultDocumentFolder(void) { +const char *BLI_getDefaultDocumentFolder(void) { #if !defined(WIN32) return getenv("HOME"); #else /* Windows */ - char * ret; + const char * ret; static char documentfolder[MAXPATHLEN]; HRESULT hResult; @@ -883,7 +883,7 @@ static int test_path(char *targetpath, const char *path_base, const char *path_s static int test_env_path(char *path, const char *envvar) { - char *env = envvar?getenv(envvar):NULL; + const char *env = envvar?getenv(envvar):NULL; if (!env) return 0; if (BLI_is_dir(env)) { @@ -1617,7 +1617,7 @@ static int add_win32_extension(char *name) #ifdef _WIN32 char filename[FILE_MAXDIR+FILE_MAXFILE]; char ext[FILE_MAXDIR+FILE_MAXFILE]; - char *extensions = getenv("PATHEXT"); + const char *extensions = getenv("PATHEXT"); if (extensions) { char *temp; do { @@ -1652,7 +1652,7 @@ static int add_win32_extension(char *name) void BLI_where_am_i(char *fullname, const int maxlen, const char *name) { char filename[FILE_MAXDIR+FILE_MAXFILE]; - char *path = NULL, *temp; + const char *path = NULL, *temp; #ifdef _WIN32 const char *separator = ";"; @@ -1666,7 +1666,7 @@ void BLI_where_am_i(char *fullname, const int maxlen, const char *name) path = br_find_exe( NULL ); if (path) { BLI_strncpy(fullname, path, maxlen); - free(path); + free((void *)path); return; } #endif @@ -1749,7 +1749,7 @@ void BLI_where_is_temp(char *fullname, const int maxlen, int usertemp) #ifdef WIN32 if (fullname[0] == '\0') { - char *tmp = getenv("TEMP"); /* Windows */ + const char *tmp = getenv("TEMP"); /* Windows */ if (tmp && BLI_is_dir(tmp)) { BLI_strncpy(fullname, tmp, maxlen); } @@ -1757,14 +1757,14 @@ void BLI_where_is_temp(char *fullname, const int maxlen, int usertemp) #else /* Other OS's - Try TMP and TMPDIR */ if (fullname[0] == '\0') { - char *tmp = getenv("TMP"); + const char *tmp = getenv("TMP"); if (tmp && BLI_is_dir(tmp)) { BLI_strncpy(fullname, tmp, maxlen); } } if (fullname[0] == '\0') { - char *tmp = getenv("TMPDIR"); + const char *tmp = getenv("TMPDIR"); if (tmp && BLI_is_dir(tmp)) { BLI_strncpy(fullname, tmp, maxlen); } diff --git a/source/blender/editors/space_file/fsmenu.c b/source/blender/editors/space_file/fsmenu.c index 340c7f72e4a..78977e4e88f 100644 --- a/source/blender/editors/space_file/fsmenu.c +++ b/source/blender/editors/space_file/fsmenu.c @@ -312,7 +312,7 @@ void fsmenu_read_system(struct FSMenu* fsmenu) #if (MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4) OSErr err=noErr; int i; - char *home; + const char *home; /* loop through all the OS X Volumes, and add them to the SYSTEM section */ for (i=1; err!=nsvErr; i++) @@ -454,7 +454,7 @@ void fsmenu_read_system(struct FSMenu* fsmenu) #else /* unix */ { - char *home= getenv("HOME"); + const char *home= getenv("HOME"); if(home) { BLI_snprintf(line, FILE_MAXDIR, "%s/", home); diff --git a/source/blender/imbuf/intern/thumbs.c b/source/blender/imbuf/intern/thumbs.c index 24c5a755aef..1585206bb6b 100644 --- a/source/blender/imbuf/intern/thumbs.c +++ b/source/blender/imbuf/intern/thumbs.c @@ -69,7 +69,7 @@ static int get_thumb_dir( char* dir , ThumbSize size) /* yes, applications shouldn't store data there, but so does GIMP :)*/ SHGetSpecialFolderPath(0, dir, CSIDL_PROFILE, 0); #else - char* home = getenv("HOME"); + const char* home = getenv("HOME"); if (!home) return 0; BLI_strncpy(dir, home, FILE_MAX); #endif