From 80ff7b315a6b5a9f9c62de5c6b03f52ddf099837 Mon Sep 17 00:00:00 2001 From: Oxore Date: Thu, 6 Dec 2018 05:24:30 +0300 Subject: 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. --- src/unicode.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/unicode.c') 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) { -- cgit v1.2.3