(/home/sate/Testcases/c/cve/wireshark-1.2.0/gtk/uat_gui.c) |
| |
| 271 | | | static gboolean uat_dlg_cb(GtkWidget *win _U_, gpointer user_data) { |
| 272 | | | struct _uat_dlg_data* dd = user_data; |
| 273 | | | guint ncols = dd->uat->ncols; |
| 274 | | | uat_field_t* f = dd->uat->fields; |
| 275 | | | const char* err = NULL; |
| 276 | | | guint colnum; |
| 277 | | | |
| 278 | | | for ( colnum = 0; colnum < ncols; colnum++ ) { |
| 279 | | | void* e = g_ptr_array_index(dd->entries,colnum);
x /usr/include/glib-2.0/glib/garray.h |
| |
111 | #define g_ptr_array_index(array,index_) ((array)->pdata)[index_] |
| |
|
| 280 | | | const char* text; |
| 281 | | | unsigned len = 0; |
| 282 | | | |
| 283 | | | switch(f[colnum].mode) { |
| 284 | | | case PT_TXTMOD_STRING: |
| 285 | | | text = gtk_entry_get_text(GTK_ENTRY(e));
x /usr/include/gtk-2.0/gtk/gtkentry.h |
| |
51 | #define GTK_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_ENTRY, GtkEntry)) |
| |
x /usr/include/glib-2.0/gobject/gtype.h |
| |
482 | #define G_TYPE_CHECK_INSTANCE_CAST(instance, g_type, c_type) (_G_TYPE_CIC ((instance), (g_type), c_type)) |
| |
x /usr/include/glib-2.0/gobject/gtype.h |
| |
1678 | # define _G_TYPE_CIC(ip, gt, ct) \ |
1679 | ((ct*) g_type_check_instance_cast ((GTypeInstance*) ip, gt)) |
| |
x /usr/include/gtk-2.0/gtk/gtkentry.h |
| |
50 | #define GTK_TYPE_ENTRY (gtk_entry_get_type ()) |
| |
|
| 286 | | | len = (unsigned) strlen(text); |
| 287 | | | break; |
| 288 | | | case PT_TXTMOD_HEXBYTES: { |
| 289 | | | text = gtk_entry_get_text(GTK_ENTRY(e));
x /usr/include/gtk-2.0/gtk/gtkentry.h |
| |
51 | #define GTK_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_ENTRY, GtkEntry)) |
| |
x /usr/include/glib-2.0/gobject/gtype.h |
| |
482 | #define G_TYPE_CHECK_INSTANCE_CAST(instance, g_type, c_type) (_G_TYPE_CIC ((instance), (g_type), c_type)) |
| |
x /usr/include/glib-2.0/gobject/gtype.h |
| |
1678 | # define _G_TYPE_CIC(ip, gt, ct) \ |
1679 | ((ct*) g_type_check_instance_cast ((GTypeInstance*) ip, gt)) |
| |
x /usr/include/gtk-2.0/gtk/gtkentry.h |
| |
50 | #define GTK_TYPE_ENTRY (gtk_entry_get_type ()) |
| |
|
| 290 | | | |
| 291 | | | text = (void*) unhexbytes(text, (guint) strlen(text), &len, &err); |
| 292 | | | |
| 293 | | | if (err) { |
| 294 | | | err = ep_strdup_printf("error in field '%s': %s",f[colnum].title,err); |
| 295 | | | goto on_failure; |
| 296 | | | } |
| 297 | | | |
| 298 | | | break; |
| 299 | | | } |
| 300 | | | case PT_TXTMOD_ENUM: { |
| 301 | | | text = *(char**)e; |
| 302 | | | text = text ? text : ""; |
| 303 | | | len = (unsigned) strlen(text); |
| 304 | | | break; |
| 305 | | | } |
| 306 | | | default: |
| 307 | | | 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__)) |
| |
|
| 308 | | | return FALSE; |
Unreachable Data Flow
The highlighted code will not execute under any circumstances. This may be because of: |
|
| 309 | | | } |
| 310 | | | |
| 311 | | | |
| 312 | | | if (f[colnum].cb.chk) { |
| 313 | | | if (! f[colnum].cb.chk(dd->rec, text, len, f[colnum].cbdata.chk, f[colnum].fld_data, &err)) { |
| 314 | | | err = ep_strdup_printf("error in column '%s': %s",f[colnum].title,err); |
| 315 | | | goto on_failure; |
| 316 | | | } |
| 317 | | | } |
| 318 | | | |
| 319 | | | f[colnum].cb.set(dd->rec,text,len, f[colnum].cbdata.set, f[colnum].fld_data); |
| 320 | | | } |
| 321 | | | |
| 322 | | | if (dd->uat->update_cb) { |
| 323 | | | dd->uat->update_cb(dd->rec,&err); |
| 324 | | | |
| 325 | | | if (err) { |
| 326 | | | err = ep_strdup_printf("error updating record: %s",err); |
| 327 | | | goto on_failure; |
| 328 | | | } |
| 329 | | | } |
| 330 | | | |
| 331 | | | if (dd->is_new) { |
| 332 | | | void* rec_tmp = dd->rec; |
| 333 | | | dd->rec = uat_add_record(dd->uat, dd->rec); |
| 334 | | | |
| 335 | | | if (dd->uat->free_cb) { |
| 336 | | | dd->uat->free_cb(rec_tmp); |
| 337 | | | } |
| 338 | | | |
| 339 | | | g_free(rec_tmp); |
| 340 | | | } |
| 341 | | | |
| 342 | | | dd->uat->changed = TRUE; |
| 343 | | | |
| 344 | | | set_buttons(dd->uat,-1); |
| 345 | | | |
| 346 | | | if (dd->is_new) { |
| 347 | | | append_row(dd->uat, (*dd->uat->nrows_p) - 1 ); |
| 348 | | | } else { |
| 349 | | | reset_row(dd->uat,dd->row); |
| 350 | | | } |
| 351 | | | |
| 352 | | | g_ptr_array_free(dd->entries,TRUE); |
| 353 | | | window_destroy(GTK_WIDGET(dd->win));
x /usr/include/gtk-2.0/gtk/gtkwidget.h |
| |
137 | #define GTK_WIDGET(widget) (G_TYPE_CHECK_INSTANCE_CAST ((widget), GTK_TYPE_WIDGET, GtkWidget)) |
| |
x /usr/include/glib-2.0/gobject/gtype.h |
| |
482 | #define G_TYPE_CHECK_INSTANCE_CAST(instance, g_type, c_type) (_G_TYPE_CIC ((instance), (g_type), c_type)) |
| |
x /usr/include/glib-2.0/gobject/gtype.h |
| |
1678 | # define _G_TYPE_CIC(ip, gt, ct) \ |
1679 | ((ct*) g_type_check_instance_cast ((GTypeInstance*) ip, gt)) |
| |
x /usr/include/gtk-2.0/gtk/gtkwidget.h |
| |
136 | #define GTK_TYPE_WIDGET (gtk_widget_get_type ()) |
| |
|
| 354 | | | |
| 355 | | | if (dd->uat->rep) |
| 356 | | | window_present(GTK_WIDGET(dd->uat->rep->window));
x /usr/include/gtk-2.0/gtk/gtkwidget.h |
| |
137 | #define GTK_WIDGET(widget) (G_TYPE_CHECK_INSTANCE_CAST ((widget), GTK_TYPE_WIDGET, GtkWidget)) |
| |
x /usr/include/glib-2.0/gobject/gtype.h |
| |
482 | #define G_TYPE_CHECK_INSTANCE_CAST(instance, g_type, c_type) (_G_TYPE_CIC ((instance), (g_type), c_type)) |
| |
x /usr/include/glib-2.0/gobject/gtype.h |
| |
1678 | # define _G_TYPE_CIC(ip, gt, ct) \ |
1679 | ((ct*) g_type_check_instance_cast ((GTypeInstance*) ip, gt)) |
| |
x /usr/include/gtk-2.0/gtk/gtkwidget.h |
| |
136 | #define GTK_TYPE_WIDGET (gtk_widget_get_type ()) |
| |
|
| 357 | | | |
| 358 | | | while (dd->tobe_freed->len) g_free( g_ptr_array_remove_index_fast(dd->tobe_freed, dd->tobe_freed->len - 1 ) ); |
| 359 | | | |
| 360 | | | g_free(dd); |
| 361 | | | |
| 362 | | | return TRUE; |
| 363 | | | on_failure: |
| 364 | | | |
| 365 | | | report_failure("%s",err); |
| 366 | | | return FALSE; |
| 367 | | | } |
| |