Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/coreutils/src/lib/striconv.c |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||
2 | - | |||||||||||||||||||
3 | - | |||||||||||||||||||
4 | - | |||||||||||||||||||
5 | - | |||||||||||||||||||
6 | - | |||||||||||||||||||
7 | - | |||||||||||||||||||
8 | - | |||||||||||||||||||
9 | - | |||||||||||||||||||
10 | int | - | ||||||||||||||||||
11 | mem_cd_iconv (const char *src, size_t srclen, iconv_t cd, | - | ||||||||||||||||||
12 | char **resultp, size_t *lengthp) | - | ||||||||||||||||||
13 | { | - | ||||||||||||||||||
14 | - | |||||||||||||||||||
15 | size_t length; | - | ||||||||||||||||||
16 | char *result; | - | ||||||||||||||||||
17 | - | |||||||||||||||||||
18 | - | |||||||||||||||||||
19 | - | |||||||||||||||||||
20 | - | |||||||||||||||||||
21 | - | |||||||||||||||||||
22 | - | |||||||||||||||||||
23 | iconv (cd, | - | ||||||||||||||||||
24 | ((void *)0) | - | ||||||||||||||||||
25 | , | - | ||||||||||||||||||
26 | ((void *)0) | - | ||||||||||||||||||
27 | , | - | ||||||||||||||||||
28 | ((void *)0) | - | ||||||||||||||||||
29 | , | - | ||||||||||||||||||
30 | ((void *)0) | - | ||||||||||||||||||
31 | ); | - | ||||||||||||||||||
32 | - | |||||||||||||||||||
33 | - | |||||||||||||||||||
34 | - | |||||||||||||||||||
35 | { | - | ||||||||||||||||||
36 | size_t count = 0; | - | ||||||||||||||||||
37 | - | |||||||||||||||||||
38 | - | |||||||||||||||||||
39 | union { unsigned int align; char buf[4096]; } tmp; | - | ||||||||||||||||||
40 | - | |||||||||||||||||||
41 | const char *inptr = src; | - | ||||||||||||||||||
42 | size_t insize = srclen; | - | ||||||||||||||||||
43 | - | |||||||||||||||||||
44 | while (insize > 0
| 0 | ||||||||||||||||||
45 | { | - | ||||||||||||||||||
46 | char *outptr = tmp.buf; | - | ||||||||||||||||||
47 | size_t outsize = 4096; | - | ||||||||||||||||||
48 | size_t res = iconv (cd, | - | ||||||||||||||||||
49 | ( char **) &inptr, &insize, | - | ||||||||||||||||||
50 | &outptr, &outsize); | - | ||||||||||||||||||
51 | - | |||||||||||||||||||
52 | if (res == (size_t)(-1)
| 0 | ||||||||||||||||||
53 | { | - | ||||||||||||||||||
54 | if ( | - | ||||||||||||||||||
55 | (*
| 0 | ||||||||||||||||||
56 | ==
| 0 | ||||||||||||||||||
57 | 7
| 0 | ||||||||||||||||||
58 | ) | - | ||||||||||||||||||
59 | ; never executed: ; | 0 | ||||||||||||||||||
60 | else if ( | - | ||||||||||||||||||
61 | (*
| 0 | ||||||||||||||||||
62 | ==
| 0 | ||||||||||||||||||
63 | 22
| 0 | ||||||||||||||||||
64 | ) | - | ||||||||||||||||||
65 | break; never executed: break; | 0 | ||||||||||||||||||
66 | else | - | ||||||||||||||||||
67 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||
68 | } | - | ||||||||||||||||||
69 | count += outptr - tmp.buf; | - | ||||||||||||||||||
70 | } never executed: end of block | 0 | ||||||||||||||||||
71 | - | |||||||||||||||||||
72 | - | |||||||||||||||||||
73 | - | |||||||||||||||||||
74 | - | |||||||||||||||||||
75 | { | - | ||||||||||||||||||
76 | char *outptr = tmp.buf; | - | ||||||||||||||||||
77 | size_t outsize = 4096; | - | ||||||||||||||||||
78 | size_t res = iconv (cd, | - | ||||||||||||||||||
79 | ((void *)0) | - | ||||||||||||||||||
80 | , | - | ||||||||||||||||||
81 | ((void *)0) | - | ||||||||||||||||||
82 | , &outptr, &outsize); | - | ||||||||||||||||||
83 | - | |||||||||||||||||||
84 | if (res == (size_t)(-1)
| 0 | ||||||||||||||||||
85 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||
86 | count += outptr - tmp.buf; | - | ||||||||||||||||||
87 | } | - | ||||||||||||||||||
88 | - | |||||||||||||||||||
89 | length = count; | - | ||||||||||||||||||
90 | - | |||||||||||||||||||
91 | } | - | ||||||||||||||||||
92 | - | |||||||||||||||||||
93 | if (length == 0
| 0 | ||||||||||||||||||
94 | { | - | ||||||||||||||||||
95 | *lengthp = 0; | - | ||||||||||||||||||
96 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||
97 | } | - | ||||||||||||||||||
98 | if (*
| 0 | ||||||||||||||||||
99 | ((void *)0)
| 0 | ||||||||||||||||||
100 | && *
| 0 | ||||||||||||||||||
101 | result = *resultp; never executed: result = *resultp; | 0 | ||||||||||||||||||
102 | else | - | ||||||||||||||||||
103 | { | - | ||||||||||||||||||
104 | result = (char *) malloc (length); | - | ||||||||||||||||||
105 | if (result ==
| 0 | ||||||||||||||||||
106 | ((void *)0)
| 0 | ||||||||||||||||||
107 | ) | - | ||||||||||||||||||
108 | { | - | ||||||||||||||||||
109 | - | |||||||||||||||||||
110 | (*__errno_location ()) | - | ||||||||||||||||||
111 | = | - | ||||||||||||||||||
112 | 12 | - | ||||||||||||||||||
113 | ; | - | ||||||||||||||||||
114 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||
115 | } | - | ||||||||||||||||||
116 | } never executed: end of block | 0 | ||||||||||||||||||
117 | - | |||||||||||||||||||
118 | - | |||||||||||||||||||
119 | - | |||||||||||||||||||
120 | - | |||||||||||||||||||
121 | - | |||||||||||||||||||
122 | - | |||||||||||||||||||
123 | iconv (cd, | - | ||||||||||||||||||
124 | ((void *)0) | - | ||||||||||||||||||
125 | , | - | ||||||||||||||||||
126 | ((void *)0) | - | ||||||||||||||||||
127 | , | - | ||||||||||||||||||
128 | ((void *)0) | - | ||||||||||||||||||
129 | , | - | ||||||||||||||||||
130 | ((void *)0) | - | ||||||||||||||||||
131 | ); | - | ||||||||||||||||||
132 | - | |||||||||||||||||||
133 | - | |||||||||||||||||||
134 | - | |||||||||||||||||||
135 | { | - | ||||||||||||||||||
136 | const char *inptr = src; | - | ||||||||||||||||||
137 | size_t insize = srclen; | - | ||||||||||||||||||
138 | char *outptr = result; | - | ||||||||||||||||||
139 | size_t outsize = length; | - | ||||||||||||||||||
140 | - | |||||||||||||||||||
141 | while (insize > 0
| 0 | ||||||||||||||||||
142 | { | - | ||||||||||||||||||
143 | size_t res = iconv (cd, | - | ||||||||||||||||||
144 | ( char **) &inptr, &insize, | - | ||||||||||||||||||
145 | &outptr, &outsize); | - | ||||||||||||||||||
146 | - | |||||||||||||||||||
147 | if (res == (size_t)(-1)
| 0 | ||||||||||||||||||
148 | { | - | ||||||||||||||||||
149 | if ( | - | ||||||||||||||||||
150 | (*
| 0 | ||||||||||||||||||
151 | ==
| 0 | ||||||||||||||||||
152 | 22
| 0 | ||||||||||||||||||
153 | ) | - | ||||||||||||||||||
154 | break; never executed: break; | 0 | ||||||||||||||||||
155 | else | - | ||||||||||||||||||
156 | goto never executed: fail;goto fail; never executed: goto fail; | 0 | ||||||||||||||||||
157 | } | - | ||||||||||||||||||
158 | } never executed: end of block | 0 | ||||||||||||||||||
159 | - | |||||||||||||||||||
160 | - | |||||||||||||||||||
161 | - | |||||||||||||||||||
162 | - | |||||||||||||||||||
163 | { | - | ||||||||||||||||||
164 | size_t res = iconv (cd, | - | ||||||||||||||||||
165 | ((void *)0) | - | ||||||||||||||||||
166 | , | - | ||||||||||||||||||
167 | ((void *)0) | - | ||||||||||||||||||
168 | , &outptr, &outsize); | - | ||||||||||||||||||
169 | - | |||||||||||||||||||
170 | if (res == (size_t)(-1)
| 0 | ||||||||||||||||||
171 | goto never executed: fail;goto fail; never executed: goto fail; | 0 | ||||||||||||||||||
172 | } | - | ||||||||||||||||||
173 | - | |||||||||||||||||||
174 | if (outsize != 0
| 0 | ||||||||||||||||||
175 | abort (); never executed: abort (); | 0 | ||||||||||||||||||
176 | } | - | ||||||||||||||||||
177 | - | |||||||||||||||||||
178 | *resultp = result; | - | ||||||||||||||||||
179 | *lengthp = length; | - | ||||||||||||||||||
180 | - | |||||||||||||||||||
181 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||
182 | - | |||||||||||||||||||
183 | fail: | - | ||||||||||||||||||
184 | { | - | ||||||||||||||||||
185 | if (result != *resultp
| 0 | ||||||||||||||||||
186 | { | - | ||||||||||||||||||
187 | int saved_errno = | - | ||||||||||||||||||
188 | (*__errno_location ()) | - | ||||||||||||||||||
189 | ; | - | ||||||||||||||||||
190 | free (result); | - | ||||||||||||||||||
191 | - | |||||||||||||||||||
192 | (*__errno_location ()) | - | ||||||||||||||||||
193 | = saved_errno; | - | ||||||||||||||||||
194 | } never executed: end of block | 0 | ||||||||||||||||||
195 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||
196 | } | - | ||||||||||||||||||
197 | - | |||||||||||||||||||
198 | } | - | ||||||||||||||||||
199 | - | |||||||||||||||||||
200 | char * | - | ||||||||||||||||||
201 | str_cd_iconv (const char *src, iconv_t cd) | - | ||||||||||||||||||
202 | { | - | ||||||||||||||||||
203 | char *result; | - | ||||||||||||||||||
204 | size_t result_size; | - | ||||||||||||||||||
205 | size_t length; | - | ||||||||||||||||||
206 | const char *inptr = src; | - | ||||||||||||||||||
207 | size_t inbytes_remaining = strlen (src); | - | ||||||||||||||||||
208 | - | |||||||||||||||||||
209 | - | |||||||||||||||||||
210 | - | |||||||||||||||||||
211 | - | |||||||||||||||||||
212 | result_size = inbytes_remaining; | - | ||||||||||||||||||
213 | { | - | ||||||||||||||||||
214 | size_t approx_sqrt_SIZE_MAX = ((size_t) -1) >> (sizeof (size_t) * 8 / 2); | - | ||||||||||||||||||
215 | if (result_size <= approx_sqrt_SIZE_MAX /
| 0-30 | ||||||||||||||||||
216 | 16
| 0-30 | ||||||||||||||||||
217 | ) | - | ||||||||||||||||||
218 | result_size *= executed 30 times by 2 tests: result_size *= 16 ; Executed by:
| 30 | ||||||||||||||||||
219 | 16 executed 30 times by 2 tests: result_size *= 16 ; Executed by:
| 30 | ||||||||||||||||||
220 | ; executed 30 times by 2 tests: result_size *= 16 ; Executed by:
| 30 | ||||||||||||||||||
221 | } | - | ||||||||||||||||||
222 | result_size += 1; | - | ||||||||||||||||||
223 | - | |||||||||||||||||||
224 | result = (char *) malloc (result_size); | - | ||||||||||||||||||
225 | if (result ==
| 0-30 | ||||||||||||||||||
226 | ((void *)0)
| 0-30 | ||||||||||||||||||
227 | ) | - | ||||||||||||||||||
228 | { | - | ||||||||||||||||||
229 | - | |||||||||||||||||||
230 | (*__errno_location ()) | - | ||||||||||||||||||
231 | = | - | ||||||||||||||||||
232 | 12 | - | ||||||||||||||||||
233 | ; | - | ||||||||||||||||||
234 | return never executed: return ((void *)0) ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
235 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
236 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
237 | } | - | ||||||||||||||||||
238 | - | |||||||||||||||||||
239 | - | |||||||||||||||||||
240 | - | |||||||||||||||||||
241 | - | |||||||||||||||||||
242 | - | |||||||||||||||||||
243 | - | |||||||||||||||||||
244 | iconv (cd, | - | ||||||||||||||||||
245 | ((void *)0) | - | ||||||||||||||||||
246 | , | - | ||||||||||||||||||
247 | ((void *)0) | - | ||||||||||||||||||
248 | , | - | ||||||||||||||||||
249 | ((void *)0) | - | ||||||||||||||||||
250 | , | - | ||||||||||||||||||
251 | ((void *)0) | - | ||||||||||||||||||
252 | ); | - | ||||||||||||||||||
253 | - | |||||||||||||||||||
254 | - | |||||||||||||||||||
255 | - | |||||||||||||||||||
256 | { | - | ||||||||||||||||||
257 | char *outptr = result; | - | ||||||||||||||||||
258 | size_t outbytes_remaining = result_size - 1; | - | ||||||||||||||||||
259 | - | |||||||||||||||||||
260 | for (;;) | - | ||||||||||||||||||
261 | { | - | ||||||||||||||||||
262 | - | |||||||||||||||||||
263 | - | |||||||||||||||||||
264 | size_t res = iconv (cd, | - | ||||||||||||||||||
265 | ( char **) &inptr, &inbytes_remaining, | - | ||||||||||||||||||
266 | &outptr, &outbytes_remaining); | - | ||||||||||||||||||
267 | - | |||||||||||||||||||
268 | if (res == (size_t)(-1)
| 15 | ||||||||||||||||||
269 | { | - | ||||||||||||||||||
270 | if ( | - | ||||||||||||||||||
271 | (*
| 0-15 | ||||||||||||||||||
272 | ==
| 0-15 | ||||||||||||||||||
273 | 22
| 0-15 | ||||||||||||||||||
274 | ) | - | ||||||||||||||||||
275 | break; never executed: break; | 0 | ||||||||||||||||||
276 | else if ( | - | ||||||||||||||||||
277 | (*
| 0-15 | ||||||||||||||||||
278 | ==
| 0-15 | ||||||||||||||||||
279 | 7
| 0-15 | ||||||||||||||||||
280 | ) | - | ||||||||||||||||||
281 | { | - | ||||||||||||||||||
282 | size_t used = outptr - result; | - | ||||||||||||||||||
283 | size_t newsize = result_size * 2; | - | ||||||||||||||||||
284 | char *newresult; | - | ||||||||||||||||||
285 | - | |||||||||||||||||||
286 | if (!(newsize > result_size)
| 0 | ||||||||||||||||||
287 | { | - | ||||||||||||||||||
288 | - | |||||||||||||||||||
289 | (*__errno_location ()) | - | ||||||||||||||||||
290 | = | - | ||||||||||||||||||
291 | 12 | - | ||||||||||||||||||
292 | ; | - | ||||||||||||||||||
293 | goto never executed: failed;goto failed; never executed: goto failed; | 0 | ||||||||||||||||||
294 | } | - | ||||||||||||||||||
295 | newresult = (char *) realloc (result, newsize); | - | ||||||||||||||||||
296 | if (newresult ==
| 0 | ||||||||||||||||||
297 | ((void *)0)
| 0 | ||||||||||||||||||
298 | ) | - | ||||||||||||||||||
299 | { | - | ||||||||||||||||||
300 | - | |||||||||||||||||||
301 | (*__errno_location ()) | - | ||||||||||||||||||
302 | = | - | ||||||||||||||||||
303 | 12 | - | ||||||||||||||||||
304 | ; | - | ||||||||||||||||||
305 | goto never executed: failed;goto failed; never executed: goto failed; | 0 | ||||||||||||||||||
306 | } | - | ||||||||||||||||||
307 | result = newresult; | - | ||||||||||||||||||
308 | result_size = newsize; | - | ||||||||||||||||||
309 | outptr = result + used; | - | ||||||||||||||||||
310 | outbytes_remaining = result_size - 1 - used; | - | ||||||||||||||||||
311 | } never executed: end of block | 0 | ||||||||||||||||||
312 | else | - | ||||||||||||||||||
313 | goto executed 15 times by 2 tests: failed;goto failed; Executed by:
executed 15 times by 2 tests: goto failed; Executed by:
| 15 | ||||||||||||||||||
314 | } | - | ||||||||||||||||||
315 | else | - | ||||||||||||||||||
316 | break; executed 15 times by 2 tests: break; Executed by:
| 15 | ||||||||||||||||||
317 | } | - | ||||||||||||||||||
318 | - | |||||||||||||||||||
319 | - | |||||||||||||||||||
320 | - | |||||||||||||||||||
321 | - | |||||||||||||||||||
322 | for (;;) | - | ||||||||||||||||||
323 | { | - | ||||||||||||||||||
324 | - | |||||||||||||||||||
325 | size_t res = iconv (cd, | - | ||||||||||||||||||
326 | ((void *)0) | - | ||||||||||||||||||
327 | , | - | ||||||||||||||||||
328 | ((void *)0) | - | ||||||||||||||||||
329 | , &outptr, &outbytes_remaining); | - | ||||||||||||||||||
330 | - | |||||||||||||||||||
331 | if (res == (size_t)(-1)
| 0-15 | ||||||||||||||||||
332 | { | - | ||||||||||||||||||
333 | if ( | - | ||||||||||||||||||
334 | (*
| 0 | ||||||||||||||||||
335 | ==
| 0 | ||||||||||||||||||
336 | 7
| 0 | ||||||||||||||||||
337 | ) | - | ||||||||||||||||||
338 | { | - | ||||||||||||||||||
339 | size_t used = outptr - result; | - | ||||||||||||||||||
340 | size_t newsize = result_size * 2; | - | ||||||||||||||||||
341 | char *newresult; | - | ||||||||||||||||||
342 | - | |||||||||||||||||||
343 | if (!(newsize > result_size)
| 0 | ||||||||||||||||||
344 | { | - | ||||||||||||||||||
345 | - | |||||||||||||||||||
346 | (*__errno_location ()) | - | ||||||||||||||||||
347 | = | - | ||||||||||||||||||
348 | 12 | - | ||||||||||||||||||
349 | ; | - | ||||||||||||||||||
350 | goto never executed: failed;goto failed; never executed: goto failed; | 0 | ||||||||||||||||||
351 | } | - | ||||||||||||||||||
352 | newresult = (char *) realloc (result, newsize); | - | ||||||||||||||||||
353 | if (newresult ==
| 0 | ||||||||||||||||||
354 | ((void *)0)
| 0 | ||||||||||||||||||
355 | ) | - | ||||||||||||||||||
356 | { | - | ||||||||||||||||||
357 | - | |||||||||||||||||||
358 | (*__errno_location ()) | - | ||||||||||||||||||
359 | = | - | ||||||||||||||||||
360 | 12 | - | ||||||||||||||||||
361 | ; | - | ||||||||||||||||||
362 | goto never executed: failed;goto failed; never executed: goto failed; | 0 | ||||||||||||||||||
363 | } | - | ||||||||||||||||||
364 | result = newresult; | - | ||||||||||||||||||
365 | result_size = newsize; | - | ||||||||||||||||||
366 | outptr = result + used; | - | ||||||||||||||||||
367 | outbytes_remaining = result_size - 1 - used; | - | ||||||||||||||||||
368 | } never executed: end of block | 0 | ||||||||||||||||||
369 | else | - | ||||||||||||||||||
370 | goto never executed: failed;goto failed; never executed: goto failed; | 0 | ||||||||||||||||||
371 | } | - | ||||||||||||||||||
372 | else | - | ||||||||||||||||||
373 | break; executed 15 times by 2 tests: break; Executed by:
| 15 | ||||||||||||||||||
374 | } | - | ||||||||||||||||||
375 | - | |||||||||||||||||||
376 | - | |||||||||||||||||||
377 | - | |||||||||||||||||||
378 | *outptr++ = '\0'; | - | ||||||||||||||||||
379 | - | |||||||||||||||||||
380 | length = outptr - result; | - | ||||||||||||||||||
381 | } | - | ||||||||||||||||||
382 | - | |||||||||||||||||||
383 | - | |||||||||||||||||||
384 | if (length < result_size
| 0-15 | ||||||||||||||||||
385 | { | - | ||||||||||||||||||
386 | char *smaller_result = (char *) realloc (result, length); | - | ||||||||||||||||||
387 | - | |||||||||||||||||||
388 | if (smaller_result !=
| 0-15 | ||||||||||||||||||
389 | ((void *)0)
| 0-15 | ||||||||||||||||||
390 | ) | - | ||||||||||||||||||
391 | result = smaller_result; executed 15 times by 2 tests: result = smaller_result; Executed by:
| 15 | ||||||||||||||||||
392 | } executed 15 times by 2 tests: end of block Executed by:
| 15 | ||||||||||||||||||
393 | - | |||||||||||||||||||
394 | return executed 15 times by 2 tests: result;return result; Executed by:
executed 15 times by 2 tests: return result; Executed by:
| 15 | ||||||||||||||||||
395 | - | |||||||||||||||||||
396 | failed: | - | ||||||||||||||||||
397 | { | - | ||||||||||||||||||
398 | int saved_errno = | - | ||||||||||||||||||
399 | (*__errno_location ()) | - | ||||||||||||||||||
400 | ; | - | ||||||||||||||||||
401 | free (result); | - | ||||||||||||||||||
402 | - | |||||||||||||||||||
403 | (*__errno_location ()) | - | ||||||||||||||||||
404 | = saved_errno; | - | ||||||||||||||||||
405 | return executed 15 times by 2 tests: return ((void *)0) ; Executed by:
executed 15 times by 2 tests: return ((void *)0) ; Executed by:
| 15 | ||||||||||||||||||
406 | ((void *)0) executed 15 times by 2 tests: return ((void *)0) ; Executed by:
| 15 | ||||||||||||||||||
407 | ; executed 15 times by 2 tests: return ((void *)0) ; Executed by:
| 15 | ||||||||||||||||||
408 | } | - | ||||||||||||||||||
409 | - | |||||||||||||||||||
410 | - | |||||||||||||||||||
411 | } | - | ||||||||||||||||||
412 | - | |||||||||||||||||||
413 | - | |||||||||||||||||||
414 | - | |||||||||||||||||||
415 | char * | - | ||||||||||||||||||
416 | str_iconv (const char *src, const char *from_codeset, const char *to_codeset) | - | ||||||||||||||||||
417 | { | - | ||||||||||||||||||
418 | if (*
| 0-30 | ||||||||||||||||||
419 | { | - | ||||||||||||||||||
420 | char *result = | - | ||||||||||||||||||
421 | (__extension__ (__builtin_constant_p (
| 0 | ||||||||||||||||||
422 | src
| 0 | ||||||||||||||||||
423 | )
| 0 | ||||||||||||||||||
424 | src
| 0 | ||||||||||||||||||
425 | ) + 1) - (size_t)(const void *)(
| 0 | ||||||||||||||||||
426 | src
| 0 | ||||||||||||||||||
427 | ) == 1)
| 0 | ||||||||||||||||||
428 | src
| 0 | ||||||||||||||||||
429 | ))[0] == '\0'
| 0 | ||||||||||||||||||
430 | src | - | ||||||||||||||||||
431 | ) + 1; char *__retval = (char *) malloc (__len); if (__retval != ((void *)0)
never executed: __retval = (char *) memcpy (__retval, src , __len); | 0 | ||||||||||||||||||
432 | src never executed: __retval = (char *) memcpy (__retval, src , __len); | 0 | ||||||||||||||||||
433 | , __len); never executed: __retval; })) : __strdup (__retval = (char *) memcpy (__retval, src , __len); | 0 | ||||||||||||||||||
434 | src | - | ||||||||||||||||||
435 | ))) | - | ||||||||||||||||||
436 | ; | - | ||||||||||||||||||
437 | - | |||||||||||||||||||
438 | if (result ==
| 0 | ||||||||||||||||||
439 | ((void *)0)
| 0 | ||||||||||||||||||
440 | ) | - | ||||||||||||||||||
441 | - | |||||||||||||||||||
442 | (* never executed: __errno_location ()) (*__errno_location ()) = 12 ; never executed: (*__errno_location ()) = 12 ; | 0 | ||||||||||||||||||
443 | = never executed: (*__errno_location ()) = 12 ; | 0 | ||||||||||||||||||
444 | 12 never executed: (*__errno_location ()) = 12 ; | 0 | ||||||||||||||||||
445 | ; never executed: (*__errno_location ()) = 12 ; | 0 | ||||||||||||||||||
446 | return never executed: result;return result; never executed: return result; | 0 | ||||||||||||||||||
447 | } | - | ||||||||||||||||||
448 | else | - | ||||||||||||||||||
449 | { | - | ||||||||||||||||||
450 | - | |||||||||||||||||||
451 | iconv_t cd; | - | ||||||||||||||||||
452 | char *result; | - | ||||||||||||||||||
453 | cd = iconv_open (to_codeset, from_codeset); | - | ||||||||||||||||||
454 | if (cd == (iconv_t) -1
| 0-30 | ||||||||||||||||||
455 | return never executed: return ((void *)0) ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
456 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
457 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
458 | - | |||||||||||||||||||
459 | result = str_cd_iconv (src, cd); | - | ||||||||||||||||||
460 | - | |||||||||||||||||||
461 | if (result ==
| 15 | ||||||||||||||||||
462 | ((void *)0)
| 15 | ||||||||||||||||||
463 | ) | - | ||||||||||||||||||
464 | { | - | ||||||||||||||||||
465 | - | |||||||||||||||||||
466 | int saved_errno = | - | ||||||||||||||||||
467 | (*__errno_location ()) | - | ||||||||||||||||||
468 | ; | - | ||||||||||||||||||
469 | iconv_close (cd); | - | ||||||||||||||||||
470 | - | |||||||||||||||||||
471 | (*__errno_location ()) | - | ||||||||||||||||||
472 | = saved_errno; | - | ||||||||||||||||||
473 | } executed 15 times by 2 tests: end of block Executed by:
| 15 | ||||||||||||||||||
474 | else | - | ||||||||||||||||||
475 | { | - | ||||||||||||||||||
476 | if (iconv_close (cd) < 0
| 0-15 | ||||||||||||||||||
477 | { | - | ||||||||||||||||||
478 | - | |||||||||||||||||||
479 | - | |||||||||||||||||||
480 | int saved_errno = | - | ||||||||||||||||||
481 | (*__errno_location ()) | - | ||||||||||||||||||
482 | ; | - | ||||||||||||||||||
483 | free (result); | - | ||||||||||||||||||
484 | - | |||||||||||||||||||
485 | (*__errno_location ()) | - | ||||||||||||||||||
486 | = saved_errno; | - | ||||||||||||||||||
487 | return never executed: return ((void *)0) ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
488 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
489 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
490 | } | - | ||||||||||||||||||
491 | } executed 15 times by 2 tests: end of block Executed by:
| 15 | ||||||||||||||||||
492 | return executed 30 times by 2 tests: result;return result; Executed by:
executed 30 times by 2 tests: return result; Executed by:
| 30 | ||||||||||||||||||
493 | } | - | ||||||||||||||||||
494 | } | - | ||||||||||||||||||
Switch to Source code | Preprocessed file |