From a50d3638a7440e30a0cbfb3bffe4712ff68e350a Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sun, 31 Oct 2010 02:02:16 +0200 Subject: s3:util_str: add strlen_m_ext_term() - variant of strlen_m_ext() counting terminator --- source3/include/proto.h | 2 ++ source3/lib/util_str.c | 9 +++++++++ 2 files changed, 11 insertions(+) (limited to 'source3') diff --git a/source3/include/proto.h b/source3/include/proto.h index 5e88476e44..058424359d 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -1435,6 +1435,8 @@ void strlower_m(char *s); void strupper_m(char *s); size_t strlen_m_ext(const char *s, const charset_t src_charset, const charset_t dst_charset); +size_t strlen_m_ext_term(const char *s, const charset_t src_charset, + const charset_t dst_charset); size_t strlen_m(const char *s); size_t strlen_m_term(const char *s); size_t strlen_m_term_null(const char *s); diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c index 27147365cd..508050d892 100644 --- a/source3/lib/util_str.c +++ b/source3/lib/util_str.c @@ -1523,6 +1523,15 @@ size_t strlen_m_ext(const char *s, const charset_t src_charset, return count; } +size_t strlen_m_ext_term(const char *s, const charset_t src_charset, + const charset_t dst_charset) +{ + if (!s) { + return 0; + } + return strlen_m_ext(s, src_charset, dst_charset) + 1; +} + /** * Calculate the number of 16-bit units that would bee needed to convert * the input string which is expected to be in CH_UNIX encoding to UTF16. -- cgit