4 # Copyright 2006, Jeff Morriss <jeff.morriss[AT]ulticom.com>
6 # A simple tool to check source code for function calls that should not
7 # be called by Wireshark code and to perform certain other checks.
10 # checkAPIs.pl [-M] [-g group1] [-g group2] [-s summary-group1] [-s summary-group2] [--nocheck-value-string-array-null-termination] file1 file2 ...
14 # Wireshark - Network traffic analyzer
15 # By Gerald Combs <gerald@wireshark.org>
16 # Copyright 1998 Gerald Combs
18 # This program is free software; you can redistribute it and/or
19 # modify it under the terms of the GNU General Public License
20 # as published by the Free Software Foundation; either version 2
21 # of the License, or (at your option) any later version.
23 # This program is distributed in the hope that it will be useful,
24 # but WITHOUT ANY WARRANTY; without even the implied warranty of
25 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 # GNU General Public License for more details.
28 # You should have received a copy of the GNU General Public License
29 # along with this program; if not, write to the Free Software
30 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
38 # Group name, e.g. 'prohibited'
40 # 'count_errors' => 1, # 1 if these are errors, 0 if warnings
41 # 'functions' => [ 'f1', 'f2', ...], # Function array
42 # 'function-counts' => {'f1',0, 'f2',0, ...}, # Function Counts hash (initialized in the code)
45 # APIs that MUST NOT be used in Wireshark
46 'prohibited' => { 'count_errors' => 1, 'functions' => [
48 # Use something that won't overwrite the end of your buffer instead
62 # use glib (g_*) versions instead of these:
69 # Windows doesn't have this; use g_ascii_strtoull() instead
72 # use memset, memcpy, memcmp instead of these:
76 # use ep_*, se_*, or g_* functions instead of these:
77 # (One thing to be aware of is that space allocated with malloc()
78 # may not be freeable--at least on Windows--with g_free() and
87 # These may have unexpected behaviors in some locales (e.g.,
88 # "I" isn't always the upper-case form of "i", and "i" isn't
89 # always the lower-case form of "I"). Use the g_ascii_* version
99 'strerror', # use g_strerror
100 # Use the ws_* version of these:
101 # (Necessary because on Windows we use UTF8 for throughout the code
102 # so we must tweak that to UTF16 before operating on the file. Code
103 # using these functions will work unless the file/path name contains
114 'tmpnam' # use mkstemp
117 # APIs that SHOULD NOT be used in Wireshark (any more)
118 'deprecated' => { 'count_errors' => 1, 'functions' => [
119 'perror', # Use g_strerror() and report messages in whatever
120 # fashion is appropriate for the code in question.
121 'ctime', # Use abs_time_secs_to_str()
122 'dissector_add', # Use dissector_add_uint()
123 'dissector_change', # Use dissector_change_uint()
124 'dissector_delete', # Use dissector_delete_uint()
125 'dissector_get_port_handle', # Use dissector_get_uint_handle()
126 'dissector_reset', # Use dissector_reset_uint()
127 'dissector_try_port', # Use dissector_try_uint()
128 'dissector_try_port_new', # Use dissector_try_uint_new()
129 'next_tvb_add_port', # Use next_tvb_add_uint() (and a matching change
130 # of NTVB_PORT -> NTVB_UINT)
132 ### Deprecated GLib/GObject functions/macros
133 # (The list is based upon the GLib 2.24.1 & GObject 2.24.1 documentation;
134 # Some of the entries are commented out since they are currently
135 # being used in Wireshark and since the replacement functionality
136 # is not available in all the GLib versions that Wireshark
137 # currently supports (ie: versions starting with GLib 2.4)).
140 'g_allocator_free', # "use slice allocator" (avail since 2.10,2.14)
141 'g_allocator_new', # "use slice allocator" (avail since 2.10,2.14)
142 'g_async_queue_ref_unlocked', # g_async_queue_ref() (OK since 2.8)
143 'g_async_queue_unref_and_unlock', # g_async_queue_unref() (OK since 2.8)
145 'g_cache_value_foreach', # g_cache_key_foreach()
146 'g_date_set_time', # g_date_set_time_t (avail since 2.10)
149 'G_GNUC_PRETTY_FUNCTION',
150 'g_hash_table_freeze',
153 'g_io_channel_close',
156 'g_io_channel_write',
157 'g_list_pop_allocator', # "does nothing since 2.10"
158 'g_list_push_allocator', # "does nothing since 2.10"
166 'g_main_set_poll_func',
167 'g_node_pop_allocator', # "does nothing since 2.10"
168 'g_node_push_allocator', # "does nothing since 2.10"
169 'g_scanner_add_symbol',
170 'g_scanner_remove_symbol',
171 'g_scanner_foreach_symbol',
172 'g_scanner_freeze_symbol_table',
173 'g_scanner_thaw_symbol_table',
174 'g_slist_pop_allocator', # "does nothing since 2.10"
175 'g_slist_push_allocator', # "does nothing since 2.10"
176 'g_string_sprintf', # use g_string_printf() instead
177 'g_string_sprintfa', # use g_string_append_printf instead
179 'g_value_set_boxed_take_ownership',
180 'g_value_set_object_take_ownership',
181 'g_value_set_param_take_ownership',
182 'g_value_set_string_take_ownership',
183 'G_WIN32_DLLMAIN_FOR_DLL_NAME',
184 'g_win32_get_package_installation_directory',
185 'g_win32_get_package_installation_subdirectory',
187 ## Following Deprecated as of GLib 2.10; to be replaced only when Wireshark requires GLib 2.10 or later
188 ## Note: Only the commented out items are currently used by Wireshark
189 ### GMemChunks should used *only* with GLib < 2.10.
190 ### There's an issue wherein GLib >= 2.10 g_mem_chunk_destroy doesn't actually free memory thus
191 ### leading to memory leaks.
192 ### So: either replace GMemChunk use with something else altogether
193 ### or use GMemChunks for GLib < 2.10 and GSlice (or whatever) for newer GLibs.
194 ## 2.10 'g_mem_chunk_alloc', # "use slice allocator" (avail since 2.10)
195 ## 2.10 'g_mem_chunk_alloc0', # "use slice allocator" (avail since 2.10)
196 'g_mem_chunk_clean', # "use slice allocator" (avail since 2.10)
197 ## 2.10 'g_mem_chunk_create', # "use slice allocator" (avail since 2.10)
198 ## 2.10 'g_mem_chunk_destroy', # "use slice allocator" (avail since 2.10)
199 ## 2.10 'g_mem_chunk_free', # "use slice allocator" (avail since 2.10)
200 'g_mem_chunk_info', # "use slice allocator" (avail since 2.10)
201 ## 2.10 'g_mem_chunk_new', # "use slice allocator" (avail since 2.10)
202 'g_mem_chunk_print', # "use slice allocator" (avail since 2.10)
203 'g_mem_chunk_reset', # "use slice allocator" (avail since 2.10)
204 'g_blow_chunks', # "use slice allocator" (avail since 2.10,2.14)
205 ## 2.10 'g_chunk_free', # g_slice_free (avail since 2.10)
206 ## 2.10 'g_chunk_new', # g_slice_new (avail since 2.10)
207 'g_chunk_new0', # g_slice_new0 (avail since 2.10)
209 ## Following Deprecated as of GLib 2.22;
210 ## Note: Not currently used by Wireshark
211 'g_mapped_file_free', # [as of 2.22: use g_map_file_unref]
214 # APIs that make the program exit. Dissectors shouldn't call these
215 'abort' => { 'count_errors' => 1, 'functions' => [
224 # APIs that print to the terminal. Dissectors shouldn't call these
225 'termoutput' => { 'count_errors' => 0, 'functions' => [
230 # Deprecated GTK APIs
231 # which SHOULD NOT be used in Wireshark (any more).
232 # (Filled in from 'E' entries in %deprecatedGtkFunctions below)
233 'deprecated-gtk' => { 'count_errors' => 1, 'functions' => [
236 # Deprecated GTK APIs yet to be replaced
237 # (Filled in from 'W' entries in %deprecatedGtkFunctions below)
238 'deprecated-gtk-todo' => { 'count_errors' => 0, 'functions' => [
243 # Deprecated GTK+ functions/macros with (E)rror or (W)arning flag:
244 # (The list is based upon the GTK+ 2.20.1 documentation; Some of
245 # the entries are commented out since they are currently
246 # being used in Wireshark and since the replacement functionality
247 # is not available in all the GTK+ versions that Wireshark
248 # currently supports (ie: versions starting with GTK+ 2.4).
249 # E: There should be no current Wireshark use so Error if seen;
250 # W: Not all Wireshark use yet fixed so Warn if seen; (Change to E as fixed)
251 my %deprecatedGtkFunctions = (
252 'gtk_about_dialog_get_name', 'E',
253 'gtk_about_dialog_set_name', 'E',
254 'gtk_accel_group_ref', 'E',
255 'gtk_accel_group_unref', 'E',
256 'gtk_action_block_activate_from', 'E', # since 2.16
257 'gtk_action_connect_proxy', 'E', # since 2.16: use gtk_activatable_set_related_action() (as of 2.16)
258 'gtk_action_disconnect_proxy', 'E', # since 2.16: use gtk_activatable_set_related_action() (as of 2.16)
259 'gtk_action_unblock_activate_from', 'E', # since 2.16
260 'gtk_binding_entry_add', 'E',
261 'gtk_binding_entry_add_signall', 'E',
262 'gtk_binding_entry_clear', 'E',
263 'gtk_binding_parse_binding', 'E',
264 'gtk_box_pack_end_defaults', 'E',
265 'gtk_box_pack_start_defaults', 'E',
266 'gtk_button_box_get_child_ipadding', 'E',
267 'gtk_button_box_get_child_size', 'E',
268 'gtk_button_box_get_spacing', 'E',
269 'gtk_button_box_set_child_ipadding', 'E', # style properties child-internal-pad-x/-y
270 'gtk_button_box_set_child_size', 'E', # style properties child-min-width/-height
271 'gtk_button_box_set_spacing', 'E', # gtk_box_set_spacing [==]
272 'gtk_button_enter', 'E', # since 2.20
273 'gtk_button_leave', 'E', # since 2.20
274 'gtk_button_pressed', 'E', # since 2.20
275 'gtk_button_released', 'E', # since 2.20
276 'gtk_calendar_display_options', 'E',
277 'gtk_calendar_freeze', 'E',
278 'gtk_calendar_thaw', 'E',
279 'GTK_CELL_PIXMAP', 'E', # GtkTreeView (& related) ...
280 'GTK_CELL_PIXTEXT', 'E',
281 'gtk_cell_renderer_editing_canceled', 'E',
282 'GTK_CELL_TEXT', 'W',
283 'GTK_CELL_WIDGET', 'E',
284 'GTK_CHECK_CAST', 'E', # G_TYPE_CHECK_INSTANCE_CAST [==]
285 'GTK_CHECK_CLASS_CAST', 'E', # G_TYPE_CHECK_CLASS_CAST [==]
286 'GTK_CHECK_CLASS_TYPE', 'E', # G_TYPE_CHECK_CLASS_TYPE [==]
287 'GTK_CHECK_GET_CLASS', 'E', # G_TYPE_INSTANCE_GET_CLASS [==]
288 'gtk_check_menu_item_set_show_toggle', 'E', # Does nothing; remove; [show_toggle is always TRUE]
289 'gtk_check_menu_item_set_state', 'E',
290 'GTK_CHECK_TYPE', 'E', # G_TYPE_CHECK_INSTANCE_TYPE [==]
291 'GTK_CLASS_NAME', 'E',
292 'GTK_CLASS_TYPE', 'E',
293 'GTK_CLIST_ADD_MODE', 'E', # GtkTreeView (& related) ...
294 'gtk_clist_append', 'W',
295 'GTK_CLIST_AUTO_RESIZE_BLOCKED', 'E',
296 'GTK_CLIST_AUTO_SORT', 'E',
297 'gtk_clist_clear', 'W',
298 'gtk_clist_column_title_active', 'E',
299 'gtk_clist_column_title_passive', 'E',
300 'gtk_clist_column_titles_active', 'E',
301 'gtk_clist_column_titles_hide', 'E',
302 'gtk_clist_column_titles_passive', 'E',
303 'gtk_clist_column_titles_show', 'E',
304 'gtk_clist_columns_autosize', 'E',
305 'GTK_CLIST_DRAW_DRAG_LINE', 'E',
306 'GTK_CLIST_DRAW_DRAG_RECT', 'E',
307 'gtk_clist_find_row_from_data', 'E',
308 'GTK_CLIST_FLAGS', 'E',
309 'gtk_clist_freeze', 'E',
310 'gtk_clist_get_cell_style', 'E',
311 'gtk_clist_get_cell_type', 'E',
312 'gtk_clist_get_column_title', 'E',
313 'gtk_clist_get_column_widget', 'E',
314 'gtk_clist_get_hadjustment', 'E',
315 'gtk_clist_get_pixmap', 'E',
316 'gtk_clist_get_pixtext', 'E',
317 'gtk_clist_get_row_data', 'E',
318 'gtk_clist_get_row_style', 'E',
319 'gtk_clist_get_selectable', 'E',
320 'gtk_clist_get_selection_info', 'E',
321 'gtk_clist_get_text', 'E',
322 'gtk_clist_get_vadjustment', 'E',
323 'GTK_CLIST_IN_DRAG', 'E',
324 'gtk_clist_insert', 'E',
325 'gtk_clist_moveto', 'E',
326 'gtk_clist_new', 'E',
327 'gtk_clist_new_with_titles', 'E',
328 'gtk_clist_optimal_column_width', 'E',
329 'gtk_clist_prepend', 'E',
330 'gtk_clist_remove', 'E',
331 'GTK_CLIST_REORDERABLE', 'E',
332 'GTK_CLIST_ROW', 'E',
333 'GTK_CLIST_ROW_HEIGHT_SET', 'E',
334 'gtk_clist_row_is_visible', 'E',
335 'gtk_clist_row_move', 'E',
336 'gtk_clist_select_all', 'E',
337 'gtk_clist_select_row', 'E',
338 'gtk_clist_set_auto_sort', 'E',
339 'gtk_clist_set_background', 'E',
340 'gtk_clist_set_button_actions', 'E',
341 'gtk_clist_set_cell_style', 'E',
342 'gtk_clist_set_column_auto_resize', 'E',
343 'gtk_clist_set_column_justification', 'E',
344 'gtk_clist_set_column_max_width', 'E',
345 'gtk_clist_set_column_min_width', 'E',
346 'gtk_clist_set_column_resizeable', 'E',
347 'gtk_clist_set_column_title', 'E',
348 'gtk_clist_set_column_visibility', 'E',
349 'gtk_clist_set_column_widget', 'E',
350 'gtk_clist_set_column_width', 'E',
351 'gtk_clist_set_compare_func', 'E',
352 'GTK_CLIST_SET_FLAG', 'E',
353 'gtk_clist_set_foreground', 'E',
354 'gtk_clist_set_hadjustment', 'E',
355 'gtk_clist_set_pixmap', 'E',
356 'gtk_clist_set_pixtext', 'E',
357 'gtk_clist_set_reorderable', 'E',
358 'gtk_clist_set_row_data', 'E',
359 'gtk_clist_set_row_data_full', 'E',
360 'gtk_clist_set_row_height', 'E',
361 'gtk_clist_set_row_style', 'E',
362 'gtk_clist_set_selectable', 'E',
363 'gtk_clist_set_selection_mode', 'E',
364 'gtk_clist_set_shadow_type', 'E',
365 'gtk_clist_set_shift', 'E',
366 'gtk_clist_set_sort_column', 'E',
367 'gtk_clist_set_sort_type', 'E',
368 'gtk_clist_set_text', 'E',
369 'gtk_clist_set_use_drag_icons', 'E',
370 'gtk_clist_set_vadjustment', 'E',
371 'GTK_CLIST_SHOW_TITLES', 'E',
372 'gtk_clist_sort', 'E',
373 'gtk_clist_swap_rows', 'E',
374 'gtk_clist_thaw', 'E',
375 'gtk_clist_undo_selection', 'E',
376 'gtk_clist_unselect_all', 'E',
377 'gtk_clist_unselect_row', 'E',
378 'GTK_CLIST_UNSET_FLAG', 'E',
379 'GTK_CLIST_USE_DRAG_ICONS', 'E',
380 'gtk_color_selection_get_color', 'E',
381 'gtk_color_selection_set_change_palette_hook', 'E',
382 'gtk_color_selection_set_color', 'E',
383 'gtk_color_selection_set_update_policy', 'E',
384 'gtk_combo_disable_activate', 'E', # GtkComboBoxEntry ... (avail since 2.4/2.6/2.10/2.14)
385 'gtk_combo_new', 'E',
386 'gtk_combo_set_case_sensitive', 'E',
387 'gtk_combo_set_item_string', 'E',
388 'gtk_combo_set_popdown_strings', 'E',
389 'gtk_combo_set_use_arrows', 'E',
390 'gtk_combo_set_use_arrows_always', 'E',
391 'gtk_combo_set_value_in_list', 'E',
392 'gtk_container_border_width', 'E', # gtk_container_set_border_width [==]
393 'gtk_container_children', 'E', # gtk_container_get_children [==]
394 'gtk_container_foreach_full', 'E',
395 'gtk_ctree_collapse', 'E',
396 'gtk_ctree_collapse_recursive', 'E',
397 'gtk_ctree_collapse_to_depth', 'E',
398 'gtk_ctree_expand', 'E',
399 'gtk_ctree_expand_recursive', 'E',
400 'gtk_ctree_expand_to_depth', 'E',
401 'gtk_ctree_export_to_gnode', 'E',
402 'gtk_ctree_find', 'E',
403 'gtk_ctree_find_all_by_row_data', 'E',
404 'gtk_ctree_find_all_by_row_data_custom','E',
405 'gtk_ctree_find_by_row_data', 'E',
406 'gtk_ctree_find_by_row_data_custom', 'E',
407 'gtk_ctree_find_node_ptr', 'E',
408 'GTK_CTREE_FUNC', 'E',
409 'gtk_ctree_get_node_info', 'E',
410 'gtk_ctree_insert_gnode', 'E',
411 'gtk_ctree_insert_node', 'E',
412 'gtk_ctree_is_ancestor', 'E',
413 'gtk_ctree_is_hot_spot', 'E',
414 'gtk_ctree_is_viewable', 'E',
415 'gtk_ctree_last', 'E',
416 'gtk_ctree_move', 'E',
417 'gtk_ctree_new', 'E',
418 'gtk_ctree_new_with_titles', 'E',
419 'GTK_CTREE_NODE', 'E',
420 'gtk_ctree_node_get_cell_style', 'E',
421 'gtk_ctree_node_get_cell_type', 'E',
422 'gtk_ctree_node_get_pixmap', 'E',
423 'gtk_ctree_node_get_pixtext', 'E',
424 'gtk_ctree_node_get_row_data', 'E',
425 'gtk_ctree_node_get_row_style', 'E',
426 'gtk_ctree_node_get_selectable', 'E',
427 'gtk_ctree_node_get_text', 'E',
428 'gtk_ctree_node_is_visible', 'E',
429 'gtk_ctree_node_moveto', 'E',
430 'GTK_CTREE_NODE_NEXT', 'E',
431 'gtk_ctree_node_nth', 'E',
432 'GTK_CTREE_NODE_PREV', 'E',
433 'gtk_ctree_node_set_background', 'E',
434 'gtk_ctree_node_set_cell_style', 'E',
435 'gtk_ctree_node_set_foreground', 'E',
436 'gtk_ctree_node_set_pixmap', 'E',
437 'gtk_ctree_node_set_pixtext', 'E',
438 'gtk_ctree_node_set_row_data', 'E',
439 'gtk_ctree_node_set_row_data_full', 'E',
440 'gtk_ctree_node_set_row_style', 'E',
441 'gtk_ctree_node_set_selectable', 'E',
442 'gtk_ctree_node_set_shift', 'E',
443 'gtk_ctree_node_set_text', 'E',
444 'gtk_ctree_post_recursive', 'E',
445 'gtk_ctree_post_recursive_to_depth', 'E',
446 'gtk_ctree_pre_recursive', 'E',
447 'gtk_ctree_pre_recursive_to_depth', 'E',
448 'gtk_ctree_real_select_recursive', 'E',
449 'gtk_ctree_remove_node', 'E',
450 'GTK_CTREE_ROW', 'E',
451 'gtk_ctree_select', 'E',
452 'gtk_ctree_select_recursive', 'E',
453 'gtk_ctree_set_drag_compare_func', 'E',
454 'gtk_ctree_set_expander_style', 'E',
455 'gtk_ctree_set_indent', 'E',
456 'gtk_ctree_set_line_style', 'E',
457 'gtk_ctree_set_node_info', 'E',
458 'gtk_ctree_set_reorderable', 'E',
459 'gtk_ctree_set_show_stub', 'E',
460 'gtk_ctree_set_spacing', 'E',
461 'gtk_ctree_sort_node', 'E',
462 'gtk_ctree_sort_recursive', 'E',
463 'gtk_ctree_toggle_expansion', 'E',
464 'gtk_ctree_toggle_expansion_recursive', 'E',
465 'gtk_ctree_unselect', 'E',
466 'gtk_ctree_unselect_recursive', 'E',
467 'gtk_curve_get_vector', 'E', # since 2.20
468 'gtk_curve_new', 'E', # since 2.20
469 'gtk_curve_reset', 'E', # since 2.20
470 'gtk_curve_set_curve_type', 'E', # since 2.20
471 'gtk_curve_set_gamma', 'E', # since 2.20
472 'gtk_curve_set_range', 'E', # since 2.20
473 'gtk_curve_set_vector', 'E', # since 2.20
474 'gtk_drag_set_default_icon', 'E',
475 'gtk_draw_arrow', 'E',
477 'gtk_draw_box_gap', 'E',
478 'gtk_draw_check', 'E',
479 'gtk_draw_diamond', 'E',
480 'gtk_draw_expander', 'E',
481 'gtk_draw_extension', 'E',
482 'gtk_draw_flat_box', 'E',
483 'gtk_draw_focus', 'E',
484 'gtk_draw_handle', 'E',
485 'gtk_draw_hline', 'E',
486 'gtk_draw_layout', 'E',
487 'gtk_draw_option', 'E',
488 'gtk_draw_polygon', 'E',
489 'gtk_draw_resize_grip', 'E',
490 'gtk_draw_shadow', 'E',
491 'gtk_draw_shadow_gap', 'E',
492 'gtk_draw_slider', 'E',
493 'gtk_draw_string', 'E',
495 'gtk_draw_vline', 'E',
496 'gtk_drawing_area_size', 'E', # >> g_object_set() [==] ?
497 # gtk_widget_set_size_request() [==?]
498 'gtk_entry_append_text', 'E', # >> gtk_editable_insert_text() [==?]
499 'gtk_entry_new_with_max_length', 'E', # gtk_entry_new(); gtk_entry_set_max_length()
500 'gtk_entry_prepend_text', 'E',
501 'gtk_entry_select_region', 'E',
502 'gtk_entry_set_editable', 'E', # >> gtk_editable_set_editable() [==?]
503 'gtk_entry_set_position', 'E',
504 'gtk_exit', 'E', # exit() [==]
505 'gtk_file_chooser_button_new_with_backend', 'E',
506 'gtk_file_chooser_dialog_new_with_backend', 'E',
507 'gtk_file_chooser_widget_new_with_backend', 'E',
508 'gtk_file_selection_complete', 'E',
509 'gtk_file_selection_get_filename', 'E', # GtkFileChooser ...
510 'gtk_file_selection_get_select_multiple', 'E',
511 'gtk_file_selection_get_selections', 'E',
512 'gtk_file_selection_hide_fileop_buttons', 'E',
513 'gtk_file_selection_new', 'E',
514 'gtk_file_selection_set_filename', 'E',
515 'gtk_file_selection_set_select_multiple', 'E',
516 'gtk_file_selection_show_fileop_buttons', 'E',
517 'gtk_fixed_get_has_window', 'E', # gtk_widget_get_has_window() (available since 2.18)
518 'gtk_fixed_set_has_window', 'E', # gtk_widget_set_has_window() (available since 2.18)
519 'gtk_font_selection_dialog_get_apply_button', 'E',
520 'gtk_font_selection_dialog_get_font', 'E',
521 'gtk_font_selection_get_font', 'E', # gtk_font_selection_get_font_name() [!=]
522 'GTK_FUNDAMENTAL_TYPE', 'E',
523 'gtk_gamma_curve_new', 'E', # since 2.20
524 'gtk_hbutton_box_get_layout_default', 'E',
525 'gtk_hbutton_box_get_spacing_default', 'E',
526 'gtk_hbutton_box_set_layout_default', 'E',
527 'gtk_hbutton_box_set_spacing_default', 'E',
529 'gtk_idle_add_full', 'E',
530 'gtk_idle_add_priority', 'E',
531 'gtk_idle_remove', 'E',
532 'gtk_idle_remove_by_data', 'E',
533 'gtk_image_get', 'E',
534 'gtk_image_set', 'E',
535 'gtk_input_add_full', 'W', # >>> g_io_add_watch_full()
536 'gtk_input_dialog_new', 'E', # since 2.20
537 'gtk_input_remove', 'W', # >>> g_source_remove()
538 'GTK_IS_ROOT_TREE', 'E',
539 'gtk_item_factories_path_delete', 'E', # GtkUIManager (avail since 2.4) ...
540 'gtk_item_factory_add_foreign', 'E',
541 'gtk_item_factory_construct', 'E',
542 'gtk_item_factory_create_item', 'W',
543 'gtk_item_factory_create_items', 'E',
544 'gtk_item_factory_create_items_ac', 'W',
545 'gtk_item_factory_create_menu_entries', 'E',
546 'gtk_item_factory_delete_entries', 'E',
547 'gtk_item_factory_delete_entry', 'E',
548 'gtk_item_factory_delete_item', 'W',
549 'gtk_item_factory_from_path', 'E',
550 'gtk_item_factory_from_widget', 'W',
551 'gtk_item_factory_get_item', 'W',
552 'gtk_item_factory_get_item_by_action', 'E',
553 'gtk_item_factory_get_widget', 'W',
554 'gtk_item_factory_get_widget_by_action', 'E',
555 'gtk_item_factory_new', 'W',
556 'gtk_item_factory_path_from_widget', 'E',
557 'gtk_item_factory_popup', 'E',
558 'gtk_item_factory_popup_data', 'E',
559 'gtk_item_factory_popup_data_from_widget', 'E',
560 'gtk_item_factory_popup_with_data', 'E',
561 'gtk_item_factory_set_translate_func', 'E',
562 'gtk_label_get', 'E', # gtk_label_get_text() [!=]
563 'gtk_label_parse_uline', 'E',
564 'gtk_label_set', 'E', # gtk_label_set_text() [==]
565 'gtk_layout_freeze', 'E',
566 'gtk_layout_thaw', 'E',
567 'gtk_list_append_items', 'E',
568 'gtk_list_child_position', 'E',
569 'gtk_list_clear_items', 'E',
570 'gtk_list_end_drag_selection', 'E',
571 'gtk_list_end_selection', 'E',
572 'gtk_list_extend_selection', 'E',
573 'gtk_list_insert_items', 'E',
574 'gtk_list_item_deselect', 'E',
575 'gtk_list_item_new', 'E',
576 'gtk_list_item_new_with_label', 'E',
577 'gtk_list_item_select', 'E',
579 'gtk_list_prepend_items', 'E',
580 'gtk_list_remove_items', 'E',
581 'gtk_list_remove_items_no_unref', 'E',
582 'gtk_list_scroll_horizontal', 'E',
583 'gtk_list_scroll_vertical', 'E',
584 'gtk_list_select_all', 'E',
585 'gtk_list_select_child', 'E',
586 'gtk_list_select_item', 'E',
587 'gtk_list_set_selection_mode', 'E',
588 'gtk_list_start_selection', 'E',
589 'gtk_list_toggle_add_mode', 'E',
590 'gtk_list_toggle_focus_row', 'E',
591 'gtk_list_toggle_row', 'E',
592 'gtk_list_undo_selection', 'E',
593 'gtk_list_unselect_all', 'E',
594 'gtk_list_unselect_child', 'E',
595 'gtk_list_unselect_item', 'E',
596 'gtk_menu_append', 'E', # gtk_menu_shell_append() [==?]
597 'gtk_menu_bar_append', 'E',
598 'gtk_menu_bar_insert', 'E',
599 'gtk_menu_bar_prepend', 'E',
600 'gtk_menu_insert', 'E',
601 'gtk_menu_item_remove_submenu', 'E',
602 'gtk_menu_item_right_justify', 'E',
603 'gtk_menu_prepend', 'E', # gtk_menu_shell_prepend() [==?]
604 'gtk_menu_tool_button_set_arrow_tooltip', 'E',
605 'gtk_notebook_current_page', 'E',
606 'gtk_notebook_query_tab_label_packing', 'E', # since 2.20
607 'gtk_notebook_get_group_id', 'E',
608 'gtk_notebook_set_group_id', 'E',
609 'gtk_notebook_set_homogeneous_tabs', 'E',
610 'gtk_notebook_set_page', 'E', # gtk_notebook_set_current_page() [==]
611 'gtk_notebook_set_tab_border', 'E',
612 'gtk_notebook_set_tab_hborder', 'E',
613 'gtk_notebook_set_tab_label_packing', 'E', # since 2.20
614 'gtk_notebook_set_tab_vborder', 'E',
615 'gtk_object_add_arg_type', 'E',
616 'gtk_object_data_force_id', 'E',
617 'gtk_object_data_try_key', 'E',
618 'GTK_OBJECT_FLOATING', 'E',
619 'gtk_object_get', 'E',
620 'gtk_object_get_data', 'E',
621 'gtk_object_get_data_by_id', 'E',
622 'gtk_object_get_user_data', 'E',
623 'gtk_object_new', 'E',
624 'gtk_object_ref', 'E',
625 'gtk_object_remove_data', 'E',
626 'gtk_object_remove_data_by_id', 'E',
627 'gtk_object_remove_no_notify', 'E',
628 'gtk_object_remove_no_notify_by_id', 'E',
629 'gtk_object_set', 'E',
630 'gtk_object_set_data', 'E',
631 'gtk_object_set_data_by_id', 'E',
632 'gtk_object_set_data_by_id_full', 'E',
633 'gtk_object_set_data_full', 'E',
634 'gtk_object_set_user_data', 'E',
635 'gtk_object_sink', 'E',
636 'GTK_OBJECT_TYPE', 'E', # G_OBJECT_TYPE
637 'GTK_OBJECT_TYPE_NAME', 'E', # G_OBJECT_TYPE_NAME
638 'gtk_object_unref', 'E',
639 'gtk_object_weakref', 'E',
640 'gtk_object_weakunref', 'E',
641 'gtk_old_editable_changed', 'E',
642 'gtk_old_editable_claim_selection', 'E',
643 'gtk_option_menu_get_history', 'E', # GtkComboBox ... (avail since 2.4/2.6/2.10/2.14)
644 'gtk_option_menu_get_menu', 'E',
645 'gtk_option_menu_new', 'E',
646 'gtk_option_menu_remove_menu', 'E',
647 'gtk_option_menu_set_history', 'E',
648 'gtk_option_menu_set_menu', 'E',
649 'gtk_paint_string', 'E',
650 'gtk_paned_gutter_size', 'E', # gtk_paned_set_gutter_size()
651 'gtk_paned_set_gutter_size', 'E', # "does nothing"
652 'gtk_pixmap_get', 'E', # GtkImage ...
653 'gtk_pixmap_new', 'E',
654 'gtk_pixmap_set', 'E',
655 'gtk_pixmap_set_build_insensitive', 'E',
656 'gtk_preview_draw_row', 'E',
657 'gtk_preview_get_cmap', 'E',
658 'gtk_preview_get_info', 'E',
659 'gtk_preview_get_visual', 'E',
660 'gtk_preview_new', 'E',
661 'gtk_preview_put', 'E',
662 'gtk_preview_reset', 'E',
663 'gtk_preview_set_color_cube', 'E',
664 'gtk_preview_set_dither', 'E',
665 'gtk_preview_set_expand', 'E',
666 'gtk_preview_set_gamma', 'E',
667 'gtk_preview_set_install_cmap', 'E',
668 'gtk_preview_set_reserved', 'E',
669 'gtk_preview_size', 'E',
670 'gtk_preview_uninit', 'E',
671 'gtk_progress_bar_new_with_adjustment', 'E',
672 'gtk_progress_bar_set_activity_blocks', 'E',
673 'gtk_progress_bar_set_activity_step', 'E',
674 'gtk_progress_bar_set_bar_style', 'E',
675 'gtk_progress_bar_set_discrete_blocks', 'E',
676 'gtk_progress_bar_update', 'E', # >>> "gtk_progress_set_value() or
677 # gtk_progress_set_percentage()"
678 ## Actually: GtkProgress is deprecated so the
679 ## right answer appears to be to use
680 ## gtk_progress_bar_set_fraction()
681 'gtk_progress_configure', 'E',
682 'gtk_progress_get_current_percentage', 'E',
683 'gtk_progress_get_current_text', 'E',
684 'gtk_progress_get_percentage_from_value', 'E',
685 'gtk_progress_get_text_from_value', 'E',
686 'gtk_progress_get_value', 'E',
687 'gtk_progress_set_activity_mode', 'E',
688 'gtk_progress_set_adjustment', 'E',
689 'gtk_progress_set_format_string', 'E',
690 'gtk_progress_set_percentage', 'E',
691 'gtk_progress_set_show_text', 'E',
692 'gtk_progress_set_text_alignment', 'E',
693 'gtk_progress_set_value', 'E',
694 'gtk_radio_button_group', 'E', # gtk_radio_button_get_group() [==]
695 'gtk_radio_menu_item_group', 'E',
696 'gtk_rc_add_class_style', 'E',
697 'gtk_rc_add_widget_class_style', 'E',
698 'gtk_rc_add_widget_name_style', 'E',
699 'gtk_rc_style_ref', 'E',
700 'gtk_rc_style_unref', 'E',
701 'gtk_recent_chooser_get_show_numbers', 'E',
702 'gtk_recent_chooser_set_show_numbers', 'E',
703 'gtk_recent_manager_get_for_screen', 'E',
704 'gtk_recent_manager_set_screen', 'E',
705 'GTK_RETLOC_BOOL', 'E',
706 'GTK_RETLOC_BOXED', 'E',
707 'GTK_RETLOC_CHAR', 'E',
708 'GTK_RETLOC_DOUBLE', 'E',
709 'GTK_RETLOC_ENUM', 'E',
710 'GTK_RETLOC_FLAGS', 'E',
711 'GTK_RETLOC_FLOAT', 'E',
712 'GTK_RETLOC_INT', 'E',
713 'GTK_RETLOC_LONG', 'E',
714 'GTK_RETLOC_OBJECT', 'E',
715 'GTK_RETLOC_POINTER', 'E',
716 'GTK_RETLOC_STRING', 'E',
717 'GTK_RETLOC_UCHAR', 'E',
718 'GTK_RETLOC_UINT', 'E',
719 'GTK_RETLOC_ULONG', 'E',
720 'gtk_selection_clear', 'E',
721 'gtk_signal_connect', 'E', # GSignal ...
722 'gtk_signal_connect_after', 'E',
723 'gtk_signal_connect_full', 'E',
724 'gtk_signal_connect_object', 'E',
725 'gtk_signal_connect_object_after', 'E',
726 'gtk_signal_connect_object_while_alive', 'E',
727 'gtk_signal_connect_while_alive', 'E',
728 'gtk_signal_default_marshaller', 'E',
729 'gtk_signal_disconnect', 'E',
730 'gtk_signal_disconnect_by_data', 'E',
731 'gtk_signal_disconnect_by_func', 'E',
732 'gtk_signal_emit', 'E',
733 'gtk_signal_emit_by_name', 'E',
734 'gtk_signal_emit_stop', 'E',
735 'gtk_signal_emit_stop_by_name', 'E',
736 'gtk_signal_emitv', 'E',
737 'gtk_signal_emitv_by_name', 'E',
738 'GTK_SIGNAL_FUNC', 'E',
739 'gtk_signal_handler_block', 'E',
740 'gtk_signal_handler_block_by_data', 'E',
741 'gtk_signal_handler_block_by_func', 'E',
742 'gtk_signal_handler_pending', 'E',
743 'gtk_signal_handler_pending_by_func', 'E',
744 'gtk_signal_handler_unblock', 'E',
745 'gtk_signal_handler_unblock_by_data', 'E',
746 'gtk_signal_handler_unblock_by_func', 'E',
747 'gtk_signal_lookup', 'E',
748 'gtk_signal_name', 'E',
749 'gtk_signal_new', 'E',
750 'gtk_signal_newv', 'E',
751 'GTK_SIGNAL_OFFSET', 'E',
752 'gtk_socket_steal', 'E',
753 'gtk_spin_button_get_value_as_float', 'E', # gtk_spin_button_get_value() [==]
754 'GTK_STRUCT_OFFSET', 'E',
755 'gtk_style_apply_default_pixmap', 'E',
756 'gtk_style_get_font', 'E',
757 'gtk_style_ref', 'E',
758 'gtk_style_set_font', 'E',
759 'gtk_style_unref', 'E', # g_object_unref() [==?]
760 'gtk_text_backward_delete', 'E',
761 'gtk_text_forward_delete', 'E',
762 'gtk_text_freeze', 'E',
763 'gtk_text_get_length', 'E',
764 'gtk_text_get_point', 'E',
765 'GTK_TEXT_INDEX', 'E',
766 'gtk_text_insert', 'E', # GtkTextView (GtkText "known to be buggy" !)
768 'gtk_text_set_adjustments', 'E',
769 'gtk_text_set_editable', 'E',
770 'gtk_text_set_line_wrap', 'E',
771 'gtk_text_set_point', 'E',
772 'gtk_text_set_word_wrap', 'E',
773 'gtk_text_thaw', 'E',
774 'gtk_timeout_add', 'E', # g_timeout_add()
775 'gtk_timeout_add_full', 'E',
776 'gtk_timeout_remove', 'E', # g_source_remove()
777 'gtk_tips_query_new', 'E',
778 'gtk_tips_query_set_caller', 'E',
779 'gtk_tips_query_set_labels', 'E',
780 'gtk_tips_query_start_query', 'E',
781 'gtk_tips_query_stop_query', 'E',
782 'gtk_toggle_button_set_state', 'E', # gtk_toggle_button_set_active [==]
783 'gtk_toolbar_append_element', 'E',
784 'gtk_toolbar_append_item', 'E',
785 'gtk_toolbar_append_space', 'E', # Use gtk_toolbar_insert() instead
786 'gtk_toolbar_append_widget', 'E', # ??
787 'gtk_toolbar_get_tooltips', 'E',
788 'gtk_toolbar_insert_element', 'E',
789 'gtk_toolbar_insert_item', 'E',
790 'gtk_toolbar_insert_space', 'E',
791 'gtk_toolbar_insert_stock', 'E',
792 'gtk_toolbar_insert_widget', 'E',
793 'gtk_toolbar_prepend_element', 'E',
794 'gtk_toolbar_prepend_item', 'E',
795 'gtk_toolbar_prepend_space', 'E',
796 'gtk_toolbar_prepend_widget', 'E',
797 'gtk_toolbar_remove_space', 'E',
798 'gtk_toolbar_set_tooltips', 'E',
799 'gtk_tree_append', 'E',
800 'gtk_tree_child_position', 'E',
801 'gtk_tree_clear_items', 'E',
802 'gtk_tree_insert', 'E',
803 'gtk_tree_item_collapse', 'E',
804 'gtk_tree_item_deselect', 'E',
805 'gtk_tree_item_expand', 'E',
806 'gtk_tree_item_new', 'E',
807 'gtk_tree_item_new_with_label', 'E',
808 'gtk_tree_item_remove_subtree', 'E',
809 'gtk_tree_item_select', 'E',
810 'gtk_tree_item_set_subtree', 'E',
811 'GTK_TREE_ITEM_SUBTREE', 'E',
812 'gtk_tree_model_get_iter_root', 'E',
814 'gtk_tree_path_new_root', 'E',
815 'gtk_tree_prepend', 'E',
816 'gtk_tree_remove_item', 'E',
817 'gtk_tree_remove_items', 'E',
818 'GTK_TREE_ROOT_TREE', 'E',
819 'gtk_tree_select_child', 'E',
820 'gtk_tree_select_item', 'E',
821 'GTK_TREE_SELECTION_OLD', 'E',
822 'gtk_tree_set_selection_mode', 'E',
823 'gtk_tree_set_view_lines', 'E',
824 'gtk_tree_set_view_mode', 'E',
825 'gtk_tree_unselect_child', 'E',
826 'gtk_tree_unselect_item', 'E',
827 'gtk_tree_view_tree_to_widget_coords', 'E',
828 'gtk_tree_view_widget_to_tree_coords', 'E',
829 'gtk_type_class', 'E', # g_type_class_peek() or g_type_class_ref()
830 'GTK_TYPE_CTREE_NODE', 'E',
831 'gtk_type_enum_find_value', 'E',
832 'gtk_type_enum_get_values', 'E',
833 'gtk_type_flags_find_value', 'E',
834 'gtk_type_flags_get_values', 'E',
835 'gtk_type_from_name', 'E',
836 'gtk_type_init', 'E',
837 'gtk_type_is_a', 'E',
838 'GTK_TYPE_IS_OBJECT', 'E',
839 'gtk_type_name', 'E',
841 'gtk_type_parent', 'E',
842 'gtk_type_unique', 'E',
843 'GTK_VALUE_BOOL', 'E',
844 'GTK_VALUE_BOXED', 'E',
845 'GTK_VALUE_CHAR', 'E',
846 'GTK_VALUE_DOUBLE', 'E',
847 'GTK_VALUE_ENUM', 'E',
848 'GTK_VALUE_FLAGS', 'E',
849 'GTK_VALUE_FLOAT', 'E',
850 'GTK_VALUE_INT', 'E',
851 'GTK_VALUE_LONG', 'E',
852 'GTK_VALUE_OBJECT', 'E',
853 'GTK_VALUE_POINTER', 'E',
854 'GTK_VALUE_SIGNAL', 'E',
855 'GTK_VALUE_STRING', 'E',
856 'GTK_VALUE_UCHAR', 'E',
857 'GTK_VALUE_UINT', 'E',
858 'GTK_VALUE_ULONG', 'E',
859 'gtk_vbutton_box_get_layout_default', 'E',
860 'gtk_vbutton_box_get_spacing_default', 'E',
861 'gtk_vbutton_box_set_layout_default', 'E',
862 'gtk_vbutton_box_set_spacing_default', 'E',
863 'gtk_widget_draw', 'E', # gtk_widget_queue_draw_area():
864 # "in general a better choice if you want
865 # to draw a region of a widget."
866 'gtk_widget_pop_visual', 'E',
867 'gtk_widget_push_visual', 'E',
868 'gtk_widget_queue_clear', 'E',
869 'gtk_widget_queue_clear_area', 'E',
870 'gtk_widget_ref', 'E', # g_object_ref() [==]
871 'gtk_widget_restore_default_style', 'E',
872 'gtk_widget_set', 'E', # g_object_set() [==]
873 'gtk_widget_set_default_visual', 'E',
874 'gtk_widget_set_rc_style', 'E',
875 'gtk_widget_set_uposition', 'E', # ?? (see GTK documentation)
876 'gtk_widget_set_usize', 'E', # gtk_widget_set_size_request()
877 'gtk_widget_set_visual', 'E',
878 'gtk_widget_unref', 'E',
879 'gtk_window_position', 'E',
880 'gtk_window_set_policy', 'E', # >>? gtk_window_set_resizable()
882 ## Deprecated for GTK+ versions greater than 2.4
883 ## Note that entries marked with 'W' are currently being used by Wireshark
884 ## Those marked with 'E' are not being used by Wireshark
886 ## Deprecated as of GTK+ 2.12 but to be replaced only when Wireshark requires GTK+ 2.12 or later
887 ## (or: use conditional code based upon the GTK version).
888 'gtk_tooltips_data_get', 'E', # new API: GtkToolTip (avail since 2.12) ...
889 'gtk_tooltips_disable', 'E',
890 'gtk_tooltips_enable', 'E',
891 'gtk_tooltips_force_window', 'E',
892 'gtk_tooltips_get_info_from_tip_window', 'E',
893 'gtk_tooltips_new', 'E',
894 'gtk_tooltips_set_delay', 'E',
895 'gtk_tooltips_set_tip', 'E',
896 'gtk_tool_item_set_tooltip', 'E', # gtk_tool_item_set_tooltip_text() (avail since 2.12)
898 ## Deprecated as of GTK+ 2.16 but to be replaced only when Wireshark requires GTK+ 2.16 or later
899 ## (or: use conditional code based upon the GTK version).
900 'gtk_scale_button_get_orientation', 'E', # gtk_orientable_get_orientation() (avail since 2.16)
901 'gtk_scale_button_set_orientation', 'E', # gtk_orientable_set_orientation() (avail since 2.16)
902 'gtk_toolbar_get_orientation', 'E', # gtk_orientable_get_orientation() (avail since 2.16)
903 ## 'gtk_toolbar_set_orientation', 'W', # gtk_orientable_set_orientation() (avail since 2.16)
904 'gtk_status_icon_set_tooltip', 'E', # gtk_status_icon_set_tooltip_text() (avail since 2.16)
905 'gtk_widget_get_action', 'E', # gtk_activatable_get_related_action() (avail since 2.16)
907 ## Deprecated as of GTK+ 2.18 but to be replaced only when Wireshark requires GTK+ 2.12 or later
908 ## (or: use conditional code based upon the GTK version).
909 'gtk_cell_view_get_cell_renderers', 'E', # gtk_cell_layout_get_cells () (avail since 2.12)
910 ## 'gtk_tree_view_column_get_cell_renderers', 'W', # gtk_cell_layout_get_cells () (avail since 2.12)
912 ## Deprecated as of GTK+ 2.20 but to be replaced only when Wireshark requires GTK+ 2.18 or later
913 ## (or: use conditional code based upon the GTK version).
914 ## If needed define these in old-gtk-compat.h
915 'GTK_WIDGET_APP_PAINTABLE', 'E', # gtk_widget_get_app_paintable() (avail since 2.18)
916 'GTK_WIDGET_CAN_DEFAULT', 'E', # gtk_widget_get_can_default() (avail since 2.18)
917 'GTK_WIDGET_CAN_FOCUS', 'E', # gtk_widget_get_can_focus() (avail since 2.18)
918 'GTK_WIDGET_COMPOSITE_CHILD', 'E', # gtk_widget_get_composite_child() (avail since 2.18)
919 'GTK_WIDGET_DOUBLE_BUFFERED', 'E', # gtk_widget_get_double_buffered() (avail since 2.18)
920 'GTK_WIDGET_DRAWABLE', 'E', # gtk_widget_get_drawable() (avail since 2.18)
921 'GTK_WIDGET_FLAGS', 'E', # gtk_widget_get_flags() (avail since 2.18)
922 'GTK_WIDGET_HAS_DEFAULT', 'E', # gtk_widget_get_has_default() (avail since 2.18)
923 'GTK_WIDGET_HAS_FOCUS', 'E', # gtk_widget_get_has_focus() (avail since 2.18)
924 'GTK_WIDGET_HAS_GRAB', 'E', # gtk_widget_get_has_grab() (avail since 2.18)
925 'GTK_WIDGET_IS_SENSITIVE', 'E', # gtk_widget_get_is_sensitive() (avail since 2.18)
926 'GTK_WIDGET_MAPPED', 'E', # gtk_widget_get_mapped() (avail since 2.18)
927 'GTK_WIDGET_NO_WINDOW', 'W', # gtk_widget_get_no_window() (avail since 2.18)
928 'GTK_WIDGET_PARENT_SENSITIVE', 'E', # gtk_widget_get_parent_sensitive() (avail since 2.18)
929 'GTK_WIDGET_RC_STYLE', 'E', # gtk_widget_get_rc_style() (avail since 2.18)
930 'GTK_WIDGET_REALIZED', 'E', # gtk_widget_get_realized() (avail since 2.18)
931 'GTK_WIDGET_RECEIVES_DEFAULT', 'E', # gtk_widget_get_receives_default() (avail since 2.18)
932 'GTK_WIDGET_SAVED_STATE', 'E', # gtk_widget_get_saved_state() (avail since 2.18)
933 'GTK_WIDGET_SENSITIVE', 'E', # gtk_widget_get_sensitive() (avail since 2.18)
934 'GTK_WIDGET_STATE', 'W', # gtk_widget_get_state() (avail since 2.18)
935 'GTK_WIDGET_TOPLEVEL', 'E', # gtk_widget_get_toplevel() (avail since 2.18)
936 'GTK_WIDGET_TYPE', 'E', # gtk_widget_get_type() (avail since 2.18)
937 'GTK_WIDGET_VISIBLE', 'E', # gtk_widget_get_visible() (avail since 2.18)
938 ## Deprecated as of GTK+ 2.22 but to be replaced only when Wireshark requires GTK+ 2.18 or later
939 ## (or: use conditional code based upon the GTK version).
940 'gtk_dialog_get_has_separator', 'E', # This function will be removed in GTK+ 3
941 'gtk_dialog_set_has_separator', 'E', # This function will be removed in GTK+ 3
942 'gtk_icon_view_get_orientation', 'E', # gtk_icon_view_get_item_orientation()
943 'gtk_icon_view_set_orientation', 'E', # gtk_icon_view_set_item_orientation()
944 'gtk_item_deselect', 'E', # gtk_menu_item_deselect()
945 'gtk_item_select', 'E', # gtk_menu_item_select()
946 'gtk_item_toggle', 'E', #
947 'gtk_recent_manager_get_limit', 'E', # Use GtkRecentChooser
948 'gtk_recent_manager_set_limit', 'E', #
950 ## Deprecated as of GTK+ 2.24 but to be replaced only when Wireshark requires GTK+ 2.24 or later
951 ## (or: use conditional code based upon the GTK version).
952 ## Mapped in old-gtk-compat.h
954 'gtk_combo_box_new_text', 'E', # gtk_combo_box_text_new()
955 'GtkComboBoxEntry', 'E', #
956 'gtk_combo_box_append_text', 'E', #
957 'gtk_combo_box_entry_get_text_column', 'E', #
958 'gtk_combo_box_entry_new', 'E', #
959 'gtk_combo_box_entry_new_text', 'E', #
960 'gtk_combo_box_entry_new_with_model', 'E', #
961 'gtk_combo_box_entry_set_text_column', 'E', #
962 'gtk_combo_box_get_active_text', 'E', #
963 'gtk_combo_box_insert_text', 'E', #
964 'gtk_combo_box_new_text', 'E', #
965 'gtk_combo_box_prepend_text', 'E', #
966 'gtk_combo_box_remove_text', 'E', #
968 ## GDK deprecated functions:
969 'gdk_bitmap_create_from_data', 'W', #
970 'gdk_bitmap_ref', 'W', #
971 'gdk_bitmap_unref', 'W', #
972 'gdk_cairo_set_source_pixmap', 'W', # deprecated since version 2.24. Use gdk_cairo_set_source_window() where appropriate(Since 2.24).
973 'gdk_char_height', 'W', #
974 'gdk_char_measure', 'W', #
975 'gdk_char_width', 'W', #
976 'gdk_char_width_wc', 'W', #
977 'gdk_colormap_change', 'W', #
978 'gdk_colormap_get_system_size', 'W', #
979 'gdk_colormap_ref', 'W', #
980 'gdk_colormap_unref', 'W', #
981 'gdk_colors_alloc', 'W', #
982 'gdk_colors_free', 'W', #
983 'gdk_colors_store', 'W', #
984 'gdk_color_alloc', 'W', #
985 'gdk_color_black', 'W', #
986 'gdk_color_change', 'W', #
987 'gdk_color_white', 'W', #
988 'gdk_cursor_destroy', 'W', #
989 'GdkDestroyNotify', 'W', #
990 'gdk_DISPLAY', 'W', #
991 'gdk_display_set_pointer_hooks', 'W', #
992 'gdk_drag_context_new', 'W', #
993 'gdk_drag_context_ref', 'W', #
994 'gdk_drag_context_unref', 'W', #
995 'gdk_drag_find_window', 'W', #
996 'gdk_drag_get_protocol', 'W', #
997 'gdk_drawable_copy_to_image', 'W', #
998 'gdk_drawable_get_data', 'W', #
999 'gdk_drawable_get_display', 'W', #
1000 'gdk_drawable_get_image', 'W', #
1001 'gdk_drawable_get_screen', 'W', #
1002 'gdk_drawable_get_size', 'W', # deprecated since version 2.24 Use gdk_window_get_width() and gdk_window_get_height() for GdkWindows.
1003 # Use gdk_pixmap_get_size() for GdkPixmaps
1004 'gdk_drawable_get_visual', 'W', #
1005 'gdk_drawable_ref', 'W', #
1006 'gdk_drawable_set_data', 'W', #
1007 'gdk_drawable_unref', 'W', #
1008 'gdk_draw_arc', 'W', # deprecated since version 2.22. Use cairo_arc() and cairo_fill() or cairo_stroke() instead.
1009 'gdk_draw_drawable', 'W', # deprecated since version 2.22. Use gdk_cairo_set_source_pixmap(), cairo_rectangle() and cairo_fill() to draw pixmap on top of other drawables
1010 'gdk_draw_glyphs', 'W', #
1011 'gdk_draw_glyphs_transformed', 'W', #
1012 'gdk_draw_gray_image', 'W', #
1013 'gdk_draw_image', 'W', #
1014 'gdk_draw_indexed_image', 'W', #
1015 'gdk_draw_layout', 'W', #
1016 'gdk_draw_layout_line', 'W', #
1017 'gdk_draw_layout_line_with_colors', 'W', #
1018 'gdk_draw_layout_with_colors', 'W', #
1019 'gdk_draw_line', 'W', #
1020 'gdk_draw_lines', 'W', # deprecated since version 2.22. Use cairo_line_to() and cairo_stroke() instead.
1021 'gdk_draw_pixbuf', 'W', # gdk_cairo_set_source_pixbuf() and cairo_paint() or cairo_rectangle() and cairo_fill() instead.
1022 'gdk_draw_pixmap', 'W', # gdk_draw_drawable() (gdk_draw_drawable has been deprecated since version 2.22 )
1023 'gdk_draw_point', 'W', #
1024 'gdk_draw_points', 'W', #
1025 'gdk_draw_polygon', 'W', #
1026 'gdk_draw_rectangle', 'W', # deprecated since version 2.22, Use cairo_rectangle() and cairo_fill() or cairo_stroke()
1027 'gdk_draw_rgb_32_image', 'W', #
1028 'gdk_draw_rgb_32_image_dithalign', 'W', #
1029 'gdk_draw_rgb_image', 'W', #
1030 'gdk_draw_rgb_image_dithalign', 'W', #
1031 'gdk_draw_segments', 'W', #
1032 'gdk_draw_string', 'W', #
1033 'gdk_draw_text', 'W', #
1034 'gdk_draw_text_wc', 'W', #
1035 'gdk_draw_trapezoids', 'W', #
1036 'gdk_event_get_graphics_expose', 'W', #
1038 'GdkFillRule', 'W', #
1040 'gdk_fontset_load', 'W', #
1041 'gdk_fontset_load_for_display', 'W', #
1042 'GdkFontType', 'W', #
1043 'gdk_font_equal', 'W', #
1044 'gdk_font_from_description', 'W', #
1045 'gdk_font_from_description_for_display', 'W', #
1046 'gdk_font_get_display', 'W', #
1047 'gdk_font_id', 'W', #
1048 'gdk_font_load', 'W', #
1049 'gdk_font_load_for_display', 'W', #
1050 'gdk_font_lookup', 'W', #
1051 'gdk_font_lookup_for_display', 'W', #
1052 'gdk_font_ref', 'W', #
1053 'gdk_font_unref', 'W', #
1054 'gdk_FONT_XDISPLAY', 'W', #
1055 'gdk_FONT_XFONT', 'W', #
1056 'gdk_free_compound_text', 'W', #
1057 'gdk_free_text_list', 'W', #
1058 'gdk_gc_copy', 'W', #
1059 'gdk_gc_destroy', 'W', #
1060 'gdk_gc_get_colormap', 'W', #
1061 'gdk_gc_get_screen', 'W', #
1062 'gdk_gc_get_values', 'W', #
1063 'gdk_gc_new', 'W', # deprecated since version 2.22 and should not be used in newly-written code. Use Cairo for rendering.
1064 'gdk_gc_new_with_values', 'W', # deprecated since version 2.22
1065 'gdk_gc_offset', 'W', #
1066 'gdk_gc_ref', 'W', #
1067 'gdk_gc_set_background', 'W', #
1068 'gdk_gc_set_clip_mask', 'W', #
1069 'gdk_gc_set_clip_origin', 'W', #
1070 'gdk_gc_set_clip_rectangle', 'W', #
1071 'gdk_gc_set_clip_region', 'W', #
1072 'gdk_gc_set_colormap', 'W', #
1073 'gdk_gc_set_dashes', 'W', #
1074 'gdk_gc_set_exposures', 'W', #
1075 'gdk_gc_set_fill', 'W', #
1076 'gdk_gc_set_font', 'W', #
1077 'gdk_gc_set_foreground', 'W', # deprecated since version 2.22. Use gdk_cairo_set_source_color() to use a GdkColor as the source in Cairo.
1078 'gdk_gc_set_function', 'W', # deprecated since version 2.22. Use cairo_set_operator() with Cairo.
1079 'gdk_gc_set_line_attributes', 'W', #
1080 'gdk_gc_set_rgb_bg_color', 'W', #
1081 'gdk_gc_set_rgb_fg_color', 'W', # deprecated since version 2.22. Use gdk_cairo_set_source_color() instead.
1082 'gdk_gc_set_stipple', 'W', #
1083 'gdk_gc_set_subwindow', 'W', #
1084 'gdk_gc_set_tile', 'W', # deprecated since version 2.22.
1085 'gdk_gc_set_ts_origin', 'W', #
1086 'gdk_gc_set_values', 'W', #
1087 'gdk_gc_unref', 'E', # deprecated since version 2.0. Use g_object_unref()
1088 'gdk_get_use_xshm', 'W', #
1089 'gdk_image_destroy', 'W', #
1090 'gdk_image_get', 'W', #
1091 'gdk_image_get_bits_per_pixel', 'W', #
1092 'gdk_image_get_bytes_per_line', 'W', #
1093 'gdk_image_get_bytes_per_pixel', 'W', #
1094 'gdk_image_get_byte_order', 'W', #
1095 'gdk_image_get_colormap', 'W', #
1096 'gdk_image_get_depth', 'W', #
1097 'gdk_image_get_height', 'W', #
1098 'gdk_image_get_image_type', 'W', #
1099 'gdk_image_get_pixel', 'W', #
1100 'gdk_image_get_pixels', 'W', #
1101 'gdk_image_get_visual', 'W', #
1102 'gdk_image_get_width', 'W', #
1103 'gdk_image_new', 'W', #
1104 'gdk_image_new_bitmap', 'W', #
1105 'gdk_image_put_pixel', 'W', #
1106 'gdk_image_ref', 'W', #
1107 'gdk_image_set_colormap', 'W', #
1108 'gdk_image_unref', 'W', #
1109 'gdk_input_add', 'W', #
1110 'gdk_input_add_full', 'W', #
1111 'gdk_input_remove', 'W', #
1112 'gdk_mbstowcs', 'W', #
1113 'gdk_net_wm_supports', 'W', #
1114 'gdk_pango_context_set_colormap', 'W', #
1115 'gdk_pixbuf_render_to_drawable', 'W', #
1116 'gdk_pixbuf_render_to_drawable_alpha', 'W', #
1117 'gdk_pixmap_colormap_create_from_xpm', 'W', #
1118 'gdk_pixmap_colormap_create_from_xpm_d', 'W', #
1119 'gdk_pixmap_create_from_data', 'W', #
1120 'gdk_pixmap_create_from_xpm', 'W', #
1121 'gdk_pixmap_create_from_xpm_d', 'W', # deprecated since version 2.22. Use a GdkPixbuf instead. You can use gdk_pixbuf_new_from_xpm_data() to create it.
1122 # If you must use a pixmap, use gdk_pixmap_new() to create it and Cairo to draw the pixbuf onto it.
1123 'gdk_pixmap_ref', 'W', #
1124 'gdk_pixmap_unref', 'E', # Deprecated equivalent of g_object_unref().
1125 'gdk_region_polygon', 'W', #
1126 'gdk_region_rect_equal', 'W', #
1127 'gdk_region_shrink', 'W', #
1128 'gdk_region_spans_intersect_foreach', 'W', #
1129 'GdkRgbCmap', 'W', #
1130 'gdk_rgb_cmap_free', 'W', #
1131 'gdk_rgb_cmap_new', 'W', #
1132 'gdk_rgb_colormap_ditherable', 'W', #
1133 'gdk_rgb_ditherable', 'W', #
1134 'gdk_rgb_find_color', 'W', #
1135 'gdk_rgb_gc_set_background', 'W', #
1136 'gdk_rgb_gc_set_foreground', 'W', #
1137 'gdk_rgb_get_cmap', 'W', #
1138 'gdk_rgb_get_colormap', 'W', #
1139 'gdk_rgb_get_visual', 'W', #
1140 'gdk_rgb_init', 'W', #
1141 'gdk_rgb_set_install', 'W', #
1142 'gdk_rgb_set_min_colors', 'W', #
1143 'gdk_rgb_set_verbose', 'W', #
1144 'gdk_rgb_xpixel_from_rgb', 'W', #
1145 'gdk_ROOT_PARENT', 'W', #
1146 'gdk_screen_get_rgb_colormap', 'W', #
1147 'gdk_screen_get_rgb_visual', 'W', #
1148 'GdkSelection', 'W', #
1149 'GdkSelectionType', 'W', #
1150 'gdk_set_locale', 'W', #
1151 'gdk_set_pointer_hooks', 'W', #
1152 'gdk_set_sm_client_id', 'W', #
1153 'gdk_set_use_xshm', 'W', #
1154 'GdkSpanFunc', 'W', #
1155 'gdk_spawn_command_line_on_screen', 'W', #
1156 'gdk_spawn_on_screen', 'W', #
1157 'gdk_spawn_on_screen_with_pipes', 'W', #
1158 'gdk_string_extents', 'W', #
1159 'gdk_string_height', 'W', #
1160 'gdk_string_measure', 'W', #
1161 'gdk_string_to_compound_text', 'W', #
1162 'gdk_string_to_compound_text_for_display', 'W', #
1163 'gdk_string_width', 'W', #
1165 'gdk_text_extents', 'W', #
1166 'gdk_text_extents_wc', 'W', #
1167 'gdk_text_height', 'W', #
1168 'gdk_text_measure', 'W', #
1169 'gdk_text_property_to_text_list', 'W', #
1170 'gdk_text_property_to_text_list_for_display', 'W', #
1171 'gdk_text_property_to_utf8_list', 'W', #
1172 'gdk_text_width', 'W', #
1173 'gdk_text_width_wc', 'W', #
1174 'gdk_threads_mutex', 'W', #
1175 'gdk_utf8_to_compound_text', 'W', #
1176 'gdk_utf8_to_compound_text_for_display', 'W', #
1177 'gdk_visual_ref', 'W', #
1178 'gdk_visual_unref', 'W', #
1179 'gdk_wcstombs', 'W', #
1180 'gdk_window_copy_area', 'W', #
1181 'gdk_window_foreign_new', 'W', #
1182 'gdk_window_foreign_new_for_display', 'W', #
1183 'gdk_window_get_colormap', 'W', # Deprecated equivalent of gdk_drawable_get_colormap().
1184 'gdk_window_get_deskrelative_origin', 'W', #
1185 'gdk_window_get_size', 'W', # Deprecated equivalent of gdk_drawable_get_size().
1186 'gdk_window_get_toplevels', 'W', #
1187 'gdk_window_get_type', 'W', #
1188 'gdk_window_lookup', 'W', #
1189 'gdk_window_lookup_for_display', 'W', #
1190 'gdk_window_ref', 'W', #
1191 'gdk_window_set_colormap', 'W', #
1192 'gdk_window_set_hints', 'W', #
1193 'gdk_window_unref', 'W', #
1194 'gdk_x11_font_get_name', 'W', #
1195 'gdk_x11_font_get_xdisplay', 'W', #
1196 'gdk_x11_font_get_xfont', 'W', #
1197 'gdk_x11_gc_get_xdisplay', 'W', #
1198 'gdk_x11_gc_get_xgc', 'W', #
1199 'gdk_xid_table_lookup', 'W', #
1200 'gdk_xid_table_lookup_for_display', 'W', #
1201 'gdkx_colormap_get', 'W', #
1202 'gdkx_visual_get', 'W', #
1206 @{$APIs{'deprecated-gtk'}->{'functions'}} = grep {$deprecatedGtkFunctions{$_} eq 'E'} keys %deprecatedGtkFunctions;
1207 @{$APIs{'deprecated-gtk-todo'}->{'functions'}} = grep {$deprecatedGtkFunctions{$_} eq 'W'} keys %deprecatedGtkFunctions;
1211 # Given a ref to a hash containing "functions" and "functions_count" entries:
1212 # Determine if the any of the list of APIs contained in the array referenced by "functions"
1213 # exists in the file.
1214 # For each API which appears in the file:
1215 # Push the API onto the provided list;
1216 # Add the number of times the API appears in the file to the total count
1217 # for the API (stored as the value of the API key in the hash referenced by "function_counts").
1219 sub findAPIinFile($$$)
1221 my ($groupHashRef, $fileContentsRef, $foundAPIsRef) = @_;
1223 for my $api ( @{$groupHashRef->{functions}} )
1226 while (${$fileContentsRef} =~ m/ \W $api \W* \( /gx)
1231 push @{$foundAPIsRef}, $api;
1232 $groupHashRef->{function_counts}->{$api} += 1;
1237 # APIs which (generally) should not be called with an argument of tvb_get_ptr()
1239 # Use NULL for the value_ptr instead of tvb_get_ptr() (only if the
1240 # given offset and length are equal) with these:
1241 'proto_tree_add_bytes_format',
1242 'proto_tree_add_bytes_format_value',
1243 # Use the tvb_* version of these:
1249 # Use tvb_bytes_to_str[_punct] instead of:
1251 'bytes_to_str_punct',
1254 sub checkAPIsCalledWithTvbGetPtr($$$)
1256 my ($APIs, $fileContentsRef, $foundAPIsRef) = @_;
1258 for my $api (@{$APIs}) {
1262 @items = (${$fileContentsRef} =~ m/($api[^;]*;)/sg);
1264 my ($item) = @items;
1266 if ($item =~ /tvb_get_ptr/xos) {
1272 push @{$foundAPIsRef}, $api;
1277 # Verify that all declared ett_ variables are registered.
1278 # Don't bother trying to check usage (for now)...
1279 sub check_ett_registration($$)
1281 my ($fileContentsRef, $filename) = @_;
1282 my @ett_declarations;
1283 my %ett_registrations;
1284 my @unRegisteredEtts;
1286 # A pattern to match ett variable names. Obviously this assumes that
1287 # they start with ett_
1288 my $EttVarName = qr{ (?: ett_[a-z0-9_]+ (?:\[[0-9]+\])? ) }xi;
1290 # Remove macro lines
1291 my $fileContents = ${$fileContentsRef};
1292 $fileContents =~ s { ^\s*\#.*$} []xogm;
1294 # Find all the ett_ variables declared in the file
1295 @ett_declarations = ($fileContents =~ m{
1296 ^\s*static # assume declarations are on their own line
1298 g?int # could be int or gint
1300 ($EttVarName) # variable name
1305 if (!@ett_declarations) {
1306 print "Found no etts in ".$filename."\n";
1310 #print "Found these etts in ".$filename.": ".join(',', @ett_declarations)."\n\n";
1312 # Find the array used for registering the etts
1313 # Save off the block of code containing just the variables
1315 @reg_blocks = ($fileContents =~ m{
1319 \s*\*\s* # it's an array of pointers
1320 [a-z0-9_]+ # array name; usually (always?) "ett"
1321 \s*\[\s*\]\s* # array brackets
1324 ((?:\s*&\s* # address of the following variable
1325 $EttVarName # variable name
1326 \s*,? # the comma is optional (for the last entry)
1327 \s*)+) # match one or more variable names
1332 #print "Found this ett registration block in ".$filename.": ".join(',', @reg_blocks)."\n";
1334 if (@reg_blocks == 0) {
1335 print "Hmm, found ".@reg_blocks." ett registration blocks in ".$filename."\n";
1340 while (@reg_blocks) {
1341 my ($block) = @reg_blocks;
1344 # Convert the list returned by the match into a hash of the
1345 # form ett_variable_name -> 1. Then combine this new hash with
1346 # the hash from the last registration block.
1347 # (Of course) using hashes makes the lookups much faster.
1348 %ett_registrations = map { $_ => 1 } ($block =~ m{
1349 \s*&\s* # address of the following variable
1350 ($EttVarName) # variable name
1351 \s*,? # the comma is optional (for the last entry)
1352 }xgios, %ett_registrations);
1354 #print "Found these ett registrations in ".$filename.": ";
1355 #while( my ($k, $v) = each %ett_registrations ) {
1359 # Find which declared etts are not registered.
1360 # XXX - using <@ett_declarations> and $_ instead of $ett_var makes this
1361 # MUCH slower... Why?
1362 while (@ett_declarations) {
1363 my ($ett_var) = @ett_declarations;
1364 shift @ett_declarations;
1366 push(@unRegisteredEtts, $ett_var) if (!$ett_registrations{$ett_var});
1369 if (@unRegisteredEtts) {
1370 print STDERR "Error: found these unregistered ett variables in ".$filename.": ".join(',', @unRegisteredEtts)."\n";
1375 # Given the file contents and a file name, check all of the hf entries for
1376 # various problems (such as those checked for in proto.c).
1377 sub check_hf_entries($$)
1379 my ($fileContentsRef, $filename) = @_;
1383 @items = (${$fileContentsRef} =~ m{
1386 &\s*([A-Z0-9_\[\]-]+) # &hf
1389 ("[A-Z0-9 '\./\(\)_:-]+") # name
1391 (NULL|"[A-Z0-9_\.-]*") # abbrev
1393 (FT_[A-Z0-9_]+) # field type
1395 ([A-Z0-9x\|_]+) # display
1397 ([A-Z0-9&_\(\)' -]+) # convert
1399 ([A-Z0-9_]+) # bitmask
1401 (NULL|"[A-Z0-9 '\./\(\)\?_:-]+") # blurb (NULL or a string)
1406 #print "Found @items items\n";
1408 my ($hf, $name, $abbrev, $ft, $display, $convert, $bitmask, $blurb) = @items;
1409 shift @items; shift @items; shift @items; shift @items; shift @items; shift @items; shift @items; shift @items;
1411 #print "name=$name, abbrev=$abbrev, ft=$ft, display=$display, convert=$convert, bitmask=$bitmask, blurb=$blurb\n";
1413 if ($abbrev eq '""' || $abbrev eq "NULL") {
1414 print STDERR "Error: field $name does not have an abbreviation in $filename\n";
1417 if ($abbrev =~ m/\.\.+/) {
1418 print STDERR "Error: the abbreviation for field $name ($abbrev) contains two or more sequential periods in $filename\n";
1421 if ($name eq $abbrev) {
1422 print STDERR "Error: the abbreviation for field $name matches the field name in $filename\n";
1425 if (lc($name) eq lc($blurb)) {
1426 print STDERR "Error: the blurb for field $name ($abbrev) matches the field name in $filename\n";
1429 if ($name =~ m/"\s+/) {
1430 print STDERR "Error: the name for field $name ($abbrev) has leading space in $filename\n";
1433 if ($name =~ m/\s+"/) {
1434 print STDERR "Error: the name for field $name ($abbrev) has trailing space in $filename\n";
1437 if ($blurb =~ m/"\s+/) {
1438 print STDERR "Error: the blurb for field $name ($abbrev) has leading space in $filename\n";
1441 if ($blurb =~ m/\s+"/) {
1442 print STDERR "Error: the blurb for field $name ($abbrev) has trailing space in $filename\n";
1445 if ($abbrev =~ m/\s+/) {
1446 print STDERR "Error: the abbreviation for field $name ($abbrev) has white space in $filename\n";
1449 if ("\"".$hf ."\"" eq $name) {
1450 print STDERR "Error: name is the hf_variable_name in field $name ($abbrev) in $filename\n";
1453 if ("\"".$hf ."\"" eq $abbrev) {
1454 print STDERR "Error: abbreviation is the hf_variable_name in field $name ($abbrev) in $filename\n";
1462 # The below Regexp are based on those from:
1463 # http://aspn.activestate.com/ASPN/Cookbook/Rx/Recipe/59811
1464 # They are in the public domain.
1466 # 1. A complicated regex which matches C-style comments.
1467 my $CComment = qr{ / [*] [^*]* [*]+ (?: [^/*] [^*]* [*]+ )* / }x;
1469 # 1.a A regex that matches C++-style comments.
1470 #my $CppComment = qr{ // (.*?) \n }x;
1472 # 2. A regex which matches double-quoted strings.
1473 # ?s added so that strings containing a 'line continuation'
1474 # ( \ followed by a new-line) will match.
1475 my $DoubleQuotedStr = qr{ (?: ["] (?s: \\. | [^\"\\])* ["]) }x;
1477 # 3. A regex which matches single-quoted strings.
1478 my $SingleQuotedStr = qr{ (?: \' (?: \\. | [^\'\\])* [']) }x;
1480 # 4. Now combine 1 through 3 to produce a regex which
1481 # matches _either_ double or single quoted strings
1482 # OR comments. We surround the comment-matching
1483 # regex in capturing parenthesis to store the contents
1484 # of the comment in $1.
1485 # my $commentAndStringRegex = qr{(?:$DoubleQuotedStr|$SingleQuotedStr)|($CComment)|($CppComment)};
1487 # 4. Wireshark is strictly a C program so don't take out C++ style comments
1488 # since they shouldn't be there anyway...
1489 # Also: capturing the comment isn't necessary.
1490 my $commentAndStringRegex = qr{ (?: $DoubleQuotedStr | $SingleQuotedStr | $CComment) }x;
1492 #### Regex for use when searching for value-string definitions
1493 my $StaticRegex = qr/ static \s+ /xs;
1494 my $ConstRegex = qr/ const \s+ /xs;
1495 my $Static_andor_ConstRegex = qr/ (?: $StaticRegex $ConstRegex | $StaticRegex | $ConstRegex) /xs;
1496 my $ValueStringRegex = qr/ $Static_andor_ConstRegex value_string \ + [^;*]+ = [^;]+ [{] [^;]+ ; /xs;
1502 # The default list, which can be expanded.
1503 my @apiGroups = qw(prohibited deprecated);
1504 my @apiSummaryGroups = ();
1505 my $check_value_string_array_null_termination = 1; # default: enabled
1506 my $machine_readable_output = 0; # default: disabled
1507 my $check_hf = 1; # default: enabled
1510 my $result = GetOptions(
1511 'group=s' => \@apiGroups,
1512 'summary-group=s' => \@apiSummaryGroups,
1513 'check-value-string-array-null-termination!' => \$check_value_string_array_null_termination,
1514 'Machine-readable' => \$machine_readable_output,
1515 'nohf' => \$check_hf,
1516 'debug' => \$debug_flag
1519 print "Usage: checkAPIs.pl [-M] [-g group1] [-g group2] ... [-s group1] [-s group2] ... [--nocheck-value-string-array-null-termination] file1 file2 ..\n";
1520 print " -g <group>: Check input files for use of APIs in <group> (in addition to the default groups)\n";
1521 print " -s <group>: Output summary (count) for each API in <group> (-g <group> also req'd)\n";
1522 print " -M: Generate output for -g in 'machine-readable' format\n";
1524 print " Default Groups[-g]: ", join (", ", sort @apiGroups), "\n";
1525 print " Available Groups: ", join (", ", sort keys %APIs), "\n";
1529 # Add a 'function_count' anonymous hash to each of the 'apiGroup' entries in the %APIs hash.
1530 for my $apiGroup (keys %APIs) {
1531 my @functions = @{$APIs{$apiGroup}{functions}};
1533 $APIs{$apiGroup}->{function_counts} = {};
1534 @{$APIs{$apiGroup}->{function_counts}}{@functions} = (); # Add fcn names as keys to the anonymous hash
1538 # Read through the files; do various checks
1539 while ($_ = $ARGV[0])
1543 my $fileContents = '';
1547 die "No such file: \"$filename\"" if (! -e $filename);
1549 # delete leading './'
1550 $filename =~ s{ ^ \. / } {}xo;
1552 # Read in the file (ouch, but it's easier that way)
1553 open(FC, $filename) || die("Couldn't open $filename");
1556 $fileContents .= $_;
1557 if ($_ =~ m{ [\x80-\xFF] }xo) {
1558 print STDERR "Error: Found non-ASCII characters on line " .$line. " of " .$filename."\n";
1565 if ($fileContents =~ m{ %ll }xo)
1567 # use G_GINT64_MODIFIER instead of ll
1568 print STDERR "Error: Found %ll in " .$filename."\n";
1571 if ($fileContents =~ m{ %hh }xo)
1573 # %hh is C99 and Windows doesn't like it:
1574 # http://connect.microsoft.com/VisualStudio/feedback/details/416843/sscanf-cannot-not-handle-hhd-format
1575 # Need to use temporary variables instead.
1576 print STDERR "Error: Found %hh in " .$filename."\n";
1580 if (! ($fileContents =~ m{ \$Id .* \$ }xo))
1582 print STDERR "Warning: ".$filename." does not have an SVN Id tag.\n";
1585 # optionally check the hf entries
1587 $errorCount += check_hf_entries(\$fileContents, $filename);
1590 # Remove all the C-comments and strings
1591 $fileContents =~ s {$commentAndStringRegex} []xog;
1593 #check_ett_registration(\$fileContents, $filename);
1595 if ($fileContents =~ m{ // }xo)
1597 print STDERR "Error: Found C++ style comments in " .$filename."\n";
1601 #checkAPIsCalledWithTvbGetPtr(\@TvbPtrAPIs, \$fileContents, \@foundAPIs);
1604 # print STDERR "Found APIs with embedded tvb_get_ptr() calls in ".$filename.": ".join(',', @foundAPIs)."\n"
1607 # Brute force check for value_string arrays which are missing {0, NULL} as the final (terminating) array entry
1608 if ($check_value_string_array_null_termination) {
1609 # Assumption: definition is of form (pseudo-Regex):
1610 # " (static const|static|const) value_string .+ = { .+ ;" (possibly over multiple lines)
1611 while ($fileContents =~ / ( $ValueStringRegex ) /xsog) {
1612 # value_string array definition found; check if NULL terminated
1613 my $vs = my $vsx = $1;
1615 $vsx =~ / ( .+ value_string [^=]+ ) = /xo;
1616 printf STDERR "==> %-35.35s: %s\n", $filename, $1;
1617 printf STDERR "%s\n", $vs;
1619 $vs =~ s{ \s } {}xg;
1620 # README.developer says
1621 # "Don't put a comma after the last tuple of an initializer of an array"
1622 # However: since this usage is present in some number of cases, we'll allow for now
1623 if ($vs !~ / , NULL [}] ,? [}] ; $/xo) {
1624 $vsx =~ /( value_string [^=]+ ) = /xo;
1625 printf STDERR "Error: %-35.35s: {0, NULL} is required as the last value_string array entry: %s\n", $filename, $1;
1628 if ($vs !~ / (static)? const value_string /xo) {
1629 $vsx =~ /( value_string [^=]+ ) = /xo;
1630 printf STDERR "Error: %-35.35s: Missing 'const': %s\n", $filename, $1;
1636 # Check and count APIs
1637 for my $apiGroup (@apiGroups) {
1638 my $pfx = "Warning";
1641 findAPIinFile($APIs{$apiGroup}, \$fileContents, \@foundAPIs);
1643 if ($APIs{$apiGroup}->{count_errors}) {
1644 # the use of "prohibited" APIs is an error, increment the error count
1645 $errorCount += @foundAPIs;
1649 if (@foundAPIs && ! $machine_readable_output) {
1650 print STDERR $pfx . ": Found " . $apiGroup . " APIs in ".$filename.": ".join(',', @foundAPIs)."\n";
1652 if (@foundAPIs && $machine_readable_output) {
1653 for my $api (@foundAPIs) {
1654 printf STDERR "%-8.8s %-20.20s %-30.30s %-45.45s\n", $pfx, $apiGroup, $filename, $api;
1660 # Summary: Print Use Counts of each API in each requested summary group
1662 for my $apiGroup (@apiSummaryGroups) {
1663 printf "\n\nUse Counts\n";
1664 for my $api (sort {"\L$a" cmp "\L$b"} (keys %{$APIs{$apiGroup}->{function_counts}} )) {
1665 printf "%-20.20s %5d %-40.40s\n", $apiGroup . ':', $APIs{$apiGroup}{function_counts}{$api}, $api;