nxt_utf8.h (0:a63ceefd6ab0) nxt_utf8.h (611:323e11065f83)
1
2/*
3 * Copyright (C) Igor Sysoev
4 * Copyright (C) NGINX, Inc.
5 */
6
7#ifndef _NXT_UTF8_H_INCLUDED_
8#define _NXT_UTF8_H_INCLUDED_
9
10
11/*
1
2/*
3 * Copyright (C) Igor Sysoev
4 * Copyright (C) NGINX, Inc.
5 */
6
7#ifndef _NXT_UTF8_H_INCLUDED_
8#define _NXT_UTF8_H_INCLUDED_
9
10
11/*
12 * Since the maximum valid Unicode character is 0x0010ffff, the maximum
13 * difference between Unicode characters is lesser 0x0010ffff and
14 * 0x0eee0eee can be used as value to indicate UTF-8 encoding error.
12 * Since the maximum valid Unicode character is 0x0010FFFF, the maximum
13 * difference between Unicode characters is lesser 0x0010FFFF and
14 * 0x0EEE0EEE can be used as value to indicate UTF-8 encoding error.
15 */
15 */
16#define NXT_UTF8_SORT_INVALID 0x0eee0eee
16#define NXT_UTF8_SORT_INVALID 0x0EEE0EEE
17
18
19NXT_EXPORT u_char *nxt_utf8_encode(u_char *p, uint32_t u);
20NXT_EXPORT uint32_t nxt_utf8_decode(const u_char **start, const u_char *end);
21NXT_EXPORT uint32_t nxt_utf8_decode2(const u_char **start, const u_char *end);
22NXT_EXPORT nxt_int_t nxt_utf8_casecmp(const u_char *start1,
23 const u_char *start2, size_t len1, size_t len2);
24NXT_EXPORT uint32_t nxt_utf8_lowcase(const u_char **start, const u_char *end);

--- 14 unchanged lines hidden (view full) ---

39
40 do {
41 /*
42 * The first UTF-8 byte is either 0xxxxxxx or 11xxxxxx.
43 * The next UTF-8 bytes are 10xxxxxx.
44 */
45 c = *p;
46
17
18
19NXT_EXPORT u_char *nxt_utf8_encode(u_char *p, uint32_t u);
20NXT_EXPORT uint32_t nxt_utf8_decode(const u_char **start, const u_char *end);
21NXT_EXPORT uint32_t nxt_utf8_decode2(const u_char **start, const u_char *end);
22NXT_EXPORT nxt_int_t nxt_utf8_casecmp(const u_char *start1,
23 const u_char *start2, size_t len1, size_t len2);
24NXT_EXPORT uint32_t nxt_utf8_lowcase(const u_char **start, const u_char *end);

--- 14 unchanged lines hidden (view full) ---

39
40 do {
41 /*
42 * The first UTF-8 byte is either 0xxxxxxx or 11xxxxxx.
43 * The next UTF-8 bytes are 10xxxxxx.
44 */
45 c = *p;
46
47 if ((c & 0xc0) != 0x80) {
47 if ((c & 0xC0) != 0x80) {
48 return p;
49 }
50
51 p++;
52
53 } while (p < end);
54 }
55
56 return p;
57}
58
59
60#endif /* _NXT_UTF8_H_INCLUDED_ */
48 return p;
49 }
50
51 p++;
52
53 } while (p < end);
54 }
55
56 return p;
57}
58
59
60#endif /* _NXT_UTF8_H_INCLUDED_ */