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:
authorHans Goudey <h.goudey@me.com>2020-06-03 20:34:24 +0300
committerHans Goudey <h.goudey@me.com>2020-06-03 20:34:24 +0300
commita4e0bccb87bbcc6ff6f36a428aa402576de5f9ec (patch)
tree391e0d6f9e21f1c83b0043cb596c5a7f1a780b2e
parentbd68312cb67b98576c1360fdd50f4cba15a8491c (diff)
Cleanup: Use ELEM Macro
-rw-r--r--source/blender/blenkernel/intern/unit.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/unit.c b/source/blender/blenkernel/intern/unit.c
index bb895304b84..a8136dd7932 100644
--- a/source/blender/blenkernel/intern/unit.c
+++ b/source/blender/blenkernel/intern/unit.c
@@ -728,7 +728,7 @@ static char *find_next_negative(const char *str, const char *remaining_str)
}
/* Don't use the "-" from scientific notation, but make sure we can look backwards first. */
- if ((str_found != str) && (*(str_found - 1) == 'e' || *(str_found - 1) == 'E')) {
+ if ((str_found != str) && ELEM(*(str_found - 1), 'e', 'E')) {
return find_next_negative(str, str_found + 1);
}
@@ -803,13 +803,13 @@ static bool unit_distribute_negatives(char *str, const int len_max)
changed = true;
/* Add '(', shift the following characters to the right to make space. */
- memmove(remaining_str + 1, remaining_str, remaining_str_len - 1);
+ memmove(remaining_str + 1, remaining_str, remaining_str_len - 2);
*remaining_str = '(';
/* Add the ')' before the next operation or at the end. */
remaining_str = find_next_op(str, remaining_str + 1, remaining_str_len);
remaining_str_len = len_max - (int)(remaining_str - str);
- memmove(remaining_str + 1, remaining_str, remaining_str_len - 1);
+ memmove(remaining_str + 1, remaining_str, remaining_str_len - 2);
*remaining_str = ')';
/* Only move forward by 1 even though we added two characters. Minus signs need to be able to
@@ -1005,6 +1005,7 @@ bool bUnit_ReplaceString(
/* Fix cases like "-1m50cm" which would evaluate to -0.5m without this. */
changed |= unit_distribute_negatives(str, len_max);
+ printf("%s\n", str);
/* Try to find a default unit from current or previous string. */
default_unit = unit_detect_from_str(usys, str, str_prev);