]> mj.ucw.cz Git - libucw.git/commitdiff
Strings: Converted to size_t.
authorPavel Charvat <pchar@ucw.cz>
Mon, 2 Jun 2014 17:40:08 +0000 (19:40 +0200)
committerPavel Charvat <pchar@ucw.cz>
Mon, 2 Jun 2014 17:40:08 +0000 (19:40 +0200)
ucw/str-hex.c
ucw/string.c
ucw/string.h

index c71c23e6d742ac2168504ad6f8a630eb85ec92ac..79f278ab162d70df6959d1b42bb16d5ac90664d2 100644 (file)
@@ -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]))
index bb1fae1af01510e163f96dd630627ec5d1f08125..7bda37407abcf8eef9f7ece4abcbd82e1497be48 100644 (file)
@@ -14,8 +14,8 @@
 #include <ucw/string.h>
 
 #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++;
index 0c64ace57dca303d8f3e6e447fc09cec03b931b0..ca756ef2e1c13664e1247c8039812c2c81ec2490 100644 (file)
@@ -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