X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=utf8.c;h=c25a84ba2a3a7a6e7f5d65d4214a432895685348;hp=b65b2a9c706cf5840b8f352eb9e7d4a94a79d42f;hb=ce5e12405904f419adf8b4b6d4465fb27274c08b;hpb=6833ce8bdca2d64e14485118f2a4417b7e1cb1b1 diff --git a/utf8.c b/utf8.c index b65b2a9..c25a84b 100644 --- a/utf8.c +++ b/utf8.c @@ -1,3 +1,16 @@ +/* + * Copyright notice from original mutt: + * [none] + * + * This file is part of mutt-ng, see http://www.muttng.org/. + * It's licensed under the GNU General Public License, + * please see the file GPL in the top level source directory. + */ + +#if HAVE_CONFIG_H +# include "config.h" +#endif + #ifndef HAVE_WC_FUNCS #include @@ -8,35 +21,28 @@ int mutt_wctoutf8 (char *s, unsigned int c) { - if (c < (1 << 7)) - { + if (c < (1 << 7)) { if (s) *s++ = c; return 1; } - else if (c < (1 << 11)) - { - if (s) - { + else if (c < (1 << 11)) { + if (s) { *s++ = 0xc0 | (c >> 6); *s++ = 0x80 | (c & 0x3f); } return 2; } - else if (c < (1 << 16)) - { - if (s) - { + else if (c < (1 << 16)) { + if (s) { *s++ = 0xe0 | (c >> 12); *s++ = 0x80 | ((c >> 6) & 0x3f); *s++ = 0x80 | (c & 0x3f); } return 3; } - else if (c < (1 << 21)) - { - if (s) - { + else if (c < (1 << 21)) { + if (s) { *s++ = 0xf0 | (c >> 18); *s++ = 0x80 | ((c >> 12) & 0x3f); *s++ = 0x80 | ((c >> 6) & 0x3f); @@ -44,10 +50,8 @@ int mutt_wctoutf8 (char *s, unsigned int c) } return 4; } - else if (c < (1 << 26)) - { - if (s) - { + else if (c < (1 << 26)) { + if (s) { *s++ = 0xf8 | (c >> 24); *s++ = 0x80 | ((c >> 18) & 0x3f); *s++ = 0x80 | ((c >> 12) & 0x3f); @@ -56,10 +60,8 @@ int mutt_wctoutf8 (char *s, unsigned int c) } return 5; } - else if (c < (1 << 31)) - { - if (s) - { + else if (c < (1 << 31)) { + if (s) { *s++ = 0xfc | (c >> 30); *s++ = 0x80 | ((c >> 24) & 0x3f); *s++ = 0x80 | ((c >> 18) & 0x3f);