From cddb781f53aa4ac90144cd950f88773191280a4a Mon Sep 17 00:00:00 2001 From: Jaap Keuter Date: Wed, 15 Oct 2008 23:17:40 +0000 Subject: [PATCH] Various corrections, as in: typos, whitespace, few return values, _U_ markers. svn path=/trunk/; revision=26472 --- airpcap_loader.c | 43 +++++++++--------- gtk/airpcap_dlg.c | 90 +++++++++++++++++++------------------- gtk/main_airpcap_toolbar.c | 14 +++--- 3 files changed, 73 insertions(+), 74 deletions(-) diff --git a/airpcap_loader.c b/airpcap_loader.c index b28a7f1be5..3c37f602b5 100644 --- a/airpcap_loader.c +++ b/airpcap_loader.c @@ -473,10 +473,10 @@ write_wlan_driver_wep_keys_to_registry(GList* key_list) key_item = (decryption_key_t*)g_list_nth_data(key_list,i); /* - * XXX - The AIRPDCAP_KEY_TYPE_WEP is the only supportd right now! + * XXX - The AIRPDCAP_KEY_TYPE_WEP is the only supported right now! * We will have to modify the AirpcapKey structure in order to * support the other two types! What happens now, is that simply the - * not supported keys will just be discarded (they will be saved in wireshark though) + * not supported keys will just be discarded (they will be saved in Wireshark though) */ if(key_item->type == AIRPDCAP_KEY_TYPE_WEP) { @@ -552,7 +552,7 @@ save_wlan_driver_wep_keys() fake_info_if = airpcap_driver_fake_if_info_new(); if(fake_info_if == NULL) - return FALSE; + return 0; /* Retrieve the wlan preferences */ wlan_prefs = prefs_find_module("wlan"); @@ -560,7 +560,6 @@ save_wlan_driver_wep_keys() /* Allocate a structure used to keep infos between the callbacks */ user_data = (keys_cb_data_t*)g_malloc(sizeof(keys_cb_data_t)); - /* Number of keys in key list */ /* Number of keys in key list */ if(fake_info_if->keysCollectionSize != 0) keys_in_list = (guint)(fake_info_if->keysCollectionSize - sizeof(AirpcapKeysCollection))/sizeof(AirpcapKey); @@ -784,7 +783,7 @@ airpcap_if_get_device_supported_channels_array(PAirpcapHandle ah, PULONG pNumSup ULONG i=0, j=0, numInfo = 0; if (!AirpcapLoaded) - return FALSE; + return NULL; if (airpcap_if_get_device_supported_channels(ah, &chanInfo, &numInfo) == FALSE) return NULL; numSupportedChannels = 0; @@ -1418,9 +1417,9 @@ get_airpcap_interface_list(int *err, char **err_str) for(i = 0; i < n_adapts; i++) { if_info = airpcap_if_info_new(adListEntry->Name, adListEntry->Description); - if (if_info != NULL){ - il = g_list_append(il, if_info); - } + if (if_info != NULL){ + il = g_list_append(il, if_info); + } adListEntry = adListEntry->next; } @@ -1625,7 +1624,7 @@ airpcap_load_selected_if_configuration(airpcap_if_info_t* if_info) if(ad) { - /* Stop blinking (if it was blinkig!)*/ + /* Stop blinking (if it was blinking!)*/ if(if_info->blinking) { /* Turn on the light (if it was off) */ @@ -1666,7 +1665,7 @@ airpcap_save_selected_if_configuration(airpcap_if_info_t* if_info) if(ad) { - /* Stop blinking (if it was blinkig!)*/ + /* Stop blinking (if it was blinking!)*/ if(if_info->blinking) { /* Turn on the light (if it was off) */ @@ -1814,7 +1813,7 @@ get_airpcap_device_keys(airpcap_if_info_t* info_if) g_free(tmp_key); /* BITS */ - new_key->bits = new_key->key->len *4; /* every char is 4 bits in WEP keys (it is an exadecimal number) */ + new_key->bits = new_key->key->len *4; /* every char is 4 bits in WEP keys (it is an hexadecimal number) */ /* SSID not used in WEP keys */ new_key->ssid = NULL; @@ -1886,7 +1885,7 @@ get_airpcap_driver_keys() if(tmp_key != NULL) g_free(tmp_key); /* BITS */ - new_key->bits = new_key->key->len *4; /* every char is 4 bits in WEP keys (it is an exadecimal number) */ + new_key->bits = new_key->key->len *4; /* every char is 4 bits in WEP keys (it is an hexadecimal number) */ /* SSID not used in WEP keys */ new_key->ssid = NULL; @@ -2179,7 +2178,7 @@ key_lists_are_equal(GList* list1, GList* list2) /* * XXX - START : Retrieve the aublists of WEP keys!!! This is needed only 'till Driver WPA decryption - * is not implemented. + * is implemented. */ for(i=0;ichannelInfo.Frequency = ch_freq; - airpcap_if_selected->saved = FALSE; + airpcap_if_selected->saved = FALSE; airpcap_update_channel_offset_cb(airpcap_if_selected, ch_freq, GTK_WIDGET(data)); } } @@ -420,7 +420,7 @@ on_channel_offset_cb_changed(GtkWidget *w, gpointer data) { sscanf(s,"%d",&offset); airpcap_if_selected->channelInfo.ExtChannel = offset; - airpcap_if_selected->saved = FALSE; + airpcap_if_selected->saved = FALSE; } } } @@ -430,7 +430,7 @@ on_channel_offset_cb_changed(GtkWidget *w, gpointer data) * Changed callback for the capture type combobox */ static void -on_capture_type_en_changed(GtkWidget *w _U_, gpointer data) +on_capture_type_en_changed(GtkWidget *w, gpointer data) { const gchar *s; @@ -450,14 +450,14 @@ on_capture_type_en_changed(GtkWidget *w _U_, gpointer data) * Activate callback for the adapter combobox */ static void -combo_if_activate_cb(GtkWidget *entry _U_, gpointer data) +combo_if_activate_cb(GtkWidget *entry _U_, gpointer data _U_) { } /* * Thread function used to blink the led */ -gboolean update_blink(gpointer data _U_) +gboolean update_blink(gpointer data) { airpcap_if_info_t* sel; PAirpcapHandle ad; @@ -487,7 +487,7 @@ gboolean update_blink(gpointer data _U_) * Blink button callback */ void -on_blink_bt_clicked( GtkWidget *blink_bt _U_, gpointer if_data ) +on_blink_bt_clicked( GtkWidget *blink_bt, gpointer if_data ) { PAirpcapHandle ad = NULL; gchar ebuf[AIRPCAP_ERRBUF_SIZE]; @@ -572,7 +572,7 @@ on_key_management_destroy(GtkWidget *w _U_, gpointer data _U_) /* the Advenced wireless Settings window was closed, cleanup things */ static void -on_airpcap_advanced_destroy(GtkWidget *w _U_, gpointer data _U_) +on_airpcap_advanced_destroy(GtkWidget *w _U_, gpointer data) { GtkWidget *airpcap_advanced_w, *toolbar; @@ -618,7 +618,7 @@ on_key_management_apply_bt_clicked(GtkWidget *button _U_, gpointer data) /* widgets in the toolbar */ GtkWidget *toolbar; - GtkWidget *toolbar_cm; + GtkWidget *toolbar_cm; GtkWidget *key_ls; GtkWidget *decryption_en; @@ -632,7 +632,7 @@ on_key_management_apply_bt_clicked(GtkWidget *button _U_, gpointer data) toolbar = GTK_WIDGET(g_object_get_data(G_OBJECT(key_management_w),AIRPCAP_TOOLBAR_KEY)); toolbar_cm = GTK_WIDGET(g_object_get_data(G_OBJECT(key_management_w),AIRPCAP_TOOLBAR_DECRYPTION_KEY)); -#define CANT_SAVE_ERR_STR "Cannot save configuration! Another application" \ +#define CANT_SAVE_ERR_STR "Cannot save configuration! Another application " \ "might be using AirPcap, or you might not have sufficient privileges." /* Set the Decryption Mode */ if (g_ascii_strcasecmp(gtk_entry_get_text(GTK_ENTRY(decryption_en)),AIRPCAP_DECRYPTION_TYPE_STRING_WIRESHARK) == 0) @@ -693,7 +693,7 @@ on_advanced_apply_bt_clicked(GtkWidget *button, gpointer data _U_) /* Update toolbar (only if airpcap_if_selected is airpcap_if_active)*/ if ( g_ascii_strcasecmp(airpcap_if_selected->description,airpcap_if_active->description) == 0) { - gtk_label_set_text(GTK_LABEL(toolbar_if_lb), g_strdup_printf("%s %s\t","Current Wireless Interface: #",airpcap_get_if_string_number(airpcap_if_selected))); + gtk_label_set_text(GTK_LABEL(toolbar_if_lb), g_strdup_printf("%s %s\t","Current Wireless Interface: #",airpcap_get_if_string_number(airpcap_if_selected))); airpcap_update_channel_combo(GTK_WIDGET(toolbar_channel_cm),airpcap_if_selected); airpcap_update_channel_offset_combo_entry(GTK_WIDGET(toolbar_channel_offset_cb),airpcap_if_selected->channelInfo.ExtChannel); airpcap_validation_type_combo_set_by_type(toolbar_wrong_crc_cm,airpcap_if_selected->CrcValidationOn); @@ -759,7 +759,7 @@ airpcap_advanced_ok_cb(GtkWidget *w, gpointer data _U_) * Callback for the 'Reset Configuration' button. */ void -on_reset_configuration_bt_clicked(GtkWidget *button, gpointer data _U_) +on_reset_configuration_bt_clicked(GtkWidget *button _U_, gpointer data _U_) { return; } @@ -876,7 +876,7 @@ on_add_key_ok_bt_clicked(GtkWidget *widget, gpointer data _U_) else if (g_ascii_strcasecmp(new_type_string->str,AIRPCAP_WPA_PWD_KEY_STRING) == 0) /* WPA Key */ { /* XXX - Perform some WPA related input fields check */ - /* If everything is ok, modify the entry int he list */ + /* If everything is ok, modify the entry in the list */ if ( ((new_key_string->len) > WPA_KEY_MAX_CHAR_SIZE) || ((new_key_string->len) < WPA_KEY_MIN_CHAR_SIZE)) { @@ -893,7 +893,7 @@ on_add_key_ok_bt_clicked(GtkWidget *widget, gpointer data _U_) } /* - * XXX - Maybe we need some check on the characters? I'm not sure if only stabdard ASCII are ok... + * XXX - Maybe we need some check on the characters? I'm not sure if only standard ASCII are ok... */ if ( ((new_ssid_string->len) > WPA_SSID_MAX_CHAR_SIZE) || ((new_ssid_string->len) < WPA_SSID_MIN_CHAR_SIZE)) { @@ -1084,7 +1084,7 @@ on_edit_key_ok_bt_clicked(GtkWidget *widget, gpointer data _U_) else if (g_ascii_strcasecmp(new_type_string->str,AIRPCAP_WPA_PWD_KEY_STRING) == 0) /* WPA Key */ { /* XXX - Perform some WPA related input fields check */ - /* If everything is ok, modify the entry int he list */ + /* If everything is ok, modify the entry in the list */ if ( ((new_key_string->len) > WPA_KEY_MAX_CHAR_SIZE) || ((new_key_string->len) < WPA_KEY_MIN_CHAR_SIZE)) { @@ -1101,7 +1101,7 @@ on_edit_key_ok_bt_clicked(GtkWidget *widget, gpointer data _U_) } /* - * XXX - Maybe we need some check on the characters? I'm not sure if only stabdard ASCII are ok... + * XXX - Maybe we need some check on the characters? I'm not sure if only standard ASCII are ok... */ if ( ((new_ssid_string->len) > WPA_SSID_MAX_CHAR_SIZE) || ((new_ssid_string->len) < WPA_SSID_MIN_CHAR_SIZE)) { @@ -1125,7 +1125,7 @@ on_edit_key_ok_bt_clicked(GtkWidget *widget, gpointer data _U_) else if (g_ascii_strcasecmp(new_type_string->str,AIRPCAP_WPA_BIN_KEY_STRING) == 0) /* WPA_BIN Key */ { /* XXX - Perform some WPA_BIN related input fields check */ - /* If everything is ok, modify the entry int he list */ + /* If everything is ok, modify the entry in the list */ if ( ((new_key_string->len) != WPA_PSK_KEY_CHAR_SIZE)) { @@ -1379,7 +1379,7 @@ on_add_new_key_bt_clicked(GtkWidget *button, gpointer data _U_) * Add key window destroy callback */ static void -add_key_w_destroy_cb(GtkWidget *button, gpointer data _U_) +add_key_w_destroy_cb(GtkWidget *button _U_, gpointer data _U_) { return; } @@ -1388,7 +1388,7 @@ add_key_w_destroy_cb(GtkWidget *button, gpointer data _U_) * Edit key window destroy callback */ void -on_edit_key_w_destroy(GtkWidget *button, gpointer data _U_) +on_edit_key_w_destroy(GtkWidget *button, gpointer data) { GtkWidget *airpcap_advanced_w; @@ -1403,7 +1403,7 @@ on_edit_key_w_destroy(GtkWidget *button, gpointer data _U_) * Add key window destroy callback */ void -on_add_key_w_destroy(GtkWidget *button, gpointer data _U_) +on_add_key_w_destroy(GtkWidget *button, gpointer data) { GtkWidget *airpcap_advanced_w; @@ -1418,7 +1418,7 @@ on_add_key_w_destroy(GtkWidget *button, gpointer data _U_) * Callback for the 'Remove Key' button. */ void -on_remove_key_bt_clicked(GtkWidget *button, gpointer data _U_) +on_remove_key_bt_clicked(GtkWidget *button, gpointer data) { GtkWidget *key_ls; GtkWidget *airpcap_advanced_w; @@ -1448,7 +1448,7 @@ on_remove_key_bt_clicked(GtkWidget *button, gpointer data _U_) if ( r == NO_ROW_SELECTED ) /* No key selected */ return; - /* Remove selected key*/ + /* Remove selected key */ gtk_clist_remove(GTK_CLIST(key_ls),r); /* Reselect another row, if any... */ @@ -1465,7 +1465,7 @@ on_remove_key_bt_clicked(GtkWidget *button, gpointer data _U_) * Callback for the 'Edit Key' button. */ void -on_edit_key_bt_clicked(GtkWidget *button, gpointer data _U_) +on_edit_key_bt_clicked(GtkWidget *button, gpointer data) { GtkWidget *edit_key_window; GtkWidget *edit_frame; @@ -1676,7 +1676,7 @@ on_edit_key_bt_clicked(GtkWidget *button, gpointer data _U_) * Callback for the 'Move Key Up' button. */ void -on_move_key_up_bt_clicked(GtkWidget *button, gpointer data _U_) +on_move_key_up_bt_clicked(GtkWidget *button, gpointer data) { GtkWidget *airpcap_advanced_w; GtkWidget *key_ls; @@ -1726,7 +1726,7 @@ on_move_key_up_bt_clicked(GtkWidget *button, gpointer data _U_) * Callback for the 'Move Key Down' button. */ void -on_move_key_down_bt_clicked(GtkWidget *button, gpointer data _U_) +on_move_key_down_bt_clicked(GtkWidget *button, gpointer data) { GtkWidget *airpcap_advanced_w; GtkWidget *key_ls; @@ -1817,7 +1817,7 @@ void update_decryption_mode_cm(GtkWidget *w) { /* - * This ensures that the entry tet changes... the callback will return immediately, but + * This ensures that the entry get changes... the callback will return immediately, but * at least next time packets will be redissected... */ gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(w)->entry),""); @@ -1861,7 +1861,7 @@ update_decryption_mode_list(GtkWidget *w) /* * XXX - Retrieve the current 'decryption mode'. It would be better just block the - * signal handler, but it doesn't work... one of these days I'll try to figure otu why... + * signal handler, but it doesn't work... one of these days I'll try to figure out why... */ current_text = g_strdup(gtk_entry_get_text(GTK_ENTRY(entry))); @@ -2317,7 +2317,7 @@ display_airpcap_advanced_cb(GtkWidget *w, gpointer data) * Callback for the OK button 'clicked' in the Advanced Wireless Settings window. */ void -on_advanced_ok_bt_clicked(GtkWidget *button, gpointer data _U_) +on_advanced_ok_bt_clicked(GtkWidget *button, gpointer data) { PAirpcapHandle ad = NULL; gchar ebuf[AIRPCAP_ERRBUF_SIZE]; @@ -2408,7 +2408,7 @@ on_advanced_ok_bt_clicked(GtkWidget *button, gpointer data _U_) * Callback for the CANCEL button 'clicked' in the Advanced Wireless Settings window. */ void -on_advanced_cancel_bt_clicked(GtkWidget *button, gpointer data _U_) +on_advanced_cancel_bt_clicked(GtkWidget *button, gpointer data) { PAirpcapHandle ad = NULL; gchar ebuf[AIRPCAP_ERRBUF_SIZE]; @@ -2778,7 +2778,7 @@ display_airpcap_key_management_cb(GtkWidget *w, gpointer data) /* Ask the user what to do ...*/ airpcap_keys_check_w(key_management_w,NULL); } - else /* Keys from lists are equals, or wireshark has got no keys */ + else /* Keys from lists are equals, or Wireshark has got no keys */ { airpcap_load_decryption_keys(airpcap_if_list); airpcap_fill_key_list(key_ls); @@ -2793,7 +2793,7 @@ display_airpcap_key_management_cb(GtkWidget *w, gpointer data) void on_key_management_ok_bt_clicked(GtkWidget *button, gpointer data) { - /* advenced window */ + /* advanced window */ GtkWidget *key_management_w; /* retrieve main window */ @@ -2828,7 +2828,7 @@ on_key_management_ok_bt_clicked(GtkWidget *button, gpointer data) * Callback for the CANCEL button 'clicked' in the Decryption Key Management window. */ void -on_key_management_cancel_bt_clicked(GtkWidget *button, gpointer data _U_) +on_key_management_cancel_bt_clicked(GtkWidget *button, gpointer data) { PAirpcapHandle ad = NULL; @@ -2867,7 +2867,7 @@ on_key_management_cancel_bt_clicked(GtkWidget *button, gpointer data _U_) } /* - * Dialog box that appears whenever keys are not consistent between wireshark and AirPcap + * Dialog box that appears whenever keys are not consistent between Wireshark and AirPcap */ void airpcap_keys_check_w(GtkWidget *w, gpointer data) @@ -3036,7 +3036,7 @@ on_keys_check_cancel_bt_clicked (GtkWidget *button, gpointer user_data) key_management_w = g_object_get_data(G_OBJECT(keys_check_w),AIRPCAP_CHECK_WINDOW_KEY); - /* w may be NULL if airpcap_keys_check_w() has been called while wireshark was loading, + /* w may be NULL if airpcap_keys_check_w() has been called while Wireshark was loading, and is not NULL if it was called when the Key Management widget has been clicked */ if (key_management_w != NULL) { @@ -3125,7 +3125,7 @@ on_keep_bt_clicked (GtkWidget *button, gpointer user_data) /* Close the window */ gtk_widget_destroy(keys_check_w); - /* w may be NULL if airpcap_keys_check_w() has been called while wireshark was loading, + /* w may be NULL if airpcap_keys_check_w() has been called while Wireshark was loading, and is not NULL if it was called when the Key Management widget has been clicked */ if (key_management_w != NULL) { @@ -3206,7 +3206,7 @@ on_merge_bt_clicked (GtkWidget * button, gpointer user_data) gtk_widget_destroy(keys_check_w); - /* w may be NULL if airpcap_keys_check_w() has been called while wireshark was loading, + /* w may be NULL if airpcap_keys_check_w() has been called while Wireshark was loading, and is not NULL if it was called when the Key Management widget has been clicked */ if (key_management_w != NULL) { @@ -3285,7 +3285,7 @@ on_import_bt_clicked (GtkWidget * button, gpointer user_data) gtk_widget_destroy(keys_check_w); - /* w may be NULL if airpcap_keys_check_w() has been called while wireshark was loading, + /* w may be NULL if airpcap_keys_check_w() has been called while Wireshark was loading, and is not NULL if it was called when the Key Management widget has been clicked */ if (key_management_w != NULL) { @@ -3308,7 +3308,7 @@ on_ignore_bt_clicked (GtkWidget * button, gpointer user_data) key_management_w = g_object_get_data(G_OBJECT(keys_check_w),AIRPCAP_CHECK_WINDOW_KEY); - /* w may be NULL if airpcap_keys_check_w() has been called while wireshark was loading, + /* w may be NULL if airpcap_keys_check_w() has been called while Wireshark was loading, and is not NULL if it was called when the Key Management widget has been clicked */ if (key_management_w != NULL) { diff --git a/gtk/main_airpcap_toolbar.c b/gtk/main_airpcap_toolbar.c index 3c09f03ffd..d6e788bd62 100644 --- a/gtk/main_airpcap_toolbar.c +++ b/gtk/main_airpcap_toolbar.c @@ -63,7 +63,7 @@ static GtkWidget *driver_warning_dialog; * Changed callback for the channel combobox */ static void -airpcap_toolbar_channel_changed_cb(GtkWidget *w _U_, gpointer data) +airpcap_toolbar_channel_changed_cb(GtkWidget *w, gpointer data) { const gchar *s; ULONG ch_freq; @@ -136,11 +136,11 @@ airpcap_toolbar_wrong_crc_combo_cb(GtkWidget *entry, gpointer user_data) void airpcap_toolbar_encryption_cb(GtkWidget *entry, gpointer user_data) { - /* We need to directly access the .ddl functions here... */ + /* We need to directly access the .dll functions here... */ gchar ebuf[AIRPCAP_ERRBUF_SIZE]; PAirpcapHandle ad; - gint n = 0; + gint n = 0; gint i = 0; airpcap_if_info_t* curr_if = NULL; @@ -239,7 +239,7 @@ GtkWidget *airpcap_toolbar_new() *channel_offset_cb = NULL, *wrong_crc_lb = NULL, *wrong_crc_cm = NULL; - GtkWidget *airpcap_tb; + GtkWidget *airpcap_tb; GtkWidget *enable_decryption_lb; GtkWidget *enable_decryption_cb; @@ -401,7 +401,7 @@ GtkWidget *airpcap_toolbar_new() gtk_widget_set_name (enable_decryption_lb, "enable_decryption_lb"); gtk_widget_show (enable_decryption_lb); gtk_toolbar_append_widget(GTK_TOOLBAR(airpcap_tb), enable_decryption_lb, - NULL, "Private"); + NULL, "Private"); enable_decryption_cb = gtk_combo_new (); gtk_widget_set_name (enable_decryption_cb, "enable_decryption_cb"); @@ -448,7 +448,7 @@ GtkWidget *airpcap_toolbar_new() /* If no airpcap interface is present, gray everything */ if(airpcap_if_active == NULL) { if(airpcap_if_list == NULL || g_list_length(airpcap_if_list) == 0) { - /*No airpcap device found */ + /* No airpcap device found */ airpcap_enable_toolbar_widgets(airpcap_tb,FALSE); /* recent.airpcap_toolbar_show = TRUE; */ } else { @@ -485,7 +485,7 @@ void airpcap_toolbar_show(GtkWidget *airpcap_tb) /* Ask the user what to do ...*/ airpcap_keys_check_w(NULL,NULL); } else { - /* Keys from lists are equals, or wireshark has got no keys */ + /* Keys from lists are equals, or Wireshark has got no keys */ airpcap_load_decryption_keys(airpcap_if_list); } }