Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-04-06 10:03:48 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-04-06 10:03:48 +0400
commita7507e945d1c314b9bf7f8298a8beea58e047d37 (patch)
treeae5ae0422e5eea00d1b2ae032ebcddaaf6058583 /source
parent5c7bed92d4a124a92c596f2dbe212cc59335925f (diff)
fix [#26803] Libs paths are case sensitive in windows
use case insensitive path comparison on windows: BLI_path_cmp
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenfont/intern/blf_dir.c2
-rw-r--r--source/blender/blenlib/BLI_path_util.h9
-rw-r--r--source/blender/blenlib/intern/path_util.c4
-rw-r--r--source/blender/blenloader/intern/readfile.c4
-rw-r--r--source/blender/blenloader/intern/writefile.c2
-rw-r--r--source/blender/editors/gpencil/gpencil_buttons.c9
-rw-r--r--source/blender/editors/interface/interface_icons.c2
-rw-r--r--source/blender/editors/space_file/file_panels.c2
-rw-r--r--source/blender/editors/space_file/filelist.c6
-rw-r--r--source/blender/editors/space_file/fsmenu.c6
-rw-r--r--source/blender/imbuf/intern/thumbs.c6
-rw-r--r--source/blender/makesdna/intern/dna_genfile.c2
-rw-r--r--source/blender/python/intern/bpy.c2
-rw-r--r--source/blender/windowmanager/intern/wm_files.c6
-rw-r--r--source/blender/windowmanager/intern/wm_keymap.c2
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c6
-rw-r--r--source/gameengine/Converter/KX_BlenderSceneConverter.cpp2
17 files changed, 38 insertions, 34 deletions
diff --git a/source/blender/blenfont/intern/blf_dir.c b/source/blender/blenfont/intern/blf_dir.c
index 3786de9f251..857ead0b7cd 100644
--- a/source/blender/blenfont/intern/blf_dir.c
+++ b/source/blender/blenfont/intern/blf_dir.c
@@ -60,7 +60,7 @@ static DirBLF *blf_dir_find(const char *path)
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;
}
diff --git a/source/blender/blenlib/BLI_path_util.h b/source/blender/blenlib/BLI_path_util.h
index ed52bf30f62..41e784ab707 100644
--- a/source/blender/blenlib/BLI_path_util.h
+++ b/source/blender/blenlib/BLI_path_util.h
@@ -158,9 +158,16 @@ int BLI_path_abs(char *path, const char *basepath);
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
diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c
index 689c6398705..bc5e20fb3b2 100644
--- a/source/blender/blenlib/intern/path_util.c
+++ b/source/blender/blenlib/intern/path_util.c
@@ -1481,7 +1481,7 @@ int BKE_rebase_path(char *abs, int abs_size, char *rel, int rel_size, const char
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 @@ int BKE_rebase_path(char *abs, int abs_size, char *rel, int rel_size, const char
}
/* 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;
}
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 54feaedc45f..779e08e8ba0 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -500,7 +500,7 @@ static Main *blo_find_main(FileData *fd, ListBase *mainlist, const char *name, c
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 @@ static void direct_link_library(FileData *fd, Library *lib, Main *main)
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);
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 50968cb2a54..7f791591e7d 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -2547,7 +2547,7 @@ int BLO_write_file(Main *mainvar, char *dir, int write_flags, ReportList *report
}
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 */
diff --git a/source/blender/editors/gpencil/gpencil_buttons.c b/source/blender/editors/gpencil/gpencil_buttons.c
index 67b732ffa5e..79fcbb0e49d 100644
--- a/source/blender/editors/gpencil/gpencil_buttons.c
+++ b/source/blender/editors/gpencil/gpencil_buttons.c
@@ -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 @@ static void gp_ui_dellayer_cb (bContext *C, void *gpd, void *gpl)
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 ------- */
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c
index 37af293e3aa..9507a1a07f4 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -686,7 +686,7 @@ int UI_iconfile_get_index(const char *filename)
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;
}
}
diff --git a/source/blender/editors/space_file/file_panels.c b/source/blender/editors/space_file/file_panels.c
index 2963f09ff96..959b1ddf1b5 100644
--- a/source/blender/editors/space_file/file_panels.c
+++ b/source/blender/editors/space_file/file_panels.c
@@ -101,7 +101,7 @@ static void file_panel_category(const bContext *C, Panel *pa, FSMenuCategory cat
/* 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;
}
}
diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c
index a32cfe29970..f0ffe34476f 100644
--- a/source/blender/editors/space_file/filelist.c
+++ b/source/blender/editors/space_file/filelist.c
@@ -459,7 +459,7 @@ int folderlist_clear_next(struct SpaceFile *sfile)
// 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 @@ int filelist_find(struct FileList* filelist, char *file)
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 @@ static void filelist_read_library(struct FileList* filelist)
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;
}
diff --git a/source/blender/editors/space_file/fsmenu.c b/source/blender/editors/space_file/fsmenu.c
index ffe1677a6a9..a6e84b0c41d 100644
--- a/source/blender/editors/space_file/fsmenu.c
+++ b/source/blender/editors/space_file/fsmenu.c
@@ -173,9 +173,11 @@ void fsmenu_insert_entry(struct FSMenu* fsmenu, FSMenuCategory category, const c
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 {
diff --git a/source/blender/imbuf/intern/thumbs.c b/source/blender/imbuf/intern/thumbs.c
index a9abcec9169..20276aede5c 100644
--- a/source/blender/imbuf/intern/thumbs.c
+++ b/source/blender/imbuf/intern/thumbs.c
@@ -281,7 +281,7 @@ ImBuf* IMB_thumb_create(const char* path, ThumbSize size, ThumbSource source, Im
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 @@ void IMB_thumb_delete(const char* path, ThumbSize size)
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 @@ ImBuf* IMB_thumb_manage(const char* path, ThumbSize size, ThumbSource source)
}
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);
diff --git a/source/blender/makesdna/intern/dna_genfile.c b/source/blender/makesdna/intern/dna_genfile.c
index 967effaeac3..e0e521a81d5 100644
--- a/source/blender/makesdna/intern/dna_genfile.c
+++ b/source/blender/makesdna/intern/dna_genfile.c
@@ -194,7 +194,7 @@ int DNA_elem_array_size(const char *astr, int len)
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);
diff --git a/source/blender/python/intern/bpy.c b/source/blender/python/intern/bpy.c
index 169d8a8ea6c..b247781b197 100644
--- a/source/blender/python/intern/bpy.c
+++ b/source/blender/python/intern/bpy.c
@@ -115,7 +115,7 @@ static PyObject *bpy_blend_paths(PyObject *UNUSED(self), PyObject *args, PyObjec
}
else {
lib= BLI_bpathIterator_getLib(bpi);
- if (lib && (strcmp(lib, BLI_bpathIterator_getBasePath(bpi)))) { /* relative path to the library is NOT the same as our blendfile path, return an absolute path */
+ if (lib && (BLI_path_cmp(lib, BLI_bpathIterator_getBasePath(bpi)))) { /* relative path to the library is NOT the same as our blendfile path, return an absolute path */
BLI_bpathIterator_getPathExpanded(bpi, filepath_expanded);
}
else {
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index 35bb874ff71..51a04b28a12 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -510,7 +510,7 @@ static void write_history(void)
recent = G.recent_files.first;
/* refresh recent-files.txt of recent opened files, when current file was changed */
- if(!(recent) || (strcmp(recent->filepath, G.main->name)!=0)) {
+ if(!(recent) || (BLI_path_cmp(recent->filepath, G.main->name)!=0)) {
fp= fopen(name, "w");
if (fp) {
/* add current file to the beginning of list */
@@ -524,7 +524,7 @@ static void write_history(void)
/* write rest of recent opened files to recent-files.txt */
while((i<U.recent_files) && (recent)){
/* this prevents to have duplicities in list */
- if (strcmp(recent->filepath, G.main->name)!=0) {
+ if (BLI_path_cmp(recent->filepath, G.main->name)!=0) {
fprintf(fp, "%s\n", recent->filepath);
recent = recent->next;
}
@@ -656,7 +656,7 @@ int WM_write_file(bContext *C, const char *target, int fileflags, ReportList *re
/* send the OnSave event */
for (li= G.main->library.first; li; li= li->id.next) {
- if (strcmp(li->filepath, di) == 0) {
+ if (BLI_path_cmp(li->filepath, di) == 0) {
BKE_reportf(reports, RPT_ERROR, "Can't overwrite used library '%.200s'", di);
return -1;
}
diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c
index 57b84fc18f4..336acd9f9bf 100644
--- a/source/blender/windowmanager/intern/wm_keymap.c
+++ b/source/blender/windowmanager/intern/wm_keymap.c
@@ -104,7 +104,7 @@ wmKeyConfig *WM_keyconfig_new_user(wmWindowManager *wm, const char *idname)
void WM_keyconfig_remove(wmWindowManager *wm, wmKeyConfig *keyconf)
{
if (keyconf) {
- if (BLI_streq(U.keyconfigstr, keyconf->idname)) {
+ if (strncmp(U.keyconfigstr, keyconf->idname, sizeof(U.keyconfigstr)) == 0) {
BLI_strncpy(U.keyconfigstr, wm->defaultconf->idname, sizeof(U.keyconfigstr));
}
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 093899954ff..4350b0505c9 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -1133,8 +1133,8 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar
sprintf(revision_str, "r%s", build_rev);
BLF_size(style->widgetlabel.uifont_id, style->widgetlabel.points, U.dpi);
- ver_width = BLF_width(style->widgetlabel.uifont_id, version_str)+5;
- rev_width = BLF_width(style->widgetlabel.uifont_id, revision_str)+5;
+ ver_width = (int)BLF_width(style->widgetlabel.uifont_id, version_str) + 5;
+ rev_width = (int)BLF_width(style->widgetlabel.uifont_id, revision_str) + 5;
#endif //NAN_BUILDINFO
block= uiBeginBlock(C, ar, "_popup", UI_EMBOSS);
@@ -1522,7 +1522,7 @@ static int wm_link_append_exec(bContext *C, wmOperator *op)
BKE_report(op->reports, RPT_ERROR, "Nothing indicated");
return OPERATOR_CANCELLED;
}
- else if(BLI_streq(bmain->name, libname)) {
+ else if(BLI_path_cmp(bmain->name, libname) == 0) {
BKE_report(op->reports, RPT_ERROR, "Cannot use current file as library");
return OPERATOR_CANCELLED;
}
diff --git a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
index 99cd30c76ed..0af6470fafc 100644
--- a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
+++ b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
@@ -926,7 +926,7 @@ vector<Main*> &KX_BlenderSceneConverter::GetMainDynamic()
Main* KX_BlenderSceneConverter::GetMainDynamicPath(const char *path)
{
for (vector<Main*>::iterator it=m_DynamicMaggie.begin(); !(it==m_DynamicMaggie.end()); it++)
- if(strcmp((*it)->name, path)==0)
+ if(BLI_path_cmp((*it)->name, path) == 0)
return *it;
return NULL;