[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [55035] trunk/blender/source: patch [ #34103]

Campbell Barton ideasman42 at gmail.com
Tue Mar 5 04:17:47 CET 2013


Revision: 55035
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=55035
Author:   campbellbarton
Date:     2013-03-05 03:17:46 +0000 (Tue, 05 Mar 2013)
Log Message:
-----------
patch [#34103]
from Lawrence D'Oliveiro (ldo)

More use of bool type, necessitating adding inclusion of BLI_utildefines.h, or moving it up in the inclusion order if it was already included, in various places
- storage.c: make some variables only used in bli_builddir local to that
- storage.c: BLI_file_descriptor_size should allow 0 as a valid file descriptor
- path_util.c: make pointers to non-reentrant storage returned from folder routines const, necessitating making variables holding these returned pointers const elsewhere as well
- path_util.c: BLI_string_to_utf8 closes iconv context in case of conversion error
-  blf_lang.c: fill_locales routine now has its own "languages" local variable to construct paths (was stealing internal storage belonging to BLI_get_folder before)

Modified Paths:
--------------
    trunk/blender/source/blender/blenfont/intern/blf_dir.c
    trunk/blender/source/blender/blenfont/intern/blf_lang.c
    trunk/blender/source/blender/blenfont/intern/blf_translation.c
    trunk/blender/source/blender/blenkernel/intern/customdata_file.c
    trunk/blender/source/blender/blenkernel/intern/tracking.c
    trunk/blender/source/blender/blenlib/BLI_fileops.h
    trunk/blender/source/blender/blenlib/BLI_path_util.h
    trunk/blender/source/blender/blenlib/BLI_utildefines.h
    trunk/blender/source/blender/blenlib/intern/path_util.c
    trunk/blender/source/blender/blenlib/intern/storage.c
    trunk/blender/source/blender/editors/render/render_preview.c
    trunk/blender/source/blender/editors/space_file/filesel.c
    trunk/blender/source/blender/editors/space_file/space_file.c
    trunk/blender/source/blender/imbuf/intern/bmp.c
    trunk/blender/source/blender/imbuf/intern/iris.c
    trunk/blender/source/blender/imbuf/intern/jpeg.c
    trunk/blender/source/blender/imbuf/intern/png.c
    trunk/blender/source/blender/imbuf/intern/radiance_hdr.c
    trunk/blender/source/blender/imbuf/intern/targa.c
    trunk/blender/source/blender/python/intern/bpy.c
    trunk/blender/source/blender/render/intern/source/render_result.c
    trunk/blender/source/blender/windowmanager/intern/wm_files.c
    trunk/blender/source/blender/windowmanager/intern/wm_operators.c
    trunk/blender/source/blender/windowmanager/intern/wm_playanim.c
    trunk/blender/source/gameengine/Ketsji/KX_PythonInit.cpp

Modified: trunk/blender/source/blender/blenfont/intern/blf_dir.c
===================================================================
--- trunk/blender/source/blender/blenfont/intern/blf_dir.c	2013-03-05 02:58:36 UTC (rev 55034)
+++ trunk/blender/source/blender/blenfont/intern/blf_dir.c	2013-03-05 03:17:46 UTC (rev 55035)
@@ -41,6 +41,7 @@
 
 #include "DNA_vec_types.h"
 
+#include "BLI_utildefines.h"
 #include "BLI_fileops.h"
 #include "BLI_listbase.h"
 #include "BLI_path_util.h"

Modified: trunk/blender/source/blender/blenfont/intern/blf_lang.c
===================================================================
--- trunk/blender/source/blender/blenfont/intern/blf_lang.c	2013-03-05 02:58:36 UTC (rev 55034)
+++ trunk/blender/source/blender/blenfont/intern/blf_lang.c	2013-03-05 03:17:46 UTC (rev 55035)
@@ -78,15 +78,16 @@
 
 static void fill_locales(void)
 {
-	char *languages_path = BLI_get_folder(BLENDER_DATAFILES, "locale");
+	const char * const languages_path = BLI_get_folder(BLENDER_DATAFILES, "locale");
+	char languages[FILE_MAX];
 	LinkNode *lines = NULL, *line;
 	char *str;
 	int idx = 0;
 
 	free_locales();
 
-	BLI_join_dirfile(languages_path, FILE_MAX, languages_path, "languages");
-	line = lines = BLI_file_read_as_lines(languages_path);
+	BLI_join_dirfile(languages, FILE_MAX, languages_path, "languages");
+	line = lines = BLI_file_read_as_lines(languages);
 
 	/* This whole "parsing" code is a bit weak, in that it expects strictly formated input file...
 	 * Should not be a problem, though, as this file is script-generated! */
@@ -185,7 +186,7 @@
 void BLF_lang_init(void)
 {
 #ifdef WITH_INTERNATIONAL
-	char *messagepath = BLI_get_folder(BLENDER_DATAFILES, "locale");
+	const char * const messagepath = BLI_get_folder(BLENDER_DATAFILES, "locale");
 
 	if (messagepath) {
 		bl_locale_init(messagepath, TEXT_DOMAIN_NAME);

Modified: trunk/blender/source/blender/blenfont/intern/blf_translation.c
===================================================================
--- trunk/blender/source/blender/blenfont/intern/blf_translation.c	2013-03-05 02:58:36 UTC (rev 55034)
+++ trunk/blender/source/blender/blenfont/intern/blf_translation.c	2013-03-05 03:17:46 UTC (rev 55035)
@@ -56,7 +56,7 @@
 {
 #ifdef WITH_INTERNATIONAL
 	if (unifont_ttf == NULL) {
-		char *fontpath = BLI_get_folder(BLENDER_DATAFILES, "fonts");
+		const char * const fontpath = BLI_get_folder(BLENDER_DATAFILES, "fonts");
 		if (fontpath) {
 			char unifont_path[1024];
 

Modified: trunk/blender/source/blender/blenkernel/intern/customdata_file.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/customdata_file.c	2013-03-05 02:58:36 UTC (rev 55034)
+++ trunk/blender/source/blender/blenkernel/intern/customdata_file.c	2013-03-05 03:17:46 UTC (rev 55035)
@@ -29,9 +29,9 @@
 
 #include "MEM_guardedalloc.h"
 
+#include "BLI_utildefines.h"
 #include "BLI_fileops.h"
 #include "BLI_string.h"
-#include "BLI_utildefines.h"
 #include "BLI_endian_switch.h"
 
 #include "BKE_customdata_file.h"

Modified: trunk/blender/source/blender/blenkernel/intern/tracking.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/tracking.c	2013-03-05 02:58:36 UTC (rev 55034)
+++ trunk/blender/source/blender/blenkernel/intern/tracking.c	2013-03-05 03:17:46 UTC (rev 55035)
@@ -1773,6 +1773,7 @@
 	(void) frame_height;
 	(void) search_ibuf;
 	(void) marker;
+	(void) from_anchor;
 	(void) track;
 	(void) use_mask;
 

Modified: trunk/blender/source/blender/blenlib/BLI_fileops.h
===================================================================
--- trunk/blender/source/blender/blenlib/BLI_fileops.h	2013-03-05 02:58:36 UTC (rev 55034)
+++ trunk/blender/source/blender/blenlib/BLI_fileops.h	2013-03-05 03:17:46 UTC (rev 55035)
@@ -61,8 +61,8 @@
 
 struct direntry;
 
-int    BLI_is_dir(const char *path);
-int    BLI_is_file(const char *path);
+bool   BLI_is_dir(const char *path);
+bool   BLI_is_file(const char *path);
 void   BLI_dir_create_recursive(const char *dir);
 double BLI_dir_free_space(const char *dir);
 char  *BLI_current_working_dir(char *dir, const size_t maxlen);
@@ -85,7 +85,7 @@
 size_t BLI_file_size(const char *file);
 
 /* compare if one was last modified before the other */
-int    BLI_file_older(const char *file1, const char *file2);
+bool   BLI_file_older(const char *file1, const char *file2);
 
 /* read ascii file as lines, empty list if reading fails */
 struct LinkNode *BLI_file_read_as_lines(const char *file);

Modified: trunk/blender/source/blender/blenlib/BLI_path_util.h
===================================================================
--- trunk/blender/source/blender/blenlib/BLI_path_util.h	2013-03-05 02:58:36 UTC (rev 55034)
+++ trunk/blender/source/blender/blenlib/BLI_path_util.h	2013-03-05 03:17:46 UTC (rev 55035)
@@ -40,10 +40,10 @@
 
 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);
-char *BLI_get_user_folder_notest(int folder_id, const char *subfolder);
-char *BLI_get_folder_version(const int id, const int ver, const bool do_check);
+const char *BLI_get_folder(int folder_id, const char *subfolder);
+const char *BLI_get_folder_create(int folder_id, const char *subfolder);
+const char *BLI_get_user_folder_notest(int folder_id, const char *subfolder);
+const char *BLI_get_folder_version(const int id, const int ver, const bool do_check);
 
 /* folder_id */
 
@@ -109,8 +109,8 @@
 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);
+bool BLI_replace_extension(char *path, size_t maxlen, const char *ext);
+bool 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);
 bool BLI_uniquename_cb(bool (*unique_check)(void * arg, const char * name),
                        void *arg, const char * defname, char delim, char *name, short name_len);
@@ -155,13 +155,14 @@
  * \retval Returns true if the path was relative (started with "//").
  */
 bool 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);
+bool BLI_path_frame(char *path, int frame, int digits);
+bool BLI_path_frame_range(char *path, int sta, int end, int digits);
+bool BLI_path_cwd(char *path);
 void BLI_path_rel(char *file, const char *relfile);
 
 bool BLI_path_is_rel(const char *path);
 
+/* path string comparisons: case-insensitive for Windows, case-sensitive otherwise */
 #ifdef WIN32
 #  define BLI_path_cmp BLI_strcasecmp
 #  define BLI_path_ncmp BLI_strncasecmp

Modified: trunk/blender/source/blender/blenlib/BLI_utildefines.h
===================================================================
--- trunk/blender/source/blender/blenlib/BLI_utildefines.h	2013-03-05 02:58:36 UTC (rev 55034)
+++ trunk/blender/source/blender/blenlib/BLI_utildefines.h	2013-03-05 03:17:46 UTC (rev 55035)
@@ -167,7 +167,7 @@
 	(b) = (tval);                 \
 } (void)0
 
-
+/* ELEM#(a, ...): is the first arg equal any of the others */
 #define ELEM(a, b, c)           ((a) == (b) || (a) == (c))
 #define ELEM3(a, b, c, d)       (ELEM(a, b, c) || (a) == (d) )
 #define ELEM4(a, b, c, d, e)    (ELEM(a, b, c) || ELEM(a, d, e) )

Modified: trunk/blender/source/blender/blenlib/intern/path_util.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/path_util.c	2013-03-05 02:58:36 UTC (rev 55034)
+++ trunk/blender/source/blender/blenlib/intern/path_util.c	2013-03-05 03:17:46 UTC (rev 55035)
@@ -79,8 +79,8 @@
 /* local */
 #define UNIQUE_NAME_MAX 128
 
-static char bprogname[FILE_MAX];    /* path to program executable */
-static char bprogdir[FILE_MAX];     /* path in which executable is located */
+static char bprogname[FILE_MAX];    /* full path to program executable */
+static char bprogdir[FILE_MAX];     /* full path to directory in which executable is located */
 static char btempdir[FILE_MAX];     /* temporary directory */
 
 static int add_win32_extension(char *name);
@@ -229,7 +229,7 @@
  * Ensures name is unique (according to criteria specified by caller in unique_check callback),
  * incrementing its numeric suffix as necessary. Returns true if name had to be adjusted.
  *
- * \param unique_check  Return true iff name is not unique
+ * \param unique_check  Return true if name is not unique
  * \param arg  Additional arg to unique_check--meaning is up to caller
  * \param defname  To initialize name if latter is empty
  * \param delim  Delimits numeric suffix in name
@@ -470,6 +470,10 @@
 	return path[0] == '/' && path[1] == '/';
 }
 
+/**
+ * Replaces *file with a relative version (prefixed by "//") such that BLI_path_abs, given
+ * the same *relfile, will convert it back to its original value.
+ */
 void BLI_path_rel(char *file, const char *relfile)
 {
 	const char *lslash;
@@ -575,8 +579,8 @@
 }
 
 /**
- * Cleans path and makes sure it ends with a slash, and returns true iff
- * it has more than one other path separator in it.
+ * Cleans path and makes sure it ends with a slash.
+ * \return  true if \a path has more than one other path separator in it.
  */
 bool BLI_has_parent(char *path)
 {
@@ -594,7 +598,7 @@
 }
 
 /**
- * Replaces path with the path of its parent directory, returning true iff
+ * Replaces path with the path of its parent directory, returning true if
  * it was able to find a parent directory within the pathname.
  */
 bool BLI_parent_dir(char *path)
@@ -618,7 +622,7 @@
 /**
  * Looks for a sequence of "#" characters in the last slash-separated component of *path,
  * returning the indexes of the first and one past the last character in the sequence in
- * *char_start and *char_end respectively. Returns true iff such a sequence was found.
+ * *char_start and *char_end respectively. Returns true if such a sequence was found.
  */

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list