mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-20 15:48:54 +02:00
Fixup max decomposition len guarantee
Unicode Technical Committee agreed to limit decomposition length to 18 in both cases. Reflect that.
This commit is contained in:
@@ -696,9 +696,12 @@ g_unichar_compose (gunichar a,
|
|||||||
* The decomposed sequence is placed in @result. Only up to
|
* The decomposed sequence is placed in @result. Only up to
|
||||||
* @result_len characters are written into @result. The length
|
* @result_len characters are written into @result. The length
|
||||||
* of the full decomposition (irrespective of @result_len) is
|
* of the full decomposition (irrespective of @result_len) is
|
||||||
* returned by the function. For canonical decomposition, a
|
* returned by the function. For canonical decomposition,
|
||||||
* result buffer of length 4 is always enough, whereas for
|
* currently all decompositions are of length at most 4, but
|
||||||
* compatibility decomposition, a buffer of 18 is enough.
|
* this may change in the future (very unlikely though).
|
||||||
|
* At any rate, Unicode does guarantee that a buffer of length
|
||||||
|
* 18 is always enough for both compatibility and canonical
|
||||||
|
* decompositions.
|
||||||
*
|
*
|
||||||
* See <ulink url="http://unicode.org/reports/tr15/">UAX#15</ulink>
|
* See <ulink url="http://unicode.org/reports/tr15/">UAX#15</ulink>
|
||||||
* for details.
|
* for details.
|
||||||
|
@@ -855,7 +855,7 @@ real_toupper (const gchar *str,
|
|||||||
* which could simplify this considerably.
|
* which could simplify this considerably.
|
||||||
*/
|
*/
|
||||||
gsize decomp_len, i;
|
gsize decomp_len, i;
|
||||||
gunichar decomp[4];
|
gunichar decomp[18];
|
||||||
|
|
||||||
decomp_len = g_unichar_fully_decompose (c, FALSE, decomp, 4);
|
decomp_len = g_unichar_fully_decompose (c, FALSE, decomp, 4);
|
||||||
for (i=0; i < decomp_len; i++)
|
for (i=0; i < decomp_len; i++)
|
||||||
|
Reference in New Issue
Block a user