From 69e9e45744b11c91626869f1ade72a07c296d387 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 13 Feb 2021 17:03:20 +1100 Subject: Cleanup: macro hygiene, use parenthesis around operators --- intern/cycles/kernel/kernel_types.h | 2 +- intern/utfconv/utfconv.h | 8 ++++---- source/blender/blenlib/intern/fileops.c | 2 +- source/blender/bmesh/tools/bmesh_bevel.c | 4 ++-- source/blender/bmesh/tools/bmesh_intersect_edges.c | 2 +- .../draw/engines/overlay/shaders/edit_curve_handle_geom.glsl | 4 ++-- .../draw/engines/overlay/shaders/edit_curve_point_vert.glsl | 2 +- source/blender/draw/intern/draw_cache_impl_curve.c | 6 +++--- source/blender/draw/intern/draw_cache_impl_gpencil.c | 2 +- source/blender/draw/intern/draw_hair_private.h | 2 +- source/creator/creator_intern.h | 2 +- 11 files changed, 18 insertions(+), 18 deletions(-) diff --git a/intern/cycles/kernel/kernel_types.h b/intern/cycles/kernel/kernel_types.h index 82cc11922e0..df56360b1df 100644 --- a/intern/cycles/kernel/kernel_types.h +++ b/intern/cycles/kernel/kernel_types.h @@ -1700,7 +1700,7 @@ typedef struct WorkTile { } WorkTile; /* Pre-computed sample table sizes for PMJ02 sampler. */ -#define NUM_PMJ_SAMPLES 64 * 64 +#define NUM_PMJ_SAMPLES (64 * 64) #define NUM_PMJ_PATTERNS 48 CCL_NAMESPACE_END diff --git a/intern/utfconv/utfconv.h b/intern/utfconv/utfconv.h index 6470802bedf..36dff288966 100644 --- a/intern/utfconv/utfconv.h +++ b/intern/utfconv/utfconv.h @@ -46,11 +46,11 @@ size_t count_utf_16_from_8(const char *string8); /** * conv_utf_*** errors */ -#define UTF_ERROR_NULL_IN 1 << 0 /* Error occures when requered parameter is missing*/ -#define UTF_ERROR_ILLCHAR 1 << 1 /* Error if character is in illigal UTF rage*/ +#define UTF_ERROR_NULL_IN (1 << 0) /* Error occures when requered parameter is missing*/ +#define UTF_ERROR_ILLCHAR (1 << 1) /* Error if character is in illigal UTF rage*/ #define UTF_ERROR_SMALL \ - 1 << 2 /* Passed size is to small. It gives legal string with character missing at the end*/ -#define UTF_ERROR_ILLSEQ 1 << 3 /* Error if sequence is broken and doesn't finish*/ + (1 << 2) /* Passed size is to small. It gives legal string with character missing at the end */ +#define UTF_ERROR_ILLSEQ (1 << 3) /* Error if sequence is broken and doesn't finish*/ /** * Converts utf-16 string to allocated utf-8 string diff --git a/source/blender/blenlib/intern/fileops.c b/source/blender/blenlib/intern/fileops.c index bb218995c83..106bd5bc793 100644 --- a/source/blender/blenlib/intern/fileops.c +++ b/source/blender/blenlib/intern/fileops.c @@ -158,7 +158,7 @@ char *BLI_file_ungzip_to_mem(const char *from_file, int *r_size) return mem; } -#define CHUNK 256 * 1024 +#define CHUNK (256 * 1024) /* gzip byte array from memory and write it to file at certain position. * return size of gzip stream. diff --git a/source/blender/bmesh/tools/bmesh_bevel.c b/source/blender/bmesh/tools/bmesh_bevel.c index 0de909b5556..a17724895f1 100644 --- a/source/blender/bmesh/tools/bmesh_bevel.c +++ b/source/blender/bmesh/tools/bmesh_bevel.c @@ -58,9 +58,9 @@ #define BEVEL_EPSILON_ANG DEG2RADF(2.0f) #define BEVEL_SMALL_ANG DEG2RADF(10.0f) /** Difference in dot products that corresponds to 10 degree difference between vectors. */ -#define BEVEL_SMALL_ANG_DOT 1 - cosf(BEVEL_SMALL_ANG) +#define BEVEL_SMALL_ANG_DOT (1.0f - cosf(BEVEL_SMALL_ANG)) /** Difference in dot products that corresponds to 2.0 degree difference between vectors. */ -#define BEVEL_EPSILON_ANG_DOT 1 - cosf(BEVEL_EPSILON_ANG) +#define BEVEL_EPSILON_ANG_DOT (1.0f - cosf(BEVEL_EPSILON_ANG)) #define BEVEL_MAX_ADJUST_PCT 10.0f #define BEVEL_MAX_AUTO_ADJUST_PCT 300.0f #define BEVEL_MATCH_SPEC_WEIGHT 0.2 diff --git a/source/blender/bmesh/tools/bmesh_intersect_edges.c b/source/blender/bmesh/tools/bmesh_intersect_edges.c index 5e266fdac0e..1e9adea2615 100644 --- a/source/blender/bmesh/tools/bmesh_intersect_edges.c +++ b/source/blender/bmesh/tools/bmesh_intersect_edges.c @@ -39,7 +39,7 @@ #define KDOP_TREE_TYPE 4 #define KDOP_AXIS_LEN 14 -#define BLI_STACK_PAIR_LEN 2 * KDOP_TREE_TYPE +#define BLI_STACK_PAIR_LEN (2 * KDOP_TREE_TYPE) /* -------------------------------------------------------------------- */ /** \name Weld Linked Wire Edges into Linked Faces diff --git a/source/blender/draw/engines/overlay/shaders/edit_curve_handle_geom.glsl b/source/blender/draw/engines/overlay/shaders/edit_curve_handle_geom.glsl index ad791a9416d..036efa41555 100644 --- a/source/blender/draw/engines/overlay/shaders/edit_curve_handle_geom.glsl +++ b/source/blender/draw/engines/overlay/shaders/edit_curve_handle_geom.glsl @@ -1,7 +1,7 @@ /* Keep the same value of `ACTIVE_NURB` in `draw_cache_imp_curve.c` */ -#define ACTIVE_NURB 1 << 2 -#define EVEN_U_BIT 1 << 4 +#define ACTIVE_NURB (1 << 2) +#define EVEN_U_BIT (1 << 4) #define COLOR_SHIFT 5 /* Keep the same value in `handle_display` in `DNA_view3d_types.h` */ diff --git a/source/blender/draw/engines/overlay/shaders/edit_curve_point_vert.glsl b/source/blender/draw/engines/overlay/shaders/edit_curve_point_vert.glsl index 64cc1b7d840..5f2154f00b8 100644 --- a/source/blender/draw/engines/overlay/shaders/edit_curve_point_vert.glsl +++ b/source/blender/draw/engines/overlay/shaders/edit_curve_point_vert.glsl @@ -1,6 +1,6 @@ /* Keep the same value of `BEZIER_HANDLE` in `draw_cache_imp_curve.c` */ -#define BEZIER_HANDLE 1 << 3 +#define BEZIER_HANDLE (1 << 3) /* Keep the same value in `handle_display` in `DNA_view3d_types.h` */ #define CURVE_HANDLE_SELECTED 0 diff --git a/source/blender/draw/intern/draw_cache_impl_curve.c b/source/blender/draw/intern/draw_cache_impl_curve.c index 3ccada23d47..e9558fb320c 100644 --- a/source/blender/draw/intern/draw_cache_impl_curve.c +++ b/source/blender/draw/intern/draw_cache_impl_curve.c @@ -50,9 +50,9 @@ /* See: edit_curve_point_vert.glsl for duplicate includes. */ #define SELECT 1 -#define ACTIVE_NURB 1 << 2 -#define BEZIER_HANDLE 1 << 3 -#define EVEN_U_BIT 1 << 4 /* Alternate this bit for every U vert. */ +#define ACTIVE_NURB (1 << 2) +#define BEZIER_HANDLE (1 << 3) +#define EVEN_U_BIT (1 << 4) /* Alternate this bit for every U vert. */ #define COLOR_SHIFT 5 /* Used as values of `color_id` in `edit_curve_overlay_handle_geom.glsl` */ diff --git a/source/blender/draw/intern/draw_cache_impl_gpencil.c b/source/blender/draw/intern/draw_cache_impl_gpencil.c index 8feacf8b026..c07271a0d33 100644 --- a/source/blender/draw/intern/draw_cache_impl_gpencil.c +++ b/source/blender/draw/intern/draw_cache_impl_gpencil.c @@ -44,7 +44,7 @@ #include "draw_cache.h" #include "draw_cache_impl.h" -#define BEZIER_HANDLE 1 << 3 +#define BEZIER_HANDLE (1 << 3) #define COLOR_SHIFT 5 /* ---------------------------------------------------------------------- */ diff --git a/source/blender/draw/intern/draw_hair_private.h b/source/blender/draw/intern/draw_hair_private.h index 33abae156cc..28bd5d4dfb5 100644 --- a/source/blender/draw/intern/draw_hair_private.h +++ b/source/blender/draw/intern/draw_hair_private.h @@ -24,7 +24,7 @@ #pragma once #define MAX_LAYER_NAME_CT 4 /* u0123456789, u, au, a0123456789 */ -#define MAX_LAYER_NAME_LEN GPU_MAX_SAFE_ATTR_NAME + 2 +#define MAX_LAYER_NAME_LEN (GPU_MAX_SAFE_ATTR_NAME + 2) #define MAX_THICKRES 2 /* see eHairType */ #define MAX_HAIR_SUBDIV 4 /* see hair_subdiv rna */ diff --git a/source/creator/creator_intern.h b/source/creator/creator_intern.h index 0a13f45eef1..bcc8a15355a 100644 --- a/source/creator/creator_intern.h +++ b/source/creator/creator_intern.h @@ -73,7 +73,7 @@ enum { /* for the callbacks: */ #ifndef WITH_PYTHON_MODULE # define BLEND_VERSION_FMT "Blender %d.%02d.%d" -# define BLEND_VERSION_ARG BLENDER_VERSION / 100, BLENDER_VERSION % 100, BLENDER_VERSION_PATCH +# define BLEND_VERSION_ARG (BLENDER_VERSION / 100), (BLENDER_VERSION % 100), BLENDER_VERSION_PATCH #endif #ifdef WITH_BUILDINFO_HEADER -- cgit v1.2.3