[Bf-blender-cvs] [e170d6b] master: Cleanup: all params of BLI_str partition funcs can be const...

Bastien Montagne noreply at git.blender.org
Sat Jun 27 11:03:26 CEST 2015


Commit: e170d6be7fb3f7853fac6e8b2bf0142347a5dcf9
Author: Bastien Montagne
Date:   Sat Jun 27 11:00:47 2015 +0200
Branches: master
https://developer.blender.org/rBe170d6be7fb3f7853fac6e8b2bf0142347a5dcf9

Cleanup: all params of BLI_str partition funcs can be const...

===================================================================

M	source/blender/blenkernel/BKE_scene.h
M	source/blender/blenkernel/intern/image.c
M	source/blender/blenkernel/intern/scene.c
M	source/blender/blenkernel/intern/sequencer.c
M	source/blender/blenlib/BLI_string.h
M	source/blender/blenlib/BLI_string_utf8.h
M	source/blender/blenlib/intern/string.c
M	source/blender/blenlib/intern/string_utf8.c
M	source/blender/editors/space_node/node_select.c
M	source/blender/imbuf/intern/openexr/openexr_api.cpp
M	source/blender/render/intern/source/render_result.c
M	tests/gtests/blenlib/BLI_string_test.cc

===================================================================

diff --git a/source/blender/blenkernel/BKE_scene.h b/source/blender/blenkernel/BKE_scene.h
index 442a438..027bdbb 100644
--- a/source/blender/blenkernel/BKE_scene.h
+++ b/source/blender/blenkernel/BKE_scene.h
@@ -160,7 +160,7 @@ void        BKE_scene_multiview_filepath_get(struct SceneRenderView *srv, const
 void        BKE_scene_multiview_view_filepath_get(const struct RenderData *rd, const char *filepath, const char *view, char *r_filepath);
 const char *BKE_scene_multiview_view_suffix_get(const struct RenderData *rd, const char *viewname);
 const char *BKE_scene_multiview_view_id_suffix_get(const struct RenderData *rd, const size_t view_id);
-void        BKE_scene_multiview_view_prefix_get(struct Scene *scene, const char *name, char *rprefix, char **rext);
+void        BKE_scene_multiview_view_prefix_get(struct Scene *scene, const char *name, char *rprefix, const char **rext);
 void        BKE_scene_multiview_videos_dimensions_get(const struct RenderData *rd, const size_t width, const size_t height, size_t *r_width, size_t *r_height);
 size_t      BKE_scene_multiview_num_videos_get(const struct RenderData *rd);
 
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index 45ae390..d648db7 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -4595,7 +4595,7 @@ static void image_update_views_format(Image *ima, ImageUser *iuser)
 		/* R_IMF_VIEWS_INDIVIDUAL */
 		char prefix[FILE_MAX] = {'\0'};
 		char *name = ima->name;
-		char *ext = NULL;
+		const char *ext = NULL;
 
 		BKE_scene_multiview_view_prefix_get(scene, name, prefix, &ext);
 
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index 0813576..28c94c8 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -2428,11 +2428,11 @@ const char *BKE_scene_multiview_view_id_suffix_get(const RenderData *rd, const s
 	}
 }
 
