[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [36031] trunk/blender/source: fix [#26803] Libs paths are case sensitive in windows

Campbell Barton ideasman42 at gmail.com
Wed Apr 6 08:03:49 CEST 2011


Revision: 36031
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=36031
Author:   campbellbarton
Date:     2011-04-06 06:03:48 +0000 (Wed, 06 Apr 2011)
Log Message:
-----------
fix [#26803] Libs paths are case sensitive in windows
use case insensitive path comparison on windows: BLI_path_cmp

Modified Paths:
--------------
    trunk/blender/source/blender/blenfont/intern/blf_dir.c
    trunk/blender/source/blender/blenlib/BLI_path_util.h
    trunk/blender/source/blender/blenlib/intern/path_util.c
    trunk/blender/source/blender/blenloader/intern/readfile.c
    trunk/blender/source/blender/blenloader/intern/writefile.c
    trunk/blender/source/blender/editors/gpencil/gpencil_buttons.c
    trunk/blender/source/blender/editors/interface/interface_icons.c
    trunk/blender/source/blender/editors/space_file/file_panels.c
    trunk/blender/source/blender/editors/space_file/filelist.c
    trunk/blender/source/blender/editors/space_file/fsmenu.c
    trunk/blender/source/blender/imbuf/intern/thumbs.c
    trunk/blender/source/blender/makesdna/intern/dna_genfile.c
    trunk/blender/source/blender/python/intern/bpy.c
    trunk/blender/source/blender/windowmanager/intern/wm_files.c
    trunk/blender/source/blender/windowmanager/intern/wm_keymap.c
    trunk/blender/source/blender/windowmanager/intern/wm_operators.c
    trunk/blender/source/gameengine/Converter/KX_BlenderSceneConverter.cpp

Modified: trunk/blender/source/blender/blenfont/intern/blf_dir.c
===================================================================
--- trunk/blender/source/blender/blenfont/intern/blf_dir.c	2011-04-06 03:02:40 UTC (rev 36030)
+++ trunk/blender/source/blender/blenfont/intern/blf_dir.c	2011-04-06 06:03:48 UTC (rev 36031)
@@ -60,7 +60,7 @@
 	
 	p= global_font_dir.first;
 	while (p) {
-		if (!strcmp(p->path, path))
+		if (BLI_path_cmp(p->path, path) == 0)
 			return(p);
 		p= p->next;
 	}

Modified: trunk/blender/source/blender/blenlib/BLI_path_util.h
===================================================================
--- trunk/blender/source/blender/blenlib/BLI_path_util.h	2011-04-06 03:02:40 UTC (rev 36030)
+++ trunk/blender/source/blender/blenlib/BLI_path_util.h	2011-04-06 06:03:48 UTC (rev 36031)
@@ -158,9 +158,16 @@
 int BLI_path_frame(char *path, int frame, int digits);
 int BLI_path_frame_range(char *path, int sta, int end, int digits);
 int BLI_path_cwd(char *path);
-
 void BLI_path_rel(char *file, const char *relfile);
 
+#ifdef WIN32
+#  define BLI_path_cmp BLI_strcasecmp
+#  define BLI_path_ncmp BLI_strncasecmp
+#else
+#  define BLI_path_cmp strcmp
+#  define BLI_path_ncmp strncmp
+#endif
+
 	/**
 	 * Change every @a from in @a string into @a to. The
 	 * result will be in @a string

Modified: trunk/blender/source/blender/blenlib/intern/path_util.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/path_util.c	2011-04-06 03:02:40 UTC (rev 36030)
+++ trunk/blender/source/blender/blenlib/intern/path_util.c	2011-04-06 06:03:48 UTC (rev 36031)
@@ -1481,7 +1481,7 @@
 	if (!strncmp(path, blend_dir, len)) {
 
 		/* if image is _in_ current .blend file directory */
-		if (!strcmp(dir, blend_dir)) {
+		if (BLI_path_cmp(dir, blend_dir) == 0) {
 			BLI_join_dirfile(dest_path, sizeof(dest_path), dest_dir, base);
 		}
 		/* "below" */
@@ -1508,7 +1508,7 @@
 	}
 
 	/* return 2 if src=dest */
-	if (!strcmp(path, dest_path)) {
+	if (BLI_path_cmp(path, dest_path) == 0) {
 		// if (G.f & G_DEBUG) printf("%s and %s are the same file\n", path, dest_path);
 		return 2;
 	}

Modified: trunk/blender/source/blender/blenloader/intern/readfile.c
===================================================================
--- trunk/blender/source/blender/blenloader/intern/readfile.c	2011-04-06 03:02:40 UTC (rev 36030)
+++ trunk/blender/source/blender/blenloader/intern/readfile.c	2011-04-06 06:03:48 UTC (rev 36031)
@@ -500,7 +500,7 @@
 	for (m= mainlist->first; m; m= m->next) {
 		char *libname= (m->curlib)?m->curlib->filepath:m->name;
 		
-		if (BLI_streq(name1, libname)) {
+		if (BLI_path_cmp(name1, libname) == 0) {
 			if(G.f & G_DEBUG) printf("blo_find_main: found library %s\n", libname);
 			return m;
 		}
@@ -5449,7 +5449,7 @@
 	
 	for(newmain= fd->mainlist.first; newmain; newmain= newmain->next) {
 		if(newmain->curlib) {
-			if(strcmp(newmain->curlib->filepath, lib->filepath)==0) {
+			if(BLI_path_cmp(newmain->curlib->filepath, lib->filepath) == 0) {
 				printf("Fixed error in file; multiple instances of lib:\n %s\n", lib->filepath);
 				BKE_reportf(fd->reports, RPT_WARNING, "Library '%s', '%s' had multiple instances, save and reload!", lib->name, lib->filepath);
 

Modified: trunk/blender/source/blender/blenloader/intern/writefile.c
===================================================================
--- trunk/blender/source/blender/blenloader/intern/writefile.c	2011-04-06 03:02:40 UTC (rev 36030)
+++ trunk/blender/source/blender/blenloader/intern/writefile.c	2011-04-06 06:03:48 UTC (rev 36031)
@@ -2547,7 +2547,7 @@
 	}
 
 	BLI_make_file_string(G.main->name, userfilename, BLI_get_folder_create(BLENDER_USER_CONFIG, NULL), BLENDER_STARTUP_FILE);
-	write_user_block= BLI_streq(dir, userfilename);
+	write_user_block= (BLI_path_cmp(dir, userfilename) == 0);
 
 	if(write_flags & G_FILE_RELATIVE_REMAP)
 		makeFilesRelative(mainvar, dir, NULL); /* note, making relative to something OTHER then G.main->name */

Modified: trunk/blender/source/blender/editors/gpencil/gpencil_buttons.c
===================================================================
--- trunk/blender/source/blender/editors/gpencil/gpencil_buttons.c	2011-04-06 03:02:40 UTC (rev 36030)
+++ trunk/blender/source/blender/editors/gpencil/gpencil_buttons.c	2011-04-06 06:03:48 UTC (rev 36031)
@@ -73,8 +73,9 @@
 /* make layer active one after being clicked on */
 static void gp_ui_activelayer_cb (bContext *C, void *gpd, void *gpl)
 {
+	/* make sure the layer we want to remove is the active one */
 	gpencil_layer_setactive(gpd, gpl);
-	
+
 	WM_event_add_notifier(C, NC_SCREEN|ND_GPENCIL|NA_EDITED, NULL); // XXX please work!
 }
 
@@ -88,13 +89,7 @@
 	WM_event_add_notifier(C, NC_SCREEN|ND_GPENCIL|NA_EDITED, NULL); // XXX please work!
 }
 
-static void gp_ui_actlayer_cb (bContext *C, void *gpd, void *gpl)
-{
-	/* make sure the layer we want to remove is the active one */
-	gpencil_layer_setactive(gpd, gpl);
 
-	WM_event_add_notifier(C, NC_SCREEN|ND_GPENCIL|NA_EDITED, NULL); // XXX please work!
-}
 
 /* ------- Drawing Code ------- */
 

Modified: trunk/blender/source/blender/editors/interface/interface_icons.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_icons.c	2011-04-06 03:02:40 UTC (rev 36030)
+++ trunk/blender/source/blender/editors/interface/interface_icons.c	2011-04-06 06:03:48 UTC (rev 36031)
@@ -686,7 +686,7 @@
 	ListBase *list=&(iconfilelist);
 	
 	for(ifile=list->first; ifile; ifile=ifile->next) {
-		if ( BLI_streq(filename, ifile->filename)) {
+		if (BLI_path_cmp(filename, ifile->filename) == 0) {
 			return ifile->index;
 		}
 	}

Modified: trunk/blender/source/blender/editors/space_file/file_panels.c
===================================================================
--- trunk/blender/source/blender/editors/space_file/file_panels.c	2011-04-06 03:02:40 UTC (rev 36030)
+++ trunk/blender/source/blender/editors/space_file/file_panels.c	2011-04-06 06:03:48 UTC (rev 36031)
@@ -101,7 +101,7 @@
 		
 		/* set this list item as active if we have a match */
 		if(sfile->params) {
-			if(strcmp(sfile->params->dir, entry) == 0) {
+			if(BLI_path_cmp(sfile->params->dir, entry) == 0) {
 				*nr= i;
 			}
 		}

Modified: trunk/blender/source/blender/editors/space_file/filelist.c
===================================================================
--- trunk/blender/source/blender/editors/space_file/filelist.c	2011-04-06 03:02:40 UTC (rev 36030)
+++ trunk/blender/source/blender/editors/space_file/filelist.c	2011-04-06 06:03:48 UTC (rev 36031)
@@ -459,7 +459,7 @@
 
 	// if previous_folder, next_folder or refresh_folder operators are executed it doesn't clear folder_next
 	folder = sfile->folders_prev->last;
-	if ((!folder) ||(!strcmp(folder->foldername, sfile->params->dir)))
+	if ((!folder) ||(BLI_path_cmp(folder->foldername, sfile->params->dir) == 0))
 		return 0;
 
 	// eventually clear flist->folders_next
@@ -697,7 +697,7 @@
 
 	
 	for (i = 0; i < filelist->numfiles; ++i) {
-		if ( strcmp(filelist->filelist[i].relname, file) == 0) {
+		if ( strcmp(filelist->filelist[i].relname, file) == 0) { /* not dealing with user input so dont need BLI_path_cmp */
 			index = i;
 			break;
 		}
@@ -880,7 +880,7 @@
 				strcat(name, file->relname);
 				
 				/* prevent current file being used as acceptable dir */
-				if (BLI_streq(G.main->name, name)==0) {
+				if (BLI_path_cmp(G.main->name, name) != 0) {
 					file->type &= ~S_IFMT;
 					file->type |= S_IFDIR;
 				}

Modified: trunk/blender/source/blender/editors/space_file/fsmenu.c
===================================================================
--- trunk/blender/source/blender/editors/space_file/fsmenu.c	2011-04-06 03:02:40 UTC (rev 36030)
+++ trunk/blender/source/blender/editors/space_file/fsmenu.c	2011-04-06 06:03:48 UTC (rev 36031)
@@ -173,9 +173,11 @@
 
 	for (; fsme; prev= fsme, fsme= fsme->next) {
 		if (fsme->path) {
-			if (BLI_streq(path, fsme->path)) {
+			const int cmp_ret= BLI_path_cmp(path, fsme->path);
+			if (cmp_ret == 0) {
 				return;
-			} else if (sorted && strcmp(path, fsme->path)<0) {
+			}
+			else if (sorted && cmp_ret < 0) {
 				break;
 			}
 		} else {

Modified: trunk/blender/source/blender/imbuf/intern/thumbs.c
===================================================================
--- trunk/blender/source/blender/imbuf/intern/thumbs.c	2011-04-06 03:02:40 UTC (rev 36030)
+++ trunk/blender/source/blender/imbuf/intern/thumbs.c	2011-04-06 06:03:48 UTC (rev 36031)
@@ -281,7 +281,7 @@
 		BLI_snprintf(tpath, FILE_MAX, "%s%s", tdir, thumb);
 		thumb[8] = '\0'; /* shorten for tempname, not needed anymore */
 		BLI_snprintf(temp, FILE_MAX, "%sblender_%d_%s.png", tdir, abs(getpid()), thumb);
-		if (strncmp(path, tdir, strlen(tdir)) == 0) {
+		if (BLI_path_ncmp(path, tdir, sizeof(tdir)) == 0) {
 			return NULL;
 		}
 		if (size == THB_FAIL) {
@@ -387,7 +387,7 @@
 		return;
 	}
 	if (thumbpath_from_uri(uri, thumb, sizeof(thumb), size)) {
-		if (strncmp(path, thumb, strlen(thumb)) == 0) {
+		if (BLI_path_ncmp(path, thumb, sizeof(thumb)) == 0) {
 			return;
 		}
 		if (BLI_exists(thumb)) {
@@ -419,7 +419,7 @@
 	}
 
 	if (thumbpath_from_uri(uri, thumb, sizeof(thumb), size)) {
-		if (strncmp(path, thumb, strlen(thumb)) == 0) {
+		if (BLI_path_ncmp(path, thumb, sizeof(thumb)) == 0) {
 			img = IMB_loadiffname(path, IB_rect);
 		} else {
 			img = IMB_loadiffname(thumb, IB_rect | IB_metadata);

Modified: trunk/blender/source/blender/makesdna/intern/dna_genfile.c
===================================================================
--- trunk/blender/source/blender/makesdna/intern/dna_genfile.c	2011-04-06 03:02:40 UTC (rev 36030)
+++ trunk/blender/source/blender/makesdna/intern/dna_genfile.c	2011-04-06 06:03:48 UTC (rev 36031)
@@ -194,7 +194,7 @@
 void DNA_sdna_free(SDNA *sdna)
 {
 	MEM_freeN(sdna->data);
-	MEM_freeN(sdna->names);
+	MEM_freeN((void *)sdna->names);
 	MEM_freeN(sdna->types);
 	MEM_freeN(sdna->structs);
 	

Modified: trunk/blender/source/blender/python/intern/bpy.c
===================================================================
--- trunk/blender/source/blender/python/intern/bpy.c	2011-04-06 03:02:40 UTC (rev 36030)
+++ trunk/blender/source/blender/python/intern/bpy.c	2011-04-06 06:03:48 UTC (rev 36031)
@@ -115,7 +115,7 @@
 		}
 		else {
 			lib= BLI_bpathIterator_getLib(bpi);

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list