Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-10-27 06:47:39 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-10-27 06:47:39 +0400
commitd6d8de015c0cc70b8f0e2bbdf3cbd39e6176e31e (patch)
treec900584ced35ff3187d5bec75b365de58e723956 /source/blender/blenlib/intern/string_utf8.c
parente903701450fd1ffe4d793a60e3c174ee47fe66dd (diff)
change BLI_strlen_range_utf8 to the more conventional BLI_strnlen_utf8
Diffstat (limited to 'source/blender/blenlib/intern/string_utf8.c')
-rw-r--r--source/blender/blenlib/intern/string_utf8.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/source/blender/blenlib/intern/string_utf8.c b/source/blender/blenlib/intern/string_utf8.c
index 7f6057dfdc4..5684b12cc8b 100644
--- a/source/blender/blenlib/intern/string_utf8.c
+++ b/source/blender/blenlib/intern/string_utf8.c
@@ -261,13 +261,21 @@ size_t BLI_strlen_utf8(const char *strc)
return len;
}
-size_t BLI_strlen_range_utf8(const char *start, const char *end)
+/**
+ * \param start the string to measure the length.
+ * \param maxlen the string length (in bytes)
+ * \return the unicode length (not in bytes!)
+ */
+size_t BLI_strnlen_utf8(const char *start, const size_t maxlen)
{
const char *strc = start;
- int len;
+ const char *strc_end = start + maxlen;
- for (len = 0; strc < end; len++)
+ size_t len;
+
+ for (len = 0; *strc && strc < strc_end; len++) {
strc += strlen_utf8_char(strc);
+ }
return len;
}