diff common/strhelp.h @ 260:e7a8b70021b6

Merged
author Sascha Wilde <wilde@intevation.de>
date Tue, 01 Apr 2014 15:46:40 +0200
parents c596568fa45b
children 4077eff1dd39
line wrap: on
line diff
--- a/common/strhelp.h	Tue Apr 01 15:41:11 2014 +0200
+++ b/common/strhelp.h	Tue Apr 01 15:46:40 2014 +0200
@@ -6,6 +6,7 @@
 #endif
 
 #include <stdbool.h>
+#include <stddef.h>
 
 /**
  * @file  strhelp.h
@@ -19,6 +20,7 @@
 void *xrealloc( void *a, size_t n );
 void *xcalloc( size_t n, size_t m );
 char *xstrndup( const char *string, const size_t len );
+void xfree ( void *p );
 
 /**
  * @brief Returns the length of the given %NULL-terminated
@@ -101,6 +103,30 @@
  */
 int str_base64_decode(char **dst, size_t *dst_size, char *src,
                       size_t src_size);
+
+#ifdef WIN32
+
+/** @brief convert a utf8 string to utf16 wchar
+ *
+ * @param[in] string utf8 string. Must be at least len characters long.
+ * @param[in] len number of characters to be converted.
+ *
+ * @returns pointer to a newly allocated wchar array. NULL on error.
+ *
+ **/
+wchar_t *utf8_to_wchar (const char *string, size_t len);
+
+/** @brief convert a utf16 string to utf8
+ *
+ * @param[in] string utf16 string. Must be at least len characters long.
+ * @param[in] len number of characters to be converted.
+ *
+ * @returns pointer to a newly allocated char array. NULL on error.
+ *
+ **/
+char *wchar_to_utf8 (const wchar_t *string, size_t len);
+#endif
+
 #ifdef __cplusplus
 }
 #endif

http://wald.intevation.org/projects/trustbridge/