Piotr Caban : msvcrt: Added _mbstrlen_l implementation.
Alexandre Julliard
julliard at winehq.org
Thu May 6 11:13:23 CDT 2010
Module: wine
Branch: master
Commit: d367314b463e47aa24dea801f0789f459b3dcf4d
URL: http://source.winehq.org/git/wine.git/?a=commit;h=d367314b463e47aa24dea801f0789f459b3dcf4d
Author: Piotr Caban <piotr at codeweavers.com>
Date: Thu May 6 14:27:22 2010 +0200
msvcrt: Added _mbstrlen_l implementation.
---
dlls/msvcrt/mbcs.c | 41 ++++++++++++++++++++++++-----------------
dlls/msvcrt/msvcrt.spec | 2 +-
2 files changed, 25 insertions(+), 18 deletions(-)
diff --git a/dlls/msvcrt/mbcs.c b/dlls/msvcrt/mbcs.c
index e558808..c562234 100644
--- a/dlls/msvcrt/mbcs.c
+++ b/dlls/msvcrt/mbcs.c
@@ -1689,25 +1689,32 @@ int CDECL MSVCRT_mblen(const char* str, MSVCRT_size_t size)
}
/*********************************************************************
+ * _mbstrlen_l(MSVCRT.@)
+ */
+MSVCRT_size_t CDECL _mbstrlen_l(const char* str, MSVCRT__locale_t locale)
+{
+ if(!locale)
+ locale = get_locale();
+
+ if(locale->locinfo->mb_cur_max > 1) {
+ MSVCRT_size_t len = 0;
+ while(*str) {
+ /* FIXME: According to the documentation we are supposed to test for
+ * multi-byte character validity. Whatever that means
+ */
+ str += MSVCRT_isleadbyte(*str) ? 2 : 1;
+ len++;
+ }
+ return len;
+ }
+
+ return strlen(str);
+}
+
+/*********************************************************************
* _mbstrlen(MSVCRT.@)
- * REMARKS
- * Unlike most of the multibyte string functions this function uses
- * the locale codepage, not the codepage set by _setmbcp
*/
MSVCRT_size_t CDECL _mbstrlen(const char* str)
{
- if(get_locale()->locinfo->mb_cur_max > 1)
- {
- MSVCRT_size_t len = 0;
- while(*str)
- {
- /* FIXME: According to the documentation we are supposed to test for
- * multi-byte character validity. Whatever that means
- */
- str += MSVCRT_isleadbyte(*str) ? 2 : 1;
- len++;
- }
- return len;
- }
- return strlen(str); /* ASCII CP */
+ return _mbstrlen_l(str, NULL);
}
diff --git a/dlls/msvcrt/msvcrt.spec b/dlls/msvcrt/msvcrt.spec
index 4334b85..3437442 100644
--- a/dlls/msvcrt/msvcrt.spec
+++ b/dlls/msvcrt/msvcrt.spec
@@ -734,7 +734,7 @@
# stub _mbstowcs_l
# stub _mbstowcs_s_l
@ cdecl _mbstrlen(str)
-# stub _mbstrlen_l
+@ cdecl _mbstrlen_l(str ptr)
# stub _mbstrnlen
# stub _mbstrnlen_l
@ cdecl _mbsupr(str)
More information about the wine-cvs
mailing list