[Bf-blender-cvs] [6eb8340ef45] master: Cleanup: use const arguments

Campbell Barton noreply at git.blender.org
Mon Jul 5 14:13:35 CEST 2021


Commit: 6eb8340ef45a2bc4d28db5430f1cf9e890c93c3e
Author: Campbell Barton
Date:   Mon Jul 5 21:41:45 2021 +1000
Branches: master
https://developer.blender.org/rB6eb8340ef45a2bc4d28db5430f1cf9e890c93c3e

Cleanup: use const arguments

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

M	source/blender/editors/space_image/image_ops.c
M	source/blender/gpu/intern/gpu_codegen.c
M	source/blender/gpu/intern/gpu_material_library.c
M	source/blender/gpu/intern/gpu_material_library.h

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

diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index b4e1f1ec9fc..3e8ac060862 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -2738,7 +2738,8 @@ static int image_flip_exec(bContext *C, wmOperator *op)
         const int source_pixel_x = use_flip_x ? size_x - x - 1 : x;
         const int source_pixel_y = use_flip_y ? size_y - y - 1 : y;
 
-        float *source_pixel = &orig_float_pixels[4 * (source_pixel_x + source_pixel_y * size_x)];
+        const float *source_pixel =
+            &orig_float_pixels[4 * (source_pixel_x + source_pixel_y * size_x)];
         float *target_pixel = &float_pixels[4 * (x + y * size_x)];
 
         copy_v4_v4(target_pixel, source_pixel);
@@ -2758,7 +2759,8 @@ static int image_flip_exec(bContext *C, wmOperator *op)
         const int source_pixel_x = use_flip_x ? size_x - x - 1 : x;
         const int source_pixel_y = use_flip_y ? size_y - y - 1 : y;
 
-        char *source_pixel = &orig_char_pixels[4 * (source_pixel_x + source_pixel_y * size_x)];
+        const char *source_pixel =
+            &orig_char_pixels[4 * (source_pixel_x + source_pixel_y * size_x)];
         char *target_pixel = &char_pixels[4 * (x + y * size_x)];
 
         copy_v4_v4_char(target_pixel, source_pixel);
diff --git a/source/blender/gpu/intern/gpu_codegen.c b/source/blender/gpu/intern/gpu_codegen.c
index b1fcfc1e202..d12cecd129e 100644
--- a/source/blender/gpu/intern/gpu_codegen.c
+++ b/source/blender/gpu/intern/gpu_codegen.c
@@ -938,9 +938,9 @@ GPUPass *GPU_generate_pass(GPUMaterial *material,
   return pass;
 }
 
-static int count_active_texture_sampler(GPUShader *shader, char *source)
+static int count_active_texture_sampler(GPUShader *shader, const char *source)
 {
-  char *code = source;
+  const char *code = source;
 
   /* Remember this is per stage. */
   GSet *sampler_ids = BLI_gset_int_new(__func__);
diff --git a/source/blender/gpu/intern/gpu_material_library.c b/source/blender/gpu/intern/gpu_material_library.c
index 3c216c1a991..73a80c62bdc 100644
--- a/source/blender/gpu/intern/gpu_material_library.c
+++ b/source/blender/gpu/intern/gpu_material_library.c
@@ -684,7 +684,7 @@ static GPUMaterialLibrary *gpu_material_libraries[] = {
 
 static GHash *FUNCTION_HASH = NULL;
 
-char *gpu_str_skip_token(char *str, char *token, int max)
+const char *gpu_str_skip_token(const char *str, char *token, int max)
 {
   int len = 0;
 
@@ -752,7 +752,7 @@ static void gpu_parse_material_library(GHash *hash, GPUMaterialLibrary *library)
   eGPUType type;
   GPUFunctionQual qual;
   int i;
-  char *code = library->code;
+  const char *code = library->code;
 
   while ((code = strstr(code, "void "))) {
     function = MEM_callocN(sizeof(GPUFunction), "GPUFunction");
diff --git a/source/blender/gpu/intern/gpu_material_library.h b/source/blender/gpu/intern/gpu_material_library.h
index da7b1636fa3..782d89d6f2a 100644
--- a/source/blender/gpu/intern/gpu_material_library.h
+++ b/source/blender/gpu/intern/gpu_material_library.h
@@ -62,5 +62,5 @@ char *gpu_material_library_generate_code(struct GSet *used_libraries, const char
 
 /* Code Parsing */
 
-char *gpu_str_skip_token(char *str, char *token, int max);
+const char *gpu_str_skip_token(const char *str, char *token, int max);
 const char *gpu_data_type_to_string(const eGPUType type);



More information about the Bf-blender-cvs mailing list