From 7809efa1b529c5c2a9af27e338b32905bb027ada Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Sun, 12 Nov 2006 14:51:18 +0200 Subject: [PATCH] Names of enum constants should be in upper case. Requested by Miciah. --- doc/hacking.txt | 2 ++ src/intl/charsets.c | 16 ++++++++-------- src/intl/charsets.h | 6 +++--- src/viewer/text/form.c | 4 ++-- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/doc/hacking.txt b/doc/hacking.txt index cf31e0044..140adf500 100644 --- a/doc/hacking.txt +++ b/doc/hacking.txt @@ -495,6 +495,8 @@ Please write sizeof(something) instead of sizeof something. Use assert() and assertm() where applicable. It will prevent hidden bugs. +Names of enum constants should be in upper case. + If you see code in ELinks that doesn't follow these rules, fix it or tell us about it. diff --git a/src/intl/charsets.c b/src/intl/charsets.c index 047beb1f5..530778be9 100644 --- a/src/intl/charsets.c +++ b/src/intl/charsets.c @@ -433,7 +433,7 @@ utf8_step_forward(unsigned char *string, unsigned char *end, end = strchr(string, '\0'); switch (way) { - case utf8_step_characters: + case UTF8_STEP_CHARACTERS: while (steps < max && current < end) { ++current; if (utf8_islead(*current)) @@ -441,8 +441,8 @@ utf8_step_forward(unsigned char *string, unsigned char *end, } break; - case utf8_step_cells_fewer: - case utf8_step_cells_more: + case UTF8_STEP_CELLS_FEWER: + case UTF8_STEP_CELLS_MORE: while (steps < max) { unicode_val_T u; unsigned char *prev = current; @@ -458,7 +458,7 @@ utf8_step_forward(unsigned char *string, unsigned char *end, } width = unicode_to_cell(u); - if (way == utf8_step_cells_fewer + if (way == UTF8_STEP_CELLS_FEWER && steps + width > max) { /* Back off. */ current = prev; @@ -500,7 +500,7 @@ utf8_step_backward(unsigned char *string, unsigned char *start, if_assert_failed goto invalid_arg; switch (way) { - case utf8_step_characters: + case UTF8_STEP_CHARACTERS: while (steps < max && current > start) { --current; if (utf8_islead(*current)) @@ -508,8 +508,8 @@ utf8_step_backward(unsigned char *string, unsigned char *start, } break; - case utf8_step_cells_fewer: - case utf8_step_cells_more: + case UTF8_STEP_CELLS_FEWER: + case UTF8_STEP_CELLS_MORE: while (steps < max) { unsigned char *prev = current; unsigned char *look; @@ -531,7 +531,7 @@ utf8_step_backward(unsigned char *string, unsigned char *start, } else width = unicode_to_cell(u); - if (way == utf8_step_cells_fewer + if (way == UTF8_STEP_CELLS_FEWER && steps + width > max) { /* Back off. */ current = prev; diff --git a/src/intl/charsets.h b/src/intl/charsets.h index 65cfc9994..25e14a324 100644 --- a/src/intl/charsets.h +++ b/src/intl/charsets.h @@ -86,17 +86,17 @@ int utf8_cells2bytes(unsigned char *, int, unsigned char *); enum utf8_step { /* Each step is one character, even if it is a combining or * double-width character. */ - utf8_step_characters, + UTF8_STEP_CHARACTERS, /* Each step is one cell. If the specified number of steps * would end in the middle of a double-width character, do not * include the character. */ - utf8_step_cells_fewer, + UTF8_STEP_CELLS_FEWER, /* Each step is one cell. If the specified number of steps * would end in the middle of a double-width character, * include the whole character. */ - utf8_step_cells_more + UTF8_STEP_CELLS_MORE }; unsigned char *utf8_step_forward(unsigned char *, unsigned char *, int, enum utf8_step, int *); diff --git a/src/viewer/text/form.c b/src/viewer/text/form.c index 0695874b1..fa4305230 100644 --- a/src/viewer/text/form.c +++ b/src/viewer/text/form.c @@ -462,8 +462,8 @@ drew_char: unsigned char *ptr = fs->value + fs->state; int cells = fc->size; enum utf8_step how = (fc->type == FC_PASSWORD) - ? utf8_step_characters - : utf8_step_cells_fewer; + ? UTF8_STEP_CHARACTERS + : UTF8_STEP_CELLS_FEWER; /* The insertion point is at the right * side of the scrolled-visible part