diff options
Diffstat (limited to 'libc')
-rw-r--r-- | libc/Android.mk | 1 | ||||
-rw-r--r-- | libc/bionic/mblen.cpp | 35 | ||||
-rw-r--r-- | libc/include/stdlib.h | 13 | ||||
-rw-r--r-- | libc/libc.arm.brillo.map | 1 | ||||
-rw-r--r-- | libc/libc.arm.map | 1 | ||||
-rw-r--r-- | libc/libc.arm64.map | 1 | ||||
-rw-r--r-- | libc/libc.map.txt | 1 | ||||
-rw-r--r-- | libc/libc.mips.brillo.map | 1 | ||||
-rw-r--r-- | libc/libc.mips.map | 1 | ||||
-rw-r--r-- | libc/libc.mips64.map | 1 | ||||
-rw-r--r-- | libc/libc.x86.brillo.map | 1 | ||||
-rw-r--r-- | libc/libc.x86.map | 1 | ||||
-rw-r--r-- | libc/libc.x86_64.map | 1 |
13 files changed, 51 insertions, 8 deletions
diff --git a/libc/Android.mk b/libc/Android.mk index 374ffa65a..ac7cd7535 100644 --- a/libc/Android.mk +++ b/libc/Android.mk @@ -133,6 +133,7 @@ libc_bionic_ndk_src_files := \ bionic/lockf.cpp \ bionic/lstat.cpp \ bionic/malloc_info.cpp \ + bionic/mblen.cpp \ bionic/mbrtoc16.cpp \ bionic/mbrtoc32.cpp \ bionic/mbstate.cpp \ diff --git a/libc/bionic/mblen.cpp b/libc/bionic/mblen.cpp new file mode 100644 index 000000000..7def6f138 --- /dev/null +++ b/libc/bionic/mblen.cpp @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2016 The Android Open Source Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include <stdlib.h> +#include <wchar.h> + +int mblen(const char* s, size_t n) { + mbstate_t state = {}; + return mbrlen(s, n, &state); +} diff --git a/libc/include/stdlib.h b/libc/include/stdlib.h index 2abaec396..ba4b14986 100644 --- a/libc/include/stdlib.h +++ b/libc/include/stdlib.h @@ -162,14 +162,11 @@ extern lldiv_t lldiv(long long, long long) __pure2; extern const char* getprogname(void); extern void setprogname(const char*); -/* make STLPort happy */ -extern int mblen(const char *, size_t) __UNAVAILABLE; -extern size_t mbstowcs(wchar_t *, const char *, size_t); -extern int mbtowc(wchar_t *, const char *, size_t); - -/* Likewise, make libstdc++-v3 happy. */ -extern int wctomb(char *, wchar_t); -extern size_t wcstombs(char *, const wchar_t *, size_t); +int mblen(const char*, size_t); +size_t mbstowcs(wchar_t*, const char*, size_t); +int mbtowc(wchar_t*, const char*, size_t); +int wctomb(char*, wchar_t); +size_t wcstombs(char*, const wchar_t*, size_t); extern size_t __ctype_get_mb_cur_max(void); #define MB_CUR_MAX __ctype_get_mb_cur_max() diff --git a/libc/libc.arm.brillo.map b/libc/libc.arm.brillo.map index 3e78e307c..a1373d899 100644 --- a/libc/libc.arm.brillo.map +++ b/libc/libc.arm.brillo.map @@ -1279,6 +1279,7 @@ LIBC_O { getpwent; getsubopt; hasmntopt; + mblen; pthread_getname_np; quotactl; setdomainname; diff --git a/libc/libc.arm.map b/libc/libc.arm.map index 420cd7e30..4e69bf112 100644 --- a/libc/libc.arm.map +++ b/libc/libc.arm.map @@ -1279,6 +1279,7 @@ LIBC_O { getpwent; getsubopt; hasmntopt; + mblen; pthread_getname_np; quotactl; setdomainname; diff --git a/libc/libc.arm64.map b/libc/libc.arm64.map index bdde35eee..7ea74a672 100644 --- a/libc/libc.arm64.map +++ b/libc/libc.arm64.map @@ -1201,6 +1201,7 @@ LIBC_O { getpwent; getsubopt; hasmntopt; + mblen; pthread_getname_np; quotactl; setdomainname; diff --git a/libc/libc.map.txt b/libc/libc.map.txt index be37ffbd3..8d1a1f9d0 100644 --- a/libc/libc.map.txt +++ b/libc/libc.map.txt @@ -1304,6 +1304,7 @@ LIBC_O { getpwent; getsubopt; hasmntopt; + mblen; pthread_getname_np; quotactl; setdomainname; diff --git a/libc/libc.mips.brillo.map b/libc/libc.mips.brillo.map index 6b5744cab..aac1d8ced 100644 --- a/libc/libc.mips.brillo.map +++ b/libc/libc.mips.brillo.map @@ -1263,6 +1263,7 @@ LIBC_O { getpwent; getsubopt; hasmntopt; + mblen; pthread_getname_np; quotactl; setdomainname; diff --git a/libc/libc.mips.map b/libc/libc.mips.map index 6ee9cf586..e514aa135 100644 --- a/libc/libc.mips.map +++ b/libc/libc.mips.map @@ -1263,6 +1263,7 @@ LIBC_O { getpwent; getsubopt; hasmntopt; + mblen; pthread_getname_np; quotactl; setdomainname; diff --git a/libc/libc.mips64.map b/libc/libc.mips64.map index bdde35eee..7ea74a672 100644 --- a/libc/libc.mips64.map +++ b/libc/libc.mips64.map @@ -1201,6 +1201,7 @@ LIBC_O { getpwent; getsubopt; hasmntopt; + mblen; pthread_getname_np; quotactl; setdomainname; diff --git a/libc/libc.x86.brillo.map b/libc/libc.x86.brillo.map index d483d3e55..f14861d30 100644 --- a/libc/libc.x86.brillo.map +++ b/libc/libc.x86.brillo.map @@ -1261,6 +1261,7 @@ LIBC_O { getpwent; getsubopt; hasmntopt; + mblen; pthread_getname_np; quotactl; setdomainname; diff --git a/libc/libc.x86.map b/libc/libc.x86.map index f0679c052..f6b6ea1ed 100644 --- a/libc/libc.x86.map +++ b/libc/libc.x86.map @@ -1261,6 +1261,7 @@ LIBC_O { getpwent; getsubopt; hasmntopt; + mblen; pthread_getname_np; quotactl; setdomainname; diff --git a/libc/libc.x86_64.map b/libc/libc.x86_64.map index bdde35eee..7ea74a672 100644 --- a/libc/libc.x86_64.map +++ b/libc/libc.x86_64.map @@ -1201,6 +1201,7 @@ LIBC_O { getpwent; getsubopt; hasmntopt; + mblen; pthread_getname_np; quotactl; setdomainname; |