]> mj.ucw.cz Git - libucw.git/blobdiff - ucw/str-hex.c
Strtonum: Support u32 and s32
[libucw.git] / ucw / str-hex.c
index 79f278ab162d70df6959d1b42bb16d5ac90664d2..04290489c5c512373f768d7fa7e678191fab1baf 100644 (file)
 #include <ucw/string.h>
 #include <ucw/chartype.h>
 
-static uns
-hex_make(uns x)
+static uint
+hex_make(uint x)
 {
   return (x < 10) ? (x + '0') : (x - 10 + 'a');
 }
 
 void
-mem_to_hex(char *dest, const byte *src, size_t bytes, uns flags)
+mem_to_hex(char *dest, const byte *src, size_t bytes, uint flags)
 {
-  uns sep = flags & 0xff;
+  uint sep = flags & 0xff;
 
   while (bytes--)
     {
@@ -39,8 +39,8 @@ mem_to_hex(char *dest, const byte *src, size_t bytes, uns flags)
   *dest = 0;
 }
 
-static uns
-hex_parse(uns c)
+static uint
+hex_parse(uint c)
 {
   c = Cupcase(c);
   c -= '0';
@@ -48,9 +48,9 @@ hex_parse(uns c)
 }
 
 const char *
-hex_to_mem(byte *dest, const char *src, size_t max_bytes, uns flags)
+hex_to_mem(byte *dest, const char *src, size_t max_bytes, uint flags)
 {
-  uns sep = flags & 0xff;
+  uint sep = flags & 0xff;
   while (max_bytes-- && Cxdigit(src[0]) && Cxdigit(src[1]))
     {
       *dest++ = (hex_parse(src[0]) << 4) | hex_parse(src[1]);