]> mj.ucw.cz Git - libucw.git/blobdiff - ucw/str-hex.c
Strtonum: Support u32 and s32
[libucw.git] / ucw / str-hex.c
index 57c3500abad097115b613637cdcc4380394b228f..04290489c5c512373f768d7fa7e678191fab1baf 100644 (file)
@@ -7,20 +7,20 @@
  *     of the GNU Lesser General Public License.
  */
 
-#include "ucw/lib.h"
-#include "ucw/string.h"
-#include "ucw/chartype.h"
+#include <ucw/lib.h>
+#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, uns 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, uns 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, uns 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]);