aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorMark Adler <git@madler.net>2026-01-28 13:47:47 -0800
committerMark Adler <git@madler.net>2026-01-28 13:55:34 -0800
commit75133f8599b7b4509db50e673c66a42c1da1be03 (patch)
tree1b5705e05e5a0a89670567b56d117edd9644aca9 /contrib
parent74377e7215a1f72261d69725007299ac28c0019f (diff)
downloadzlib-75133f8599b7b4509db50e673c66a42c1da1be03.tar.gz
zlib-75133f8599b7b4509db50e673c66a42c1da1be03.tar.bz2
zlib-75133f8599b7b4509db50e673c66a42c1da1be03.zip
Replace // with /* comments in minizip zip.c.
Diffstat (limited to 'contrib')
-rw-r--r--contrib/minizip/zip.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/contrib/minizip/zip.c b/contrib/minizip/zip.c
index b6c7550e..2ec886cb 100644
--- a/contrib/minizip/zip.c
+++ b/contrib/minizip/zip.c
@@ -1247,32 +1247,32 @@ local int Write_LocalFileHeader(zip64_internal* zi, const char* filename, uInt s
1247 return err; 1247 return err;
1248} 1248}
1249 1249
1250// Return the length of the UTF-8 code at str[0..len-1] in [1..4], or negative 1250/* Return the length of the UTF-8 code at str[0..len-1] in [1..4], or negative
1251// if there is no valid UTF-8 code there. If negative, it is minus the number 1251 if there is no valid UTF-8 code there. If negative, it is minus the number
1252// of bytes examined in order to determine it was bad. Or if minus the return 1252 of bytes examined in order to determine it was bad. Or if minus the return
1253// code is one less than len, then at least one more byte than provided would 1253 code is one less than len, then at least one more byte than provided would
1254// be needed to complete the code. 1254 be needed to complete the code. */
1255local int utf8len(unsigned char const *str, size_t len) { 1255local int utf8len(unsigned char const *str, size_t len) {
1256 return 1256 return
1257 len == 0 ? -1 : // empty input 1257 len == 0 ? -1 : /* empty input */
1258 str[0] < 0x80 ? 1 : // good one-byte 1258 str[0] < 0x80 ? 1 : /* good one-byte */
1259 str[0] < 0xc0 ? -1 : // bad first byte 1259 str[0] < 0xc0 ? -1 : /* bad first byte */
1260 len < 2 || (str[1] >> 6) != 2 ? -2 : // missing or bad second byte 1260 len < 2 || (str[1] >> 6) != 2 ? -2 : /* missing or bad 2nd byte */
1261 str[0] < 0xc2 ? -2 : // overlong code 1261 str[0] < 0xc2 ? -2 : /* overlong code */
1262 str[0] < 0xe0 ? 2 : // good two-byte 1262 str[0] < 0xe0 ? 2 : /* good two-byte */
1263 len < 3 || (str[2] >> 6) != 2 ? -3 : // missing or bad third byte 1263 len < 3 || (str[2] >> 6) != 2 ? -3 : /* missing or bad 3rd byte */
1264 str[0] == 0xe0 && str[1] < 0xa0 ? -3 : // overlong code 1264 str[0] == 0xe0 && str[1] < 0xa0 ? -3 : /* overlong code */
1265 str[0] < 0xf0 ? 3 : // good three-byte 1265 str[0] < 0xf0 ? 3 : /* good three-byte */
1266 len < 4 || (str[3] >> 6) != 2 ? -4 : // missing or bad fourth byte 1266 len < 4 || (str[3] >> 6) != 2 ? -4 : /* missing or bad 4th byte */
1267 str[0] == 0xf0 && str[1] < 0x90 ? -4 : // overlong code 1267 str[0] == 0xf0 && str[1] < 0x90 ? -4 : /* overlong code */
1268 str[0] < 0xf4 || 1268 str[0] < 0xf4 ||
1269 (str[0] == 0xf4 && str[1] < 0x90) ? 4 : // good four-byte 1269 (str[0] == 0xf4 && str[1] < 0x90) ? 4 : /* good four-byte */
1270 -4; // code > 0x10ffff 1270 -4; /* code > 0x10ffff */
1271} 1271}
1272 1272
1273// Return true if str[0..len-1] is valid UTF-8 *and* it contains at least one 1273/* Return true if str[0..len-1] is valid UTF-8 *and* it contains at least one
1274// code of two or more bytes. This is used to determine whether or not to set 1274 code of two or more bytes. This is used to determine whether or not to set
1275// bit 11 in the zip header flags. 1275 bit 11 in the zip header flags. */
1276local int isutf8(char const *str, size_t len) { 1276local int isutf8(char const *str, size_t len) {
1277 int utf8 = 0; 1277 int utf8 = 0;
1278 while (len) { 1278 while (len) {