From: Pavel Charvat Date: Mon, 2 Jun 2014 17:40:08 +0000 (+0200) Subject: Strings: Converted to size_t. X-Git-Tag: v6.0~19 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=e28b3208ee7dfd580fa86bb9e586638498a24dcb;p=libucw.git Strings: Converted to size_t. --- diff --git a/ucw/str-hex.c b/ucw/str-hex.c index c71c23e6..79f278ab 100644 --- a/ucw/str-hex.c +++ b/ucw/str-hex.c @@ -18,7 +18,7 @@ hex_make(uns x) } void -mem_to_hex(char *dest, const byte *src, uns bytes, uns flags) +mem_to_hex(char *dest, const byte *src, size_t bytes, uns flags) { uns sep = flags & 0xff; @@ -48,7 +48,7 @@ hex_parse(uns c) } const char * -hex_to_mem(byte *dest, const char *src, uns max_bytes, uns flags) +hex_to_mem(byte *dest, const char *src, size_t max_bytes, uns flags) { uns sep = flags & 0xff; while (max_bytes-- && Cxdigit(src[0]) && Cxdigit(src[1])) diff --git a/ucw/string.c b/ucw/string.c index bb1fae1a..7bda3740 100644 --- a/ucw/string.c +++ b/ucw/string.c @@ -14,8 +14,8 @@ #include #ifdef CONFIG_DARWIN -uns -strnlen(const char *str, uns n) +size_t +strnlen(const char *str, size_t n) { const char *end = str + n; const char *c; @@ -39,11 +39,11 @@ str_format_flags(char *dest, const char *fmt, uns flags) return start; } -uns +size_t str_count_char(const char *str, uns chr) { const byte *s = str; - uns i = 0; + size_t i = 0; while (*s) if (*s++ == chr) i++; diff --git a/ucw/string.h b/ucw/string.h index 0c64ace5..ca756ef2 100644 --- a/ucw/string.h +++ b/ucw/string.h @@ -30,7 +30,7 @@ /* string.c */ #ifdef CONFIG_DARWIN -uns strnlen(const char *str, uns n); // NOAPI +size_t strnlen(const char *str, size_t n); // NOAPI #endif /** @@ -40,7 +40,7 @@ uns strnlen(const char *str, uns n); // NOAPI char *str_format_flags(char *dest, const char *fmt, uns flags); /** Counts occurrences of @chr in @str. **/ -uns str_count_char(const char *str, uns chr); +size_t str_count_char(const char *str, uns chr); /* str-esc.c */ @@ -94,14 +94,14 @@ int str_match_pattern_nocase(const char *patt, const char *str); * not be separated), possibly OR-ed with `MEM_TO_HEX_UPCASE` when upper-case * characters should be used. **/ -void mem_to_hex(char *dest, const byte *src, uns bytes, uns flags); +void mem_to_hex(char *dest, const byte *src, size_t bytes, uns flags); /** * An inverse function to @mem_to_hex(). Takes a hexdump of at most @max_bytes * bytes and stores the bytes to a buffer starting at @dest. Returns a pointer * at the first character after the dump. **/ -const char *hex_to_mem(byte *dest, const char *src, uns max_bytes, uns flags); +const char *hex_to_mem(byte *dest, const char *src, size_t max_bytes, uns flags); // Bottom 8 bits of flags are an optional separator of bytes, the rest is: #define MEM_TO_HEX_UPCASE 0x100