Add Mike Garratt to the list of authors for (at the very least) his contributions...
[metze/wireshark/wip.git] / airpcap_loader.c
index 75be9e5526b29bdb2e15687bbf96ae2e926cf453..fd7abdd2846dc54a27789a79dd0644c2c9cc49eb 100644 (file)
@@ -249,7 +249,7 @@ set_wep_key(pref_t *pref, gpointer ud _U_)
     keys_cb_data_t*  user_data;
     uat_t *uat;
     gint i;
-    char* err = NULL;
+    const char* err = NULL;
     uat_wep_key_record_t uat_key;
 
     decryption_key_t* new_key;
@@ -260,10 +260,16 @@ set_wep_key(pref_t *pref, gpointer ud _U_)
     if (g_ascii_strcasecmp(pref->name, "wep_key_table") == 0 && pref->type == PREF_UAT)
     {
         uat = (uat_t *)pref->varp.uat;
-        /* UAT must be loaded */
         if (!uat->loaded)
-            return 1;
+        {
+            /* UAT will only be loaded if previous keys exist, so it may need
+               to be loaded now */
+            uat_load(uat, &err);
+            if (err != NULL)
+                return 1;
 
+            uat->loaded = 1;
+        }
         /* Free the old records */
         uat_clear(uat);
 
@@ -273,7 +279,7 @@ set_wep_key(pref_t *pref, gpointer ud _U_)
 
             uat_key.string = get_key_string(new_key);
             uat_key.key = new_key->type;
-            uat_add_record(uat, &uat_key);
+            uat_add_record(uat, &uat_key, TRUE);
         }
 
         uat_save(uat, &err);
@@ -807,7 +813,7 @@ airpcap_if_get_device_supported_channels_array(PAirpcapHandle ah, guint * pNumSu
     if (numInfo == 0)
         return NULL;
 
-    pSupportedChannels = g_malloc(numInfo * (sizeof *pSupportedChannels));
+    pSupportedChannels = (Dot11Channel *)g_malloc(numInfo * (sizeof *pSupportedChannels));
 
     for (i = 0; i < numInfo; i++)
     {
@@ -1117,7 +1123,7 @@ airpcap_if_info_new(char *name, char *description)
     ad = airpcap_if_open(name, ebuf);
     if (ad)
     {
-        if_info = g_malloc0(sizeof (airpcap_if_info_t));
+        if_info = (airpcap_if_info_t *)g_malloc0(sizeof (airpcap_if_info_t));
         if_info->name = g_strdup(name);
         if (description == NULL){
             if_info->description = NULL;
@@ -1167,7 +1173,7 @@ airpcap_driver_fake_if_info_new(void)
      * Retrieve the first AirPcap adapter available. If no interface is found,
      * it is not possible to retrieve the driver's settings, so return NULL.
      */
-    if_info = g_list_nth_data(airpcap_if_list,0);
+    if_info = (airpcap_if_info_t *)g_list_nth_data(airpcap_if_list,0);
     if (if_info == NULL)
         return NULL;
 
@@ -1175,7 +1181,7 @@ airpcap_driver_fake_if_info_new(void)
     ad = airpcap_if_open(if_info->name, ebuf);
     if (ad)
     {
-        fake_if_info = g_malloc(sizeof (airpcap_if_info_t));
+        fake_if_info = (airpcap_if_info_t *)g_malloc(sizeof (airpcap_if_info_t));
         fake_if_info->name = g_strdup(if_info->name);
         fake_if_info->description = g_strdup(if_info->description);
         fake_if_info->loopback = FALSE;
@@ -1341,7 +1347,7 @@ airpcap_if_save_driver_keys(PAirpcapHandle ad, airpcap_if_info_t *if_info)
 static void
 free_airpcap_if_cb(gpointer data, gpointer user_data _U_)
 {
-    airpcap_if_info_t *if_info = data;
+    airpcap_if_info_t *if_info = (airpcap_if_info_t *)data;
 
     if (NULL == if_info)
         return;
@@ -1528,7 +1534,7 @@ airpcap_if_clear_decryption_settings(airpcap_if_info_t* info_if)
 
         info_if->keysCollectionSize = 0;
 
-        info_if->DecryptionOn = FALSE;
+        info_if->DecryptionOn = AIRPCAP_DECRYPTION_OFF;
         info_if->saved = FALSE;
     }
 }
@@ -2414,7 +2420,7 @@ set_airpcap_decryption(gboolean on_off)
             ad = airpcap_if_open(curr_if->name, ebuf);
             if (ad)
             {
-                curr_if->DecryptionOn = (gboolean)AIRPCAP_DECRYPTION_OFF;
+                curr_if->DecryptionOn = AIRPCAP_DECRYPTION_OFF;
                 airpcap_if_set_decryption_state(ad,curr_if->DecryptionOn);
                 /* Save configuration for the curr_if */
                 if (!airpcap_if_store_cur_config_as_adapter_default(ad))
@@ -2533,3 +2539,16 @@ get_runtime_airpcap_version(GString *str)
         vrev, build);
 }
 #endif /* HAVE_AIRPCAP */
+
+/*
+ * Editor modelines  -  http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 4
+ * tab-width: 8
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vi: set shiftwidth=4 tabstop=8 expandtab:
+ * :indentSize=4:tabSize=8:noTabs=true:
+ */