| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/libressl/src/crypto/asn1/a_mbstr.c |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||||||||||||||
| 2 | - | |||||||||||||||||||||||||||||||
| 3 | - | |||||||||||||||||||||||||||||||
| 4 | static int traverse_string(const unsigned char *p, int len, int inform, | - | ||||||||||||||||||||||||||||||
| 5 | int (*rfunc)(unsigned long value, void *in), void *arg); | - | ||||||||||||||||||||||||||||||
| 6 | static int in_utf8(unsigned long value, void *arg); | - | ||||||||||||||||||||||||||||||
| 7 | static int out_utf8(unsigned long value, void *arg); | - | ||||||||||||||||||||||||||||||
| 8 | static int type_str(unsigned long value, void *arg); | - | ||||||||||||||||||||||||||||||
| 9 | static int cpy_asc(unsigned long value, void *arg); | - | ||||||||||||||||||||||||||||||
| 10 | static int cpy_bmp(unsigned long value, void *arg); | - | ||||||||||||||||||||||||||||||
| 11 | static int cpy_univ(unsigned long value, void *arg); | - | ||||||||||||||||||||||||||||||
| 12 | static int cpy_utf8(unsigned long value, void *arg); | - | ||||||||||||||||||||||||||||||
| 13 | static int is_printable(unsigned long value); | - | ||||||||||||||||||||||||||||||
| 14 | int | - | ||||||||||||||||||||||||||||||
| 15 | ASN1_mbstring_copy(ASN1_STRING **out, const unsigned char *in, int len, | - | ||||||||||||||||||||||||||||||
| 16 | int inform, unsigned long mask) | - | ||||||||||||||||||||||||||||||
| 17 | { | - | ||||||||||||||||||||||||||||||
| 18 | return executed 1838 times by 8 tests: ASN1_mbstring_ncopy(out, in, len, inform, mask, 0, 0);return ASN1_mbstring_ncopy(out, in, len, inform, mask, 0, 0);Executed by:
executed 1838 times by 8 tests: return ASN1_mbstring_ncopy(out, in, len, inform, mask, 0, 0);Executed by:
| 1838 | ||||||||||||||||||||||||||||||
| 19 | } | - | ||||||||||||||||||||||||||||||
| 20 | - | |||||||||||||||||||||||||||||||
| 21 | int | - | ||||||||||||||||||||||||||||||
| 22 | ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len, | - | ||||||||||||||||||||||||||||||
| 23 | int inform, unsigned long mask, long minsize, long maxsize) | - | ||||||||||||||||||||||||||||||
| 24 | { | - | ||||||||||||||||||||||||||||||
| 25 | int str_type; | - | ||||||||||||||||||||||||||||||
| 26 | int ret; | - | ||||||||||||||||||||||||||||||
| 27 | char free_out; | - | ||||||||||||||||||||||||||||||
| 28 | int outform, outlen = 0; | - | ||||||||||||||||||||||||||||||
| 29 | ASN1_STRING *dest; | - | ||||||||||||||||||||||||||||||
| 30 | unsigned char *p; | - | ||||||||||||||||||||||||||||||
| 31 | int nchar; | - | ||||||||||||||||||||||||||||||
| 32 | int (*cpyfunc)(unsigned long, void *) = | - | ||||||||||||||||||||||||||||||
| 33 | ((void *)0) | - | ||||||||||||||||||||||||||||||
| 34 | ; | - | ||||||||||||||||||||||||||||||
| 35 | - | |||||||||||||||||||||||||||||||
| 36 | if (len < 0
| 32-1839 | ||||||||||||||||||||||||||||||
| 37 | len = strlen((const char *)in); executed 32 times by 2 tests: len = strlen((const char *)in);Executed by:
| 32 | ||||||||||||||||||||||||||||||
| 38 | if (!mask
| 0-1871 | ||||||||||||||||||||||||||||||
| 39 | mask = (0x0002|0x0004|0x0800|0x2000); never executed: mask = (0x0002|0x0004|0x0800|0x2000); | 0 | ||||||||||||||||||||||||||||||
| 40 | - | |||||||||||||||||||||||||||||||
| 41 | - | |||||||||||||||||||||||||||||||
| 42 | switch (inform) { | - | ||||||||||||||||||||||||||||||
| 43 | case never executed: (0x1000|2):case (0x1000|2):never executed: case (0x1000|2): | 0 | ||||||||||||||||||||||||||||||
| 44 | if (len & 1
| 0 | ||||||||||||||||||||||||||||||
| 45 | ERR_put_error(13,(0xfff),(129),__FILE__,116); | - | ||||||||||||||||||||||||||||||
| 46 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||||||||||||||
| 47 | } | - | ||||||||||||||||||||||||||||||
| 48 | nchar = len >> 1; | - | ||||||||||||||||||||||||||||||
| 49 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 50 | - | |||||||||||||||||||||||||||||||
| 51 | case never executed: (0x1000|4):case (0x1000|4):never executed: case (0x1000|4): | 0 | ||||||||||||||||||||||||||||||
| 52 | if (len & 3
| 0 | ||||||||||||||||||||||||||||||
| 53 | ERR_put_error(13,(0xfff),(133),__FILE__,124); | - | ||||||||||||||||||||||||||||||
| 54 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||||||||||||||
| 55 | } | - | ||||||||||||||||||||||||||||||
| 56 | nchar = len >> 2; | - | ||||||||||||||||||||||||||||||
| 57 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 58 | - | |||||||||||||||||||||||||||||||
| 59 | case executed 1392 times by 8 tests: (0x1000):case (0x1000):Executed by:
executed 1392 times by 8 tests: case (0x1000):Executed by:
| 1392 | ||||||||||||||||||||||||||||||
| 60 | nchar = 0; | - | ||||||||||||||||||||||||||||||
| 61 | - | |||||||||||||||||||||||||||||||
| 62 | ret = traverse_string(in, len, (0x1000), in_utf8, &nchar); | - | ||||||||||||||||||||||||||||||
| 63 | if (ret < 0
| 0-1392 | ||||||||||||||||||||||||||||||
| 64 | ERR_put_error(13,(0xfff),(134),__FILE__,135); | - | ||||||||||||||||||||||||||||||
| 65 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||||||||||||||
| 66 | } | - | ||||||||||||||||||||||||||||||
| 67 | break; executed 1392 times by 8 tests: break;Executed by:
| 1392 | ||||||||||||||||||||||||||||||
| 68 | - | |||||||||||||||||||||||||||||||
| 69 | case executed 479 times by 7 tests: (0x1000|1):case (0x1000|1):Executed by:
executed 479 times by 7 tests: case (0x1000|1):Executed by:
| 479 | ||||||||||||||||||||||||||||||
| 70 | nchar = len; | - | ||||||||||||||||||||||||||||||
| 71 | break; executed 479 times by 7 tests: break;Executed by:
| 479 | ||||||||||||||||||||||||||||||
| 72 | - | |||||||||||||||||||||||||||||||
| 73 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||||||||
| 74 | ERR_put_error(13,(0xfff),(160),__FILE__,145); | - | ||||||||||||||||||||||||||||||
| 75 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||||||||||||||
| 76 | } | - | ||||||||||||||||||||||||||||||
| 77 | - | |||||||||||||||||||||||||||||||
| 78 | if ((
| 0-1838 | ||||||||||||||||||||||||||||||
| 79 | ERR_put_error(13,(0xfff),(152),__FILE__,150); | - | ||||||||||||||||||||||||||||||
| 80 | ERR_asprintf_error_data("minsize=%ld", minsize); | - | ||||||||||||||||||||||||||||||
| 81 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||||||||||||||
| 82 | } | - | ||||||||||||||||||||||||||||||
| 83 | - | |||||||||||||||||||||||||||||||
| 84 | if ((
| 0-1838 | ||||||||||||||||||||||||||||||
| 85 | ERR_put_error(13,(0xfff),(151),__FILE__,156); | - | ||||||||||||||||||||||||||||||
| 86 | ERR_asprintf_error_data("maxsize=%ld", maxsize); | - | ||||||||||||||||||||||||||||||
| 87 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||||||||||||||
| 88 | } | - | ||||||||||||||||||||||||||||||
| 89 | - | |||||||||||||||||||||||||||||||
| 90 | - | |||||||||||||||||||||||||||||||
| 91 | if (traverse_string(in, len, inform, type_str, &mask) < 0
| 0-1871 | ||||||||||||||||||||||||||||||
| 92 | ERR_put_error(13,(0xfff),(124),__FILE__,163); | - | ||||||||||||||||||||||||||||||
| 93 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||||||||||||||
| 94 | } | - | ||||||||||||||||||||||||||||||
| 95 | - | |||||||||||||||||||||||||||||||
| 96 | - | |||||||||||||||||||||||||||||||
| 97 | - | |||||||||||||||||||||||||||||||
| 98 | outform = (0x1000|1); | - | ||||||||||||||||||||||||||||||
| 99 | if (mask & 0x0002
| 2-1869 | ||||||||||||||||||||||||||||||
| 100 | str_type = 19; executed 2 times by 1 test: str_type = 19;Executed by:
| 2 | ||||||||||||||||||||||||||||||
| 101 | else if (mask & 0x0010
| 0-1869 | ||||||||||||||||||||||||||||||
| 102 | str_type = 22; never executed: str_type = 22; | 0 | ||||||||||||||||||||||||||||||
| 103 | else if (mask & 0x0004
| 0-1869 | ||||||||||||||||||||||||||||||
| 104 | str_type = 20; never executed: str_type = 20; | 0 | ||||||||||||||||||||||||||||||
| 105 | else if (mask & 0x0800
| 0-1869 | ||||||||||||||||||||||||||||||
| 106 | str_type = 30; | - | ||||||||||||||||||||||||||||||
| 107 | outform = (0x1000|2); | - | ||||||||||||||||||||||||||||||
| 108 | } never executed: else if (mask & 0x0100end of block
| 0-1869 | ||||||||||||||||||||||||||||||
| 109 | str_type = 28; | - | ||||||||||||||||||||||||||||||
| 110 | outform = (0x1000|4); | - | ||||||||||||||||||||||||||||||
| 111 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 112 | str_type = 12; | - | ||||||||||||||||||||||||||||||
| 113 | outform = (0x1000); | - | ||||||||||||||||||||||||||||||
| 114 | } executed 1869 times by 8 tests: end of blockExecuted by:
| 1869 | ||||||||||||||||||||||||||||||
| 115 | if (!out
| 0-1871 | ||||||||||||||||||||||||||||||
| 116 | return never executed: str_type;return str_type;never executed: return str_type; | 0 | ||||||||||||||||||||||||||||||
| 117 | if (*
| 0-1871 | ||||||||||||||||||||||||||||||
| 118 | free_out = 0; | - | ||||||||||||||||||||||||||||||
| 119 | dest = *out; | - | ||||||||||||||||||||||||||||||
| 120 | if (dest->data
| 0-1871 | ||||||||||||||||||||||||||||||
| 121 | dest->length = 0; | - | ||||||||||||||||||||||||||||||
| 122 | free(dest->data); | - | ||||||||||||||||||||||||||||||
| 123 | dest->data = | - | ||||||||||||||||||||||||||||||
| 124 | ((void *)0) | - | ||||||||||||||||||||||||||||||
| 125 | ; | - | ||||||||||||||||||||||||||||||
| 126 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 127 | dest->type = str_type; | - | ||||||||||||||||||||||||||||||
| 128 | } executed 1871 times by 8 tests: else {end of blockExecuted by:
| 1871 | ||||||||||||||||||||||||||||||
| 129 | free_out = 1; | - | ||||||||||||||||||||||||||||||
| 130 | dest = ASN1_STRING_type_new(str_type); | - | ||||||||||||||||||||||||||||||
| 131 | if (!dest
| 0 | ||||||||||||||||||||||||||||||
| 132 | ERR_put_error(13,(0xfff),((1|64)),__FILE__,201); | - | ||||||||||||||||||||||||||||||
| 133 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||||||||||||||
| 134 | } | - | ||||||||||||||||||||||||||||||
| 135 | *out = dest; | - | ||||||||||||||||||||||||||||||
| 136 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 137 | - | |||||||||||||||||||||||||||||||
| 138 | if (inform == outform
| 477-1394 | ||||||||||||||||||||||||||||||
| 139 | if (!ASN1_STRING_set(dest, in, len)
| 0-1394 | ||||||||||||||||||||||||||||||
| 140 | ERR_put_error(13,(0xfff),((1|64)),__FILE__,209); | - | ||||||||||||||||||||||||||||||
| 141 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||||||||
| 142 | } | - | ||||||||||||||||||||||||||||||
| 143 | return executed 1394 times by 8 tests: str_type;return str_type;Executed by:
executed 1394 times by 8 tests: return str_type;Executed by:
| 1394 | ||||||||||||||||||||||||||||||
| 144 | } | - | ||||||||||||||||||||||||||||||
| 145 | - | |||||||||||||||||||||||||||||||
| 146 | - | |||||||||||||||||||||||||||||||
| 147 | switch (outform) { | - | ||||||||||||||||||||||||||||||
| 148 | case never executed: (0x1000|1):case (0x1000|1):never executed: case (0x1000|1): | 0 | ||||||||||||||||||||||||||||||
| 149 | outlen = nchar; | - | ||||||||||||||||||||||||||||||
| 150 | cpyfunc = cpy_asc; | - | ||||||||||||||||||||||||||||||
| 151 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 152 | - | |||||||||||||||||||||||||||||||
| 153 | case never executed: (0x1000|2):case (0x1000|2):never executed: case (0x1000|2): | 0 | ||||||||||||||||||||||||||||||
| 154 | outlen = nchar << 1; | - | ||||||||||||||||||||||||||||||
| 155 | cpyfunc = cpy_bmp; | - | ||||||||||||||||||||||||||||||
| 156 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 157 | - | |||||||||||||||||||||||||||||||
| 158 | case never executed: (0x1000|4):case (0x1000|4):never executed: case (0x1000|4): | 0 | ||||||||||||||||||||||||||||||
| 159 | outlen = nchar << 2; | - | ||||||||||||||||||||||||||||||
| 160 | cpyfunc = cpy_univ; | - | ||||||||||||||||||||||||||||||
| 161 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 162 | - | |||||||||||||||||||||||||||||||
| 163 | case executed 477 times by 7 tests: (0x1000):case (0x1000):Executed by:
executed 477 times by 7 tests: case (0x1000):Executed by:
| 477 | ||||||||||||||||||||||||||||||
| 164 | outlen = 0; | - | ||||||||||||||||||||||||||||||
| 165 | if (traverse_string(in, len, inform, out_utf8, &outlen) < 0
| 0-477 | ||||||||||||||||||||||||||||||
| 166 | ERR_put_error(13,(0xfff),(124),__FILE__,235); | - | ||||||||||||||||||||||||||||||
| 167 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||||||||
| 168 | } | - | ||||||||||||||||||||||||||||||
| 169 | cpyfunc = cpy_utf8; | - | ||||||||||||||||||||||||||||||
| 170 | break; executed 477 times by 7 tests: break;Executed by:
| 477 | ||||||||||||||||||||||||||||||
| 171 | } | - | ||||||||||||||||||||||||||||||
| 172 | if (!(p = malloc(outlen + 1))
| 0-477 | ||||||||||||||||||||||||||||||
| 173 | ERR_put_error(13,(0xfff),((1|64)),__FILE__,242); | - | ||||||||||||||||||||||||||||||
| 174 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||||||||
| 175 | } | - | ||||||||||||||||||||||||||||||
| 176 | dest->length = outlen; | - | ||||||||||||||||||||||||||||||
| 177 | dest->data = p; | - | ||||||||||||||||||||||||||||||
| 178 | p[outlen] = 0; | - | ||||||||||||||||||||||||||||||
| 179 | traverse_string(in, len, inform, cpyfunc, &p); | - | ||||||||||||||||||||||||||||||
| 180 | return executed 477 times by 7 tests: str_type;return str_type;Executed by:
executed 477 times by 7 tests: return str_type;Executed by:
| 477 | ||||||||||||||||||||||||||||||
| 181 | - | |||||||||||||||||||||||||||||||
| 182 | err: | - | ||||||||||||||||||||||||||||||
| 183 | if (free_out
| 0 | ||||||||||||||||||||||||||||||
| 184 | ASN1_STRING_free(dest); | - | ||||||||||||||||||||||||||||||
| 185 | *out = | - | ||||||||||||||||||||||||||||||
| 186 | ((void *)0) | - | ||||||||||||||||||||||||||||||
| 187 | ; | - | ||||||||||||||||||||||||||||||
| 188 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 189 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||||||||||||||
| 190 | } | - | ||||||||||||||||||||||||||||||
| 191 | - | |||||||||||||||||||||||||||||||
| 192 | - | |||||||||||||||||||||||||||||||
| 193 | - | |||||||||||||||||||||||||||||||
| 194 | - | |||||||||||||||||||||||||||||||
| 195 | - | |||||||||||||||||||||||||||||||
| 196 | static int | - | ||||||||||||||||||||||||||||||
| 197 | traverse_string(const unsigned char *p, int len, int inform, | - | ||||||||||||||||||||||||||||||
| 198 | int (*rfunc)(unsigned long value, void *in), void *arg) | - | ||||||||||||||||||||||||||||||
| 199 | { | - | ||||||||||||||||||||||||||||||
| 200 | unsigned long value; | - | ||||||||||||||||||||||||||||||
| 201 | int ret; | - | ||||||||||||||||||||||||||||||
| 202 | - | |||||||||||||||||||||||||||||||
| 203 | while (len
| 4217-58449 | ||||||||||||||||||||||||||||||
| 204 | switch (inform) { | - | ||||||||||||||||||||||||||||||
| 205 | case executed 3937 times by 7 tests: (0x1000|1):case (0x1000|1):Executed by:
executed 3937 times by 7 tests: case (0x1000|1):Executed by:
| 3937 | ||||||||||||||||||||||||||||||
| 206 | value = *p++; | - | ||||||||||||||||||||||||||||||
| 207 | len--; | - | ||||||||||||||||||||||||||||||
| 208 | break; executed 3937 times by 7 tests: break;Executed by:
| 3937 | ||||||||||||||||||||||||||||||
| 209 | case never executed: (0x1000|2):case (0x1000|2):never executed: case (0x1000|2): | 0 | ||||||||||||||||||||||||||||||
| 210 | value = *p++ << 8; | - | ||||||||||||||||||||||||||||||
| 211 | value |= *p++; | - | ||||||||||||||||||||||||||||||
| 212 | - | |||||||||||||||||||||||||||||||
| 213 | if (((
| 0 | ||||||||||||||||||||||||||||||
| 214 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||||||||||||||
| 215 | len -= 2; | - | ||||||||||||||||||||||||||||||
| 216 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 217 | case never executed: (0x1000|4):case (0x1000|4):never executed: case (0x1000|4): | 0 | ||||||||||||||||||||||||||||||
| 218 | value = (unsigned long)*p++ << 24; | - | ||||||||||||||||||||||||||||||
| 219 | value |= *p++ << 16; | - | ||||||||||||||||||||||||||||||
| 220 | value |= *p++ << 8; | - | ||||||||||||||||||||||||||||||
| 221 | value |= *p++; | - | ||||||||||||||||||||||||||||||
| 222 | if (value > 0x10FFFF
| 0 | ||||||||||||||||||||||||||||||
| 223 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||||||||||||||
| 224 | len -= 4; | - | ||||||||||||||||||||||||||||||
| 225 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 226 | default executed 54512 times by 8 tests: :default:Executed by:
executed 54512 times by 8 tests: default:Executed by:
| 54512 | ||||||||||||||||||||||||||||||
| 227 | ret = UTF8_getc(p, len, &value); | - | ||||||||||||||||||||||||||||||
| 228 | if (ret < 0
| 0-54512 | ||||||||||||||||||||||||||||||
| 229 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||||||||||||||
| 230 | len -= ret; | - | ||||||||||||||||||||||||||||||
| 231 | p += ret; | - | ||||||||||||||||||||||||||||||
| 232 | break; executed 54512 times by 8 tests: break;Executed by:
| 54512 | ||||||||||||||||||||||||||||||
| 233 | } | - | ||||||||||||||||||||||||||||||
| 234 | if (rfunc
| 0-58449 | ||||||||||||||||||||||||||||||
| 235 | ret = rfunc(value, arg); | - | ||||||||||||||||||||||||||||||
| 236 | if (ret <= 0
| 0-58449 | ||||||||||||||||||||||||||||||
| 237 | return never executed: ret;return ret;never executed: return ret; | 0 | ||||||||||||||||||||||||||||||
| 238 | } executed 58449 times by 8 tests: end of blockExecuted by:
| 58449 | ||||||||||||||||||||||||||||||
| 239 | } executed 58449 times by 8 tests: end of blockExecuted by:
| 58449 | ||||||||||||||||||||||||||||||
| 240 | return executed 4217 times by 8 tests: 1;return 1;Executed by:
executed 4217 times by 8 tests: return 1;Executed by:
| 4217 | ||||||||||||||||||||||||||||||
| 241 | } | - | ||||||||||||||||||||||||||||||
| 242 | - | |||||||||||||||||||||||||||||||
| 243 | - | |||||||||||||||||||||||||||||||
| 244 | - | |||||||||||||||||||||||||||||||
| 245 | - | |||||||||||||||||||||||||||||||
| 246 | - | |||||||||||||||||||||||||||||||
| 247 | static int | - | ||||||||||||||||||||||||||||||
| 248 | in_utf8(unsigned long value, void *arg) | - | ||||||||||||||||||||||||||||||
| 249 | { | - | ||||||||||||||||||||||||||||||
| 250 | int *nchar; | - | ||||||||||||||||||||||||||||||
| 251 | - | |||||||||||||||||||||||||||||||
| 252 | nchar = arg; | - | ||||||||||||||||||||||||||||||
| 253 | (*nchar)++; | - | ||||||||||||||||||||||||||||||
| 254 | return executed 27256 times by 8 tests: 1;return 1;Executed by:
executed 27256 times by 8 tests: return 1;Executed by:
| 27256 | ||||||||||||||||||||||||||||||
| 255 | } | - | ||||||||||||||||||||||||||||||
| 256 | - | |||||||||||||||||||||||||||||||
| 257 | - | |||||||||||||||||||||||||||||||
| 258 | - | |||||||||||||||||||||||||||||||
| 259 | static int | - | ||||||||||||||||||||||||||||||
| 260 | out_utf8(unsigned long value, void *arg) | - | ||||||||||||||||||||||||||||||
| 261 | { | - | ||||||||||||||||||||||||||||||
| 262 | int *outlen; | - | ||||||||||||||||||||||||||||||
| 263 | int ret; | - | ||||||||||||||||||||||||||||||
| 264 | - | |||||||||||||||||||||||||||||||
| 265 | outlen = arg; | - | ||||||||||||||||||||||||||||||
| 266 | ret = UTF8_putc( | - | ||||||||||||||||||||||||||||||
| 267 | ((void *)0) | - | ||||||||||||||||||||||||||||||
| 268 | , -1, value); | - | ||||||||||||||||||||||||||||||
| 269 | if (ret < 0
| 0-1311 | ||||||||||||||||||||||||||||||
| 270 | return never executed: ret;return ret;never executed: return ret; | 0 | ||||||||||||||||||||||||||||||
| 271 | *outlen += ret; | - | ||||||||||||||||||||||||||||||
| 272 | return executed 1311 times by 7 tests: 1;return 1;Executed by:
executed 1311 times by 7 tests: return 1;Executed by:
| 1311 | ||||||||||||||||||||||||||||||
| 273 | } | - | ||||||||||||||||||||||||||||||
| 274 | - | |||||||||||||||||||||||||||||||
| 275 | - | |||||||||||||||||||||||||||||||
| 276 | - | |||||||||||||||||||||||||||||||
| 277 | - | |||||||||||||||||||||||||||||||
| 278 | - | |||||||||||||||||||||||||||||||
| 279 | static int | - | ||||||||||||||||||||||||||||||
| 280 | type_str(unsigned long value, void *arg) | - | ||||||||||||||||||||||||||||||
| 281 | { | - | ||||||||||||||||||||||||||||||
| 282 | unsigned long types; | - | ||||||||||||||||||||||||||||||
| 283 | - | |||||||||||||||||||||||||||||||
| 284 | types = *((unsigned long *)arg); | - | ||||||||||||||||||||||||||||||
| 285 | if ((
| 0-28567 | ||||||||||||||||||||||||||||||
| 286 | types &= ~0x0002; never executed: types &= ~0x0002; | 0 | ||||||||||||||||||||||||||||||
| 287 | if ((
| 0-28571 | ||||||||||||||||||||||||||||||
| 288 | types &= ~0x0010; never executed: types &= ~0x0010; | 0 | ||||||||||||||||||||||||||||||
| 289 | if ((
| 0-28571 | ||||||||||||||||||||||||||||||
| 290 | types &= ~0x0004; never executed: types &= ~0x0004; | 0 | ||||||||||||||||||||||||||||||
| 291 | if ((
| 0-28571 | ||||||||||||||||||||||||||||||
| 292 | types &= ~0x0800; never executed: types &= ~0x0800; | 0 | ||||||||||||||||||||||||||||||
| 293 | if (!types
| 0-28571 | ||||||||||||||||||||||||||||||
| 294 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||||||||||||||
| 295 | *((unsigned long *)arg) = types; | - | ||||||||||||||||||||||||||||||
| 296 | return executed 28571 times by 8 tests: 1;return 1;Executed by:
executed 28571 times by 8 tests: return 1;Executed by:
| 28571 | ||||||||||||||||||||||||||||||
| 297 | } | - | ||||||||||||||||||||||||||||||
| 298 | - | |||||||||||||||||||||||||||||||
| 299 | - | |||||||||||||||||||||||||||||||
| 300 | - | |||||||||||||||||||||||||||||||
| 301 | static int | - | ||||||||||||||||||||||||||||||
| 302 | cpy_asc(unsigned long value, void *arg) | - | ||||||||||||||||||||||||||||||
| 303 | { | - | ||||||||||||||||||||||||||||||
| 304 | unsigned char **p, *q; | - | ||||||||||||||||||||||||||||||
| 305 | - | |||||||||||||||||||||||||||||||
| 306 | p = arg; | - | ||||||||||||||||||||||||||||||
| 307 | q = *p; | - | ||||||||||||||||||||||||||||||
| 308 | *q = value; | - | ||||||||||||||||||||||||||||||
| 309 | (*p)++; | - | ||||||||||||||||||||||||||||||
| 310 | return never executed: 1;return 1;never executed: return 1; | 0 | ||||||||||||||||||||||||||||||
| 311 | } | - | ||||||||||||||||||||||||||||||
| 312 | - | |||||||||||||||||||||||||||||||
| 313 | - | |||||||||||||||||||||||||||||||
| 314 | - | |||||||||||||||||||||||||||||||
| 315 | static int | - | ||||||||||||||||||||||||||||||
| 316 | cpy_bmp(unsigned long value, void *arg) | - | ||||||||||||||||||||||||||||||
| 317 | { | - | ||||||||||||||||||||||||||||||
| 318 | unsigned char **p, *q; | - | ||||||||||||||||||||||||||||||
| 319 | - | |||||||||||||||||||||||||||||||
| 320 | p = arg; | - | ||||||||||||||||||||||||||||||
| 321 | q = *p; | - | ||||||||||||||||||||||||||||||
| 322 | *q++ = (value >> 8) & 0xff; | - | ||||||||||||||||||||||||||||||
| 323 | *q = value & 0xff; | - | ||||||||||||||||||||||||||||||
| 324 | *p += 2; | - | ||||||||||||||||||||||||||||||
| 325 | return never executed: 1;return 1;never executed: return 1; | 0 | ||||||||||||||||||||||||||||||
| 326 | } | - | ||||||||||||||||||||||||||||||
| 327 | - | |||||||||||||||||||||||||||||||
| 328 | - | |||||||||||||||||||||||||||||||
| 329 | - | |||||||||||||||||||||||||||||||
| 330 | static int | - | ||||||||||||||||||||||||||||||
| 331 | cpy_univ(unsigned long value, void *arg) | - | ||||||||||||||||||||||||||||||
| 332 | { | - | ||||||||||||||||||||||||||||||
| 333 | unsigned char **p, *q; | - | ||||||||||||||||||||||||||||||
| 334 | - | |||||||||||||||||||||||||||||||
| 335 | p = arg; | - | ||||||||||||||||||||||||||||||
| 336 | q = *p; | - | ||||||||||||||||||||||||||||||
| 337 | *q++ = (value >> 24) & 0xff; | - | ||||||||||||||||||||||||||||||
| 338 | *q++ = (value >> 16) & 0xff; | - | ||||||||||||||||||||||||||||||
| 339 | *q++ = (value >> 8) & 0xff; | - | ||||||||||||||||||||||||||||||
| 340 | *q = value & 0xff; | - | ||||||||||||||||||||||||||||||
| 341 | *p += 4; | - | ||||||||||||||||||||||||||||||
| 342 | return never executed: 1;return 1;never executed: return 1; | 0 | ||||||||||||||||||||||||||||||
| 343 | } | - | ||||||||||||||||||||||||||||||
| 344 | - | |||||||||||||||||||||||||||||||
| 345 | - | |||||||||||||||||||||||||||||||
| 346 | - | |||||||||||||||||||||||||||||||
| 347 | static int | - | ||||||||||||||||||||||||||||||
| 348 | cpy_utf8(unsigned long value, void *arg) | - | ||||||||||||||||||||||||||||||
| 349 | { | - | ||||||||||||||||||||||||||||||
| 350 | unsigned char **p; | - | ||||||||||||||||||||||||||||||
| 351 | - | |||||||||||||||||||||||||||||||
| 352 | int ret; | - | ||||||||||||||||||||||||||||||
| 353 | p = arg; | - | ||||||||||||||||||||||||||||||
| 354 | - | |||||||||||||||||||||||||||||||
| 355 | ret = UTF8_putc(*p, 0xff, value); | - | ||||||||||||||||||||||||||||||
| 356 | *p += ret; | - | ||||||||||||||||||||||||||||||
| 357 | return executed 1311 times by 7 tests: 1;return 1;Executed by:
executed 1311 times by 7 tests: return 1;Executed by:
| 1311 | ||||||||||||||||||||||||||||||
| 358 | } | - | ||||||||||||||||||||||||||||||
| 359 | - | |||||||||||||||||||||||||||||||
| 360 | - | |||||||||||||||||||||||||||||||
| 361 | static int | - | ||||||||||||||||||||||||||||||
| 362 | is_printable(unsigned long value) | - | ||||||||||||||||||||||||||||||
| 363 | { | - | ||||||||||||||||||||||||||||||
| 364 | int ch; | - | ||||||||||||||||||||||||||||||
| 365 | - | |||||||||||||||||||||||||||||||
| 366 | if (value > 0x7f
| 0-4 | ||||||||||||||||||||||||||||||
| 367 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
| 368 | ch = (int)value; | - | ||||||||||||||||||||||||||||||
| 369 | - | |||||||||||||||||||||||||||||||
| 370 | - | |||||||||||||||||||||||||||||||
| 371 | - | |||||||||||||||||||||||||||||||
| 372 | - | |||||||||||||||||||||||||||||||
| 373 | if ((
| 0-4 | ||||||||||||||||||||||||||||||
| 374 | return never executed: 1;return 1;never executed: return 1; | 0 | ||||||||||||||||||||||||||||||
| 375 | if ((
| 0-4 | ||||||||||||||||||||||||||||||
| 376 | return executed 4 times by 1 test: 1;return 1;Executed by:
executed 4 times by 1 test: return 1;Executed by:
| 4 | ||||||||||||||||||||||||||||||
| 377 | if ((
| 0 | ||||||||||||||||||||||||||||||
| 378 | return never executed: 1;return 1;never executed: return 1; | 0 | ||||||||||||||||||||||||||||||
| 379 | if ((
| 0 | ||||||||||||||||||||||||||||||
| 380 | (
| 0 | ||||||||||||||||||||||||||||||
| 381 | ch
| 0 | ||||||||||||||||||||||||||||||
| 382 | )
| 0 | ||||||||||||||||||||||||||||||
| 383 | "'()+,-./:=?"
| 0 | ||||||||||||||||||||||||||||||
| 384 | )
| 0 | ||||||||||||||||||||||||||||||
| 385 | ch
| 0 | ||||||||||||||||||||||||||||||
| 386 | ) == '\0'
| 0 | ||||||||||||||||||||||||||||||
| 387 | "'()+,-./:=?"
| 0 | ||||||||||||||||||||||||||||||
| 388 | ,
| 0 | ||||||||||||||||||||||||||||||
| 389 | ch
| 0 | ||||||||||||||||||||||||||||||
| 390 | ) : __builtin_strchr (
| 0 | ||||||||||||||||||||||||||||||
| 391 | "'()+,-./:=?"
| 0 | ||||||||||||||||||||||||||||||
| 392 | ,
| 0 | ||||||||||||||||||||||||||||||
| 393 | ch
| 0 | ||||||||||||||||||||||||||||||
| 394 | )))
| 0 | ||||||||||||||||||||||||||||||
| 395 | ) | - | ||||||||||||||||||||||||||||||
| 396 | return never executed: 1;return 1;never executed: return 1; | 0 | ||||||||||||||||||||||||||||||
| 397 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
| 398 | } | - | ||||||||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |