Mercurial > trustbridge
annotate common/strhelp.h @ 1208:0a803c3fb5a6
(issue138) Set the ACL explictly on existing files or directories
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Tue, 23 Sep 2014 19:15:49 +0200 |
parents | ffdc8cba139a |
children | 82fab0c689bf |
rev | line source |
---|---|
404 | 1 /* Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik |
2 * Software engineering by Intevation GmbH | |
3 * | |
4 * This file is Free Software under the GNU GPL (v>=2) | |
5 * and comes with ABSOLUTELY NO WARRANTY! | |
6 * See LICENSE.txt for details. | |
7 */ | |
60
6acb1dae6185
Use strn functions and improve error handling.
Andre Heinecke <aheinecke@intevation.de>
parents:
59
diff
changeset
|
8 #ifndef STRHELP_H |
6acb1dae6185
Use strn functions and improve error handling.
Andre Heinecke <aheinecke@intevation.de>
parents:
59
diff
changeset
|
9 #define STRHELP_H |
118
d6a74464430b
Fix doxygen documentation.
Sascha Wilde <wilde@intevation.de>
parents:
116
diff
changeset
|
10 |
184
1f44aae4528e
Add C linkage for strhelp. Check for data in commontest.
Andre Heinecke <aheinecke@intevation.de>
parents:
160
diff
changeset
|
11 #ifdef __cplusplus |
1f44aae4528e
Add C linkage for strhelp. Check for data in commontest.
Andre Heinecke <aheinecke@intevation.de>
parents:
160
diff
changeset
|
12 extern "C" { |
1f44aae4528e
Add C linkage for strhelp. Check for data in commontest.
Andre Heinecke <aheinecke@intevation.de>
parents:
160
diff
changeset
|
13 #endif |
1f44aae4528e
Add C linkage for strhelp. Check for data in commontest.
Andre Heinecke <aheinecke@intevation.de>
parents:
160
diff
changeset
|
14 |
131
9104b1b2e4da
Added string comparison functions.
Sascha Wilde <wilde@intevation.de>
parents:
120
diff
changeset
|
15 #include <stdbool.h> |
251
c596568fa45b
Add utf16 conversion functions for Windows.
Andre Heinecke <aheinecke@intevation.de>
parents:
239
diff
changeset
|
16 #include <stddef.h> |
131
9104b1b2e4da
Added string comparison functions.
Sascha Wilde <wilde@intevation.de>
parents:
120
diff
changeset
|
17 |
118
d6a74464430b
Fix doxygen documentation.
Sascha Wilde <wilde@intevation.de>
parents:
116
diff
changeset
|
18 /** |
d6a74464430b
Fix doxygen documentation.
Sascha Wilde <wilde@intevation.de>
parents:
116
diff
changeset
|
19 * @file strhelp.h |
d6a74464430b
Fix doxygen documentation.
Sascha Wilde <wilde@intevation.de>
parents:
116
diff
changeset
|
20 * @brief Helper functions for c strings and memory management |
d6a74464430b
Fix doxygen documentation.
Sascha Wilde <wilde@intevation.de>
parents:
116
diff
changeset
|
21 * @details strhelp contains terminating memory allocation functions and |
d6a74464430b
Fix doxygen documentation.
Sascha Wilde <wilde@intevation.de>
parents:
116
diff
changeset
|
22 * some conveniance functions to work with c strings or arrays of c |
d6a74464430b
Fix doxygen documentation.
Sascha Wilde <wilde@intevation.de>
parents:
116
diff
changeset
|
23 * strings. |
59
3f6378647371
Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
24 */ |
118
d6a74464430b
Fix doxygen documentation.
Sascha Wilde <wilde@intevation.de>
parents:
116
diff
changeset
|
25 |
59
3f6378647371
Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
26 void *xmalloc( size_t n ); |
3f6378647371
Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
27 void *xrealloc( void *a, size_t n ); |
3f6378647371
Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
28 void *xcalloc( size_t n, size_t m ); |
60
6acb1dae6185
Use strn functions and improve error handling.
Andre Heinecke <aheinecke@intevation.de>
parents:
59
diff
changeset
|
29 char *xstrndup( const char *string, const size_t len ); |
251
c596568fa45b
Add utf16 conversion functions for Windows.
Andre Heinecke <aheinecke@intevation.de>
parents:
239
diff
changeset
|
30 void xfree ( void *p ); |
59
3f6378647371
Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
31 |
3f6378647371
Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
32 /** |
319
4077eff1dd39
Added terminateing version of asprintf.
Sascha Wilde <wilde@intevation.de>
parents:
251
diff
changeset
|
33 * @brief Terminating variant of asprintf |
4077eff1dd39
Added terminateing version of asprintf.
Sascha Wilde <wilde@intevation.de>
parents:
251
diff
changeset
|
34 * |
4077eff1dd39
Added terminateing version of asprintf.
Sascha Wilde <wilde@intevation.de>
parents:
251
diff
changeset
|
35 * This function behaves exactly like asprintf(3) but will terminate |
4077eff1dd39
Added terminateing version of asprintf.
Sascha Wilde <wilde@intevation.de>
parents:
251
diff
changeset
|
36 * when an error occures (usally that means that memoy allocation |
4077eff1dd39
Added terminateing version of asprintf.
Sascha Wilde <wilde@intevation.de>
parents:
251
diff
changeset
|
37 * failed). |
4077eff1dd39
Added terminateing version of asprintf.
Sascha Wilde <wilde@intevation.de>
parents:
251
diff
changeset
|
38 */ |
4077eff1dd39
Added terminateing version of asprintf.
Sascha Wilde <wilde@intevation.de>
parents:
251
diff
changeset
|
39 int xasprintf (char **strp, const char *fmt, ...); |
4077eff1dd39
Added terminateing version of asprintf.
Sascha Wilde <wilde@intevation.de>
parents:
251
diff
changeset
|
40 |
4077eff1dd39
Added terminateing version of asprintf.
Sascha Wilde <wilde@intevation.de>
parents:
251
diff
changeset
|
41 /** |
118
d6a74464430b
Fix doxygen documentation.
Sascha Wilde <wilde@intevation.de>
parents:
116
diff
changeset
|
42 * @brief Returns the length of the given %NULL-terminated |
d6a74464430b
Fix doxygen documentation.
Sascha Wilde <wilde@intevation.de>
parents:
116
diff
changeset
|
43 * string array str_array. |
120
702033705bb8
Removed trailing whitespace.
Sascha Wilde <wilde@intevation.de>
parents:
118
diff
changeset
|
44 * @param[in] str_array a %NULL-terminated array of strings |
118
d6a74464430b
Fix doxygen documentation.
Sascha Wilde <wilde@intevation.de>
parents:
116
diff
changeset
|
45 * @returns length of str_array. |
59
3f6378647371
Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
46 */ |
3f6378647371
Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
47 unsigned int strv_length (char **str_array); |
3f6378647371
Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
48 |
118
d6a74464430b
Fix doxygen documentation.
Sascha Wilde <wilde@intevation.de>
parents:
116
diff
changeset
|
49 /** |
d6a74464430b
Fix doxygen documentation.
Sascha Wilde <wilde@intevation.de>
parents:
116
diff
changeset
|
50 * @brief append a string to a NULL terminated array of strings. |
59
3f6378647371
Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
51 * |
118
d6a74464430b
Fix doxygen documentation.
Sascha Wilde <wilde@intevation.de>
parents:
116
diff
changeset
|
52 * @param[inout] pArray pointer to the NULL terminated list of string pointers. |
59
3f6378647371
Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
53 * @param[in] string pointer to the string to append to the list. |
60
6acb1dae6185
Use strn functions and improve error handling.
Andre Heinecke <aheinecke@intevation.de>
parents:
59
diff
changeset
|
54 * @param[in] len length of the string to append to the list |
118
d6a74464430b
Fix doxygen documentation.
Sascha Wilde <wilde@intevation.de>
parents:
116
diff
changeset
|
55 */ |
116
c602d8cfa619
Refactoring: unified naming of string vector functions.
Sascha Wilde <wilde@intevation.de>
parents:
91
diff
changeset
|
56 void strv_append (char ***pArray, const char *string, const size_t len); |
59
3f6378647371
Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
57 |
118
d6a74464430b
Fix doxygen documentation.
Sascha Wilde <wilde@intevation.de>
parents:
116
diff
changeset
|
58 /** |
d6a74464430b
Fix doxygen documentation.
Sascha Wilde <wilde@intevation.de>
parents:
116
diff
changeset
|
59 * @brief append a string to another string. |
59
3f6378647371
Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
60 * |
3f6378647371
Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
61 * @param[inout] pDst pointer to the string to be extended. |
91
80ab2168760f
Also add output size handling to str_append_str
Andre Heinecke <aheinecke@intevation.de>
parents:
60
diff
changeset
|
62 * @param[inout] dst_len length of the dst string. Will be modified. |
59
3f6378647371
Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
63 * @param[in] appendage pointer to the string to append. |
60
6acb1dae6185
Use strn functions and improve error handling.
Andre Heinecke <aheinecke@intevation.de>
parents:
59
diff
changeset
|
64 * @param[in] len length of the string to append. |
118
d6a74464430b
Fix doxygen documentation.
Sascha Wilde <wilde@intevation.de>
parents:
116
diff
changeset
|
65 */ |
116
c602d8cfa619
Refactoring: unified naming of string vector functions.
Sascha Wilde <wilde@intevation.de>
parents:
91
diff
changeset
|
66 void str_append_str (char **pDst, size_t *dst_len, const char *appendage, |
91
80ab2168760f
Also add output size handling to str_append_str
Andre Heinecke <aheinecke@intevation.de>
parents:
60
diff
changeset
|
67 const size_t len); |
59
3f6378647371
Start work on cinst. Strhelp new helpers to work with C String
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
68 |
118
d6a74464430b
Fix doxygen documentation.
Sascha Wilde <wilde@intevation.de>
parents:
116
diff
changeset
|
69 /** |
d6a74464430b
Fix doxygen documentation.
Sascha Wilde <wilde@intevation.de>
parents:
116
diff
changeset
|
70 * @brief Frees the given %NULL-terminated string array. |
120
702033705bb8
Removed trailing whitespace.
Sascha Wilde <wilde@intevation.de>
parents:
118
diff
changeset
|
71 * @param[inout] str_array a %NULL-terminated array of strings |
118
d6a74464430b
Fix doxygen documentation.
Sascha Wilde <wilde@intevation.de>
parents:
116
diff
changeset
|
72 */ |
116
c602d8cfa619
Refactoring: unified naming of string vector functions.
Sascha Wilde <wilde@intevation.de>
parents:
91
diff
changeset
|
73 void strv_free (char **str_array); |
131
9104b1b2e4da
Added string comparison functions.
Sascha Wilde <wilde@intevation.de>
parents:
120
diff
changeset
|
74 |
9104b1b2e4da
Added string comparison functions.
Sascha Wilde <wilde@intevation.de>
parents:
120
diff
changeset
|
75 /** |
9104b1b2e4da
Added string comparison functions.
Sascha Wilde <wilde@intevation.de>
parents:
120
diff
changeset
|
76 * @brief Checks whether two strings exactly match |
9104b1b2e4da
Added string comparison functions.
Sascha Wilde <wilde@intevation.de>
parents:
120
diff
changeset
|
77 * @param[in] s1 the first string |
9104b1b2e4da
Added string comparison functions.
Sascha Wilde <wilde@intevation.de>
parents:
120
diff
changeset
|
78 * @param[in] s2 the second string |
9104b1b2e4da
Added string comparison functions.
Sascha Wilde <wilde@intevation.de>
parents:
120
diff
changeset
|
79 * @returns true if s1 and s2 are equal |
9104b1b2e4da
Added string comparison functions.
Sascha Wilde <wilde@intevation.de>
parents:
120
diff
changeset
|
80 */ |
9104b1b2e4da
Added string comparison functions.
Sascha Wilde <wilde@intevation.de>
parents:
120
diff
changeset
|
81 bool str_equal (char *s1, char *s2); |
9104b1b2e4da
Added string comparison functions.
Sascha Wilde <wilde@intevation.de>
parents:
120
diff
changeset
|
82 |
9104b1b2e4da
Added string comparison functions.
Sascha Wilde <wilde@intevation.de>
parents:
120
diff
changeset
|
83 /** |
9104b1b2e4da
Added string comparison functions.
Sascha Wilde <wilde@intevation.de>
parents:
120
diff
changeset
|
84 * @brief Checks whether s2 exactly matches the beginning of s1. |
9104b1b2e4da
Added string comparison functions.
Sascha Wilde <wilde@intevation.de>
parents:
120
diff
changeset
|
85 * @param[in] s1 the string who's beginning is searched |
9104b1b2e4da
Added string comparison functions.
Sascha Wilde <wilde@intevation.de>
parents:
120
diff
changeset
|
86 * @param[in] s2 the string which is searched for |
9104b1b2e4da
Added string comparison functions.
Sascha Wilde <wilde@intevation.de>
parents:
120
diff
changeset
|
87 * @returns true if s1 starts with s2, false otherwise |
9104b1b2e4da
Added string comparison functions.
Sascha Wilde <wilde@intevation.de>
parents:
120
diff
changeset
|
88 */ |
9104b1b2e4da
Added string comparison functions.
Sascha Wilde <wilde@intevation.de>
parents:
120
diff
changeset
|
89 bool str_starts_with (char *s1, char *s2); |
9104b1b2e4da
Added string comparison functions.
Sascha Wilde <wilde@intevation.de>
parents:
120
diff
changeset
|
90 |
133
c719d3fdbc15
Added functrion to trim white space from string.
Sascha Wilde <wilde@intevation.de>
parents:
131
diff
changeset
|
91 /** |
c719d3fdbc15
Added functrion to trim white space from string.
Sascha Wilde <wilde@intevation.de>
parents:
131
diff
changeset
|
92 * @brief Trims all white space from the start and end of string. |
c719d3fdbc15
Added functrion to trim white space from string.
Sascha Wilde <wilde@intevation.de>
parents:
131
diff
changeset
|
93 * @details the start of the string is trimmed by setting *s to the |
c719d3fdbc15
Added functrion to trim white space from string.
Sascha Wilde <wilde@intevation.de>
parents:
131
diff
changeset
|
94 * first non white space character. The end is trimmed by setting the |
c719d3fdbc15
Added functrion to trim white space from string.
Sascha Wilde <wilde@intevation.de>
parents:
131
diff
changeset
|
95 * first character after the last non white space character to \0. |
c719d3fdbc15
Added functrion to trim white space from string.
Sascha Wilde <wilde@intevation.de>
parents:
131
diff
changeset
|
96 * @param[inout] s ponter to the string to strip |
c719d3fdbc15
Added functrion to trim white space from string.
Sascha Wilde <wilde@intevation.de>
parents:
131
diff
changeset
|
97 */ |
c719d3fdbc15
Added functrion to trim white space from string.
Sascha Wilde <wilde@intevation.de>
parents:
131
diff
changeset
|
98 bool str_trim (char **s); |
c719d3fdbc15
Added functrion to trim white space from string.
Sascha Wilde <wilde@intevation.de>
parents:
131
diff
changeset
|
99 |
160
bf4bfd8843bd
Add memory allocating base64 decode function
Andre Heinecke <aheinecke@intevation.de>
parents:
133
diff
changeset
|
100 /** @brief decode base64 encoded data |
bf4bfd8843bd
Add memory allocating base64 decode function
Andre Heinecke <aheinecke@intevation.de>
parents:
133
diff
changeset
|
101 * |
bf4bfd8843bd
Add memory allocating base64 decode function
Andre Heinecke <aheinecke@intevation.de>
parents:
133
diff
changeset
|
102 * The memory allocated for dest needs to be free'd by the |
bf4bfd8843bd
Add memory allocating base64 decode function
Andre Heinecke <aheinecke@intevation.de>
parents:
133
diff
changeset
|
103 * caller. |
bf4bfd8843bd
Add memory allocating base64 decode function
Andre Heinecke <aheinecke@intevation.de>
parents:
133
diff
changeset
|
104 * |
239
6b4ad6ccc48e
Change the specification of str_b64_decode so that it matches the
Andre Heinecke <aheinecke@intevation.de>
parents:
184
diff
changeset
|
105 * _Input warning:_ |
6b4ad6ccc48e
Change the specification of str_b64_decode so that it matches the
Andre Heinecke <aheinecke@intevation.de>
parents:
184
diff
changeset
|
106 * If the input contains invalid base64 characters an error |
6b4ad6ccc48e
Change the specification of str_b64_decode so that it matches the
Andre Heinecke <aheinecke@intevation.de>
parents:
184
diff
changeset
|
107 * is returned. |
6b4ad6ccc48e
Change the specification of str_b64_decode so that it matches the
Andre Heinecke <aheinecke@intevation.de>
parents:
184
diff
changeset
|
108 * |
6b4ad6ccc48e
Change the specification of str_b64_decode so that it matches the
Andre Heinecke <aheinecke@intevation.de>
parents:
184
diff
changeset
|
109 * If the input is invalid base64 but consists of valid |
6b4ad6ccc48e
Change the specification of str_b64_decode so that it matches the
Andre Heinecke <aheinecke@intevation.de>
parents:
184
diff
changeset
|
110 * base64 characters _no error_ is returned and dst contains |
6b4ad6ccc48e
Change the specification of str_b64_decode so that it matches the
Andre Heinecke <aheinecke@intevation.de>
parents:
184
diff
changeset
|
111 * the valid input up to the error. |
6b4ad6ccc48e
Change the specification of str_b64_decode so that it matches the
Andre Heinecke <aheinecke@intevation.de>
parents:
184
diff
changeset
|
112 * |
160
bf4bfd8843bd
Add memory allocating base64 decode function
Andre Heinecke <aheinecke@intevation.de>
parents:
133
diff
changeset
|
113 * @param [out] dst Pointer to the destination. Needs to be NULL |
bf4bfd8843bd
Add memory allocating base64 decode function
Andre Heinecke <aheinecke@intevation.de>
parents:
133
diff
changeset
|
114 * @param [out] dst_size Size allocated for the destination. |
bf4bfd8843bd
Add memory allocating base64 decode function
Andre Heinecke <aheinecke@intevation.de>
parents:
133
diff
changeset
|
115 * @param [in] src Pointer to the base64 encoded data. |
bf4bfd8843bd
Add memory allocating base64 decode function
Andre Heinecke <aheinecke@intevation.de>
parents:
133
diff
changeset
|
116 * @param [in] src_size Size of the encoded data. |
bf4bfd8843bd
Add memory allocating base64 decode function
Andre Heinecke <aheinecke@intevation.de>
parents:
133
diff
changeset
|
117 * |
bf4bfd8843bd
Add memory allocating base64 decode function
Andre Heinecke <aheinecke@intevation.de>
parents:
133
diff
changeset
|
118 * @returns 0 on success a polarssl error or -1 otherwise |
bf4bfd8843bd
Add memory allocating base64 decode function
Andre Heinecke <aheinecke@intevation.de>
parents:
133
diff
changeset
|
119 */ |
bf4bfd8843bd
Add memory allocating base64 decode function
Andre Heinecke <aheinecke@intevation.de>
parents:
133
diff
changeset
|
120 int str_base64_decode(char **dst, size_t *dst_size, char *src, |
bf4bfd8843bd
Add memory allocating base64 decode function
Andre Heinecke <aheinecke@intevation.de>
parents:
133
diff
changeset
|
121 size_t src_size); |
251
c596568fa45b
Add utf16 conversion functions for Windows.
Andre Heinecke <aheinecke@intevation.de>
parents:
239
diff
changeset
|
122 |
c596568fa45b
Add utf16 conversion functions for Windows.
Andre Heinecke <aheinecke@intevation.de>
parents:
239
diff
changeset
|
123 #ifdef WIN32 |
c596568fa45b
Add utf16 conversion functions for Windows.
Andre Heinecke <aheinecke@intevation.de>
parents:
239
diff
changeset
|
124 |
c596568fa45b
Add utf16 conversion functions for Windows.
Andre Heinecke <aheinecke@intevation.de>
parents:
239
diff
changeset
|
125 /** @brief convert a utf8 string to utf16 wchar |
c596568fa45b
Add utf16 conversion functions for Windows.
Andre Heinecke <aheinecke@intevation.de>
parents:
239
diff
changeset
|
126 * |
c596568fa45b
Add utf16 conversion functions for Windows.
Andre Heinecke <aheinecke@intevation.de>
parents:
239
diff
changeset
|
127 * @param[in] string utf8 string. Must be at least len characters long. |
c596568fa45b
Add utf16 conversion functions for Windows.
Andre Heinecke <aheinecke@intevation.de>
parents:
239
diff
changeset
|
128 * @param[in] len number of characters to be converted. |
c596568fa45b
Add utf16 conversion functions for Windows.
Andre Heinecke <aheinecke@intevation.de>
parents:
239
diff
changeset
|
129 * |
c596568fa45b
Add utf16 conversion functions for Windows.
Andre Heinecke <aheinecke@intevation.de>
parents:
239
diff
changeset
|
130 * @returns pointer to a newly allocated wchar array. NULL on error. |
c596568fa45b
Add utf16 conversion functions for Windows.
Andre Heinecke <aheinecke@intevation.de>
parents:
239
diff
changeset
|
131 * |
c596568fa45b
Add utf16 conversion functions for Windows.
Andre Heinecke <aheinecke@intevation.de>
parents:
239
diff
changeset
|
132 **/ |
c596568fa45b
Add utf16 conversion functions for Windows.
Andre Heinecke <aheinecke@intevation.de>
parents:
239
diff
changeset
|
133 wchar_t *utf8_to_wchar (const char *string, size_t len); |
c596568fa45b
Add utf16 conversion functions for Windows.
Andre Heinecke <aheinecke@intevation.de>
parents:
239
diff
changeset
|
134 |
1158
ffdc8cba139a
(issue36) Add acp_to_wchar based on utf8_to_wchar
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
135 /** @brief convert a local 8 bit (acp) string to utf16 wchar |
ffdc8cba139a
(issue36) Add acp_to_wchar based on utf8_to_wchar
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
136 * |
ffdc8cba139a
(issue36) Add acp_to_wchar based on utf8_to_wchar
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
137 * @param[in] string acp string. Must be at least len characters long. |
ffdc8cba139a
(issue36) Add acp_to_wchar based on utf8_to_wchar
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
138 * @param[in] len number of characters to be converted. |
ffdc8cba139a
(issue36) Add acp_to_wchar based on utf8_to_wchar
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
139 * |
ffdc8cba139a
(issue36) Add acp_to_wchar based on utf8_to_wchar
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
140 * @returns pointer to a newly allocated wchar array. NULL on error. |
ffdc8cba139a
(issue36) Add acp_to_wchar based on utf8_to_wchar
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
141 * |
ffdc8cba139a
(issue36) Add acp_to_wchar based on utf8_to_wchar
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
142 **/ |
ffdc8cba139a
(issue36) Add acp_to_wchar based on utf8_to_wchar
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
143 wchar_t *acp_to_wchar (const char *string, size_t len); |
ffdc8cba139a
(issue36) Add acp_to_wchar based on utf8_to_wchar
Andre Heinecke <andre.heinecke@intevation.de>
parents:
404
diff
changeset
|
144 |
251
c596568fa45b
Add utf16 conversion functions for Windows.
Andre Heinecke <aheinecke@intevation.de>
parents:
239
diff
changeset
|
145 /** @brief convert a utf16 string to utf8 |
c596568fa45b
Add utf16 conversion functions for Windows.
Andre Heinecke <aheinecke@intevation.de>
parents:
239
diff
changeset
|
146 * |
c596568fa45b
Add utf16 conversion functions for Windows.
Andre Heinecke <aheinecke@intevation.de>
parents:
239
diff
changeset
|
147 * @param[in] string utf16 string. Must be at least len characters long. |
c596568fa45b
Add utf16 conversion functions for Windows.
Andre Heinecke <aheinecke@intevation.de>
parents:
239
diff
changeset
|
148 * @param[in] len number of characters to be converted. |
c596568fa45b
Add utf16 conversion functions for Windows.
Andre Heinecke <aheinecke@intevation.de>
parents:
239
diff
changeset
|
149 * |
c596568fa45b
Add utf16 conversion functions for Windows.
Andre Heinecke <aheinecke@intevation.de>
parents:
239
diff
changeset
|
150 * @returns pointer to a newly allocated char array. NULL on error. |
c596568fa45b
Add utf16 conversion functions for Windows.
Andre Heinecke <aheinecke@intevation.de>
parents:
239
diff
changeset
|
151 * |
c596568fa45b
Add utf16 conversion functions for Windows.
Andre Heinecke <aheinecke@intevation.de>
parents:
239
diff
changeset
|
152 **/ |
c596568fa45b
Add utf16 conversion functions for Windows.
Andre Heinecke <aheinecke@intevation.de>
parents:
239
diff
changeset
|
153 char *wchar_to_utf8 (const wchar_t *string, size_t len); |
c596568fa45b
Add utf16 conversion functions for Windows.
Andre Heinecke <aheinecke@intevation.de>
parents:
239
diff
changeset
|
154 #endif |
c596568fa45b
Add utf16 conversion functions for Windows.
Andre Heinecke <aheinecke@intevation.de>
parents:
239
diff
changeset
|
155 |
184
1f44aae4528e
Add C linkage for strhelp. Check for data in commontest.
Andre Heinecke <aheinecke@intevation.de>
parents:
160
diff
changeset
|
156 #ifdef __cplusplus |
1f44aae4528e
Add C linkage for strhelp. Check for data in commontest.
Andre Heinecke <aheinecke@intevation.de>
parents:
160
diff
changeset
|
157 } |
1f44aae4528e
Add C linkage for strhelp. Check for data in commontest.
Andre Heinecke <aheinecke@intevation.de>
parents:
160
diff
changeset
|
158 #endif |
160
bf4bfd8843bd
Add memory allocating base64 decode function
Andre Heinecke <aheinecke@intevation.de>
parents:
133
diff
changeset
|
159 |
60
6acb1dae6185
Use strn functions and improve error handling.
Andre Heinecke <aheinecke@intevation.de>
parents:
59
diff
changeset
|
160 #endif |