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:
authorCampbell Barton <ideasman42@gmail.com>2022-01-06 05:54:56 +0300
committerCampbell Barton <ideasman42@gmail.com>2022-01-06 05:54:56 +0300
commitc12607baa3a45eeceaf084c1e8b537183b6cc07e (patch)
tree852ae773af2d192e9e8d3e09bca339e8ed94bae8 /source/blender/bmesh/tools
parent66a4da87f4ce9345bf8649b5382041380134adcb (diff)
Cleanup: quiet GCC stringop-overflow in bmesh_beautify.c
Also elaborate on the doc-string.
Diffstat (limited to 'source/blender/bmesh/tools')
-rw-r--r--source/blender/bmesh/tools/bmesh_beautify.c39
1 files changed, 23 insertions, 16 deletions
diff --git a/source/blender/bmesh/tools/bmesh_beautify.c b/source/blender/bmesh/tools/bmesh_beautify.c
index b7cf9c88282..266b1c0cea8 100644
--- a/source/blender/bmesh/tools/bmesh_beautify.c
+++ b/source/blender/bmesh/tools/bmesh_beautify.c
@@ -49,8 +49,17 @@
/* GSet for edge rotation */
typedef struct EdRotState {
- int v1, v2; /* edge vert, small -> large */
- int f1, f2; /* face vert, small -> large */
+ /**
+ * Edge vert indices (ordered small -> large).
+ */
+ int v_pair[2];
+ /**
+ * Face vert indices (small -> large).
+ *
+ * Each face-vertex points to a connected triangles vertex
+ * that's isn't part of the edge defined by `v_pair`.
+ */
+ int f_pair[2];
} EdRotState;
#if 0
@@ -58,7 +67,7 @@ typedef struct EdRotState {
static uint erot_gsetutil_hash(const void *ptr)
{
const EdRotState *e_state = (const EdRotState *)ptr;
- return BLI_ghashutil_inthash_v4(&e_state->v1);
+ return BLI_ghashutil_inthash_v4(&e_state->v_pair[0]);
}
#endif
#if 0
@@ -66,33 +75,31 @@ static int erot_gsetutil_cmp(const void *a, const void *b)
{
const EdRotState *e_state_a = (const EdRotState *)a;
const EdRotState *e_state_b = (const EdRotState *)b;
- if (e_state_a->v1 < e_state_b->v1) {
+ if (e_state_a->v_pair[0] < e_state_b->v_pair[0]) {
return -1;
}
- else if (e_state_a->v1 > e_state_b->v1) {
+ if (e_state_a->v_pair[0] > e_state_b->v_pair[0]) {
return 1;
}
- else if (e_state_a->v2 < e_state_b->v2) {
+ if (e_state_a->v_pair[1] < e_state_b->v_pair[1]) {
return -1;
}
- else if (e_state_a->v2 > e_state_b->v2) {
+ if (e_state_a->v_pair[1] > e_state_b->v_pair[1]) {
return 1;
}
- else if (e_state_a->f1 < e_state_b->f1) {
+ if (e_state_a->f_pair[0] < e_state_b->f_pair[0]) {
return -1;
}
- else if (e_state_a->f1 > e_state_b->f1) {
+ if (e_state_a->f_pair[0] > e_state_b->f_pair[0]) {
return 1;
}
- else if (e_state_a->f2 < e_state_b->f2) {
+ if (e_state_a->f_pair[1] < e_state_b->f_pair[1]) {
return -1;
}
- else if (e_state_a->f2 > e_state_b->f2) {
+ if (e_state_a->f_pair[1] > e_state_b->f_pair[1]) {
return 1;
}
- else {
- return 0;
- }
+ return 0;
}
#endif
static GSet *erot_gset_new(void)
@@ -127,12 +134,12 @@ static void erot_state_ex(const BMEdge *e, int v_index[2], int f_index[2])
static void erot_state_current(const BMEdge *e, EdRotState *e_state)
{
- erot_state_ex(e, &e_state->v1, &e_state->f1);
+ erot_state_ex(e, e_state->v_pair, e_state->f_pair);
}
static void erot_state_alternate(const BMEdge *e, EdRotState *e_state)
{
- erot_state_ex(e, &e_state->f1, &e_state->v1);
+ erot_state_ex(e, e_state->f_pair, e_state->v_pair);
}
/* -------------------------------------------------------------------- */