History log of /haiku/headers/private/libroot/locale/LocaleBackend.h
Revision Date Author Comments
# e8d32897 28-Oct-2023 Augustin Cavalier <waddlesplash@gmail.com>

ICUTimeConversion: Fix buffer overflows and add more error handling.

* Declare databridge buffer lengths in LocaleBackend.
* Use strcpy instead of strlcpy when writing to databridge buffers
(this is the first fix for #18598.)
* Check for overflows and error out when they happen.
* Verify that ICU actually knows the timezone in question
and fall back to GMT if it does not (this would also fix that crash.)

Fixes #18598.


# 3e1163d6 08-Apr-2023 Augustin Cavalier <waddlesplash@gmail.com>

libroot: Disambiguate parameters of ICUCollateData::Strxfrm.

Same thing that was done for wcsxfrm in 218604196afb8f7bc142ab94af6e9cafdf5327b2.


# d02c0bad 26-Jul-2022 Trung Nguyen <trungnt282910@gmail.com>

libs/posix: Fix NULL pointer in uselocale

uselocale now attempts to create a backend and a databrige.

If the attempt fails due to a missing libroot-addon-icu, uselocale
does nothing (to support applications calling uselocale during
startup to enforce the C locale).

Else, uselocale will fail with ENOMEM.

LocaleBackend::CreateBackend() has been modified to return a status_t
that indicates whether NULL is returned due to out of memory (B_NO_MEMORY)
or due to being unable to load the ICU addon (B_MISSING_LIBRARY).

Change-Id: I0f62ebde5890364c64e6694ec58d38de43ec6841
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5505
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# d338200e 30-May-2022 Trung Nguyen <trungnt282910@gmail.com>

libs/posix: Implemented new locale functions

Implemented the missing POSIX functions in <locale.h>:
newlocale, duplocale, uselocale, and freelocale, and also
provided missing type definitions for <locale.h>.

Implemented missing POSIX locale-based function variants.

Modified LocaleBackend so that it could support thread-local
locales.

Some glibc-like locale-related variables supporting
ctype and printf family of functions have also been updated
to reflect the thread-local variables present in the latest
glibc sources.

As there have been some modifications to global symbols
in libroot, libroot_stubs.c has been regenerated.

Bug: #17168
Change-Id: Ibf296c58c47d42d1d1dfb2ce64042442f2679431
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5351
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>


# 21860419 11-Jan-2022 Augustin Cavalier <waddlesplash@gmail.com>

libroot: Fix ICU locale implementation of wcsxfrm.

* The "size" parameter is the size of "out" not "in", and the
return size_t parameter is supposed to always have the total amount
of wchar_ts needed, not how many are actually used.
* In the case where "outSize == 0", we set "requiredSize" and then
return.

Fixes crashes seen in glib2 Unicode collation routines, which
are used in GTK file dialogs.

Thanks to PulkoMandy for glancing at this.


# c1e6e51a 20-Feb-2021 Jérôme Duval <jerome.duval@gmail.com>

libroot: implement timegm calling the ICU backend

Change-Id: Ib4de4288e061670acbc2edea3671cee029305d33
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3748
Reviewed-by: Axel Dörfler <axeld@pinc-software.de>


# bd55dcbe 07-Jan-2012 Oliver Tappe <zooey@hirschkaefer.de>

Add our implementation for wcscoll() and wcsxfrm().

* add Wcscoll() and Wcsxfrm() ICU locale backend
* provide implementations of wcscoll() and wcsxfrm() that are using
the respective methods of the locale backend


# 995d6d82 11-Dec-2011 Oliver Tappe <zooey@hirschkaefer.de>

Implement our own version of wcsrtombs().

* add WcharStringToMultibyte() to libroot's locale backend
* implement wcstombs(), wcsrtombs() and wcsnrtombs() on top of that
new backend function


# 73186b2f 07-Dec-2011 Oliver Tappe <zooey@hirschkaefer.de>

Add implementation of mbsrtowcs() to our locale backend.

* add MultibyteStringToWchar() to ICU locale backend
* implement mbsrtowcs() and mbsnrtowcs() on top of
MultibyteStringToWchar()
* drop respective glibc files


# c894d186 23-Nov-2011 Oliver Tappe <zooey@hirschkaefer.de>

Bring rewritten multibyte-support into repository.

* update copyrights of locale backend files

Multibyte-support has been rewritten to use ICU as backend.
While this does not necessarily work properly in every aspect
(e.g. the shell still has [different] problems with multibyte-
characters now), it does fix #6263 and #7700.


# 28ae43d0 22-Nov-2011 Oliver Tappe <zooey@hirschkaefer.de>

Add multibyte-support to ctype-locale backend.

* add actual converter methods MultibyteToWchar() and WcharToMultibyte()
to locale backend and implement them in the ctype subpart
* add management code for maintaining converters referenced by mbstate_t


# e0eb1d38 22-Nov-2011 Oliver Tappe <zooey@hirschkaefer.de>

Let MB_CUR_LEN lookup the actual value.

* instead of yielding 1, MB_CUR_LEN now looks up the correct
value in the ctype data provided by the locale backend


# 25dc253d 22-Nov-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

* Merged weak-symbols branch.
* Fixed trivial merge conflict in src/system/libroot/posix/locale/nl_langinfo.cpp
* Fixed gcc 2 compilation of src/system/glue/init_term_dyn.c.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39571 a95241bf-73f2-0310-859d-f6bbb57e9c96


# de2e54ac 12-Nov-2010 Oliver Tappe <zooey@hirschkaefer.de>

Adjust tzset() implementation to better follow the POSIX specs and
make some more perl tests happy.
* no longer expect a ICU timezone ID in the TZ environment variable,
but only expect this format if the TZ-value is starting with ':'
* accept "standard" TZ-values like "EST5" (of which only "EST" is
relevant to us) - if such a value is specified, we hardcode the
timezone name to the given value, no matter how ICU calls it
* adjust tests accordingly


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39415 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 86932f41 12-Sep-2010 Oliver Tappe <zooey@hirschkaefer.de>

Try to fix #6581:
* avoid trying to overwrite values of a constant structure when
updating the numeric locale data values used by glibc


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38623 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 560b10ff 16-Aug-2010 Oliver Tappe <zooey@hirschkaefer.de>

Implement tzset(), gmtime(), localtime() and mktime() on top of ICU
* no longer keep a separate time-backend, since the implementation needs to
access (data of) the locale backend anyway
* moved more stuff from localtime_fading_out.c to localtime.cpp
* added respective tests to locale_test
* added two more tests copied from glibc, test_time.c and tst-mktime.c


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38162 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a3f66598 23-Jul-2010 Oliver Tappe <zooey@hirschkaefer.de>

* reintegrated posix-locale

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37725 a95241bf-73f2-0310-859d-f6bbb57e9c96


# bd55dcbefbf303b990bbc118370f2325fe064cc2 07-Jan-2012 Oliver Tappe <zooey@hirschkaefer.de>

Add our implementation for wcscoll() and wcsxfrm().

* add Wcscoll() and Wcsxfrm() ICU locale backend
* provide implementations of wcscoll() and wcsxfrm() that are using
the respective methods of the locale backend


# 995d6d827f60efc46a0fcb29d3b9ea8226188339 11-Dec-2011 Oliver Tappe <zooey@hirschkaefer.de>

Implement our own version of wcsrtombs().

* add WcharStringToMultibyte() to libroot's locale backend
* implement wcstombs(), wcsrtombs() and wcsnrtombs() on top of that
new backend function


# 73186b2fcd3d7af7b513f0f9c4a481315d0579bc 07-Dec-2011 Oliver Tappe <zooey@hirschkaefer.de>

Add implementation of mbsrtowcs() to our locale backend.

* add MultibyteStringToWchar() to ICU locale backend
* implement mbsrtowcs() and mbsnrtowcs() on top of
MultibyteStringToWchar()
* drop respective glibc files


# c894d1868ef1d23e5536bfdbd8608402cef14607 23-Nov-2011 Oliver Tappe <zooey@hirschkaefer.de>

Bring rewritten multibyte-support into repository.

* update copyrights of locale backend files

Multibyte-support has been rewritten to use ICU as backend.
While this does not necessarily work properly in every aspect
(e.g. the shell still has [different] problems with multibyte-
characters now), it does fix #6263 and #7700.


# 28ae43d0339118e569c3a0ba1443b3befbb40a38 22-Nov-2011 Oliver Tappe <zooey@hirschkaefer.de>

Add multibyte-support to ctype-locale backend.

* add actual converter methods MultibyteToWchar() and WcharToMultibyte()
to locale backend and implement them in the ctype subpart
* add management code for maintaining converters referenced by mbstate_t


# e0eb1d38c4e11e7d728ea2de0a374a4e30c04278 22-Nov-2011 Oliver Tappe <zooey@hirschkaefer.de>

Let MB_CUR_LEN lookup the actual value.

* instead of yielding 1, MB_CUR_LEN now looks up the correct
value in the ctype data provided by the locale backend


# 25dc253d6ab28ce204fa4de2d3e7a27d167fc817 22-Nov-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

* Merged weak-symbols branch.
* Fixed trivial merge conflict in src/system/libroot/posix/locale/nl_langinfo.cpp
* Fixed gcc 2 compilation of src/system/glue/init_term_dyn.c.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39571 a95241bf-73f2-0310-859d-f6bbb57e9c96


# de2e54ace0213b150fb13d9b740e92f4c1433a06 12-Nov-2010 Oliver Tappe <zooey@hirschkaefer.de>

Adjust tzset() implementation to better follow the POSIX specs and
make some more perl tests happy.
* no longer expect a ICU timezone ID in the TZ environment variable,
but only expect this format if the TZ-value is starting with ':'
* accept "standard" TZ-values like "EST5" (of which only "EST" is
relevant to us) - if such a value is specified, we hardcode the
timezone name to the given value, no matter how ICU calls it
* adjust tests accordingly


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39415 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 86932f41cc48343fe103b2e6db257882df67dae5 12-Sep-2010 Oliver Tappe <zooey@hirschkaefer.de>

Try to fix #6581:
* avoid trying to overwrite values of a constant structure when
updating the numeric locale data values used by glibc


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38623 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 560b10ff88d306ac6e6f8f76eafc61df94f941d6 16-Aug-2010 Oliver Tappe <zooey@hirschkaefer.de>

Implement tzset(), gmtime(), localtime() and mktime() on top of ICU
* no longer keep a separate time-backend, since the implementation needs to
access (data of) the locale backend anyway
* moved more stuff from localtime_fading_out.c to localtime.cpp
* added respective tests to locale_test
* added two more tests copied from glibc, test_time.c and tst-mktime.c


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38162 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a3f665982e2e078ba42e7bf941bd5f3dd8989c55 23-Jul-2010 Oliver Tappe <zooey@hirschkaefer.de>

* reintegrated posix-locale

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37725 a95241bf-73f2-0310-859d-f6bbb57e9c96