Skip to content

Commit 563b873

Browse files
committed
Update utf8proc to v2.11.0
Unicode 17 support
1 parent 2bf3c68 commit 563b873

File tree

3 files changed

+7159
-7119
lines changed

3 files changed

+7159
-7119
lines changed

compat/utf8proc.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ UTF8PROC_DLLEXPORT const char *utf8proc_version(void) {
101101
}
102102

103103
UTF8PROC_DLLEXPORT const char *utf8proc_unicode_version(void) {
104-
return "16.0.0";
104+
return "17.0.0";
105105
}
106106

107107
UTF8PROC_DLLEXPORT const char *utf8proc_errmsg(utf8proc_ssize_t errcode) {
@@ -388,7 +388,7 @@ static utf8proc_ssize_t seqindex_write_char_decomposed(utf8proc_uint16_t seqinde
388388
for (; len >= 0; entry++, len--) {
389389
utf8proc_int32_t entry_cp = seqindex_decode_entry(&entry);
390390

391-
written += utf8proc_decompose_char(entry_cp, dst+written,
391+
written += utf8proc_decompose_char(entry_cp, dst ? dst+written : dst,
392392
(bufsize > written) ? (bufsize - written) : 0, options,
393393
last_boundclass);
394394
if (written < 0) return UTF8PROC_ERROR_OVERFLOW;
@@ -578,7 +578,7 @@ UTF8PROC_DLLEXPORT utf8proc_ssize_t utf8proc_decompose_custom(
578578
uc = custom_func(uc, custom_data); /* user-specified custom mapping */
579579
}
580580
decomp_result = utf8proc_decompose_char(
581-
uc, buffer + wpos, (bufsize > wpos) ? (bufsize - wpos) : 0, options,
581+
uc, buffer ? buffer+wpos : buffer, (bufsize > wpos) ? (bufsize - wpos) : 0, options,
582582
&boundclass
583583
);
584584
if (decomp_result < 0) return decomp_result;

compat/utf8proc.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
/** The MAJOR version number (increased when backwards API compatibility is broken). */
7272
#define UTF8PROC_VERSION_MAJOR 2
7373
/** The MINOR version number (increased when new functionality is added in a backwards-compatible manner). */
74-
#define UTF8PROC_VERSION_MINOR 10
74+
#define UTF8PROC_VERSION_MINOR 11
7575
/** The PATCH version (increased for fixes that do not change the API). */
7676
#define UTF8PROC_VERSION_PATCH 0
7777
/** @} */
@@ -150,7 +150,7 @@ typedef enum {
150150
UTF8PROC_STABLE = (1<<1),
151151
/** Compatibility decomposition (i.e. formatting information is lost). */
152152
UTF8PROC_COMPAT = (1<<2),
153-
/** Return a result with decomposed characters. */
153+
/** Return a result with composed characters. */
154154
UTF8PROC_COMPOSE = (1<<3),
155155
/** Return a result with decomposed characters. */
156156
UTF8PROC_DECOMPOSE = (1<<4),
@@ -517,7 +517,7 @@ UTF8PROC_DLLEXPORT const utf8proc_property_t *utf8proc_get_property(utf8proc_int
517517
* @param dst the destination buffer.
518518
* @param bufsize the size of the destination buffer.
519519
* @param options one or more of the following flags:
520-
* - @ref UTF8PROC_REJECTNA - return an error `codepoint` is unassigned
520+
* - @ref UTF8PROC_REJECTNA - return an error if `codepoint` is unassigned
521521
* - @ref UTF8PROC_IGNORE - strip "default ignorable" codepoints
522522
* - @ref UTF8PROC_CASEFOLD - apply Unicode casefolding
523523
* - @ref UTF8PROC_COMPAT - replace certain codepoints with their
@@ -532,6 +532,11 @@ UTF8PROC_DLLEXPORT const utf8proc_property_t *utf8proc_get_property(utf8proc_int
532532
* option is used. If the string is being processed in order, this can be initialized to 0 for
533533
* the beginning of the string, and is thereafter updated automatically. Otherwise, this parameter is ignored.
534534
*
535+
* In the current version of utf8proc, the maximum destination buffer with the @ref UTF8PROC_DECOMPOSE
536+
* option is 4 elements (or double that with @ref UTF8PROC_CHARBOUND), so this is a good default size.
537+
* However, this may increase in future Unicode versions, so you should always check the return value
538+
* as described below.
539+
*
535540
* @return
536541
* In case of success, the number of codepoints written is returned; in case
537542
* of an error, a negative error code is returned (utf8proc_errmsg()).

0 commit comments

Comments
 (0)