summaryrefslogtreecommitdiff
path: root/lib/unistr.h
diff options
context:
space:
mode:
authorAndreas Rottmann <a.rottmann@gmx.at>2010-05-27 18:23:17 +0200
committerAndreas Rottmann <a.rottmann@gmx.at>2010-05-27 18:23:17 +0200
commitbd6adfa17d453e4c486e36fed4c5779db90a8a0e (patch)
tree9798677560d5f99061afe9f0db105a8c97f2438a /lib/unistr.h
parent79ca645d222db2e158784642c3b464a47bea26f3 (diff)
parent3e0814cd9862b89c7a39672672937477bd87ddfb (diff)
Merge commit 'upstream/0.9.3'
Diffstat (limited to 'lib/unistr.h')
-rw-r--r--lib/unistr.h36
1 files changed, 20 insertions, 16 deletions
diff --git a/lib/unistr.h b/lib/unistr.h
index 01ecc37..4d3c325 100644
--- a/lib/unistr.h
+++ b/lib/unistr.h
@@ -1,5 +1,5 @@
/* Elementary Unicode string functions.
- Copyright (C) 2001-2002, 2005-2009 Free Software Foundation, Inc.
+ Copyright (C) 2001-2002, 2005-2010 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published
@@ -19,6 +19,9 @@
#include "unitypes.h"
+/* Get common macros for C. */
+#include <unistring/cdefs.h>
+
/* Get inline if available. */
#include <unistring/inline.h>
@@ -84,32 +87,32 @@ extern const uint32_t *
/* Convert an UTF-8 string to an UTF-16 string. */
extern uint16_t *
u8_to_u16 (const uint8_t *s, size_t n, uint16_t *resultbuf,
- size_t *lengthp);
+ size_t *lengthp);
/* Convert an UTF-8 string to an UCS-4 string. */
extern uint32_t *
u8_to_u32 (const uint8_t *s, size_t n, uint32_t *resultbuf,
- size_t *lengthp);
+ size_t *lengthp);
/* Convert an UTF-16 string to an UTF-8 string. */
extern uint8_t *
u16_to_u8 (const uint16_t *s, size_t n, uint8_t *resultbuf,
- size_t *lengthp);
+ size_t *lengthp);
/* Convert an UTF-16 string to an UCS-4 string. */
extern uint32_t *
u16_to_u32 (const uint16_t *s, size_t n, uint32_t *resultbuf,
- size_t *lengthp);
+ size_t *lengthp);
/* Convert an UCS-4 string to an UTF-8 string. */
extern uint8_t *
u32_to_u8 (const uint32_t *s, size_t n, uint8_t *resultbuf,
- size_t *lengthp);
+ size_t *lengthp);
/* Convert an UCS-4 string to an UTF-16 string. */
extern uint16_t *
u32_to_u16 (const uint32_t *s, size_t n, uint16_t *resultbuf,
- size_t *lengthp);
+ size_t *lengthp);
/* Elementary string functions. */
@@ -186,7 +189,8 @@ extern int
u32_mbtouc_unsafe (ucs4_t *puc, const uint32_t *s, size_t n);
# else
static inline int
-u32_mbtouc_unsafe (ucs4_t *puc, const uint32_t *s, size_t n _UNUSED_PARAMETER_)
+u32_mbtouc_unsafe (ucs4_t *puc,
+ const uint32_t *s, size_t n _GL_UNUSED_PARAMETER)
{
uint32_t c = *s;
@@ -256,7 +260,7 @@ extern int
u32_mbtouc (ucs4_t *puc, const uint32_t *s, size_t n);
# else
static inline int
-u32_mbtouc (ucs4_t *puc, const uint32_t *s, size_t n _UNUSED_PARAMETER_)
+u32_mbtouc (ucs4_t *puc, const uint32_t *s, size_t n _GL_UNUSED_PARAMETER)
{
uint32_t c = *s;
@@ -354,12 +358,12 @@ u32_uctomb (uint32_t *s, ucs4_t uc, int n)
if (uc < 0xd800 || (uc >= 0xe000 && uc < 0x110000))
{
if (n > 0)
- {
- *s = uc;
- return 1;
- }
+ {
+ *s = uc;
+ return 1;
+ }
else
- return -2;
+ return -2;
}
else
return -1;
@@ -528,8 +532,8 @@ extern uint16_t *
extern uint32_t *
u32_strncpy (uint32_t *dest, const uint32_t *src, size_t n);
-/* Copy no more than N units of SRC to DEST, returning the address of
- the last unit written into DEST. */
+/* Copy no more than N units of SRC to DEST. Return a pointer past the last
+ non-NUL unit written into DEST. */
/* Similar to stpncpy(). */
extern uint8_t *
u8_stpncpy (uint8_t *dest, const uint8_t *src, size_t n);