From 01888dcca8255a86603c7d5e42bf67dd827138ff Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 25 Jul 2021 16:48:28 +0200 Subject: u{8,16,32}-uctomb: Avoid possible trouble with huge strings. * doc/unistr.texi (Creating Unicode strings): Update prototypes of u8_uctomb, u16_uctomb, u32_uctomb to match the change in gnulib on 2020-09-05. --- ChangeLog | 7 +++++++ NEWS | 2 ++ doc/unistr.texi | 6 +++--- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1c1674a..277a6e0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2021-07-25 Bruno Haible + + u{8,16,32}-uctomb: Avoid possible trouble with huge strings. + * doc/unistr.texi (Creating Unicode strings): Update prototypes of + u8_uctomb, u16_uctomb, u32_uctomb to match the change in gnulib on + 2020-09-05. + 2021-05-30 Bruno Haible Change license to LGPLv3+ or GPLv2+. diff --git a/NEWS b/NEWS index 9276191..42b6cd2 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,7 @@ New in 0.9.11: * The license has changed from "LGPLv3+ or GPLv2" to "LGPLv3+ or GPLv2+". +* The functions u8_uctomb, u16_uctomb, u32_uctomb now support strings larger + than 2 GiB by taking an 'n' argument of type ptrdiff_t (instead of int). * Fixed multithread-safety bugs on Cygwin, native Windows, and Haiku. New in 0.9.10: diff --git a/doc/unistr.texi b/doc/unistr.texi index c59094d..d26a3f3 100644 --- a/doc/unistr.texi +++ b/doc/unistr.texi @@ -152,9 +152,9 @@ gives more details about the failure, similar to @posixfunc{mbrtowc}. The following function stores a Unicode character as a Unicode string in memory. -@deftypefun int u8_uctomb (uint8_t@tie{}*@var{s}, ucs4_t@tie{}@var{uc}, int@tie{}@var{n}) -@deftypefunx int u16_uctomb (uint16_t@tie{}*@var{s}, ucs4_t@tie{}@var{uc}, int@tie{}@var{n}) -@deftypefunx int u32_uctomb (uint32_t@tie{}*@var{s}, ucs4_t@tie{}@var{uc}, int@tie{}@var{n}) +@deftypefun int u8_uctomb (uint8_t@tie{}*@var{s}, ucs4_t@tie{}@var{uc}, ptrdiff_t@tie{}@var{n}) +@deftypefunx int u16_uctomb (uint16_t@tie{}*@var{s}, ucs4_t@tie{}@var{uc}, ptrdiff_t@tie{}@var{n}) +@deftypefunx int u32_uctomb (uint32_t@tie{}*@var{s}, ucs4_t@tie{}@var{uc}, ptrdiff_t@tie{}@var{n}) Puts the multibyte character represented by @var{uc} in @var{s}, returning its length. Returns -1 upon failure, -2 if the number of available units, @var{n}, is too small. The latter case cannot occur if @var{n} >= 6/2/1, respectively. -- cgit v1.2.1