diff options
author | Oxore <oxore@protonmail.com> | 2018-12-06 05:24:30 +0300 |
---|---|---|
committer | Oxore <oxore@protonmail.com> | 2018-12-06 07:59:07 +0300 |
commit | 80ff7b315a6b5a9f9c62de5c6b03f52ddf099837 (patch) | |
tree | b8b982e702ac5a64db40116e39fd453e998b3dbd /src/unicode.c | |
parent | 80325e9dfaece1316fa5cdc2b0551280369c4f7d (diff) |
Add simple documentation in comments, refactor.
Change all `unsigned int` and `unsigned long` types to `size_t`.
Fix names alignment in headers.
Add documentation and simple description:
Painter - painter.h
Main - tetris.c
Unicode - unicode.h
IDList - idlist.h
Engine - engine.c
Minor changes:
tetris.c - fix indentation and code blocks separation with newlines,
remove unused includes.
idlist.h - fix structure field name alignment.
field.h, engine.c - define aliases for ghost and active shapes indexes
in the field.
engine.c - rename menuTick to snake case, fix curly braces style of
functions.
Makefile - switch SFML deprecated warnings off.
Diffstat (limited to 'src/unicode.c')
-rw-r--r-- | src/unicode.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/unicode.c b/src/unicode.c index 8bde67d..8e4309d 100644 --- a/src/unicode.c +++ b/src/unicode.c @@ -3,7 +3,7 @@ #include "unicode.h" -static inline unsigned int utf8_char_len(unsigned char c) +static inline size_t utf8_char_len(unsigned char c) { if (c > 0x00 && c < 0xC0) return 1; @@ -17,9 +17,9 @@ static inline unsigned int utf8_char_len(unsigned char c) return 0; } -unsigned long utf8_strlen(char *string) +size_t utf8_strlen(char *string) { - unsigned long len = 0, keep = 0; + size_t len = 0, keep = 0; for (char *c = string; *c; (keep ? --keep : ++len), ++c) if (!keep) keep = (keep = utf8_char_len(*c)) ? keep - 1 : keep; @@ -30,7 +30,7 @@ void utf8to32_strcpy(wchar_t *dest, char *src) { wchar_t *dc = dest; char *c = src; - unsigned long len = 0; + size_t len = 0; while (*c) { int clen = utf8_char_len(*c); if (clen == 1) { |