diff options
author | Sybren A. Stüvel <sybren@blender.org> | 2020-07-03 18:19:13 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2020-07-03 18:42:45 +0300 |
commit | bf532b11068d2f203f2a6db573e73c7d6b5b7407 (patch) | |
tree | 37d3c861fd87cad5186abaa8c2685e8229e8422a /source/blender/editors/space_text/text_ops.c | |
parent | 2f6fc5a7e8c435275926f37140fc11bd370f82cb (diff) |
Cleanup: Editors/Space/Text, Clang-Tidy else-after-return fixes
This addresses warnings from Clang-Tidy's `readability-else-after-return`
rule in the `source/blender/editors/space_text` module.
No functional changes.
Diffstat (limited to 'source/blender/editors/space_text/text_ops.c')
-rw-r--r-- | source/blender/editors/space_text/text_ops.c | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index c0343900f8b..6be436cffb5 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -3012,7 +3012,7 @@ static void text_cursor_set_to_pos_wrapped( break; /* Exactly at the cursor */ } - else if (y == 0 && i - start <= x && i + columns - start > x) { + if (y == 0 && i - start <= x && i + columns - start > x) { /* current position could be wrapped to next line */ /* this should be checked when end of current line would be reached */ charp = curs = j; @@ -3471,21 +3471,20 @@ static int text_insert_invoke(bContext *C, wmOperator *op, const wmEvent *event) if ((event->ctrl || event->oskey) && !event->utf8_buf[0]) { return OPERATOR_PASS_THROUGH; } - else { - char str[BLI_UTF8_MAX + 1]; - size_t len; - if (event->utf8_buf[0]) { - len = BLI_str_utf8_size_safe(event->utf8_buf); - memcpy(str, event->utf8_buf, len); - } - else { - /* in theory, ghost can set value to extended ascii here */ - len = BLI_str_utf8_from_unicode(event->ascii, str); - } - str[len] = '\0'; - RNA_string_set(op->ptr, "text", str); + char str[BLI_UTF8_MAX + 1]; + size_t len; + + if (event->utf8_buf[0]) { + len = BLI_str_utf8_size_safe(event->utf8_buf); + memcpy(str, event->utf8_buf, len); } + else { + /* in theory, ghost can set value to extended ascii here */ + len = BLI_str_utf8_from_unicode(event->ascii, str); + } + str[len] = '\0'; + RNA_string_set(op->ptr, "text", str); } ret = text_insert_exec(C, op); @@ -3673,9 +3672,7 @@ static int text_replace_exec(bContext *C, wmOperator *op) if (replace_all) { return text_replace_all(C); } - else { - return text_find_and_replace(C, op, TEXT_REPLACE); - } + return text_find_and_replace(C, op, TEXT_REPLACE); } void TEXT_OT_replace(wmOperatorType *ot) |