summaryrefslogtreecommitdiff
path: root/tools.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2007-06-16 10:41:21 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2007-06-16 10:41:21 +0200
commitb532dc82299d1a11b5bdbbbee17f614dd87e8307 (patch)
tree26e67a6b9f0ef901f7df1e2213b9deb450aea40c /tools.c
parent81e44bce198d53d0515290724c0ec8f989b9e01d (diff)
downloadvdr-b532dc82299d1a11b5bdbbbee17f614dd87e8307.tar.gz
vdr-b532dc82299d1a11b5bdbbbee17f614dd87e8307.tar.bz2
Replaced strncpy() and strn0cpy() with Utf8Strn0Cpy() where necessary
Diffstat (limited to 'tools.c')
-rw-r--r--tools.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/tools.c b/tools.c
index b44a4bb0..0faf1ea2 100644
--- a/tools.c
+++ b/tools.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: tools.c 1.127 2007/06/16 09:05:11 kls Exp $
+ * $Id: tools.c 1.128 2007/06/16 09:22:40 kls Exp $
*/
#include "tools.h"
@@ -661,6 +661,25 @@ int Utf8StrLen(const char *s)
return n;
}
+char *Utf8Strn0Cpy(char *Dest, const char *Src, int n)
+{
+ if (cCharSetConv::SystemCharacterTable())
+ return strn0cpy(Dest, Src, n);
+ char *d = Dest;
+ while (*Src) {
+ int sl = Utf8CharLen(Src);
+ n -= sl;
+ if (n > 0) {
+ while (sl--)
+ *d++ = *Src++;
+ }
+ else
+ break;
+ }
+ *d = 0;
+ return Dest;
+}
+
int Utf8ToArray(const char *s, uint *a, int Size)
{
int n = 0;