(/home/sate/Testcases/c/cve/wireshark-1.2.0/gtk/supported_protos_dlg.c) |
| |
| 193 | | | static void set_supported_text(GtkWidget *w, supported_type_t type) |
| 194 | | | { |
| 195 | | | |
| 196 | | | #define BUFF_LEN 4096 |
| 197 | | | #define B_LEN 256 |
| 198 | | | char buffer[BUFF_LEN]; |
| 199 | | | *hfinfo; |
| 200 | | | int i, len, maxlen = 0, maxlen2 = 0, maxlen4 = 0; |
| 201 | | | const char *type_name; |
| 202 | | | void *cookie, *cookie2; |
| 203 | | | protocol_t *protocol; |
| 204 | | | const char *name, *short_name, *filter_name; |
| 205 | | | int namel = 0, short_namel = 0, filter_namel = 0; |
| 206 | | | int count, fcount; |
| 207 | | | |
| 208 | | | |
| 209 | | | |
| 210 | | | |
| 211 | | | |
| 212 | | | |
| 213 | | | |
| 214 | | | |
| 215 | | | |
| 216 | | | |
| 217 | | | |
| 218 | | | switch(type) { |
| 219 | | | |
| 220 | | | case PROTOCOL_SUPPORTED : |
| 221 | | | |
| 222 | | | count = 0; |
| 223 | | | for (i = proto_get_first_protocol(&cookie); i != -1; |
| 224 | | | i = proto_get_next_protocol(&cookie)) { |
| 225 | | | count++; |
| 226 | | | protocol = find_protocol_by_id(i); |
| 227 | | | name = proto_get_protocol_name(i); |
| 228 | | | short_name = proto_get_protocol_short_name(protocol); |
| 229 | | | filter_name = proto_get_protocol_filter_name(i); |
| 230 | | | if ((len = (int) strlen(name)) > namel) |
| 231 | | | namel = len; |
| 232 | | | if ((len = (int) strlen(short_name)) > short_namel) |
| 233 | | | short_namel = len; |
| 234 | | | if ((len = (int) strlen(filter_name)) > filter_namel) |
| 235 | | | filter_namel = len; |
| 236 | | | } |
| 237 | | | maxlen = namel + short_namel + filter_namel; |
| 238 | | | |
| 239 | | | len = g_snprintf(buffer, BUFF_LEN, proto_supported, count); |
| 240 | | | insert_text(w, buffer, len); |
| 241 | | | |
| 242 | | | |
| 243 | | | for (i = proto_get_first_protocol(&cookie); i != -1; |
| 244 | | | i = proto_get_next_protocol(&cookie)) { |
| 245 | | | protocol = find_protocol_by_id(i); |
| 246 | | | name = proto_get_protocol_name(i); |
| 247 | | | short_name = proto_get_protocol_short_name(protocol); |
| 248 | | | filter_name = proto_get_protocol_filter_name(i); |
| 249 | | | |
| 250 | | | |
| 251 | | | len = g_snprintf(buffer, BUFF_LEN, "%*s %*s %*s\n", |
| 252 | | | -short_namel, short_name, |
| 253 | | | -namel, name, |
| 254 | | | -filter_namel, filter_name); |
| 255 | | | insert_text(w, buffer, (int) strlen(buffer)); |
| 256 | | | } |
| 257 | | | |
| 258 | | | break; |
| 259 | | | |
| 260 | | | case DFILTER_SUPPORTED : |
| 261 | | | |
| 262 | | | |
| 263 | | | |
| 264 | | | |
| 265 | | | for (i = proto_get_first_protocol(&cookie); i != -1; |
| 266 | | | i = proto_get_next_protocol(&cookie)) { |
| 267 | | | |
| 268 | | | for (hfinfo = proto_get_first_protocol_field(i, &cookie2); hfinfo != NULL; |
| 269 | | | hfinfo = proto_get_next_protocol_field(&cookie2)) { |
| 270 | | | |
| 271 | | | if (hfinfo->same_name_prev != NULL) |
| 272 | | | continue; |
| 273 | | | |
| 274 | | | if ((len = (int) strlen(hfinfo->abbrev)) > maxlen) |
| 275 | | | maxlen = len; |
| 276 | | | if ((len = (int) strlen(hfinfo->name)) > maxlen2) |
| 277 | | | maxlen2 = len; |
| 278 | | | if (hfinfo->blurb != NULL) { |
| 279 | | | if ((len = (int) strlen(hfinfo->blurb)) > maxlen4) |
| 280 | | | maxlen4 = len; |
| 281 | | | } |
| 282 | | | } |
| 283 | | | } |
| 284 | | | |
| 285 | | | insert_text(w, dfilter_supported, (int) strlen(dfilter_supported)); |
| 286 | | | |
| 287 | | | fcount = 0; |
| 288 | | | for (i = proto_get_first_protocol(&cookie); i != -1; |
| 289 | | | i = proto_get_next_protocol(&cookie)) { |
| 290 | | | protocol = find_protocol_by_id(i); |
| 291 | | | name = proto_get_protocol_name(i); |
| 292 | | | short_name = proto_get_protocol_short_name(protocol); |
| 293 | | | filter_name = proto_get_protocol_filter_name(i); |
| 294 | | | |
| 295 | | | count = 0; |
| 296 | | | for (hfinfo = proto_get_first_protocol_field(i, &cookie2); hfinfo != NULL; |
| 297 | | | hfinfo = proto_get_next_protocol_field(&cookie2)) { |
| 298 | | | |
| 299 | | | if (hfinfo->same_name_prev != NULL) |
| 300 | | | continue; |
| 301 | | | count++; |
| 302 | | | } |
| 303 | | | fcount += count; |
| 304 | | | |
| 305 | | | len = g_snprintf(buffer, BUFF_LEN, "\n%s - %s (%s) [%d fields]:\n", |
| 306 | | | short_name, name, filter_name, count); |
| 307 | | | insert_text(w, buffer, len); |
| 308 | | | |
| 309 | | | for (hfinfo = proto_get_first_protocol_field(i, &cookie2); hfinfo != NULL; |
| 310 | | | hfinfo = proto_get_next_protocol_field(&cookie2)) { |
| 311 | | | |
| 312 | | | if (hfinfo->same_name_prev != NULL) |
| 313 | | | continue; |
| 314 | | | |
| 315 | | | type_name = ftype_pretty_name(hfinfo->type); |
| 316 | | | if (hfinfo->blurb != NULL && hfinfo->blurb[0] != '\0') { |
| 317 | | | len = g_snprintf(buffer, BUFF_LEN, "%*s %*s %*s (%s)\n", |
| 318 | | | -maxlen, hfinfo->abbrev, |
| 319 | | | -maxlen2, hfinfo->name, |
| 320 | | | -maxlen4, hfinfo->blurb, |
| 321 | | | type_name); |
| 322 | | | } else { |
| 323 | | | len = g_snprintf(buffer, BUFF_LEN, "%*s %*s (%s)\n", |
| 324 | | | -maxlen, hfinfo->abbrev, |
| 325 | | | -maxlen2, hfinfo->name, |
| 326 | | | type_name); |
| 327 | | | } |
| 328 | | | insert_text(w, buffer, (int) strlen(buffer)); |
| 329 | | | } |
| 330 | | | } |
| 331 | | | len = g_snprintf(buffer, BUFF_LEN, "\n-- Total %d fields\n", fcount); |
| 332 | | | insert_text(w, buffer, len); |
| 333 | | | |
| 334 | | | break; |
| 335 | | | default : |
| 336 | | | g_assert_not_reached();
x /usr/include/glib-2.0/glib/gtestutils.h |
| |
73 | #define g_assert_not_reached() do { g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, NULL); } while (0) |
| |
x /usr/include/glib-2.0/glib/gmacros.h |
| |
160 | # define G_STRFUNC ((const char*) (__PRETTY_FUNCTION__)) |
| |
|
| 337 | | | break; |
Unreachable Control Flow
The highlighted code will not execute under any circumstances. This may be because of: |
|
| 338 | | | } |
| 339 | | | } |
| |