diff options
author | Sebastian Rasmussen <sebras@gmail.com> | 2016-03-01 00:34:49 +0100 |
---|---|---|
committer | Sebastian Rasmussen <sebras@gmail.com> | 2016-03-02 00:13:05 +0100 |
commit | 34ca477b353a48b315ef8dc598c35f9ddca20370 (patch) | |
tree | 8ada958c4264c42615c9c1625a37cf01fbfc6a3f /source/fitz/string.c | |
parent | 9c7536238c872ca3b4d7ab864c1ee9aef039501d (diff) | |
download | mupdf-34ca477b353a48b315ef8dc598c35f9ddca20370.tar.xz |
Move UTF-8 string length function to fitz.
Diffstat (limited to 'source/fitz/string.c')
-rw-r--r-- | source/fitz/string.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/source/fitz/string.c b/source/fitz/string.c index d22efe8e..025b612c 100644 --- a/source/fitz/string.c +++ b/source/fitz/string.c @@ -352,6 +352,24 @@ fz_runelen(int c) return fz_runetochar(str, c); } +int +fz_utflen(const char *s) +{ + int c, n, rune; + n = 0; + for(;;) { + c = *(const unsigned char*)s; + if(c < Runeself) { + if(c == 0) + return n; + s++; + } else + s += fz_chartorune(&rune, s); + n++; + } + return 0; +} + float fz_atof(const char *s) { float result; |