diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2016-04-12 14:36:11 +0000 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2016-04-12 14:36:11 +0000 |
commit | 095d09c986c895f197d32a8aef67f9f42efcdebe (patch) | |
tree | 612709af43dcfcd53f7d312235156de144179d2c /src/microhttpd/mhd_str.h | |
parent | 36d82b1a0d34dc1b436abeeae9984b101718086c (diff) | |
download | libmicrohttpd-095d09c986c895f197d32a8aef67f9f42efcdebe.tar.gz libmicrohttpd-095d09c986c895f197d32a8aef67f9f42efcdebe.zip |
mhd_str: added MHD_strx_to_uint32_(), MHD_strx_to_uint32_n_(), MHD_strx_to_uint64_() and
MHD_strx_to_uint64_n_() functions
Diffstat (limited to 'src/microhttpd/mhd_str.h')
-rw-r--r-- | src/microhttpd/mhd_str.h | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/src/microhttpd/mhd_str.h b/src/microhttpd/mhd_str.h index 5c519568..2572c050 100644 --- a/src/microhttpd/mhd_str.h +++ b/src/microhttpd/mhd_str.h | |||
@@ -124,4 +124,72 @@ MHD_strx_to_sizet_n_ (const char * str, | |||
124 | size_t maxlen, | 124 | size_t maxlen, |
125 | size_t * out_val); | 125 | size_t * out_val); |
126 | 126 | ||
127 | |||
128 | /** | ||
129 | * Convert hexadecimal US-ASCII digits in string to number in uint32_t. | ||
130 | * Conversion stopped at first non-digit character. | ||
131 | * @param str string to convert | ||
132 | * @param out_val pointer to uint32_t to store result of conversion | ||
133 | * @return non-zero number of characters processed on succeed, | ||
134 | * zero if no digit is found, resulting value is larger | ||
135 | * then possible to store in uint32_t or @a out_val is NULL | ||
136 | */ | ||
137 | size_t | ||
138 | MHD_strx_to_uint32_ (const char * str, | ||
139 | uint32_t * out_val); | ||
140 | |||
141 | |||
142 | /** | ||
143 | * Convert not more then @a maxlen hexadecimal US-ASCII digits in string | ||
144 | * to number in uint32_t. | ||
145 | * Conversion stopped at first non-digit character or after @a maxlen | ||
146 | * digits. | ||
147 | * @param str string to convert | ||
148 | * @param maxlen maximum number of characters to process | ||
149 | * @param out_val pointer to uint32_t to store result of conversion | ||
150 | * @param next_char pointer to store pointer to character next to last | ||
151 | * converted digit, ignored if NULL | ||
152 | * @return non-zero number of characters processed on succeed, | ||
153 | * zero if no digit is found, resulting value is larger | ||
154 | * then possible to store in uint32_t or @a out_val is NULL | ||
155 | */ | ||
156 | size_t | ||
157 | MHD_strx_to_uint32_n_ (const char * str, | ||
158 | size_t maxlen, | ||
159 | uint32_t * out_val); | ||
160 | |||
161 | |||
162 | /** | ||
163 | * Convert hexadecimal US-ASCII digits in string to number in uint64_t. | ||
164 | * Conversion stopped at first non-digit character. | ||
165 | * @param str string to convert | ||
166 | * @param out_val pointer to uint64_t to store result of conversion | ||
167 | * @return non-zero number of characters processed on succeed, | ||
168 | * zero if no digit is found, resulting value is larger | ||
169 | * then possible to store in uint64_t or @a out_val is NULL | ||
170 | */ | ||
171 | size_t | ||
172 | MHD_strx_to_uint64_ (const char * str, | ||
173 | uint64_t * out_val); | ||
174 | |||
175 | |||
176 | /** | ||
177 | * Convert not more then @a maxlen hexadecimal US-ASCII digits in string | ||
178 | * to number in uint64_t. | ||
179 | * Conversion stopped at first non-digit character or after @a maxlen | ||
180 | * digits. | ||
181 | * @param str string to convert | ||
182 | * @param maxlen maximum number of characters to process | ||
183 | * @param out_val pointer to uint64_t to store result of conversion | ||
184 | * @param next_char pointer to store pointer to character next to last | ||
185 | * converted digit, ignored if NULL | ||
186 | * @return non-zero number of characters processed on succeed, | ||
187 | * zero if no digit is found, resulting value is larger | ||
188 | * then possible to store in uint64_t or @a out_val is NULL | ||
189 | */ | ||
190 | size_t | ||
191 | MHD_strx_to_uint64_n_ (const char * str, | ||
192 | size_t maxlen, | ||
193 | uint64_t * out_val); | ||
194 | |||
127 | #endif /* MHD_STR_H */ | 195 | #endif /* MHD_STR_H */ |