Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenlib/BLI_astar.h10
-rw-r--r--source/blender/blenlib/BLI_ghash.h3
-rw-r--r--source/blender/blenlib/BLI_kdopbvh.h6
-rw-r--r--source/blender/blenlib/BLI_noise.h3
-rw-r--r--source/blender/blenlib/BLI_scanfill.h18
-rw-r--r--source/blender/blenlib/BLI_string_utf8.h6
-rw-r--r--source/blender/blenlib/intern/BLI_dial_2d.c6
-rw-r--r--source/blender/blenlib/intern/BLI_filelist.c3
-rw-r--r--source/blender/blenlib/intern/BLI_ghash.c12
-rw-r--r--source/blender/blenlib/intern/BLI_kdopbvh.c41
-rw-r--r--source/blender/blenlib/intern/DLRB_tree.c14
-rw-r--r--source/blender/blenlib/intern/array_store.c10
-rw-r--r--source/blender/blenlib/intern/astar.c7
-rw-r--r--source/blender/blenlib/intern/expr_pylike_eval.c3
-rw-r--r--source/blender/blenlib/intern/freetypefont.c3
-rw-r--r--source/blender/blenlib/intern/hash_md5.c54
-rw-r--r--source/blender/blenlib/intern/math_color.c4
-rw-r--r--source/blender/blenlib/intern/math_geom.c21
-rw-r--r--source/blender/blenlib/intern/math_interp.c6
-rw-r--r--source/blender/blenlib/intern/math_matrix.c6
-rw-r--r--source/blender/blenlib/intern/math_rotation.c21
-rw-r--r--source/blender/blenlib/intern/noise.c7
-rw-r--r--source/blender/blenlib/intern/path_util.c22
-rw-r--r--source/blender/blenlib/intern/polyfill_2d.c22
-rw-r--r--source/blender/blenlib/intern/polyfill_2d_beautify.c5
-rw-r--r--source/blender/blenlib/intern/rct.c3
-rw-r--r--source/blender/blenlib/intern/scanfill.c21
-rw-r--r--source/blender/blenlib/intern/scanfill_utils.c5
-rw-r--r--source/blender/blenlib/intern/string.c7
-rw-r--r--source/blender/blenlib/intern/string_utf8.c14
-rw-r--r--source/blender/blenlib/intern/task.c16
-rw-r--r--source/blender/blenlib/intern/timecode.c6
-rw-r--r--source/blender/blenlib/intern/voxel.c3
33 files changed, 246 insertions, 142 deletions
diff --git a/source/blender/blenlib/BLI_astar.h b/source/blender/blenlib/BLI_astar.h
index 99e0dcd1a27..6edb97c1eca 100644
--- a/source/blender/blenlib/BLI_astar.h
+++ b/source/blender/blenlib/BLI_astar.h
@@ -54,9 +54,13 @@ typedef struct BLI_AStarGNode {
typedef struct BLI_AStarSolution {
/* Final 'most useful' data. */
- int steps; /* Number of steps (i.e. walked links) in path (nodes num, including start and end, is steps + 1). */
- int *prev_nodes; /* Store the path, in reversed order (from destination to source node), as indices. */
- BLI_AStarGNLink **prev_links; /* Indices are nodes' ones, as prev_nodes, but they map to relevant link. */
+ /** Number of steps (i.e. walked links) in path
+ * (nodes num, including start and end, is steps + 1). */
+ int steps;
+ /** Store the path, in reversed order (from destination to source node), as indices. */
+ int *prev_nodes;
+ /** Indices are nodes' ones, as prev_nodes, but they map to relevant link. */
+ BLI_AStarGNLink **prev_links;
void *custom_data;
diff --git a/source/blender/blenlib/BLI_ghash.h b/source/blender/blenlib/BLI_ghash.h
index 7003eb039dd..35547115726 100644
--- a/source/blender/blenlib/BLI_ghash.h
+++ b/source/blender/blenlib/BLI_ghash.h
@@ -77,7 +77,8 @@ enum {
#ifdef GHASH_INTERNAL_API
/* Internal usage only */
- GHASH_FLAG_IS_GSET = (1 << 16), /* Whether the GHash is actually used as GSet (no value storage). */
+ /* Whether the GHash is actually used as GSet (no value storage). */
+ GHASH_FLAG_IS_GSET = (1 << 16),
#endif
};
diff --git a/source/blender/blenlib/BLI_kdopbvh.h b/source/blender/blenlib/BLI_kdopbvh.h
index d83de68169e..c43b76c3c58 100644
--- a/source/blender/blenlib/BLI_kdopbvh.h
+++ b/source/blender/blenlib/BLI_kdopbvh.h
@@ -151,7 +151,8 @@ void BLI_bvhtree_update_tree(BVHTree *tree);
int BLI_bvhtree_overlap_thread_num(const BVHTree *tree);
-/* collision/overlap: check two trees if they overlap, alloc's *overlap with length of the int return value */
+/* collision/overlap: check two trees if they overlap,
+ * alloc's *overlap with length of the int return value */
BVHTreeOverlap *BLI_bvhtree_overlap(
const BVHTree *tree1, const BVHTree *tree2, unsigned int *r_overlap_tot,
BVHTree_OverlapCallback callback, void *userdata);
@@ -161,7 +162,8 @@ int BLI_bvhtree_get_tree_type(const BVHTree *tree);
float BLI_bvhtree_get_epsilon(const BVHTree *tree);
/* find nearest node to the given coordinates
- * (if nearest is given it will only search nodes where square distance is smaller than nearest->dist) */
+ * (if nearest is given it will only search nodes where
+ * square distance is smaller than nearest->dist) */
int BLI_bvhtree_find_nearest_ex(
BVHTree *tree, const float co[3], BVHTreeNearest *nearest,
BVHTree_NearestPointCallback callback, void *userdata,
diff --git a/source/blender/blenlib/BLI_noise.h b/source/blender/blenlib/BLI_noise.h
index 03f2c588f5e..6749d74009a 100644
--- a/source/blender/blenlib/BLI_noise.h
+++ b/source/blender/blenlib/BLI_noise.h
@@ -42,7 +42,8 @@ float BLI_hnoise(float noisesize, float x, float y, float z);
float BLI_hnoisep(float noisesize, float x, float y, float z);
float BLI_turbulence(float noisesize, float x, float y, float z, int nr);
float BLI_turbulence1(float noisesize, float x, float y, float z, int nr);
-/* newnoise: generic noise & turbulence functions to replace the above BLI_hnoise/p & BLI_turbulence/1.
+/* newnoise: generic noise & turbulence functions
+ * to replace the above BLI_hnoise/p & BLI_turbulence/1.
* This is done so different noise basis functions can be used */
float BLI_gNoise(float noisesize, float x, float y, float z, int hard, int noisebasis);
float BLI_gTurbulence(float noisesize, float x, float y, float z, int oct, int hard, int noisebasis);
diff --git a/source/blender/blenlib/BLI_scanfill.h b/source/blender/blenlib/BLI_scanfill.h
index f6b37fa2ec3..eaca79801be 100644
--- a/source/blender/blenlib/BLI_scanfill.h
+++ b/source/blender/blenlib/BLI_scanfill.h
@@ -71,13 +71,19 @@ typedef struct ScanFillVert {
int i;
unsigned int u;
} tmp;
- float co[3]; /* vertex location */
- float xy[2]; /* 2D projection of vertex location */
- unsigned int keyindex; /* index, caller can use how it likes to match the scanfill result with own data */
+ /** vertex location */
+ float co[3];
+ /** 2D projection of vertex location */
+ float xy[2];
+ /** index, caller can use how it likes to match the scanfill result with own data */
+ unsigned int keyindex;
unsigned short poly_nr;
- unsigned char edge_tot; /* number of edges using this vertex */
- unsigned int f : 4; /* vert status */
- unsigned int user_flag : 4; /* flag callers can use as they like */
+ /** number of edges using this vertex */
+ unsigned char edge_tot;
+ /** vert status */
+ unsigned int f : 4;
+ /** flag callers can use as they like */
+ unsigned int user_flag : 4;
} ScanFillVert;
typedef struct ScanFillEdge {
diff --git a/source/blender/blenlib/BLI_string_utf8.h b/source/blender/blenlib/BLI_string_utf8.h
index 21542d0d6e1..4617a3abf64 100644
--- a/source/blender/blenlib/BLI_string_utf8.h
+++ b/source/blender/blenlib/BLI_string_utf8.h
@@ -39,7 +39,8 @@ char *BLI_strncat_utf8(char *__restrict dst, const char *__restrict src,
ptrdiff_t BLI_utf8_invalid_byte(const char *str, size_t length) ATTR_NONNULL();
int BLI_utf8_invalid_strip(char *str, size_t length) ATTR_NONNULL();
-int BLI_str_utf8_size(const char *p) ATTR_NONNULL(); /* warning, can return -1 on bad chars */
+/* warning, can return -1 on bad chars */
+int BLI_str_utf8_size(const char *p) ATTR_NONNULL();
int BLI_str_utf8_size_safe(const char *p) ATTR_NONNULL();
/* copied from glib */
unsigned int BLI_str_utf8_as_unicode(const char *p) ATTR_NONNULL();
@@ -64,7 +65,8 @@ size_t BLI_strncpy_wchar_from_utf8(wchar_t *__restrict dst, const char *__
/* count columns that character/string occupies, based on wcwidth.c */
int BLI_wcwidth(wchar_t ucs);
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 */
+/* warning, can return -1 on bad chars */
+int BLI_str_utf8_char_width(const char *p) ATTR_NONNULL();
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[], const char **sep, const char **suf) ATTR_NONNULL();
diff --git a/source/blender/blenlib/intern/BLI_dial_2d.c b/source/blender/blenlib/intern/BLI_dial_2d.c
index 1f4c59ac2fb..eb18b307e3c 100644
--- a/source/blender/blenlib/intern/BLI_dial_2d.c
+++ b/source/blender/blenlib/intern/BLI_dial_2d.c
@@ -66,7 +66,8 @@ float BLI_dial_angle(Dial *dial, const float current_position[2])
sub_v2_v2v2(current_direction, current_position, dial->center);
- /* only update when we have enough precision, by having the mouse adequately away from center */
+ /* only update when we have enough precision,
+ * by having the mouse adequately away from center */
if (len_squared_v2(current_direction) > dial->threshold_squared) {
float angle;
float cosval, sinval;
@@ -86,7 +87,8 @@ float BLI_dial_angle(Dial *dial, const float current_position[2])
angle = atan2f(sinval, cosval);
/* change of sign, we passed the 180 degree threshold. This means we need to add a turn.
- * to distinguish between transition from 0 to -1 and -PI to +PI, use comparison with PI/2 */
+ * to distinguish between transition from 0 to -1 and -PI to +PI,
+ * use comparison with PI/2 */
if ((angle * dial->last_angle < 0.0f) &&
(fabsf(dial->last_angle) > (float)M_PI_2))
{
diff --git a/source/blender/blenlib/intern/BLI_filelist.c b/source/blender/blenlib/intern/BLI_filelist.c
index 76de52bda66..976a496c45b 100644
--- a/source/blender/blenlib/intern/BLI_filelist.c
+++ b/source/blender/blenlib/intern/BLI_filelist.c
@@ -179,7 +179,8 @@ static void bli_builddir(struct BuildDirCtx *dir_ctx, const char *dirname)
file->type = file->s.st_mode;
}
else if (FILENAME_IS_CURRPAR(file->relname)) {
- /* Hack around for UNC paths on windows - does not support stat on '\\SERVER\foo\..', sigh... */
+ /* Hack around for UNC paths on windows:
+ * does not support stat on '\\SERVER\foo\..', sigh... */
file->type |= S_IFDIR;
}
dir_ctx->nrfiles++;
diff --git a/source/blender/blenlib/intern/BLI_ghash.c b/source/blender/blenlib/intern/BLI_ghash.c
index 3c5fbf5c6e9..7dac54d69bb 100644
--- a/source/blender/blenlib/intern/BLI_ghash.c
+++ b/source/blender/blenlib/intern/BLI_ghash.c
@@ -242,8 +242,8 @@ static void ghash_buckets_resize(GHash *gh, const uint nbuckets)
buckets_new[bucket_index] = e;
}
#else
- /* No need to recompute hashes in this case, since our mask is just smaller, all items in old bucket i
- * will go in same new bucket (i & new_mask)! */
+ /* No need to recompute hashes in this case, since our mask is just smaller,
+ * all items in old bucket 'i' will go in same new bucket (i & new_mask)! */
const unsigned bucket_index = ghash_bucket_index(gh, i);
BLI_assert(!buckets_old[i] || (bucket_index == ghash_bucket_index(gh, ghash_entryhash(gh, buckets_old[i]))));
Entry *e;
@@ -614,8 +614,9 @@ static Entry *ghash_pop(GHash *gh, GHashIterState *state)
return NULL;
}
- /* Note: using first_bucket_index here allows us to avoid potential huge number of loops over buckets,
- * in case we are popping from a large ghash with few items in it... */
+ /* Note: using first_bucket_index here allows us to avoid potential
+ * huge number of loops over buckets,
+ * in case we are popping from a large ghash with few items in it... */
curr_bucket = ghash_find_next_bucket_index(gh, curr_bucket);
Entry *e = gh->buckets[curr_bucket];
@@ -681,7 +682,8 @@ static GHash *ghash_copy(GHash *gh, GHashKeyCopyFP keycopyfp, GHashValCopyFP val
* This means entries in buckets in new copy will be in reversed order!
* This shall not be an issue though, since order should never be assumed in ghash. */
- /* Note: We can use 'i' here, since we are sure that 'gh' and 'gh_new' have the same number of buckets! */
+ /* Note: We can use 'i' here, since we are sure that
+ * 'gh' and 'gh_new' have the same number of buckets! */
e_new->next = gh_new->buckets[i];
gh_new->buckets[i] = e_new;
}
diff --git a/source/blender/blenlib/intern/BLI_kdopbvh.c b/source/blender/blenlib/intern/BLI_kdopbvh.c
index 7959ca4c0f2..d497c7a83ab 100644
--- a/source/blender/blenlib/intern/BLI_kdopbvh.c
+++ b/source/blender/blenlib/intern/BLI_kdopbvh.c
@@ -279,7 +279,8 @@ static int bvh_partition(BVHNode **a, int lo, int hi, BVHNode *x, int axis)
}
}
-static BVHNode *bvh_medianof3(BVHNode **a, int lo, int mid, int hi, int axis) /* returns Sortable */
+/* returns Sortable */
+static BVHNode *bvh_medianof3(BVHNode **a, int lo, int mid, int hi, int axis)
{
if ((a[mid])->bv[axis] < (a[lo])->bv[axis]) {
if ((a[hi])->bv[axis] < (a[mid])->bv[axis])
@@ -544,13 +545,16 @@ static void bvhtree_verify(BVHTree *tree)
* This code can be easily reduced
* (basicly this is only method to calculate pow(k, n) in O(1).. and stuff like that) */
typedef struct BVHBuildHelper {
- int tree_type; /* */
- int totleafs; /* */
+ int tree_type;
+ int totleafs;
- int leafs_per_child[32]; /* Min number of leafs that are archievable from a node at depth N */
- int branches_on_level[32]; /* Number of nodes at depth N (tree_type^N) */
+ /** Min number of leafs that are archievable from a node at depth N */
+ int leafs_per_child[32];
+ /** Number of nodes at depth N (tree_type^N) */
+ int branches_on_level[32];
- int remain_leafs; /* Number of leafs that are placed on the level that is not 100% filled */
+ /** Number of leafs that are placed on the level that is not 100% filled */
+ int remain_leafs;
} BVHBuildHelper;
@@ -699,17 +703,20 @@ static void non_recursive_bvh_div_nodes_task_cb(
nth_positions[data->tree_type] = parent_leafs_end;
for (k = 1; k < data->tree_type; k++) {
const int child_index = j * data->tree_type + data->tree_offset + k;
- const int child_level_index = child_index - data->first_of_next_level; /* child level index */
+ /* child level index */
+ const int child_level_index = child_index - data->first_of_next_level;
nth_positions[k] = implicit_leafs_index(data->data, data->depth + 1, child_level_index);
}
split_leafs(data->leafs_array, nth_positions, data->tree_type, split_axis);
/* Setup children and totnode counters
- * Not really needed but currently most of BVH code relies on having an explicit children structure */
+ * Not really needed but currently most of BVH code
+ * relies on having an explicit children structure */
for (k = 0; k < data->tree_type; k++) {
const int child_index = j * data->tree_type + data->tree_offset + k;
- const int child_level_index = child_index - data->first_of_next_level; /* child level index */
+ /* child level index */
+ const int child_level_index = child_index - data->first_of_next_level;
const int child_leafs_begin = implicit_leafs_index(data->data, data->depth + 1, child_level_index);
const int child_leafs_end = implicit_leafs_index(data->data, data->depth + 1, child_level_index + 1);
@@ -751,7 +758,9 @@ static void non_recursive_bvh_div_nodes(
int i;
const int tree_type = tree->tree_type;
- const int tree_offset = 2 - tree->tree_type; /* this value is 0 (on binary trees) and negative on the others */
+ /* this value is 0 (on binary trees) and negative on the others */
+ const int tree_offset = 2 - tree->tree_type;
+
const int num_branches = implicit_needed_branches(tree_type, num_leafs);
BVHBuildHelper data;
@@ -785,7 +794,8 @@ static void non_recursive_bvh_div_nodes(
/* Loop tree levels (log N) loops */
for (i = 1, depth = 1; i <= num_branches; i = i * tree_type + tree_offset, depth++) {
const int first_of_next_level = i * tree_type + tree_offset;
- const int i_stop = min_ii(first_of_next_level, num_branches + 1); /* index of last branch on this level */
+ /* index of last branch on this level */
+ const int i_stop = min_ii(first_of_next_level, num_branches + 1);
/* Loop all branches on this level */
cb_data.first_of_next_level = first_of_next_level;
@@ -834,7 +844,8 @@ BVHTree *BLI_bvhtree_new(int maxsize, float epsilon, char tree_type, char axis)
/* tree epsilon must be >= FLT_EPSILON
* so that tangent rays can still hit a bounding volume..
- * this bug would show up when casting a ray aligned with a kdop-axis and with an edge of 2 faces */
+ * this bug would show up when casting a ray aligned with a kdop-axis
+ * and with an edge of 2 faces */
epsilon = max_ff(FLT_EPSILON, epsilon);
if (tree) {
@@ -1259,7 +1270,8 @@ BVHTreeOverlap *BLI_bvhtree_overlap(
/** \name BLI_bvhtree_find_nearest
* \{ */
-/* Determines the nearest point of the given node BV. Returns the squared distance to that point. */
+/* Determines the nearest point of the given node BV.
+ * Returns the squared distance to that point. */
static float calc_nearest_point_squared(const float proj[3], BVHNode *node, float nearest[3])
{
int i;
@@ -1743,7 +1755,8 @@ static void dfs_range_query(RangeQueryData *data, BVHNode *node)
{
if (node->totnode == 0) {
#if 0 /*UNUSED*/
- /* Calculate the node min-coords (if the node was a point then this is the point coordinates) */
+ /* Calculate the node min-coords
+ * (if the node was a point then this is the point coordinates) */
float co[3];
co[0] = node->bv[0];
co[1] = node->bv[2];
diff --git a/source/blender/blenlib/intern/DLRB_tree.c b/source/blender/blenlib/intern/DLRB_tree.c
index e331e070a4a..c49f37d5650 100644
--- a/source/blender/blenlib/intern/DLRB_tree.c
+++ b/source/blender/blenlib/intern/DLRB_tree.c
@@ -443,7 +443,8 @@ static void insert_check_3(DLRBT_Tree *tree, DLRBT_Node *node)
{
DLRBT_Node *gp = get_grandparent(node);
- /* check that grandparent and node->parent exist (jut in case... really shouldn't happen on a good tree) */
+ /* check that grandparent and node->parent exist
+ * (jut in case... really shouldn't happen on a good tree) */
if (node && node->parent && gp) {
/* a left rotation will switch the roles of node and its parent, assuming that
* the parent is the left child of the grandparent... otherwise, rotation direction
@@ -466,13 +467,13 @@ static void insert_check_3(DLRBT_Tree *tree, DLRBT_Node *node)
/* get 'new' grandparent (i.e. grandparent for old-parent (node)) */
gp = get_grandparent(node);
- /* modify the coloring of the grandparent and parent so that they still satisfy the constraints */
+ /* modify the coloring of the grandparent and parent
+ * so that they still satisfy the constraints */
node->parent->tree_col = DLRBT_BLACK;
gp->tree_col = DLRBT_RED;
- /* if there are several nodes that all form a left chain, do a right rotation to correct this
- * (or a rotation in the opposite direction if they all form a right chain)
- */
+ /* if there are several nodes that all form a left chain, do a right rotation to correct
+ * this (or a rotation in the opposite direction if they all form a right chain) */
if ((node == node->parent->left) && (node->parent == gp->left))
rotate_right(tree, gp);
else //if ((node == node->parent->right) && (node->parent == gp->right))
@@ -502,7 +503,8 @@ void BLI_dlrbTree_insert(DLRBT_Tree *tree, DLRBT_Node *node)
/* ----- */
/* Add the given data to the tree, and return the node added */
-/* NOTE: for duplicates, the update_cb is called (if available), and the existing node is returned */
+/* NOTE: for duplicates, the update_cb is called (if available),
+ * and the existing node is returned */
DLRBT_Node *BLI_dlrbTree_add(DLRBT_Tree *tree, DLRBT_Comparator_FP cmp_cb,
DLRBT_NAlloc_FP new_cb, DLRBT_NUpdate_FP update_cb, void *data)
{
diff --git a/source/blender/blenlib/intern/array_store.c b/source/blender/blenlib/intern/array_store.c
index 153ba3ea0d0..c9142608324 100644
--- a/source/blender/blenlib/intern/array_store.c
+++ b/source/blender/blenlib/intern/array_store.c
@@ -473,7 +473,8 @@ static void bchunk_list_ensure_min_size_last(
BLI_mempool_free(bs_mem->chunk_ref, cref);
}
else {
- /* If we always merge small slices, we should _almost_ never end up having very large chunks.
+ /* If we always merge small slices, we should _almost_
+ * never end up having very large chunks.
* Gradual expanding on contracting will cause this.
*
* if we do, the code below works (test by setting 'BCHUNK_SIZE_MAX_MUL = 1.2') */
@@ -1324,8 +1325,8 @@ static BChunkList *bchunk_list_from_data_merge(
BChunk *chunk_found = cref_found->link;
if (bchunk_data_compare(chunk_found, data, data_len, i_prev)) {
- /* may be useful to remove table data, assuming we dont have repeating memory
- * where it would be useful to re-use chunks. */
+ /* may be useful to remove table data, assuming we dont have
+ * repeating memory where it would be useful to re-use chunks. */
i += chunk_found->data_len;
bchunk_list_append(info, bs_mem, chunk_list, chunk_found);
/* chunk_found may be freed! */
@@ -1377,7 +1378,8 @@ static BChunkList *bchunk_list_from_data_merge(
BChunk *chunk = cref->link;
// BLI_assert(bchunk_data_compare(chunk, data, data_len, i_prev));
i_prev += chunk->data_len;
- /* use simple since we assume the references chunks have already been sized correctly. */
+ /* use simple since we assume the references chunks
+ * have already been sized correctly. */
bchunk_list_append_only(bs_mem, chunk_list, chunk);
ASSERT_CHUNKLIST_DATA(chunk_list, data);
cref = cref->next;
diff --git a/source/blender/blenlib/intern/astar.c b/source/blender/blenlib/intern/astar.c
index 4a94c385b59..29975185f0b 100644
--- a/source/blender/blenlib/intern/astar.c
+++ b/source/blender/blenlib/intern/astar.c
@@ -237,7 +237,8 @@ bool BLI_astar_graph_solve(
LinkData *ld;
if (BLI_BITMAP_TEST(done_nodes, node_curr_idx)) {
- /* Might happen, because we always add nodes to heap when evaluating them, without ever removing them. */
+ /* Might happen, because we always add nodes to heap when evaluating them,
+ * without ever removing them. */
continue;
}
@@ -268,8 +269,8 @@ bool BLI_astar_graph_solve(
prev_links[node_next_idx] = link;
g_costs[node_next_idx] = g_cst;
g_steps[node_next_idx] = g_steps[node_curr_idx] + 1;
- /* We might have this node already in heap, but since this 'instance' will be evaluated first,
- * no problem. */
+ /* We might have this node already in heap, but since this 'instance'
+ * will be evaluated first, no problem. */
BLI_heapsimple_insert(
todo_nodes,
f_cost_cb(as_graph, r_solution, link, node_curr_idx, node_next_idx, node_index_dst),
diff --git a/source/blender/blenlib/intern/expr_pylike_eval.c b/source/blender/blenlib/intern/expr_pylike_eval.c
index 7bcf32dd880..9586ef94f40 100644
--- a/source/blender/blenlib/intern/expr_pylike_eval.c
+++ b/source/blender/blenlib/intern/expr_pylike_eval.c
@@ -706,7 +706,8 @@ static bool parse_unary(ExprParseState *state)
return parse_next_token(state);
case TOKEN_ID:
- /* Parameters: search in reverse order in case of duplicate names - the last one should win. */
+ /* Parameters: search in reverse order in case of duplicate names -
+ * the last one should win. */
for (i = state->param_names_len - 1; i >= 0; i--) {
if (STREQ(state->tokenbuf, state->param_names[i])) {
parse_add_op(state, OPCODE_PARAMETER, 1)->arg.ival = i;
diff --git a/source/blender/blenlib/intern/freetypefont.c b/source/blender/blenlib/intern/freetypefont.c
index 77b2949c54c..f7deebcf507 100644
--- a/source/blender/blenlib/intern/freetypefont.c
+++ b/source/blender/blenlib/intern/freetypefont.c
@@ -486,7 +486,8 @@ VChar *BLI_vfontchar_from_freetypefont(VFont *vfont, unsigned long character)
}
/* Yeah, this is very bad... But why is this in BLI in the first place, since it uses Nurb data?
- * Anyway, do not feel like duplicating whole Nurb copy code here, so unless someone has a better idea... */
+ * Anyway, do not feel like duplicating whole Nurb copy code here,
+ * so unless someone has a better idea... */
#include "../../blenkernel/BKE_curve.h"
VChar *BLI_vfontchar_copy(const VChar *vchar_src, const int UNUSED(flag))
diff --git a/source/blender/blenlib/intern/hash_md5.c b/source/blender/blenlib/intern/hash_md5.c
index c73fe7a3ff1..f4573f18371 100644
--- a/source/blender/blenlib/intern/hash_md5.c
+++ b/source/blender/blenlib/intern/hash_md5.c
@@ -40,9 +40,10 @@
# include <limits.h>
#endif
-/* The following contortions are an attempt to use the C preprocessor to determine an unsigned integral type
- * that is 32 bits wide. An alternative approach is to use autoconf's AC_CHECK_SIZEOF macro, but doing that
- * would require that the configure script compile and *run* the resulting executable.
+/* The following contortions are an attempt to use the C preprocessor to determine an unsigned
+ * integral type that is 32 bits wide.
+ * An alternative approach is to use autoconf's AC_CHECK_SIZEOF macro, but doing that would require
+ * that the configure script compile and *run* the resulting executable.
* Locally running cross-compiled executables is usually not possible.
*/
@@ -94,7 +95,8 @@ struct md5_ctx {
# define SWAP(n) (n)
#endif
-/* This array contains the bytes used to pad the buffer to the next 64-byte boundary. (RFC 1321, 3.1: Step 1) */
+/* This array contains the bytes used to pad the buffer to the next 64-byte boundary.
+ * (RFC 1321, 3.1: Step 1) */
static const unsigned char fillbuf[64] = {0x80, 0 /* , 0, 0, ... */};
/** Initialize structure containing state of computation.
@@ -108,14 +110,16 @@ static void md5_init_ctx(struct md5_ctx *ctx)
ctx->D = 0x10325476;
}
-/** Starting with the result of former calls of this function (or the initialization), this function updates
- * the 'ctx' context for the next 'len' bytes starting at 'buffer'.
- * It is necessary that 'len' is a multiple of 64!!!
+/**
+ * Starting with the result of former calls of this function (or the initialization),
+ * this function updates the 'ctx' context for the next 'len' bytes starting at 'buffer'.
+ * It is necessary that 'len' is a multiple of 64!!!
*/
static void md5_process_block(const void *buffer, size_t len, struct md5_ctx *ctx)
{
-/* These are the four functions used in the four steps of the MD5 algorithm and defined in the RFC 1321.
- * The first function is a little bit optimized (as found in Colin Plumbs public domain implementation).
+/* These are the four functions used in the four steps of the MD5 algorithm and defined in the
+ * RFC 1321. The first function is a little bit optimized
+ * (as found in Colin Plumbs public domain implementation).
*/
/* #define FF(b, c, d) ((b & c) | (~b & d)) */
#define FF(b, c, d) (d ^ (b & (c ^ d)))
@@ -123,7 +127,8 @@ static void md5_process_block(const void *buffer, size_t len, struct md5_ctx *ct
#define FH(b, c, d) (b ^ c ^ d)
#define FI(b, c, d) (c ^ (b | ~d))
-/* It is unfortunate that C does not provide an operator for cyclic rotation. Hope the C compiler is smart enough. */
+/* It is unfortunate that C does not provide an operator for cyclic rotation.
+ * Hope the C compiler is smart enough. */
#define CYCLIC(w, s) (w = (w << s) | (w >> (32 - s)))
md5_uint32 correct_words[16];
@@ -143,10 +148,11 @@ static void md5_process_block(const void *buffer, size_t len, struct md5_ctx *ct
md5_uint32 C_save = C;
md5_uint32 D_save = D;
- /* First round: using the given function, the context and a constant the next context is computed.
- * Because the algorithms processing unit is a 32-bit word and it is determined to work on words in
- * little endian byte order we perhaps have to change the byte order before the computation.
- * To reduce the work for the next steps we store the swapped words in the array CORRECT_WORDS.
+ /* First round: using the given function, the context and a constant the next context is
+ * computed. Because the algorithms processing unit is a 32-bit word and it is determined
+ * to work on words in little endian byte order we perhaps have to change the byte order
+ * before the computation. To reduce the work for the next steps we store the swapped words
+ * in the array CORRECT_WORDS.
*/
#define OP(a, b, c, d, s, T) \
a += FF(b, c, d) + (*cwp++ = SWAP(*words)) + T; \
@@ -264,8 +270,10 @@ static void md5_process_block(const void *buffer, size_t len, struct md5_ctx *ct
#undef CYCLIC
}
-/** Put result from 'ctx' in first 16 bytes of 'resbuf'. The result is always in little endian byte order,
- * so that a byte-wise output yields to the wanted ASCII representation of the message digest.
+/**
+ * Put result from 'ctx' in first 16 bytes of 'resbuf'.
+ * The result is always in little endian byte order,
+ * so that a byte-wise output yields to the wanted ASCII representation of the message digest.
*/
static void *md5_read_ctx(const struct md5_ctx *ctx, void *resbuf)
{
@@ -300,8 +308,9 @@ int BLI_hash_md5_stream(FILE *stream, void *resblock)
/* Iterate over full file contents. */
while (1) {
- /* We read the file in blocks of BLOCKSIZE bytes. One call of the computation function processes
- * the whole buffer so that with the next round of the loop another block can be read.
+ /* We read the file in blocks of BLOCKSIZE bytes.
+ * One call of the computation function processes the whole buffer
+ * so that with the next round of the loop another block can be read.
*/
size_t n;
sum = 0;
@@ -330,7 +339,8 @@ int BLI_hash_md5_stream(FILE *stream, void *resblock)
md5_process_block(buffer, BLOCKSIZE, &ctx);
}
- /* We can copy 64 bytes because the buffer is always big enough. 'fillbuf' contains the needed bits. */
+ /* We can copy 64 bytes because the buffer is always big enough.
+ * 'fillbuf' contains the needed bits. */
memcpy(&buffer[sum], fillbuf, 64);
/* Compute amount of padding bytes needed. Alignment is done to (N + PAD) % 64 == 56.
@@ -373,10 +383,12 @@ void *BLI_hash_md5_buffer(const char *buffer, size_t len, void *resblock)
rest = len - blocks;
/* Copy to own buffer. */
memcpy(restbuf, &buffer[blocks], rest);
- /* Append needed fill bytes at end of buffer. We can copy 64 bytes because the buffer is always big enough. */
+ /* Append needed fill bytes at end of buffer.
+ * We can copy 64 bytes because the buffer is always big enough. */
memcpy(&restbuf[rest], fillbuf, 64);
- /* PAD bytes are used for padding to correct alignment. Note that always at least one byte is padded. */
+ /* PAD bytes are used for padding to correct alignment.
+ * Note that always at least one byte is padded. */
pad = rest >= 56 ? 64 + 56 - rest : 56 - rest;
/* Put length of buffer in *bits* in last eight bytes. */
diff --git a/source/blender/blenlib/intern/math_color.c b/source/blender/blenlib/intern/math_color.c
index 91d733e9691..a778a97c2cc 100644
--- a/source/blender/blenlib/intern/math_color.c
+++ b/source/blender/blenlib/intern/math_color.c
@@ -479,7 +479,7 @@ int constrain_rgb(float *r, float *g, float *b)
return 0; /* Color within RGB gamut */
}
-/* ********************************* lift/gamma/gain / ASC-CDL conversion ********************************* */
+/* ********************** lift/gamma/gain / ASC-CDL conversion ********************************* */
void lift_gamma_gain_to_asc_cdl(float *lift, float *gamma, float *gain, float *offset, float *slope, float *power)
{
@@ -494,7 +494,7 @@ void lift_gamma_gain_to_asc_cdl(float *lift, float *gamma, float *gain, float *o
}
}
-/* ******************************************** other ************************************************* */
+/* ************************************* other ************************************************* */
/* Applies an hue offset to a float rgb color */
void rgb_float_set_hue_float_offset(float rgb[3], float hue_offset)
diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c
index 930c12d3070..d9f4183d8ab 100644
--- a/source/blender/blenlib/intern/math_geom.c
+++ b/source/blender/blenlib/intern/math_geom.c
@@ -2200,7 +2200,8 @@ bool isect_tri_tri_epsilon_v3(
/* ignore collinear lines, they are either an edge shared between 2 tri's
* (which runs along [co_proj, plane_no], but can be safely ignored).
*
- * or a collinear edge placed away from the ray - which we don't intersect with & can ignore. */
+ * or a collinear edge placed away from the ray -
+ * which we don't intersect with & can ignore. */
if (UNLIKELY(edge_fac == -1.0f)) {
/* pass */
}
@@ -3424,7 +3425,8 @@ void transform_point_by_tri_v3(
* axis where its barycentric weights can be calculated in 2D and its Z offset can
* be re-applied. The weights are applied directly to the targets 3D points and the
* z-depth is used to scale the targets normal as an offset.
- * This saves transforming the target into its Z-Up orientation and back (which could also work) */
+ * This saves transforming the target into its Z-Up orientation and back
+ * (which could also work) */
float no_tar[3], no_src[3];
float mat_src[3][3];
float pt_src_xy[3];
@@ -3631,7 +3633,8 @@ void interp_weights_poly_v3(float *w, float v[][3], const int n, const float co[
while (i_next < n) {
/* Mark Mayer et al algorithm that is used here does not operate well if vertex is close
- * to borders of face. In that case, do simple linear interpolation between the two edge vertices */
+ * to borders of face.
+ * In that case, do simple linear interpolation between the two edge vertices */
/* 'd_next.len' is infact 'd_curr.len', just avoid copy to begin with */
if (UNLIKELY(d_next.len < eps)) {
@@ -3704,7 +3707,8 @@ void interp_weights_poly_v2(float *w, float v[][2], const int n, const float co[
while (i_next < n) {
/* Mark Mayer et al algorithm that is used here does not operate well if vertex is close
- * to borders of face. In that case, do simple linear interpolation between the two edge vertices */
+ * to borders of face. In that case,
+ * do simple linear interpolation between the two edge vertices */
/* 'd_next.len' is infact 'd_curr.len', just avoid copy to begin with */
if (UNLIKELY(d_next.len < eps)) {
@@ -3786,7 +3790,8 @@ void interp_cubic_v3(float x[3], float v[3], const float x1[3], const float v1[3
v[2] = 3 * a[2] * t2 + 2 * b[2] * t + v1[2];
}
-/* unfortunately internal calculations have to be done at double precision to achieve correct/stable results. */
+/* unfortunately internal calculations have to be done at double precision
+ * to achieve correct/stable results. */
#define IS_ZERO(x) ((x > (-DBL_EPSILON) && x < DBL_EPSILON) ? 1 : 0)
@@ -4056,7 +4061,8 @@ void perspective_m4(float mat[4][4], const float left, const float right, const
}
-/* translate a matrix created by orthographic_m4 or perspective_m4 in XY coords (used to jitter the view) */
+/* translate a matrix created by orthographic_m4 or perspective_m4 in XY coords
+ * (used to jitter the view) */
void window_translate_m4(float winmat[4][4], float perspmat[4][4], const float x, const float y)
{
if (winmat[2][3] == -1.0f) {
@@ -4550,7 +4556,8 @@ void vcloud_estimate_transform_v3(
if (lloc) copy_v3_v3(lloc, accu_com);
if (rloc) copy_v3_v3(rloc, accu_rcom);
if (lrot || lscale) { /* caller does not want rot nor scale, strange but legal */
- /*so now do some reverse engineering and see if we can split rotation from scale ->Polardecompose*/
+ /* so now do some reverse engineering and see if we can
+ * split rotation from scale -> Polardecompose */
/* build 'projection' matrix */
float m[3][3], mr[3][3], q[3][3], qi[3][3];
float va[3], vb[3], stunt[3];
diff --git a/source/blender/blenlib/intern/math_interp.c b/source/blender/blenlib/intern/math_interp.c
index b93a7f55821..a432cfad1fc 100644
--- a/source/blender/blenlib/intern/math_interp.c
+++ b/source/blender/blenlib/intern/math_interp.c
@@ -146,7 +146,8 @@ BLI_INLINE void bicubic_interpolation(const unsigned char *byte_buffer, const fl
CLAMP(y1, 0, height - 1);
/* normally we could do this */
/* w = P(n-a) * P(b-m); */
- /* except that would call P() 16 times per pixel therefor pow() 64 times, better precalc these */
+ /* except that would call P() 16 times per pixel therefor pow() 64 times,
+ * better precalc these */
w = wx * wy[m + 1];
if (float_output) {
@@ -414,7 +415,8 @@ void BLI_bilinear_interpolation_wrap_char(const unsigned char *buffer, unsigned
/**************************************************************************
* Filtering method based on
- * "Creating raster omnimax images from multiple perspective views using the elliptical weighted average filter"
+ * "Creating raster omnimax images from multiple perspective views
+ * using the elliptical weighted average filter"
* by Ned Greene and Paul S. Heckbert (1986)
***************************************************************************/
diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c
index 462d0737016..15858e8797e 100644
--- a/source/blender/blenlib/intern/math_matrix.c
+++ b/source/blender/blenlib/intern/math_matrix.c
@@ -1788,11 +1788,13 @@ void blend_m4_m4m4(float out[4][4], const float dst[4][4], const float src[4][4]
*/
void interp_m3_m3m3(float R[3][3], const float A[3][3], const float B[3][3], const float t)
{
- /* 'Rotation' component ('U' part of polar decomposition, the closest orthogonal matrix to M3 rot/scale
+ /* 'Rotation' component ('U' part of polar decomposition,
+ * the closest orthogonal matrix to M3 rot/scale
* transformation matrix), spherically interpolated. */
float U_A[3][3], U_B[3][3], U[3][3];
float quat_A[4], quat_B[4], quat[4];
- /* 'Scaling' component ('P' part of polar decomposition, i.e. scaling in U-defined space), linearly interpolated. */
+ /* 'Scaling' component ('P' part of polar decomposition, i.e. scaling in U-defined space),
+ * linearly interpolated. */
float P_A[3][3], P_B[3][3], P[3][3];
int i;
diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c
index 8e5b3f0000e..97f456dba60 100644
--- a/source/blender/blenlib/intern/math_rotation.c
+++ b/source/blender/blenlib/intern/math_rotation.c
@@ -197,7 +197,8 @@ void sub_qt_qtqt(float q[4], const float q1[4], const float q2[4])
void pow_qt_fl_normalized(float q[4], const float fac)
{
BLI_ASSERT_UNIT_QUAT(q);
- const float angle = fac * saacos(q[0]); /* quat[0] = cos(0.5 * angle), but now the 0.5 and 2.0 rule out */
+ const float angle = fac * saacos(q[0]); /* quat[0] = cos(0.5 * angle),
+ * but now the 0.5 and 2.0 rule out */
const float co = cosf(angle);
const float si = sinf(angle);
q[0] = co;
@@ -2011,12 +2012,18 @@ void quat_apply_track(float quat[4], short axis, short upflag)
/* rotations are hard coded to match vec_to_quat */
const float sqrt_1_2 = (float)M_SQRT1_2;
const float quat_track[][4] = {
- {sqrt_1_2, 0.0, -sqrt_1_2, 0.0}, /* pos-y90 */
- {0.5, 0.5, 0.5, 0.5}, /* Quaternion((1,0,0), radians(90)) * Quaternion((0,1,0), radians(90)) */
- {sqrt_1_2, 0.0, 0.0, sqrt_1_2}, /* pos-z90 */
- {sqrt_1_2, 0.0, sqrt_1_2, 0.0}, /* neg-y90 */
- {0.5, -0.5, -0.5, 0.5}, /* Quaternion((1,0,0), radians(-90)) * Quaternion((0,1,0), radians(-90)) */
- {0.0, sqrt_1_2, sqrt_1_2, 0.0} /* no rotation */
+ /* pos-y90 */
+ {sqrt_1_2, 0.0, -sqrt_1_2, 0.0},
+ /* Quaternion((1,0,0), radians(90)) * Quaternion((0,1,0), radians(90)) */
+ {0.5, 0.5, 0.5, 0.5},
+ /* pos-z90 */
+ {sqrt_1_2, 0.0, 0.0, sqrt_1_2},
+ /* neg-y90 */
+ {sqrt_1_2, 0.0, sqrt_1_2, 0.0},
+ /* Quaternion((1,0,0), radians(-90)) * Quaternion((0,1,0), radians(-90)) */
+ {0.5, -0.5, -0.5, 0.5},
+ /* no rotation */
+ {0.0, sqrt_1_2, sqrt_1_2, 0.0}
};
assert(axis >= 0 && axis <= 5);
diff --git a/source/blender/blenlib/intern/noise.c b/source/blender/blenlib/intern/noise.c
index ee2bab11ade..87f1adc5b1a 100644
--- a/source/blender/blenlib/intern/noise.c
+++ b/source/blender/blenlib/intern/noise.c
@@ -288,7 +288,9 @@ static float newPerlin(float x, float y, float z)
{
int A, AA, AB, B, BA, BB;
float u = floor(x), v = floor(y), w = floor(z);
- int X = ((int)u) & 255, Y = ((int)v) & 255, Z = ((int)w) & 255; /* FIND UNIT CUBE THAT CONTAINS POINT */
+ int X = ((int)u) & 255,
+ Y = ((int)v) & 255,
+ Z = ((int)w) & 255; /* FIND UNIT CUBE THAT CONTAINS POINT */
x -= u; /* FIND RELATIVE X,Y,Z */
y -= v; /* OF POINT IN CUBE. */
z -= w;
@@ -1304,7 +1306,8 @@ static float voronoi_Cr(float x, float y, float z)
}
-/* Signed version of all 6 of the above, just 2x-1, not really correct though (range is potentially (0, sqrt(6)).
+/* Signed version of all 6 of the above, just 2x-1, not really correct though
+ * (range is potentially (0, sqrt(6)).
* Used in the musgrave functions */
static float voronoi_F1S(float x, float y, float z)
{
diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c
index 5c9a56e33d2..dd4077d5b2d 100644
--- a/source/blender/blenlib/intern/path_util.c
+++ b/source/blender/blenlib/intern/path_util.c
@@ -342,14 +342,16 @@ bool BLI_filename_make_safe(char *fname)
changed = true;
}
- /* Check for forbidden names - not we have to check all combination of upper and lower cases, hence the usage
- * of lower_fname (more efficient than using BLI_strcasestr repeatedly). */
+ /* Check for forbidden names - not we have to check all combination
+ * of upper and lower cases, hence the usage of lower_fname
+ * (more efficient than using BLI_strcasestr repeatedly). */
BLI_str_tolower_ascii(lower_fname, len);
for (iname = invalid_names; *iname; iname++) {
if (strstr(lower_fname, *iname) == lower_fname) {
const size_t iname_len = strlen(*iname);
- /* Only invalid if the whole name is made of the invalid chunk, or it has an (assumed extension) dot
- * just after. This means it will also catch 'valid' names like 'aux.foo.bar', but should be
+ /* Only invalid if the whole name is made of the invalid chunk, or it has an
+ * (assumed extension) dot just after. This means it will also catch 'valid'
+ * names like 'aux.foo.bar', but should be
* good enough for us! */
if ((iname_len == len) || (lower_fname[iname_len] == '.')) {
*fname = '_';
@@ -1048,7 +1050,8 @@ bool BLI_path_abs(char *path, const char *basepath)
BLI_str_replace_char(base + BLI_path_unc_prefix_len(base), '\\', '/');
if (lslash) {
- const int baselen = (int) (lslash - base) + 1; /* length up to and including last "/" */
+ /* length up to and including last "/" */
+ const int baselen = (int) (lslash - base) + 1;
/* use path for temp storage here, we copy back over it right away */
BLI_strncpy(path, tmp + 2, FILE_MAX); /* strip "//" */
@@ -1501,7 +1504,8 @@ bool BLI_path_extension_glob_validate(char *ext_fnmatch)
for (size_t i = strlen(ext_fnmatch); i-- > 0; ) {
if (ext_fnmatch[i] == ';') {
- /* Group separator, we truncate here if we only had wildcards so far. Otherwise, all is sound and fine. */
+ /* Group separator, we truncate here if we only had wildcards so far.
+ * Otherwise, all is sound and fine. */
if (only_wildcards) {
ext_fnmatch[i] = '\0';
return true;
@@ -1515,7 +1519,8 @@ bool BLI_path_extension_glob_validate(char *ext_fnmatch)
/* So far, only wildcards in last group of the pattern... */
only_wildcards = true;
}
- /* Only one group in the pattern, so even if its only made of wildcard(s), it is assumed vaid. */
+ /* Only one group in the pattern, so even if its only made of wildcard(s),
+ * it is assumed vaid. */
return false;
}
@@ -1613,7 +1618,8 @@ void BLI_split_dirfile(const char *string, char *dir, char *file, const size_t d
if (dir) {
if (lslash) {
- BLI_strncpy(dir, string, MIN2(dirlen, lslash + 1)); /* +1 to include the slash and the last char */
+ /* +1 to include the slash and the last char */
+ BLI_strncpy(dir, string, MIN2(dirlen, lslash + 1));
}
else {
dir[0] = '\0';
diff --git a/source/blender/blenlib/intern/polyfill_2d.c b/source/blender/blenlib/intern/polyfill_2d.c
index 8c0870f0c07..5a171cd9299 100644
--- a/source/blender/blenlib/intern/polyfill_2d.c
+++ b/source/blender/blenlib/intern/polyfill_2d.c
@@ -650,10 +650,13 @@ static PolyIndex *pf_ear_tip_find(
#endif
}
- /* Desperate mode: if no vertex is an ear tip, we are dealing with a degenerate polygon (e.g. nearly collinear).
- * Note that the input was not necessarily degenerate, but we could have made it so by clipping some valid ears.
+ /* Desperate mode: if no vertex is an ear tip,
+ * we are dealing with a degenerate polygon (e.g. nearly collinear).
+ * Note that the input was not necessarily degenerate,
+ * but we could have made it so by clipping some valid ears.
*
- * Idea taken from Martin Held, "FIST: Fast industrial-strength triangulation of polygons", Algorithmica (1998),
+ * Idea taken from Martin Held, "FIST: Fast industrial-strength triangulation of polygons",
+ * Algorithmica (1998),
* http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.115.291
*
* Return a convex or tangential vertex if one exists.
@@ -736,19 +739,22 @@ static bool pf_ear_tip_check(PolyFill *pf, PolyIndex *pi_ear_tip)
v3 = coords[pi_ear_tip->next->index];
/* Check if any point is inside the triangle formed by previous, current and next vertices.
- * Only consider vertices that are not part of this triangle, or else we'll always find one inside. */
+ * Only consider vertices that are not part of this triangle,
+ * or else we'll always find one inside. */
for (pi_curr = pi_ear_tip->next->next; pi_curr != pi_ear_tip->prev; pi_curr = pi_curr->next) {
- /* Concave vertices can obviously be inside the candidate ear, but so can tangential vertices
- * if they coincide with one of the triangle's vertices. */
+ /* Concave vertices can obviously be inside the candidate ear,
+ * but so can tangential vertices if they coincide with one of the triangle's vertices. */
if (pi_curr->sign != CONVEX) {
const float *v = coords[pi_curr->index];
/* Because the polygon has clockwise winding order,
* the area sign will be positive if the point is strictly inside.
* It will be 0 on the edge, which we want to include as well. */
- /* note: check (v3, v1) first since it fails _far_ more often then the other 2 checks (those fail equally).
- * It's logical - the chance is low that points exist on the same side as the ear we're clipping off. */
+ /* note: check (v3, v1) first since it fails _far_ more often then the other 2 checks
+ * (those fail equally).
+ * It's logical - the chance is low that points exist on the
+ * same side as the ear we're clipping off. */
if ((span_tri_v2_sign(v3, v1, v) != CONCAVE) &&
(span_tri_v2_sign(v1, v2, v) != CONCAVE) &&
(span_tri_v2_sign(v2, v3, v) != CONCAVE))
diff --git a/source/blender/blenlib/intern/polyfill_2d_beautify.c b/source/blender/blenlib/intern/polyfill_2d_beautify.c
index 17f3205aaff..2266a04a294 100644
--- a/source/blender/blenlib/intern/polyfill_2d_beautify.c
+++ b/source/blender/blenlib/intern/polyfill_2d_beautify.c
@@ -221,8 +221,9 @@ static void polyedge_beauty_cost_update_single(
const uint i = e->base_index;
/* recalculate edge */
const float cost = polyedge_rotate_beauty_calc(coords, edges, e);
- /* We can get cases where both choices generate very small negative costs, which leads to infinite loop.
- * Anyway, costs above that are not worth recomputing, maybe we could even optimize it to a smaller limit?
+ /* We can get cases where both choices generate very small negative costs,
+ * which leads to infinite loop. Anyway, costs above that are not worth recomputing,
+ * maybe we could even optimize it to a smaller limit?
* Actually, FLT_EPSILON is too small in some cases, 1e-6f seems to work OK hopefully?
* See T43578, T49478. */
if (cost < -1e-6f) {
diff --git a/source/blender/blenlib/intern/rct.c b/source/blender/blenlib/intern/rct.c
index 5b1e378a2da..ba808c73907 100644
--- a/source/blender/blenlib/intern/rct.c
+++ b/source/blender/blenlib/intern/rct.c
@@ -179,7 +179,8 @@ bool BLI_rcti_inside_rcti(const rcti *rct_a, const rcti *rct_b)
}
-/* based closely on 'isect_seg_seg_v2_int', but in modified so corner cases are treated as intersections */
+/* based closely on 'isect_seg_seg_v2_int',
+ * but in modified so corner cases are treated as intersections */
static int isect_segments_i(const int v1[2], const int v2[2], const int v3[2], const int v4[2])
{
const double div = (double)((v2[0] - v1[0]) * (v4[1] - v3[1]) - (v2[1] - v1[1]) * (v4[0] - v3[0]));
diff --git a/source/blender/blenlib/intern/scanfill.c b/source/blender/blenlib/intern/scanfill.c
index 427a3eb1edb..cad0490977d 100644
--- a/source/blender/blenlib/intern/scanfill.c
+++ b/source/blender/blenlib/intern/scanfill.c
@@ -201,7 +201,8 @@ static bool boundisect(PolyFill *pf2, PolyFill *pf1)
}
-static void mergepolysSimp(ScanFillContext *sf_ctx, PolyFill *pf1, PolyFill *pf2) /* add pf2 to pf1 */
+/* add pf2 to pf1 */
+static void mergepolysSimp(ScanFillContext *sf_ctx, PolyFill *pf1, PolyFill *pf2)
{
ScanFillVert *eve;
ScanFillEdge *eed;
@@ -502,7 +503,8 @@ static unsigned int scanfill(ScanFillContext *sf_ctx, PolyFill *pf, const int fl
eve->f = SF_VERT_NEW; /* flag for connectedges later on */
sc->vert = eve;
sc->edge_first = sc->edge_last = NULL;
- /* if (even->tmp.v == NULL) eve->tmp.u = verts; */ /* Note, debug print only will work for curve polyfill, union is in use for mesh */
+ /* Note, debug print only will work for curve polyfill, union is in use for mesh */
+ /* if (even->tmp.v == NULL) eve->tmp.u = verts; */
sc++;
}
}
@@ -570,7 +572,8 @@ static unsigned int scanfill(ScanFillContext *sf_ctx, PolyFill *pf, const int fl
maxface = 2 * verts; /* 2*verts: based at a filled circle within a triangle */
}
else {
- maxface = verts - 2; /* when we don't calc any holes, we assume face is a non overlapping loop */
+ /* when we don't calc any holes, we assume face is a non overlapping loop */
+ maxface = verts - 2;
}
sc = scdata;
@@ -593,7 +596,8 @@ static unsigned int scanfill(ScanFillContext *sf_ctx, PolyFill *pf, const int fl
ed1 = sc->edge_first;
ed2 = ed1->next;
- /* commented out... the ESC here delivers corrupted memory (and doesnt work during grab) */
+ /* commented out... the ESC here delivers corrupted memory
+ * (and doesnt work during grab) */
/* if (callLocalInterruptCallBack()) break; */
if (totface >= maxface) {
/* printf("Fill error: endless loop. Escaped at vert %d, tot: %d.\n", a, verts); */
@@ -634,15 +638,16 @@ static unsigned int scanfill(ScanFillContext *sf_ctx, PolyFill *pf, const int fl
if (testedgeside(v3->xy, v1->xy, sc1->vert->xy)) {
/* point is in triangle */
- /* because multiple points can be inside triangle (concave holes) */
- /* we continue searching and pick the one with sharpest corner */
-
+ /* Because multiple points can be inside triangle
+ * (concave holes) we continue searching and pick the
+ * one with sharpest corner. */
if (best_sc == NULL) {
/* even without holes we need to keep checking [#35861] */
best_sc = sc1;
}
else {
- /* prevent angle calc for the simple cases only 1 vertex is found */
+ /* Prevent angle calc for the simple cases
+ * only 1 vertex is found. */
if (firsttime == false) {
angle_best_cos = cos_v2v2v2(v2->xy, v1->xy, best_sc->vert->xy);
firsttime = true;
diff --git a/source/blender/blenlib/intern/scanfill_utils.c b/source/blender/blenlib/intern/scanfill_utils.c
index ef1df479f13..59ba03926df 100644
--- a/source/blender/blenlib/intern/scanfill_utils.c
+++ b/source/blender/blenlib/intern/scanfill_utils.c
@@ -214,7 +214,10 @@ static bool scanfill_preprocess_self_isect(
copy_v2_v2(isect->co, pt);
isect->co[2] = eed->v1->co[2];
isect->v = BLI_scanfill_vert_add(sf_ctx, isect->co);
- isect->v->poly_nr = eed->v1->poly_nr; /* NOTE: vert may belong to 2 polys now */
+
+ /* NOTE: vert may belong to 2 polys now */
+ isect->v->poly_nr = eed->v1->poly_nr;
+
VFLAG_SET(isect->v, V_ISISECT);
edge_isect_ls_add(isect_hash, eed, isect);
edge_isect_ls_add(isect_hash, eed_other, isect);
diff --git a/source/blender/blenlib/intern/string.c b/source/blender/blenlib/intern/string.c
index f092d278338..032041dbf68 100644
--- a/source/blender/blenlib/intern/string.c
+++ b/source/blender/blenlib/intern/string.c
@@ -380,7 +380,8 @@ char *BLI_str_quoted_substrN(const char *__restrict str, const char *__restrict
{
const char *startMatch, *endMatch;
- /* get the starting point (i.e. where prefix starts, and add prefixLen+1 to it to get be after the first " */
+ /* get the starting point (i.e. where prefix starts, and add prefixLen+1
+ * to it to get be after the first " */
startMatch = strstr(str, prefix);
if (startMatch) {
const size_t prefixLen = strlen(prefix);
@@ -438,8 +439,8 @@ char *BLI_str_replaceN(const char *__restrict str, const char *__restrict substr
* copy the text up to this position and advance the current position in the string
*/
if (str != match) {
- /* add the segment of the string from str to match to the buffer, then restore the value at match
- */
+ /* add the segment of the string from str to match to the buffer,
+ * then restore the value at match */
BLI_dynstr_nappend(ds, str, (match - str));
/* now our current position should be set on the start of the match */
diff --git a/source/blender/blenlib/intern/string_utf8.c b/source/blender/blenlib/intern/string_utf8.c
index 1e2a9629e0f..c2022f975b7 100644
--- a/source/blender/blenlib/intern/string_utf8.c
+++ b/source/blender/blenlib/intern/string_utf8.c
@@ -48,7 +48,8 @@
// #define DEBUG_STRSIZE
/* array copied from glib's gutf8.c, */
-/* Note: last two values (0xfe and 0xff) are forbidden in utf-8, so they are considered 1 byte length too. */
+/* Note: last two values (0xfe and 0xff) are forbidden in utf-8,
+ * so they are considered 1 byte length too. */
static const size_t utf8_skip_data[256] = {
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@@ -90,8 +91,8 @@ ptrdiff_t BLI_utf8_invalid_byte(const char *str, size_t length)
if ((c & 0xc0) != 0xc0)
goto utf8_error;
- /* Note that since we always increase p (and decrease length) by one byte in main loop, we only add/subtract
- * extra utf8 bytes in code below
+ /* Note that since we always increase p (and decrease length) by one byte in main loop,
+ * we only add/subtract extra utf8 bytes in code below
* (ab number, aka number of bytes remaining in the utf8 sequence after the initial one). */
ab = (int)utf8_skip_data[c] - 1;
if (length <= ab) {
@@ -272,7 +273,8 @@ char *BLI_strncat_utf8(char *__restrict dst, const char *__restrict src, size_t
size_t BLI_strncpy_wchar_as_utf8(char *__restrict dst, const wchar_t *__restrict src, const size_t maxncpy)
{
const size_t maxlen = maxncpy - 1;
- const int64_t maxlen_secured = (int64_t)maxlen - 6; /* 6 is max utf8 length of an unicode char. */
+ /* 6 is max utf8 length of an unicode char. */
+ const int64_t maxlen_secured = (int64_t)maxlen - 6;
size_t len = 0;
BLI_assert(maxncpy != 0);
@@ -285,8 +287,8 @@ size_t BLI_strncpy_wchar_as_utf8(char *__restrict dst, const wchar_t *__restrict
len += BLI_str_utf8_from_unicode((uint)*src++, dst + len);
}
- /* We have to be more careful for the last six bytes, to avoid buffer overflow in case utf8-encoded char
- * would be too long for our dst buffer. */
+ /* We have to be more careful for the last six bytes,
+ * to avoid buffer overflow in case utf8-encoded char would be too long for our dst buffer. */
while (*src) {
char t[6];
size_t l = BLI_str_utf8_from_unicode((uint)*src++, t);
diff --git a/source/blender/blenlib/intern/task.c b/source/blender/blenlib/intern/task.c
index 4c6f27ab359..76d46e3a231 100644
--- a/source/blender/blenlib/intern/task.c
+++ b/source/blender/blenlib/intern/task.c
@@ -364,12 +364,13 @@ static bool task_scheduler_thread_wait_pop(TaskScheduler *scheduler, Task **task
do {
Task *current_task;
- /* Assuming we can only have a void queue in 'exit' case here seems logical (we should only be here after
- * our worker thread has been woken up from a condition_wait(), which only happens after a new task was
- * added to the queue), but it is wrong.
- * Waiting on condition may wake up the thread even if condition is not signaled (spurious wake-ups), and some
- * race condition may also empty the queue **after** condition has been signaled, but **before** awoken thread
- * reaches this point...
+ /* Assuming we can only have a void queue in 'exit' case here seems logical
+ * (we should only be here after our worker thread has been woken up from a
+ * condition_wait(), which only happens after a new task was added to the queue),
+ * but it is wrong.
+ * Waiting on condition may wake up the thread even if condition is not signaled
+ * (spurious wake-ups), and some race condition may also empty the queue **after**
+ * condition has been signaled, but **before** awoken thread reaches this point...
* See http://stackoverflow.com/questions/8594591
*
* So we only abort here if do_exit is set.
@@ -635,7 +636,8 @@ static TaskPool *task_pool_create_ex(TaskScheduler *scheduler,
TaskPool *pool = MEM_mallocN(sizeof(TaskPool), "TaskPool");
#ifndef NDEBUG
- /* Assert we do not try to create a background pool from some parent task - those only work OK from main thread. */
+ /* Assert we do not try to create a background pool from some parent task -
+ * those only work OK from main thread. */
if (is_background) {
const pthread_t thread_id = pthread_self();
int i = scheduler->num_threads;
diff --git a/source/blender/blenlib/intern/timecode.c b/source/blender/blenlib/intern/timecode.c
index ab7766d2cd6..5f710ad10e4 100644
--- a/source/blender/blenlib/intern/timecode.c
+++ b/source/blender/blenlib/intern/timecode.c
@@ -135,7 +135,8 @@ size_t BLI_timecode_string_from_time(
}
case USER_TIMECODE_SMPTE_MSF:
{
- /* reduced SMPTE format that always shows minutes, seconds, frames. Hours only shown as needed. */
+ /* reduced SMPTE format that always shows minutes, seconds, frames.
+ * Hours only shown as needed. */
if (hours) {
rlen = BLI_snprintf_rlen(str, maxncpy, "%s%02d:%02d:%02d:%02d", neg, hours, minutes, seconds, frames);
}
@@ -165,7 +166,8 @@ size_t BLI_timecode_string_from_time(
}
case USER_TIMECODE_SUBRIP:
{
- /* SubRip, like SMPTE milliseconds but seconds and milliseconds are separated by a comma, not a dot... */
+ /* SubRip, like SMPTE milliseconds but seconds and milliseconds
+ * are separated by a comma, not a dot... */
/* precision of decimal part */
const int ms_dp = (power <= 0) ? (1 - power) : 1;
diff --git a/source/blender/blenlib/intern/voxel.c b/source/blender/blenlib/intern/voxel.c
index 37b7ca37ba5..e7e58071d76 100644
--- a/source/blender/blenlib/intern/voxel.c
+++ b/source/blender/blenlib/intern/voxel.c
@@ -63,7 +63,8 @@ BLI_INLINE int FLOORI(float x)
return ((x >= 0.f) || (float)r == x) ? r : (r - 1);
}
-/* clamp function, cannot use the CLAMPIS macro, it sometimes returns unwanted results apparently related to
+/* clamp function, cannot use the CLAMPIS macro,
+ * it sometimes returns unwanted results apparently related to
* gcc optimization flag -fstrict-overflow which is enabled at -O2
*
* this causes the test (x + 2) < 0 with int x == 2147483647 to return false (x being an integer,