Page MenuHome

bli_testextensie.patch

bli_testextensie.patch

commit 5b2365c879edbe0ad2694f6b6abbc65dbc4e2f15
Author: Lawrence D'Oliveiro <ldo@geek-central.gen.nz>
Date: Wed Feb 13 00:14:59 2013 +0000
Simpler reimplementation of BLI_testextensie
BLI_testextensiexxx routines now return bool, which necessitated adding inclusion of BLI_utildefines.h, or moving it up in the inclusion order if it was already included, in various places
diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c
index 3be9097..372a8f7 100644
--- a/source/blender/blenkernel/intern/text.c
+++ b/source/blender/blenkernel/intern/text.c
@@ -38,12 +38,12 @@
#include "MEM_guardedalloc.h"
+#include "BLI_utildefines.h"
#include "BLI_path_util.h"
#include "BLI_string.h"
#include "BLI_string_cursor_utf8.h"
#include "BLI_string_utf8.h"
#include "BLI_listbase.h"
-#include "BLI_utildefines.h"
#include "BLI_fileops.h"
#include "DNA_constraint_types.h"
diff --git a/source/blender/blenlib/BLI_path_util.h b/source/blender/blenlib/BLI_path_util.h
index 8c51c92..b4a5e19 100644
--- a/source/blender/blenlib/BLI_path_util.h
+++ b/source/blender/blenlib/BLI_path_util.h
@@ -106,9 +106,9 @@ void BLI_del_slash(char *string);
char *BLI_first_slash(char *string);
void BLI_getlastdir(const char *dir, char *last, const size_t maxlen);
-int BLI_testextensie(const char *str, const char *ext);
-int BLI_testextensie_array(const char *str, const char **ext_array);
-int BLI_testextensie_glob(const char *str, const char *ext_fnmatch);
+bool BLI_testextensie(const char *str, const char *ext);
+bool BLI_testextensie_array(const char *str, const char **ext_array);
+bool BLI_testextensie_glob(const char *str, const char *ext_fnmatch);
int BLI_replace_extension(char *path, size_t maxlen, const char *ext);
int BLI_ensure_extension(char *path, size_t maxlen, const char *ext);
void BLI_uniquename(struct ListBase *list, void *vlink, const char defname[], char delim, short name_offs, short len);
diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c
index 5265d86..6a8115e 100644
--- a/source/blender/blenlib/intern/path_util.c
+++ b/source/blender/blenlib/intern/path_util.c
@@ -41,11 +41,11 @@
#include "DNA_listBase.h"
+#include "BLI_utildefines.h"
#include "BLI_fileops.h"
#include "BLI_path_util.h"
#include "BLI_string.h"
#include "BLI_string_utf8.h"
-#include "BLI_utildefines.h"
#include "../blenkernel/BKE_blender.h" /* BLENDER_VERSION, bad level include (no function call) */
@@ -1359,43 +1359,35 @@ void BLI_make_file_string(const char *relabase, char *string, const char *dir,
BLI_clean(string);
}
-int BLI_testextensie(const char *str, const char *ext)
+bool BLI_testextensie(const char *str, const char *ext)
+/* does str end with ext. */
{
- short a, b;
- int retval;
-
- a = strlen(str);
- b = strlen(ext);
-
- if (a == 0 || b == 0 || b >= a) {
- retval = 0;
- }
- else if (BLI_strcasecmp(ext, str + a - b)) {
- retval = 0;
- }
- else {
- retval = 1;
- }
-
- return (retval);
+ const short a = strlen(str);
+ const short b = strlen(ext);
+
+ return
+ !(a == 0 || b == 0 || b >= a)
+ &&
+ BLI_strcasecmp(ext, str + a - b) == 0;
}
-int BLI_testextensie_array(const char *str, const char **ext_array)
+bool BLI_testextensie_array(const char *str, const char **ext_array)
+/* does str end with any of the suffixes in *ext_array. */
{
int i = 0;
while (ext_array[i]) {
if (BLI_testextensie(str, ext_array[i])) {
- return 1;
+ return true;
}
i++;
}
- return 0;
+ return false;
}
/* semicolon separated wildcards, eg:
* '*.zip;*.py;*.exe' */
-int BLI_testextensie_glob(const char *str, const char *ext_fnmatch)
+bool BLI_testextensie_glob(const char *str, const char *ext_fnmatch)
{
const char *ext_step = ext_fnmatch;
char pattern[16];
@@ -1414,12 +1406,12 @@ int BLI_testextensie_glob(const char *str, const char *ext_fnmatch)
BLI_strncpy(pattern, ext_step, len_ext);
if (fnmatch(pattern, str, FNM_CASEFOLD) == 0) {
- return 1;
+ return true;
}
ext_step += len_ext;
}
- return 0;
+ return false;
}
diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c
index 0c9a5aa..25560b3 100644
--- a/source/blender/editors/mesh/mesh_data.c
+++ b/source/blender/editors/mesh/mesh_data.c
@@ -36,6 +36,7 @@
#include "DNA_scene_types.h"
#include "DNA_view3d_types.h"
+#include "BLI_utildefines.h"
#include "BLI_path_util.h"
#include "BLI_array.h"
#include "BLI_math.h"
diff --git a/source/blender/editors/space_buttons/buttons_ops.c b/source/blender/editors/space_buttons/buttons_ops.c
index 5426197..4e954db 100644
--- a/source/blender/editors/space_buttons/buttons_ops.c
+++ b/source/blender/editors/space_buttons/buttons_ops.c
@@ -35,10 +35,10 @@
#include "DNA_userdef_types.h"
+#include "BLI_utildefines.h"
#include "BLI_fileops.h"
#include "BLI_path_util.h"
#include "BLI_string.h"
-#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_global.h"
diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c
index dfb69be..6d1cc33 100644
--- a/source/blender/editors/space_clip/clip_ops.c
+++ b/source/blender/editors/space_clip/clip_ops.c
@@ -36,8 +36,8 @@
#include "DNA_userdef_types.h"
#include "DNA_scene_types.h" /* min/max frames */
-#include "BLI_path_util.h"
#include "BLI_utildefines.h"
+#include "BLI_path_util.h"
#include "BLI_math.h"
#include "BLI_rect.h"
diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c
index 8d79482..381e0b8 100644
--- a/source/blender/imbuf/intern/anim_movie.c
+++ b/source/blender/imbuf/intern/anim_movie.c
@@ -64,9 +64,9 @@
#include <io.h>
#endif
+#include "BLI_utildefines.h"
#include "BLI_string.h"
#include "BLI_path_util.h"
-#include "BLI_utildefines.h"
#include "BLI_math_base.h"
#include "MEM_guardedalloc.h"
diff --git a/source/blender/imbuf/intern/readimage.c b/source/blender/imbuf/intern/readimage.c
index 00bc78e..5026b98 100644
--- a/source/blender/imbuf/intern/readimage.c
+++ b/source/blender/imbuf/intern/readimage.c
@@ -43,12 +43,11 @@
#endif
#include <stdlib.h>
+#include "BLI_utildefines.h"
#include "BLI_string.h"
#include "BLI_path_util.h"
#include "BLI_fileops.h"
-#include "BLI_utildefines.h"
-
#include "imbuf.h"
#include "IMB_imbuf_types.h"
#include "IMB_imbuf.h"
diff --git a/source/blender/imbuf/intern/thumbs.c b/source/blender/imbuf/intern/thumbs.c
index c1d80ad..bdf2476 100644
--- a/source/blender/imbuf/intern/thumbs.c
+++ b/source/blender/imbuf/intern/thumbs.c
@@ -34,6 +34,7 @@
#include "MEM_guardedalloc.h"
+#include "BLI_utildefines.h"
#include "BLI_string.h"
#include "BLI_path_util.h"
#include "BLI_fileops.h"
diff --git a/source/blender/imbuf/intern/util.c b/source/blender/imbuf/intern/util.c
index 549a95e..68d1c90 100644
--- a/source/blender/imbuf/intern/util.c
+++ b/source/blender/imbuf/intern/util.c
@@ -41,9 +41,9 @@
#include <stdlib.h>
+#include "BLI_utildefines.h"
#include "BLI_path_util.h"
#include "BLI_fileops.h"
-#include "BLI_utildefines.h"
#include "BLI_string.h"
#include "DNA_userdef_types.h"
diff --git a/source/blender/makesrna/intern/rna_fluidsim.c b/source/blender/makesrna/intern/rna_fluidsim.c
index 84ff53e..9ff83da 100644
--- a/source/blender/makesrna/intern/rna_fluidsim.c
+++ b/source/blender/makesrna/intern/rna_fluidsim.c
@@ -28,6 +28,7 @@
#include "DNA_object_fluidsim.h"
+#include "BLI_utildefines.h"
#include "BLI_path_util.h"
#include "RNA_define.h"
diff --git a/source/blender/makesrna/intern/rna_main.c b/source/blender/makesrna/intern/rna_main.c
index 04b8d2f..75b7655 100644
--- a/source/blender/makesrna/intern/rna_main.c
+++ b/source/blender/makesrna/intern/rna_main.c
@@ -27,6 +27,7 @@
#include <stdlib.h>
#include <string.h>
+#include "BLI_utildefines.h"
#include "BLI_path_util.h"
#include "RNA_define.h"
diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c
index 7175c8e..4d5d4d4 100644
--- a/source/blender/makesrna/intern/rna_main_api.c
+++ b/source/blender/makesrna/intern/rna_main_api.c
@@ -36,8 +36,8 @@
#include "DNA_ID.h"
#include "DNA_modifier_types.h"
-#include "BLI_path_util.h"
#include "BLI_utildefines.h"
+#include "BLI_path_util.h"
#include "RNA_define.h"
#include "RNA_access.h"
diff --git a/source/blender/makesrna/intern/rna_render.c b/source/blender/makesrna/intern/rna_render.c
index 5931440..f51c0b0 100644
--- a/source/blender/makesrna/intern/rna_render.c
+++ b/source/blender/makesrna/intern/rna_render.c
@@ -28,6 +28,7 @@
#include "DNA_scene_types.h"
+#include "BLI_utildefines.h"
#include "BLI_path_util.h"
#include "RNA_define.h"
diff --git a/source/blender/makesrna/intern/rna_scene_api.c b/source/blender/makesrna/intern/rna_scene_api.c
index b0df27b..08adc9d 100644
--- a/source/blender/makesrna/intern/rna_scene_api.c
+++ b/source/blender/makesrna/intern/rna_scene_api.c
@@ -32,6 +32,7 @@
#include <stdlib.h>
#include <stdio.h>
+#include "BLI_utildefines.h"
#include "BLI_path_util.h"
#include "RNA_define.h"
diff --git a/source/blender/makesrna/intern/rna_texture_api.c b/source/blender/makesrna/intern/rna_texture_api.c
index 218fda3..10ac5a9 100644
--- a/source/blender/makesrna/intern/rna_texture_api.c
+++ b/source/blender/makesrna/intern/rna_texture_api.c
@@ -28,6 +28,7 @@
#include <stdio.h>
#include <string.h>
+#include "BLI_utildefines.h"
#include "BLI_path_util.h"
#include "RNA_define.h"
diff --git a/source/blender/nodes/composite/nodes/node_composite_outputFile.c b/source/blender/nodes/composite/nodes/node_composite_outputFile.c
index e8a6506..959d82f 100644
--- a/source/blender/nodes/composite/nodes/node_composite_outputFile.c
+++ b/source/blender/nodes/composite/nodes/node_composite_outputFile.c
@@ -31,6 +31,7 @@
#include <string.h>
+#include "BLI_utildefines.h"
#include "BLI_path_util.h"
#include "node_composite_util.h"
diff --git a/source/blender/python/intern/bpy.c b/source/blender/python/intern/bpy.c
index c4d68290..71f85af 100644
--- a/source/blender/python/intern/bpy.c
+++ b/source/blender/python/intern/bpy.c
@@ -35,10 +35,10 @@
#include "RNA_types.h"
#include "RNA_access.h"
+#include "BLI_utildefines.h"
#include "BLI_path_util.h"
#include "BLI_string.h"
#include "BKE_bpath.h"
-#include "BLI_utildefines.h"
#include "bpy.h"
#include "bpy_util.h"
diff --git a/source/blender/python/intern/bpy_app.c b/source/blender/python/intern/bpy_app.c
index 5195f82..f2ad239 100644
--- a/source/blender/python/intern/bpy_app.c
+++ b/source/blender/python/intern/bpy_app.c
@@ -41,9 +41,8 @@
#include "bpy_app_handlers.h"
#include "bpy_driver.h"
-#include "BLI_path_util.h"
#include "BLI_utildefines.h"
-
+#include "BLI_path_util.h"
#include "BKE_blender.h"
#include "BKE_global.h"
diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c
index 632018f..8d2cc21 100644
--- a/source/blender/python/intern/bpy_interface.c
+++ b/source/blender/python/intern/bpy_interface.c
@@ -39,13 +39,13 @@
#include "MEM_guardedalloc.h"
+#include "BLI_utildefines.h"
#include "BLI_path_util.h"
#include "BLI_fileops.h"
#include "BLI_listbase.h"
#include "BLI_math_base.h"
#include "BLI_string.h"
#include "BLI_string_utf8.h"
-#include "BLI_utildefines.h"
#include "BLI_threads.h"
#include "RNA_types.h"
diff --git a/source/blender/python/intern/bpy_traceback.c b/source/blender/python/intern/bpy_traceback.c
index 48bf65a..81d12e9 100644
--- a/source/blender/python/intern/bpy_traceback.c
+++ b/source/blender/python/intern/bpy_traceback.c
@@ -29,6 +29,7 @@
#include <Python.h>
#include <frameobject.h>
+#include "BLI_utildefines.h"
#include "BLI_path_util.h"
#include "BLI_string.h"

File Metadata

Mime Type
text/x-diff
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
fe/53/4f0e5ff7a27c3496e7eaf82cf4ef

Event Timeline