]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: unichar - Change uni_utf8_char_bytes to accept unsigned char
authorAki Tuomi <aki.tuomi@open-xchange.com>
Thu, 20 Aug 2020 05:57:35 +0000 (08:57 +0300)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Thu, 22 Oct 2020 12:16:16 +0000 (12:16 +0000)
src/lib-imap/imap-utf7.c
src/lib/unichar.h

index f46eca1c261a27afd4f4c5983fc0b775e2157c4c..6fe603bf5ffa7040976a3b92405eb64de0fbe288 100644 (file)
@@ -111,7 +111,7 @@ int imap_utf8_to_utf7(const char *src, string_t *dest)
                                *u++ = u16 >> 8;
                                *u++ = u16 & 0xff;
                        }
-                       p += uni_utf8_char_bytes(*p);
+                       p += uni_utf8_char_bytes((unsigned char)*p);
                }
                mbase64_encode(dest, utf16, u-utf16);
        }
index a7578cea8d73031b4a8900ee2e0a216ab5a2cfd8..88defcd43f5e7688fafb2efd49b8fbf726ec8dfa 100644 (file)
@@ -91,12 +91,12 @@ unsigned int uni_utf8_partial_strlen_n(const void *input, size_t size,
    parameter is the first byte of the UTF-8 sequence. Invalid input is
    returned with length 1. */
 static inline unsigned int ATTR_CONST
-uni_utf8_char_bytes(char chr)
+uni_utf8_char_bytes(unsigned char chr)
 {
        /* 0x00 .. 0x7f are ASCII. 0x80 .. 0xC1 are invalid. */
-       if ((uint8_t)chr < (192 + 2))
+       if (chr < (192 + 2))
                return 1;
-       return uni_utf8_non1_bytes[(uint8_t)chr - (192 + 2)];
+       return uni_utf8_non1_bytes[chr - (192 + 2)];
 }
 
 /* Return given character in titlecase. */