From 41ad6f9d0a5923a5f4607417c607d37a10317ee1 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 9 Oct 2008 22:44:52 +0000 Subject: fix for [#12255] Rename the File at File Window,the file is deleted renaming a file on win32 would delete it because it didnt test if the 2 filenames were the same (case insensitive), and remove the 'to' file to make way for the 'from' file. --- source/blender/blenlib/intern/fileops.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source/blender/blenlib') diff --git a/source/blender/blenlib/intern/fileops.c b/source/blender/blenlib/intern/fileops.c index 2acbbbe6712..fd9bb17071a 100644 --- a/source/blender/blenlib/intern/fileops.c +++ b/source/blender/blenlib/intern/fileops.c @@ -303,7 +303,8 @@ void BLI_recurdir_fileops(char *dirname) { int BLI_rename(char *from, char *to) { if (!BLI_exists(from)) return 0; - if (BLI_exists(to)) + /* make sure the filenames are different (case insensitive) before removing */ + if (BLI_exists(to) && strcasecmp(from, to)) if(BLI_delete(to, 0, 0)) return 1; return rename(from, to); -- cgit v1.2.3 From 3c27b8034b624d23024e3ece23639bd428f2788f Mon Sep 17 00:00:00 2001 From: Erwin Coumans Date: Fri, 10 Oct 2008 05:17:47 +0000 Subject: use BLI_strcasecmp instead of strcasecmp so it actually links under Windows --- source/blender/blenlib/intern/fileops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/blenlib') diff --git a/source/blender/blenlib/intern/fileops.c b/source/blender/blenlib/intern/fileops.c index fd9bb17071a..76437720e45 100644 --- a/source/blender/blenlib/intern/fileops.c +++ b/source/blender/blenlib/intern/fileops.c @@ -304,7 +304,7 @@ int BLI_rename(char *from, char *to) { if (!BLI_exists(from)) return 0; /* make sure the filenames are different (case insensitive) before removing */ - if (BLI_exists(to) && strcasecmp(from, to)) + if (BLI_exists(to) && BLI_strcasecmp(from, to)) if(BLI_delete(to, 0, 0)) return 1; return rename(from, to); -- cgit v1.2.3 From 2f9e0ec15453261c7edde8b2fa487c4c17af65de Mon Sep 17 00:00:00 2001 From: Kent Mein Date: Fri, 10 Oct 2008 17:52:25 +0000 Subject: This commit fixes bug: [#17770] Texture Plugins do not work. (on windows) Thanks to Lguillaume for helping with this one. Had to go back to bug: [#17631] PIL_dynlib_get_error_as_string() returns NULL, causes crash and revert the fix and make some new updates. function needs to return NULL so fix the functions that were assuming it always returns a string. Kent --- source/blender/blenlib/intern/dynlib.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'source/blender/blenlib') diff --git a/source/blender/blenlib/intern/dynlib.c b/source/blender/blenlib/intern/dynlib.c index e7fa3332f43..858aa6e60bf 100644 --- a/source/blender/blenlib/intern/dynlib.c +++ b/source/blender/blenlib/intern/dynlib.c @@ -78,10 +78,7 @@ char *PIL_dynlib_get_error_as_string(PILdynlib* lib) { /* if lib is NULL reset the last error code */ err= GetLastError(); - if (!lib) { - SetLastError(ERROR_SUCCESS); - err = ERROR_SUCCESS; - } + if (!lib) SetLastError(ERROR_SUCCESS); if (err) { static char buf[1024]; @@ -96,7 +93,7 @@ char *PIL_dynlib_get_error_as_string(PILdynlib* lib) { return buf; } - return "unrecognized error"; + return err; } void PIL_dynlib_close(PILdynlib *lib) { -- cgit v1.2.3 From 42e287af1cc3ed2f37630f6f62c82c2d8ccc66b3 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 19 Oct 2008 04:02:37 +0000 Subject: source/blender/blenloader/intern/readfile.c - use memmove rather then strncpy for overlapping strings. source/blender/blenlib/intern/fileops.c - zero length strings would check for a slash before the strings first char. source/gameengine/GameLogic/SCA_JoystickSensor.cpp - m_istrig_prev was not initialized source/blender/src/editmesh.c - active face pointer was not set to NULL in free_editMesh() --- source/blender/blenlib/intern/fileops.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source/blender/blenlib') diff --git a/source/blender/blenlib/intern/fileops.c b/source/blender/blenlib/intern/fileops.c index 76437720e45..ebd8f4be1cf 100644 --- a/source/blender/blenlib/intern/fileops.c +++ b/source/blender/blenlib/intern/fileops.c @@ -95,12 +95,12 @@ char *BLI_last_slash(const char *string) { void BLI_add_slash(char *string) { int len = strlen(string); #ifdef WIN32 - if (string[len-1]!='\\') { + if (len==0 || string[len-1]!='\\') { string[len] = '\\'; string[len+1] = '\0'; } #else - if (string[len-1]!='/') { + if (len==0 || string[len-1]!='/') { string[len] = '/'; string[len+1] = '\0'; } -- cgit v1.2.3