diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-04-01 04:34:00 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-04-01 08:22:28 +0400 |
commit | 617557b08ea94e2b65a1697ddf0b79651204d92b (patch) | |
tree | 50b24bab075b42fa20456140c9a9681cfb01325b /source/blender/blenkernel/intern/text.c | |
parent | 2c00ecc738c04dc5dc22d4a6b81a1e937526ba6d (diff) |
Code cleanup: remove TRUE/FALSE & WITH_BOOL_COMPAT define
Diffstat (limited to 'source/blender/blenkernel/intern/text.c')
-rw-r--r-- | source/blender/blenkernel/intern/text.c | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index 1d2caaa0640..22267c93680 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -996,7 +996,8 @@ void txt_move_left(Text *text, const bool sel) void txt_move_right(Text *text, const bool sel) { TextLine **linep; - int *charp, do_tab = FALSE, i; + int *charp, i; + bool do_tab = false; if (!text) return; if (sel) txt_curs_sel(text, &linep, &charp); @@ -1013,10 +1014,10 @@ void txt_move_right(Text *text, const bool sel) // do nice right only if there are only spaces // spaces hardcoded in DNA_text_types.h if (text->flags & TXT_TABSTOSPACES && (*linep)->line[*charp] == ' ') { - do_tab = TRUE; + do_tab = true; for (i = 0; i < *charp; i++) if ((*linep)->line[i] != ' ') { - do_tab = FALSE; + do_tab = false; break; } } @@ -2577,7 +2578,7 @@ static void txt_convert_tab_to_spaces(Text *text) txt_insert_buf(text, sb); } -static int txt_add_char_intern(Text *text, unsigned int add, int replace_tabs) +static bool txt_add_char_intern(Text *text, unsigned int add, bool replace_tabs) { char *tmp, ch[BLI_UTF8_MAX]; size_t add_len; @@ -2620,12 +2621,12 @@ static int txt_add_char_intern(Text *text, unsigned int add, int replace_tabs) return 1; } -int txt_add_char(Text *text, unsigned int add) +bool txt_add_char(Text *text, unsigned int add) { - return txt_add_char_intern(text, add, text->flags & TXT_TABSTOSPACES); + return txt_add_char_intern(text, add, (text->flags & TXT_TABSTOSPACES) != 0); } -int txt_add_raw_char(Text *text, unsigned int add) +bool txt_add_raw_char(Text *text, unsigned int add) { return txt_add_char_intern(text, add, 0); } @@ -2636,7 +2637,7 @@ void txt_delete_selected(Text *text) txt_make_dirty(text); } -int txt_replace_char(Text *text, unsigned int add) +bool txt_replace_char(Text *text, unsigned int add) { unsigned int del; size_t del_size = 0, add_size; @@ -2709,7 +2710,7 @@ void txt_indent(Text *text) curc_old = text->curc; num = 0; - while (TRUE) { + while (true) { /* don't indent blank lines */ if (text->curl->len != 0) { @@ -2758,7 +2759,7 @@ void txt_unindent(Text *text) int num = 0; const char *remove = "\t"; int indentlen = 1; - int unindented_first = FALSE; + bool unindented_first = false; /* hardcoded: TXT_TABSIZE = 4 spaces: */ int spaceslen = TXT_TABSIZE; @@ -2773,11 +2774,12 @@ void txt_unindent(Text *text) indentlen = spaceslen; } - while (TRUE) { + while (true) { int i = 0; if (BLI_strncasecmp(text->curl->line, remove, indentlen) == 0) { - if (num == 0) unindented_first = TRUE; + if (num == 0) + unindented_first = true; while (i < text->curl->len) { text->curl->line[i] = text->curl->line[i + indentlen]; i++; @@ -2822,7 +2824,7 @@ void txt_comment(Text *text) if (!text->sell) return; // Need to change this need to check if only one line is selected to more than one num = 0; - while (TRUE) { + while (true) { tmp = MEM_mallocN(text->curl->len + 2, "textline_string"); text->curc = 0; @@ -2869,7 +2871,7 @@ void txt_uncomment(Text *text) if (!text->curl) return; if (!text->sell) return; - while (TRUE) { + while (true) { int i = 0; if (text->curl->line[i] == remove) { |