| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/bash/src/lib/glob/xmbsrtowcs.c | 
| Switch to Source code | Preprocessed file | 
| Line | Source | Count | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||||||||
| 2 | - | |||||||||||||||||||||||||
| 3 | - | |||||||||||||||||||||||||
| 4 | - | |||||||||||||||||||||||||
| 5 | - | |||||||||||||||||||||||||
| 6 | static mbstate_t local_state; | - | ||||||||||||||||||||||||
| 7 | static int local_state_use = 0; | - | ||||||||||||||||||||||||
| 8 | - | |||||||||||||||||||||||||
| 9 | size_t | - | ||||||||||||||||||||||||
| 10 | xmbsrtowcs (dest, src, len, pstate) | - | ||||||||||||||||||||||||
| 11 | wchar_t *dest; | - | ||||||||||||||||||||||||
| 12 | const char **src; | - | ||||||||||||||||||||||||
| 13 | size_t len; | - | ||||||||||||||||||||||||
| 14 | mbstate_t *pstate; | - | ||||||||||||||||||||||||
| 15 | { | - | ||||||||||||||||||||||||
| 16 | mbstate_t *ps; | - | ||||||||||||||||||||||||
| 17 | size_t mblength, wclength, n; | - | ||||||||||||||||||||||||
| 18 | - | |||||||||||||||||||||||||
| 19 | ps = pstate; | - | ||||||||||||||||||||||||
| 20 | if (pstate == 
 | 0 | ||||||||||||||||||||||||
| 21 | ((void *)0) 
 | 0 | ||||||||||||||||||||||||
| 22 | ) | - | ||||||||||||||||||||||||
| 23 | { | - | ||||||||||||||||||||||||
| 24 | if (!local_state_use 
 | 0 | ||||||||||||||||||||||||
| 25 | { | - | ||||||||||||||||||||||||
| 26 | memset (&local_state, '\0', sizeof(mbstate_t)); | - | ||||||||||||||||||||||||
| 27 | local_state_use = 1; | - | ||||||||||||||||||||||||
| 28 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 29 | ps = &local_state; | - | ||||||||||||||||||||||||
| 30 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 31 | - | |||||||||||||||||||||||||
| 32 | n = strlen (*src); | - | ||||||||||||||||||||||||
| 33 | - | |||||||||||||||||||||||||
| 34 | if (dest == 
 | 0 | ||||||||||||||||||||||||
| 35 | ((void *)0) 
 | 0 | ||||||||||||||||||||||||
| 36 | ) | - | ||||||||||||||||||||||||
| 37 | { | - | ||||||||||||||||||||||||
| 38 | wchar_t *wsbuf; | - | ||||||||||||||||||||||||
| 39 | const char *mbs; | - | ||||||||||||||||||||||||
| 40 | mbstate_t psbuf; | - | ||||||||||||||||||||||||
| 41 | - | |||||||||||||||||||||||||
| 42 | - | |||||||||||||||||||||||||
| 43 | - | |||||||||||||||||||||||||
| 44 | wsbuf = (wchar_t *) malloc ((n + 1) * sizeof(wchar_t)); | - | ||||||||||||||||||||||||
| 45 | mbs = *src; | - | ||||||||||||||||||||||||
| 46 | psbuf = *ps; | - | ||||||||||||||||||||||||
| 47 | - | |||||||||||||||||||||||||
| 48 | wclength = mbsrtowcs (wsbuf, &mbs, n, &psbuf); | - | ||||||||||||||||||||||||
| 49 | - | |||||||||||||||||||||||||
| 50 | if (wsbuf 
 | 0 | ||||||||||||||||||||||||
| 51 | free (wsbuf); never executed:  free (wsbuf); | 0 | ||||||||||||||||||||||||
| 52 | return never executed: wclength; return wclength;never executed:  return wclength; | 0 | ||||||||||||||||||||||||
| 53 | } | - | ||||||||||||||||||||||||
| 54 | - | |||||||||||||||||||||||||
| 55 | for (wclength = 0; wclength < len 
 | 0 | ||||||||||||||||||||||||
| 56 | { | - | ||||||||||||||||||||||||
| 57 | if (mbsinit(ps) 
 | 0 | ||||||||||||||||||||||||
| 58 | { | - | ||||||||||||||||||||||||
| 59 | if (** 
 
 | 0 | ||||||||||||||||||||||||
| 60 | { | - | ||||||||||||||||||||||||
| 61 | *dest = L'\0'; | - | ||||||||||||||||||||||||
| 62 | *src = | - | ||||||||||||||||||||||||
| 63 | ((void *)0) | - | ||||||||||||||||||||||||
| 64 | ; | - | ||||||||||||||||||||||||
| 65 | return never executed: (wclength); return (wclength);never executed:  return (wclength); | 0 | ||||||||||||||||||||||||
| 66 | } | - | ||||||||||||||||||||||||
| 67 | else if (** 
 
 | 0 | ||||||||||||||||||||||||
| 68 | { | - | ||||||||||||||||||||||||
| 69 | *dest = L'\\'; | - | ||||||||||||||||||||||||
| 70 | mblength = 1; | - | ||||||||||||||||||||||||
| 71 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 72 | else | - | ||||||||||||||||||||||||
| 73 | mblength = mbrtowc(dest, *src, n, ps); never executed:  mblength = mbrtowc(dest, *src, n, ps); | 0 | ||||||||||||||||||||||||
| 74 | } | - | ||||||||||||||||||||||||
| 75 | else | - | ||||||||||||||||||||||||
| 76 | mblength = mbrtowc(dest, *src, n, ps); never executed:  mblength = mbrtowc(dest, *src, n, ps); | 0 | ||||||||||||||||||||||||
| 77 | - | |||||||||||||||||||||||||
| 78 | - | |||||||||||||||||||||||||
| 79 | if (mblength == (size_t)-1 
 
 | 0 | ||||||||||||||||||||||||
| 80 | return never executed: (size_t)-1; return (size_t)-1;never executed:  return (size_t)-1; | 0 | ||||||||||||||||||||||||
| 81 | - | |||||||||||||||||||||||||
| 82 | *src += mblength; | - | ||||||||||||||||||||||||
| 83 | n -= mblength; | - | ||||||||||||||||||||||||
| 84 | - | |||||||||||||||||||||||||
| 85 | - | |||||||||||||||||||||||||
| 86 | - | |||||||||||||||||||||||||
| 87 | if (* 
 
 | 0 | ||||||||||||||||||||||||
| 88 | { | - | ||||||||||||||||||||||||
| 89 | *src = | - | ||||||||||||||||||||||||
| 90 | ((void *)0) | - | ||||||||||||||||||||||||
| 91 | ; | - | ||||||||||||||||||||||||
| 92 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 93 | } | - | ||||||||||||||||||||||||
| 94 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 95 | - | |||||||||||||||||||||||||
| 96 | return never executed: (wclength); return (wclength);never executed:  return (wclength); | 0 | ||||||||||||||||||||||||
| 97 | } | - | ||||||||||||||||||||||||
| 98 | static size_t | - | ||||||||||||||||||||||||
| 99 | xdupmbstowcs2 (destp, src) | - | ||||||||||||||||||||||||
| 100 | wchar_t **destp; | - | ||||||||||||||||||||||||
| 101 | const char *src; | - | ||||||||||||||||||||||||
| 102 | { | - | ||||||||||||||||||||||||
| 103 | const char *p; | - | ||||||||||||||||||||||||
| 104 | wchar_t *wsbuf; | - | ||||||||||||||||||||||||
| 105 | size_t wsbuf_size; | - | ||||||||||||||||||||||||
| 106 | size_t wcnum; | - | ||||||||||||||||||||||||
| 107 | mbstate_t state; | - | ||||||||||||||||||||||||
| 108 | size_t n, wcslength; | - | ||||||||||||||||||||||||
| 109 | const char *end_or_backslash; | - | ||||||||||||||||||||||||
| 110 | size_t nms; | - | ||||||||||||||||||||||||
| 111 | mbstate_t tmp_state; | - | ||||||||||||||||||||||||
| 112 | const char *tmp_p; | - | ||||||||||||||||||||||||
| 113 | - | |||||||||||||||||||||||||
| 114 | memset (&state, '\0', sizeof(mbstate_t)); | - | ||||||||||||||||||||||||
| 115 | - | |||||||||||||||||||||||||
| 116 | wsbuf_size = 0; | - | ||||||||||||||||||||||||
| 117 | wsbuf = | - | ||||||||||||||||||||||||
| 118 | ((void *)0) | - | ||||||||||||||||||||||||
| 119 | ; | - | ||||||||||||||||||||||||
| 120 | - | |||||||||||||||||||||||||
| 121 | p = src; | - | ||||||||||||||||||||||||
| 122 | wcnum = 0; | - | ||||||||||||||||||||||||
| 123 | do | - | ||||||||||||||||||||||||
| 124 | { | - | ||||||||||||||||||||||||
| 125 | end_or_backslash = strchrnul(p, '\\'); | - | ||||||||||||||||||||||||
| 126 | nms = end_or_backslash - p; | - | ||||||||||||||||||||||||
| 127 | if (* 
 
 | 2315529-4634220 | ||||||||||||||||||||||||
| 128 | nms++; executed 4634220 times by 1 test:  nms++;Executed by: 
 | 4634220 | ||||||||||||||||||||||||
| 129 | - | |||||||||||||||||||||||||
| 130 | - | |||||||||||||||||||||||||
| 131 | tmp_p = p; | - | ||||||||||||||||||||||||
| 132 | tmp_state = state; | - | ||||||||||||||||||||||||
| 133 | - | |||||||||||||||||||||||||
| 134 | if (nms == 0 
 
 
 | 0-4634363 | ||||||||||||||||||||||||
| 135 | nms = wcslength = 1; executed 2315386 times by 1 test:  nms = wcslength = 1;Executed by: 
 | 2315386 | ||||||||||||||||||||||||
| 136 | else | - | ||||||||||||||||||||||||
| 137 | wcslength = mbsnrtowcs ( executed 4634363 times by 1 test:  wcslength = mbsnrtowcs ( ((void *)0) , &tmp_p, nms, 0, &tmp_state);Executed by: 
 | 4634363 | ||||||||||||||||||||||||
| 138 | ((void *)0) executed 4634363 times by 1 test:  wcslength = mbsnrtowcs ( ((void *)0) , &tmp_p, nms, 0, &tmp_state);Executed by: 
 | 4634363 | ||||||||||||||||||||||||
| 139 | , &tmp_p, nms, 0, &tmp_state); executed 4634363 times by 1 test:  wcslength = mbsnrtowcs ( ((void *)0) , &tmp_p, nms, 0, &tmp_state);Executed by: 
 | 4634363 | ||||||||||||||||||||||||
| 140 | - | |||||||||||||||||||||||||
| 141 | if (wcslength == 0 
 | 0-6949749 | ||||||||||||||||||||||||
| 142 | { | - | ||||||||||||||||||||||||
| 143 | tmp_p = p; | - | ||||||||||||||||||||||||
| 144 | tmp_state = state; | - | ||||||||||||||||||||||||
| 145 | wcslength = 1; | - | ||||||||||||||||||||||||
| 146 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 147 | - | |||||||||||||||||||||||||
| 148 | - | |||||||||||||||||||||||||
| 149 | if (wcslength == (size_t)-1 
 | 6-6949743 | ||||||||||||||||||||||||
| 150 | { | - | ||||||||||||||||||||||||
| 151 | free (wsbuf); | - | ||||||||||||||||||||||||
| 152 | *destp = | - | ||||||||||||||||||||||||
| 153 | ((void *)0) | - | ||||||||||||||||||||||||
| 154 | ; | - | ||||||||||||||||||||||||
| 155 | return executed 6 times by 1 test: (size_t)-1; return (size_t)-1;Executed by: 
 executed 6 times by 1 test:  return (size_t)-1;Executed by: 
 | 6 | ||||||||||||||||||||||||
| 156 | } | - | ||||||||||||||||||||||||
| 157 | - | |||||||||||||||||||||||||
| 158 | - | |||||||||||||||||||||||||
| 159 | if (wsbuf_size < wcnum+wcslength+1 
 | 2315526-4634217 | ||||||||||||||||||||||||
| 160 | { | - | ||||||||||||||||||||||||
| 161 | wchar_t *wstmp; | - | ||||||||||||||||||||||||
| 162 | - | |||||||||||||||||||||||||
| 163 | while (wsbuf_size < wcnum+wcslength+1 
 | 4634217-4634228 | ||||||||||||||||||||||||
| 164 | wsbuf_size += 32; executed 4634228 times by 1 test:  wsbuf_size += 32;Executed by: 
 | 4634228 | ||||||||||||||||||||||||
| 165 | - | |||||||||||||||||||||||||
| 166 | wstmp = (wchar_t *) realloc (wsbuf, wsbuf_size * sizeof (wchar_t)); | - | ||||||||||||||||||||||||
| 167 | if (wstmp == 
 | 0-4634217 | ||||||||||||||||||||||||
| 168 | ((void *)0) 
 | 0-4634217 | ||||||||||||||||||||||||
| 169 | ) | - | ||||||||||||||||||||||||
| 170 | { | - | ||||||||||||||||||||||||
| 171 | free (wsbuf); | - | ||||||||||||||||||||||||
| 172 | *destp = | - | ||||||||||||||||||||||||
| 173 | ((void *)0) | - | ||||||||||||||||||||||||
| 174 | ; | - | ||||||||||||||||||||||||
| 175 | return never executed: (size_t)-1; return (size_t)-1;never executed:  return (size_t)-1; | 0 | ||||||||||||||||||||||||
| 176 | } | - | ||||||||||||||||||||||||
| 177 | wsbuf = wstmp; | - | ||||||||||||||||||||||||
| 178 | } executed 4634217 times by 1 test:  end of blockExecuted by: 
 | 4634217 | ||||||||||||||||||||||||
| 179 | - | |||||||||||||||||||||||||
| 180 | - | |||||||||||||||||||||||||
| 181 | - | |||||||||||||||||||||||||
| 182 | n = mbsnrtowcs(wsbuf+wcnum, &p, nms, wsbuf_size-wcnum, &state); | - | ||||||||||||||||||||||||
| 183 | - | |||||||||||||||||||||||||
| 184 | if (n == 0 
 
 | 0-6949743 | ||||||||||||||||||||||||
| 185 | { | - | ||||||||||||||||||||||||
| 186 | wsbuf[wcnum] = L'\0'; | - | ||||||||||||||||||||||||
| 187 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 188 | } | - | ||||||||||||||||||||||||
| 189 | - | |||||||||||||||||||||||||
| 190 | - | |||||||||||||||||||||||||
| 191 | if (wcslength == 1 
 
 
 | 0-4631702 | ||||||||||||||||||||||||
| 192 | { | - | ||||||||||||||||||||||||
| 193 | state = tmp_state; | - | ||||||||||||||||||||||||
| 194 | p = tmp_p; | - | ||||||||||||||||||||||||
| 195 | wsbuf[wcnum] = *p; | - | ||||||||||||||||||||||||
| 196 | if (* 
 
 | 0 | ||||||||||||||||||||||||
| 197 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 198 | else | - | ||||||||||||||||||||||||
| 199 | { | - | ||||||||||||||||||||||||
| 200 | wcnum++; p++; | - | ||||||||||||||||||||||||
| 201 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 202 | } | - | ||||||||||||||||||||||||
| 203 | else | - | ||||||||||||||||||||||||
| 204 | wcnum += wcslength; executed 6949743 times by 1 test:  wcnum += wcslength;Executed by: 
 | 6949743 | ||||||||||||||||||||||||
| 205 | - | |||||||||||||||||||||||||
| 206 | if (mbsinit (&state) 
 
 
 | 0-6949743 | ||||||||||||||||||||||||
| 207 | ((void *)0) 
 | 2315529-4634214 | ||||||||||||||||||||||||
| 208 | ) 
 
 
 | 143-4634214 | ||||||||||||||||||||||||
| 209 | { | - | ||||||||||||||||||||||||
| 210 | wsbuf[wcnum++] = L'\\'; | - | ||||||||||||||||||||||||
| 211 | p++; | - | ||||||||||||||||||||||||
| 212 | } executed 143 times by 1 test:  end of blockExecuted by: 
 | 143 | ||||||||||||||||||||||||
| 213 | } executed 6949743 times by 1 test:  end of blockExecuted by: 
 | 6949743 | ||||||||||||||||||||||||
| 214 | while (p != 
 | 2315529-4634214 | ||||||||||||||||||||||||
| 215 | ((void *)0) 
 | 2315529-4634214 | ||||||||||||||||||||||||
| 216 | ); | - | ||||||||||||||||||||||||
| 217 | - | |||||||||||||||||||||||||
| 218 | *destp = wsbuf; | - | ||||||||||||||||||||||||
| 219 | - | |||||||||||||||||||||||||
| 220 | - | |||||||||||||||||||||||||
| 221 | return executed 4634214 times by 1 test: wcnum; return wcnum;Executed by: 
 executed 4634214 times by 1 test:  return wcnum;Executed by: 
 | 4634214 | ||||||||||||||||||||||||
| 222 | } | - | ||||||||||||||||||||||||
| 223 | size_t | - | ||||||||||||||||||||||||
| 224 | xdupmbstowcs (destp, indicesp, src) | - | ||||||||||||||||||||||||
| 225 | wchar_t **destp; | - | ||||||||||||||||||||||||
| 226 | char ***indicesp; | - | ||||||||||||||||||||||||
| 227 | const char *src; | - | ||||||||||||||||||||||||
| 228 | { | - | ||||||||||||||||||||||||
| 229 | const char *p; | - | ||||||||||||||||||||||||
| 230 | wchar_t wc; | - | ||||||||||||||||||||||||
| 231 | wchar_t *wsbuf; | - | ||||||||||||||||||||||||
| 232 | char **indices; | - | ||||||||||||||||||||||||
| 233 | size_t wsbuf_size; | - | ||||||||||||||||||||||||
| 234 | size_t wcnum; | - | ||||||||||||||||||||||||
| 235 | mbstate_t state; | - | ||||||||||||||||||||||||
| 236 | - | |||||||||||||||||||||||||
| 237 | - | |||||||||||||||||||||||||
| 238 | if (src == 
 | 0-4634230 | ||||||||||||||||||||||||
| 239 | ((void *)0) 
 | 0-4634230 | ||||||||||||||||||||||||
| 240 | || destp == 
 | 0-4634230 | ||||||||||||||||||||||||
| 241 | ((void *)0) 
 | 0-4634230 | ||||||||||||||||||||||||
| 242 | ) | - | ||||||||||||||||||||||||
| 243 | { | - | ||||||||||||||||||||||||
| 244 | if (destp 
 | 0 | ||||||||||||||||||||||||
| 245 | * never executed: destp = *destp = ((void *)0) ;never executed:  *destp = ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 246 | ((void *)0) never executed:  *destp = ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 247 | ; never executed:  *destp = ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 248 | if (indicesp 
 | 0 | ||||||||||||||||||||||||
| 249 | * never executed: indicesp = *indicesp = ((void *)0) ;never executed:  *indicesp = ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 250 | ((void *)0) never executed:  *indicesp = ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 251 | ; never executed:  *indicesp = ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 252 | return never executed: (size_t)-1; return (size_t)-1;never executed:  return (size_t)-1; | 0 | ||||||||||||||||||||||||
| 253 | } | - | ||||||||||||||||||||||||
| 254 | - | |||||||||||||||||||||||||
| 255 | - | |||||||||||||||||||||||||
| 256 | if (indicesp == 
 | 10-4634220 | ||||||||||||||||||||||||
| 257 | ((void *)0) 
 | 10-4634220 | ||||||||||||||||||||||||
| 258 | ) | - | ||||||||||||||||||||||||
| 259 | return executed 4634220 times by 1 test: (xdupmbstowcs2 (destp, src)); return (xdupmbstowcs2 (destp, src));Executed by: 
 executed 4634220 times by 1 test:  return (xdupmbstowcs2 (destp, src));Executed by: 
 | 4634220 | ||||||||||||||||||||||||
| 260 | - | |||||||||||||||||||||||||
| 261 | - | |||||||||||||||||||||||||
| 262 | memset (&state, '\0', sizeof(mbstate_t)); | - | ||||||||||||||||||||||||
| 263 | wsbuf_size = 32; | - | ||||||||||||||||||||||||
| 264 | - | |||||||||||||||||||||||||
| 265 | wsbuf = (wchar_t *) malloc (wsbuf_size * sizeof(wchar_t)); | - | ||||||||||||||||||||||||
| 266 | if (wsbuf == 
 | 0-10 | ||||||||||||||||||||||||
| 267 | ((void *)0) 
 | 0-10 | ||||||||||||||||||||||||
| 268 | ) | - | ||||||||||||||||||||||||
| 269 | { | - | ||||||||||||||||||||||||
| 270 | *destp = | - | ||||||||||||||||||||||||
| 271 | ((void *)0) | - | ||||||||||||||||||||||||
| 272 | ; | - | ||||||||||||||||||||||||
| 273 | if (indicesp 
 | 0 | ||||||||||||||||||||||||
| 274 | * never executed: indicesp = *indicesp = ((void *)0) ;never executed:  *indicesp = ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 275 | ((void *)0) never executed:  *indicesp = ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 276 | ; never executed:  *indicesp = ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 277 | return never executed: (size_t)-1; return (size_t)-1;never executed:  return (size_t)-1; | 0 | ||||||||||||||||||||||||
| 278 | } | - | ||||||||||||||||||||||||
| 279 | - | |||||||||||||||||||||||||
| 280 | indices = | - | ||||||||||||||||||||||||
| 281 | ((void *)0) | - | ||||||||||||||||||||||||
| 282 | ; | - | ||||||||||||||||||||||||
| 283 | if (indicesp 
 | 0-10 | ||||||||||||||||||||||||
| 284 | { | - | ||||||||||||||||||||||||
| 285 | indices = (char **) malloc (wsbuf_size * sizeof(char *)); | - | ||||||||||||||||||||||||
| 286 | if (indices == 
 | 0-10 | ||||||||||||||||||||||||
| 287 | ((void *)0) 
 | 0-10 | ||||||||||||||||||||||||
| 288 | ) | - | ||||||||||||||||||||||||
| 289 | { | - | ||||||||||||||||||||||||
| 290 | free (wsbuf); | - | ||||||||||||||||||||||||
| 291 | *destp = | - | ||||||||||||||||||||||||
| 292 | ((void *)0) | - | ||||||||||||||||||||||||
| 293 | ; | - | ||||||||||||||||||||||||
| 294 | *indicesp = | - | ||||||||||||||||||||||||
| 295 | ((void *)0) | - | ||||||||||||||||||||||||
| 296 | ; | - | ||||||||||||||||||||||||
| 297 | return never executed: (size_t)-1; return (size_t)-1;never executed:  return (size_t)-1; | 0 | ||||||||||||||||||||||||
| 298 | } | - | ||||||||||||||||||||||||
| 299 | } executed 10 times by 1 test:  end of blockExecuted by: 
 | 10 | ||||||||||||||||||||||||
| 300 | - | |||||||||||||||||||||||||
| 301 | p = src; | - | ||||||||||||||||||||||||
| 302 | wcnum = 0; | - | ||||||||||||||||||||||||
| 303 | do | - | ||||||||||||||||||||||||
| 304 | { | - | ||||||||||||||||||||||||
| 305 | size_t mblength; | - | ||||||||||||||||||||||||
| 306 | - | |||||||||||||||||||||||||
| 307 | if (mbsinit (&state) 
 | 0-50 | ||||||||||||||||||||||||
| 308 | { | - | ||||||||||||||||||||||||
| 309 | if (* 
 
 | 10-40 | ||||||||||||||||||||||||
| 310 | { | - | ||||||||||||||||||||||||
| 311 | wc = L'\0'; | - | ||||||||||||||||||||||||
| 312 | mblength = 1; | - | ||||||||||||||||||||||||
| 313 | } executed 10 times by 1 test:  end of blockExecuted by: 
 | 10 | ||||||||||||||||||||||||
| 314 | else if (* 
 
 | 0-40 | ||||||||||||||||||||||||
| 315 | { | - | ||||||||||||||||||||||||
| 316 | wc = L'\\'; | - | ||||||||||||||||||||||||
| 317 | mblength = 1; | - | ||||||||||||||||||||||||
| 318 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 319 | else | - | ||||||||||||||||||||||||
| 320 | mblength = mbrtowc(&wc, p, executed 40 times by 1 test:  mblength = mbrtowc(&wc, p, 16 , &state);Executed by: 
 | 40 | ||||||||||||||||||||||||
| 321 | 16 executed 40 times by 1 test:  mblength = mbrtowc(&wc, p, 16 , &state);Executed by: 
 | 40 | ||||||||||||||||||||||||
| 322 | , &state); executed 40 times by 1 test:  mblength = mbrtowc(&wc, p, 16 , &state);Executed by: 
 | 40 | ||||||||||||||||||||||||
| 323 | } | - | ||||||||||||||||||||||||
| 324 | else | - | ||||||||||||||||||||||||
| 325 | mblength = mbrtowc(&wc, p, never executed:  mblength = mbrtowc(&wc, p, 16 , &state); | 0 | ||||||||||||||||||||||||
| 326 | 16 never executed:  mblength = mbrtowc(&wc, p, 16 , &state); | 0 | ||||||||||||||||||||||||
| 327 | , &state); never executed:  mblength = mbrtowc(&wc, p, 16 , &state); | 0 | ||||||||||||||||||||||||
| 328 | - | |||||||||||||||||||||||||
| 329 | - | |||||||||||||||||||||||||
| 330 | if ((( 
 
 
 
 | 0-50 | ||||||||||||||||||||||||
| 331 | { | - | ||||||||||||||||||||||||
| 332 | free (wsbuf); | - | ||||||||||||||||||||||||
| 333 | do { if (indices 
 never executed: } while (0); free (indices); | 0 | ||||||||||||||||||||||||
| 334 | *destp = | - | ||||||||||||||||||||||||
| 335 | ((void *)0) | - | ||||||||||||||||||||||||
| 336 | ; | - | ||||||||||||||||||||||||
| 337 | if (indicesp 
 | 0 | ||||||||||||||||||||||||
| 338 | * never executed: indicesp = *indicesp = ((void *)0) ;never executed:  *indicesp = ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 339 | ((void *)0) never executed:  *indicesp = ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 340 | ; never executed:  *indicesp = ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 341 | return never executed: (size_t)-1; return (size_t)-1;never executed:  return (size_t)-1; | 0 | ||||||||||||||||||||||||
| 342 | } | - | ||||||||||||||||||||||||
| 343 | - | |||||||||||||||||||||||||
| 344 | ++wcnum; | - | ||||||||||||||||||||||||
| 345 | - | |||||||||||||||||||||||||
| 346 | - | |||||||||||||||||||||||||
| 347 | if (wsbuf_size < wcnum 
 | 0-50 | ||||||||||||||||||||||||
| 348 | { | - | ||||||||||||||||||||||||
| 349 | wchar_t *wstmp; | - | ||||||||||||||||||||||||
| 350 | char **idxtmp; | - | ||||||||||||||||||||||||
| 351 | - | |||||||||||||||||||||||||
| 352 | wsbuf_size += 32; | - | ||||||||||||||||||||||||
| 353 | - | |||||||||||||||||||||||||
| 354 | wstmp = (wchar_t *) realloc (wsbuf, wsbuf_size * sizeof (wchar_t)); | - | ||||||||||||||||||||||||
| 355 | if (wstmp == 
 | 0 | ||||||||||||||||||||||||
| 356 | ((void *)0) 
 | 0 | ||||||||||||||||||||||||
| 357 | ) | - | ||||||||||||||||||||||||
| 358 | { | - | ||||||||||||||||||||||||
| 359 | free (wsbuf); | - | ||||||||||||||||||||||||
| 360 | do { if (indices 
 never executed: } while (0); free (indices); | 0 | ||||||||||||||||||||||||
| 361 | *destp = | - | ||||||||||||||||||||||||
| 362 | ((void *)0) | - | ||||||||||||||||||||||||
| 363 | ; | - | ||||||||||||||||||||||||
| 364 | if (indicesp 
 | 0 | ||||||||||||||||||||||||
| 365 | * never executed: indicesp = *indicesp = ((void *)0) ;never executed:  *indicesp = ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 366 | ((void *)0) never executed:  *indicesp = ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 367 | ; never executed:  *indicesp = ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 368 | return never executed: (size_t)-1; return (size_t)-1;never executed:  return (size_t)-1; | 0 | ||||||||||||||||||||||||
| 369 | } | - | ||||||||||||||||||||||||
| 370 | wsbuf = wstmp; | - | ||||||||||||||||||||||||
| 371 | - | |||||||||||||||||||||||||
| 372 | if (indicesp 
 | 0 | ||||||||||||||||||||||||
| 373 | { | - | ||||||||||||||||||||||||
| 374 | idxtmp = (char **) realloc (indices, wsbuf_size * sizeof (char *)); | - | ||||||||||||||||||||||||
| 375 | if (idxtmp == 
 | 0 | ||||||||||||||||||||||||
| 376 | ((void *)0) 
 | 0 | ||||||||||||||||||||||||
| 377 | ) | - | ||||||||||||||||||||||||
| 378 | { | - | ||||||||||||||||||||||||
| 379 | free (wsbuf); | - | ||||||||||||||||||||||||
| 380 | free (indices); | - | ||||||||||||||||||||||||
| 381 | *destp = | - | ||||||||||||||||||||||||
| 382 | ((void *)0) | - | ||||||||||||||||||||||||
| 383 | ; | - | ||||||||||||||||||||||||
| 384 | if (indicesp 
 | 0 | ||||||||||||||||||||||||
| 385 | * never executed: indicesp = *indicesp = ((void *)0) ;never executed:  *indicesp = ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 386 | ((void *)0) never executed:  *indicesp = ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 387 | ; never executed:  *indicesp = ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 388 | return never executed: (size_t)-1; return (size_t)-1;never executed:  return (size_t)-1; | 0 | ||||||||||||||||||||||||
| 389 | } | - | ||||||||||||||||||||||||
| 390 | indices = idxtmp; | - | ||||||||||||||||||||||||
| 391 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 392 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 393 | - | |||||||||||||||||||||||||
| 394 | wsbuf[wcnum - 1] = wc; | - | ||||||||||||||||||||||||
| 395 | if (indices 
 | 0-50 | ||||||||||||||||||||||||
| 396 | indices[wcnum - 1] = (char *)p; executed 50 times by 1 test:  indices[wcnum - 1] = (char *)p;Executed by: 
 | 50 | ||||||||||||||||||||||||
| 397 | p += mblength; | - | ||||||||||||||||||||||||
| 398 | } executed 50 times by 1 test:  end of blockExecuted by: 
 | 50 | ||||||||||||||||||||||||
| 399 | while ((( 
 
 | 10-40 | ||||||||||||||||||||||||
| 400 | - | |||||||||||||||||||||||||
| 401 | - | |||||||||||||||||||||||||
| 402 | *destp = wsbuf; | - | ||||||||||||||||||||||||
| 403 | if (indicesp != 
 | 0-10 | ||||||||||||||||||||||||
| 404 | ((void *)0) 
 | 0-10 | ||||||||||||||||||||||||
| 405 | ) | - | ||||||||||||||||||||||||
| 406 | * executed 10 times by 1 test: indicesp = indices; *indicesp = indices;Executed by: 
 executed 10 times by 1 test:  *indicesp = indices;Executed by: 
 | 10 | ||||||||||||||||||||||||
| 407 | - | |||||||||||||||||||||||||
| 408 | return executed 10 times by 1 test: (wcnum - 1); return (wcnum - 1);Executed by: 
 executed 10 times by 1 test:  return (wcnum - 1);Executed by: 
 | 10 | ||||||||||||||||||||||||
| 409 | } | - | ||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |