X-Git-Url: https://pd.if.org/git/?p=pdclib;a=blobdiff_plain;f=functions%2Fuchar%2Fc16rtomb.c;h=bce172bd00ff070a5095d33747ff273d56b8021b;hp=6e3a27cfd5add2eef9dfe50d11a855b8fe43433e;hb=da0f3f353d417fed71f358a48d5d5394145e460d;hpb=7d481cb7bb4a37865e66c110b87476e8df04e690 diff --git a/functions/uchar/c16rtomb.c b/functions/uchar/c16rtomb.c index 6e3a27c..bce172b 100644 --- a/functions/uchar/c16rtomb.c +++ b/functions/uchar/c16rtomb.c @@ -1,7 +1,4 @@ -/* c16rtomb( - char *restrict s, - char16_t c16, - mbstate_t *restrict ps); +/* c16rtomb( char *, char16_t, mbstate_t * ) This file is part of the Public Domain C Library (PDCLib). Permission is granted to use, modify, and / or redistribute at will. @@ -13,8 +10,8 @@ #include #include #include -#include <_PDCLIB_encoding.h> -#include <_PDCLIB_locale.h> +#include "_PDCLIB_encoding.h" +#include "_PDCLIB_locale.h" size_t c16rtomb_l( char *restrict s, @@ -24,6 +21,8 @@ size_t c16rtomb_l( ) { const char16_t *restrict psrc = &c16; + char buf[s ? 0 : MB_CUR_MAX]; + s = s ? s : buf; if(!l->_Codec->__c16stombs) { // Codec doesn't support direct conversion - translate via UCS-4 @@ -95,7 +94,7 @@ size_t c16rtomb( #endif #ifdef TEST -#include <_PDCLIB_test.h> +#include "_PDCLIB_test.h" int main( void ) {