From 1cc7f499cf576dcc621edc33a3c5294814964ca8 Mon Sep 17 00:00:00 2001 From: Michal Kazior Date: Sat, 25 Jul 2020 19:14:35 +0200 Subject: wchar: implement __vfwprintf_chk Signed-off-by: Michal Kazior --- libgcompat/wchar.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'libgcompat/wchar.c') diff --git a/libgcompat/wchar.c b/libgcompat/wchar.c index 4ed7a7b..60384fb 100644 --- a/libgcompat/wchar.c +++ b/libgcompat/wchar.c @@ -6,6 +6,19 @@ int __vswprintf_chk(wchar_t *s, size_t n, int flag, size_t slen, const wchar_t *format, va_list ap); +/** + * Convert formatted wide-character output, with stack checking + * + * LSB 5.0: LSB-Core-generic/baselib---vfwprintf-chk-1.html + */ +int __vfwprintf_chk(FILE *fp, int flag, const wchar_t *format, va_list ap) +{ + assert(fp != NULL); + assert(format != NULL); + + return vfwprintf(fp, format, ap); +} + /** * Convert formatted wide-character output, with stack checking * -- cgit v1.2.3-70-g09d2 From 338ea5e946324040954d5917a919c8285f956e1d Mon Sep 17 00:00:00 2001 From: Michal Kazior Date: Sat, 25 Jul 2020 16:57:12 +0200 Subject: wchar: implement __fwprintf_chk Signed-off-by: Michal Kazior --- libgcompat/wchar.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'libgcompat/wchar.c') diff --git a/libgcompat/wchar.c b/libgcompat/wchar.c index 60384fb..7ac36f6 100644 --- a/libgcompat/wchar.c +++ b/libgcompat/wchar.c @@ -5,6 +5,24 @@ int __vswprintf_chk(wchar_t *s, size_t n, int flag, size_t slen, const wchar_t *format, va_list ap); +int __vfwprintf_chk(FILE *fp, int flag, const wchar_t *format, va_list ap); + +/** + * Convert formatted wide-character output, with stack checking + * + * LSB 5.0: LSB-Core-generic/baselib---fwprintf-chk-1.html + */ +int __fwprintf_chk(FILE *stream, int flag, const wchar_t *format, ...) +{ + int ret; + va_list ap; + + va_start(ap, format); + ret = __vfwprintf_chk(stream, flag, format, ap); + va_end(ap); + + return ret; +} /** * Convert formatted wide-character output, with stack checking -- cgit v1.2.3-70-g09d2 From 86d4db218e92bcf82e63698f214c0c628ebd982b Mon Sep 17 00:00:00 2001 From: Michal Kazior Date: Sat, 25 Jul 2020 16:58:12 +0200 Subject: wchar: implement wcstoul_l This is similar to strtoll_l() in a way it ignores the locale_t argument and uses the global locale settings. Signed-off-by: Michal Kazior --- libgcompat/wchar.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'libgcompat/wchar.c') diff --git a/libgcompat/wchar.c b/libgcompat/wchar.c index 7ac36f6..c017582 100644 --- a/libgcompat/wchar.c +++ b/libgcompat/wchar.c @@ -103,3 +103,14 @@ long int __wcstol_internal(const wchar_t *nptr, wchar_t **endptr, int base, assert(group == 0); return wcstol(nptr, endptr, base); } + +/** + * Convert a wide-character string to an unsigned long int. + * + * Some day, when musl supports LC_NUMERIC, we can probably remove this. + */ +unsigned long int wcstoul_l(const wchar_t *nptr, wchar_t **endptr, + int base, locale_t loc) +{ + return wcstoul(nptr, endptr, base); +} -- cgit v1.2.3-70-g09d2 From c200c851e40cdeeb1d8d5856683076113cb8e039 Mon Sep 17 00:00:00 2001 From: Michal Kazior Date: Sat, 25 Jul 2020 16:58:33 +0200 Subject: wchar: implement wcstol_l This is similar to strtoll_l() in a way it ignores the locale_t argument and uses the global locale settings. Signed-off-by: Michal Kazior --- libgcompat/wchar.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'libgcompat/wchar.c') diff --git a/libgcompat/wchar.c b/libgcompat/wchar.c index c017582..0d53e88 100644 --- a/libgcompat/wchar.c +++ b/libgcompat/wchar.c @@ -114,3 +114,14 @@ unsigned long int wcstoul_l(const wchar_t *nptr, wchar_t **endptr, { return wcstoul(nptr, endptr, base); } + +/** + * Convert a wide-character string to a long int. + * + * Some day, when musl supports LC_NUMERIC, we can probably remove this. + */ +long int wcstol_l(const wchar_t *nptr, wchar_t **endptr, int base, + locale_t loc) +{ + return wcstol(nptr, endptr, base); +} -- cgit v1.2.3-70-g09d2 From 93b7fedb31b6086d2b9fd966cb8bf17430a9a515 Mon Sep 17 00:00:00 2001 From: Michal Kazior Date: Sat, 25 Jul 2020 16:58:43 +0200 Subject: wchar: implement wcstod_l This is similar to strtoll_l() in a way it ignores the locale_t argument and uses the global locale settings. Signed-off-by: Michal Kazior --- libgcompat/wchar.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'libgcompat/wchar.c') diff --git a/libgcompat/wchar.c b/libgcompat/wchar.c index 0d53e88..930cc7c 100644 --- a/libgcompat/wchar.c +++ b/libgcompat/wchar.c @@ -125,3 +125,13 @@ long int wcstol_l(const wchar_t *nptr, wchar_t **endptr, int base, { return wcstol(nptr, endptr, base); } + +/** + * Convert a wide-character string to a double. + * + * Some day, when musl supports LC_NUMERIC, we can probably remove this. + */ +double wcstod_l(const wchar_t *nptr, wchar_t **endptr, locale_t loc) +{ + return wcstod(nptr, endptr); +} -- cgit v1.2.3-70-g09d2