-void BKE_scene_multiview_view_prefix_get(Scene *scene, const char *name, char *rprefix, char **rext)
+void BKE_scene_multiview_view_prefix_get(Scene *scene, const char *name, char *rprefix, const char **rext)
 {
 	SceneRenderView *srv;
 	size_t index_act;
-	char *suf_act;
+	const char *suf_act;
 	const char delims[] = {'.', '\0'};
 
 	rprefix[0] = '\0';
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index 21ef9fe..4ec5dd5 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -854,7 +854,7 @@ void BKE_sequence_reload_new_file(Scene *scene, Sequence *seq, const bool lock_r
 
 			if (is_multiview && (seq->views_format == R_IMF_VIEWS_INDIVIDUAL)) {
 				char prefix[FILE_MAX];
-				char *ext = NULL;
+				const char *ext = NULL;
 				size_t totfiles = seq_num_files(scene, seq->views_format, true);
 				int i = 0;
 
@@ -1479,7 +1479,7 @@ static void seq_open_anim_file(Scene *scene, Sequence *seq, bool openfile)
 	if (is_multiview && seq->views_format == R_IMF_VIEWS_INDIVIDUAL) {
 		size_t totfiles = seq_num_files(scene, seq->views_format, true);
 		char prefix[FILE_MAX];
-		char *ext = NULL;
+		const char *ext = NULL;
 		int i;
 
 		BKE_scene_multiview_view_prefix_get(scene, name, prefix, &ext);
@@ -1773,7 +1773,7 @@ static bool seq_proxy_multiview_context_invalid(Sequence *seq, Scene *scene, con
 
 	if ((seq->type == SEQ_TYPE_IMAGE) && (seq->views_format == R_IMF_VIEWS_INDIVIDUAL)) {
 		static char prefix[FILE_MAX];
-		static char *ext = NULL;
+		static const char *ext = NULL;
 		char str[FILE_MAX];
 
 		if (view_id == 0) {
@@ -2739,7 +2739,7 @@ static ImBuf *seq_render_image_strip(const SeqRenderData *context, Sequence *seq
 		size_t totviews;
 		struct ImBuf **ibufs_arr;
 		char prefix[FILE_MAX];
-		char *ext = NULL;
+		const char *ext = NULL;
 		int i;
 
 		if (totfiles > 1) {
@@ -5068,7 +5068,7 @@ Sequence *BKE_sequencer_add_movie_strip(bContext *C, ListBase *seqbasep, SeqLoad
 
 	if (is_multiview && (seq_load->views_format == R_IMF_VIEWS_INDIVIDUAL)) {
 		char prefix[FILE_MAX];
-		char *ext = NULL;
+		const char *ext = NULL;
 		size_t j = 0;
 
 		BKE_scene_multiview_view_prefix_get(scene, path, prefix, &ext);
diff --git a/source/blender/blenlib/BLI_string.h b/source/blender/blenlib/BLI_string.h
index a94777d..c8491f4 100644
--- a/source/blender/blenlib/BLI_string.h
+++ b/source/blender/blenlib/BLI_string.h
@@ -90,10 +90,10 @@ int BLI_str_index_in_array(const char *__restrict str, const char **__restrict s
 bool BLI_str_endswith(const char *__restrict str, const char *__restrict end) ATTR_NONNULL();
 bool BLI_strn_endswith(const char *__restrict str, const char *__restrict end, size_t length) ATTR_NONNULL();
 
-size_t BLI_str_partition(const char *str, const char delim[], char **sep, char **suf) ATTR_NONNULL();
-size_t BLI_str_rpartition(const char *str, const char delim[], char **sep, char **suf) ATTR_NONNULL();
+size_t BLI_str_partition(const char *str, const char delim[], const char **sep, const char **suf) ATTR_NONNULL();
+size_t BLI_str_rpartition(const char *str, const char delim[], const char **sep, const char **suf) ATTR_NONNULL();
 size_t BLI_str_partition_ex(
-        const char *str, const char *end, const char delim[], char **sep, char **suf, const bool from_right)
+        const char *str, const char *end, const char delim[], const char **sep, const char **suf, const bool from_right)
         ATTR_NONNULL(1, 3, 4, 5);
 
 #ifdef __cplusplus
diff --git a/source/blender/blenlib/BLI_string_utf8.h b/source/blender/blenlib/BLI_string_utf8.h
index 18eff67..0740b57 100644
--- a/source/blender/blenlib/BLI_string_utf8.h
+++ b/source/blender/blenlib/BLI_string_utf8.h
@@ -67,10 +67,10 @@ int          BLI_wcswidth(const wchar_t *pwcs, size_t n) ATTR_NONNULL();
 int          BLI_str_utf8_char_width(const char *p) ATTR_NONNULL(); /* warning, can return -1 on bad chars */
 int          BLI_str_utf8_char_width_safe(const char *p) ATTR_NONNULL();
 
-size_t       BLI_str_partition_utf8(const char *str, const unsigned int delim[], char **sep, char **suf) ATTR_NONNULL();
-size_t       BLI_str_rpartition_utf8(const char *str, const unsigned int delim[], char **sep, char **suf) ATTR_NONNULL();
+size_t       BLI_str_partition_utf8(const char *str, const unsigned int delim[], const char **sep, const char **suf) ATTR_NONNULL();
+size_t       BLI_str_rpartition_utf8(const char *str, const unsigned int delim[], const char **sep, const char **suf) ATTR_NONNULL();
 size_t       BLI_str_partition_ex_utf8(
-        const char *str, const char *end, const unsigned int delim[], char **sep, char **suf, const bool from_right)
+        const char *str, const char *end, const unsigned int delim[], const char **sep, const char **suf, const bool from_right)
         ATTR_NONNULL(1, 3, 4, 5);
 
 #define      BLI_UTF8_MAX 6        /* mem */
diff --git a/source/blender/blenlib/intern/string.c b/source/blender/blenlib/intern/string.c
index 0dcb84c..3177bc6 100644
--- a/source/blender/blenlib/intern/string.c
+++ b/source/blender/blenlib/intern/string.c
@@ -854,7 +854,7 @@ bool BLI_str_endswith(const char *__restrict str, const char *end)
  * \param suf Return value, set to next char after the first delimiter found (or NULL if none found).
  * \return The length of the prefix (i.e. *sep - str).
  */
-size_t BLI_str_partition(const char *str, const char delim[], char **sep, char **suf)
+size_t BLI_str_partition(const char *str, const char delim[], const char **sep, const char **suf)
 {
 	return BLI_str_partition_ex(str, NULL, delim, sep, suf, false);
 }
@@ -868,7 +868,7 @@ size_t BLI_str_partition(const char *str, const char delim[], char **sep, char *
  * \param suf Return value, set to next char after the first delimiter found (or NULL if none found).
  * \return The length of the prefix (i.e. *sep - str).
  */
-size_t BLI_str_rpartition(const char *str, const char delim[], char **sep, char **suf)
+size_t BLI_str_rpartition(const char *str, const char delim[], const char **sep, const char **suf)
 {
 	return BLI_str_partition_ex(str, NULL, delim, sep, suf, true);
 }
@@ -885,7 +885,7 @@ size_t BLI_str_rpartition(const char *str, const char delim[], char **sep, char
  * \return The length of the prefix (i.e. *sep - str).
  */
 size_t BLI_str_partition_ex(
-        const char *str, const char *end, const char delim[], char **sep, char **suf, const bool from_right)
+        const char *str, const char *end, const char delim[], const char **sep, const char **suf, const bool from_right)
 {
 	const char *d;
 	char *(*func)(const char *str, int c) = from_right ? strrchr : strchr;
@@ -916,7 +916,7 @@ size_t BLI_str_partition_ex(
 		}
 
 		if (tmp && (from_right ? (*sep < tmp) : (!*sep || *sep > tmp))) {
-			*sep = (char *)tmp;
+			*sep = tmp;
 		}
 	}
 
diff --git a/source/blender/blenlib/intern/string_utf8.c b/source/blender/blenlib/intern/string_utf8.c
index 85306cc..9603361 100644
--- a/source/blender/blenlib/intern/string_utf8.c
+++ b/source/blender/blenlib/intern/string_utf8.c
@@ -734,18 +734,18 @@ char *BLI_str_prev_char_utf8(const char *p)
 }
 /* end glib copy */
 
-size_t BLI_str_partition_utf8(const char *str, const unsigned int delim[], char **sep, char **suf)
+size_t BLI_str_partition_utf8(const char *str, const unsigned int delim[], const char **sep, const char **suf)
 {
 	return BLI_str_partition_ex_utf8(str, NULL, delim, sep, suf, false);
 }
 
-size_t BLI_str_rpartition_utf8(const char *str, const unsigned int delim[], char **sep, char **suf)
+size_t BLI_str_rpartition_utf8(const char *str, const unsigned int delim[], const char **sep, const char **suf)
 {
 	return BLI_str_partition_ex_utf8(str, NULL, delim, sep, suf, true);
 }
 
 size_t BLI_str_partition_ex_utf8(
-        const char *str, const char *end, const unsigned int delim[], char **sep, char **suf, const bool from_right)
+        const char *str, const char *end, const unsigned int delim[], const char **sep, const char **suf, const bool from_right)
 {
 	const unsigned int *d;
 	const size_t str_len = end ? (size_t)(end - str) : strlen(str);
diff --git a/source/blender/editors/space_node/node_select.c b/source/blender/editors/space_node/node_selec

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list