]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/basic/escape.c
tree-wide: use UINT64_MAX or friends
[thirdparty/systemd.git] / src / basic / escape.c
index 31f3cda472e60668dfd1084d6198d6e4ec42a8bf..af785ecfa457752879845f65e7ae6fa2f8fc2029 100644 (file)
@@ -114,7 +114,7 @@ int cunescape_one(const char *p, size_t length, char32_t *ret, bool *eight_bit,
          * instead be copied directly.
          */
 
-        if (length != (size_t) -1 && length < 1)
+        if (length != SIZE_MAX && length < 1)
                 return -EINVAL;
 
         switch (p[0]) {
@@ -159,7 +159,7 @@ int cunescape_one(const char *p, size_t length, char32_t *ret, bool *eight_bit,
                 /* hexadecimal encoding */
                 int a, b;
 
-                if (length != (size_t) -1 && length < 3)
+                if (length != SIZE_MAX && length < 3)
                         return -EINVAL;
 
                 a = unhexchar(p[1]);
@@ -187,7 +187,7 @@ int cunescape_one(const char *p, size_t length, char32_t *ret, bool *eight_bit,
                 size_t i;
                 uint32_t c;
 
-                if (length != (size_t) -1 && length < 5)
+                if (length != SIZE_MAX && length < 5)
                         return -EINVAL;
 
                 for (i = 0; i < 4; i++) {
@@ -214,7 +214,7 @@ int cunescape_one(const char *p, size_t length, char32_t *ret, bool *eight_bit,
                 size_t i;
                 char32_t c;
 
-                if (length != (size_t) -1 && length < 9)
+                if (length != SIZE_MAX && length < 9)
                         return -EINVAL;
 
                 for (i = 0; i < 8; i++) {
@@ -251,7 +251,7 @@ int cunescape_one(const char *p, size_t length, char32_t *ret, bool *eight_bit,
                 int a, b, c;
                 char32_t m;
 
-                if (length != (size_t) -1 && length < 3)
+                if (length != SIZE_MAX && length < 3)
                         return -EINVAL;
 
                 a = unoctchar(p[0]);