hal: Branch 'master'

Danny Kukawka dkukawka at kemper.freedesktop.org
Fri Apr 18 11:41:59 PDT 2008


 hald-runner/runner.c                        |    2 +-
 hald-runner/runner.h                        |    4 ++--
 hald/create_cache.c                         |    2 +-
 hald/device_info.c                          |    2 +-
 hald/device_store.c                         |    2 +-
 hald/hald.h                                 |    4 ++--
 hald/hald_dbus.c                            |   14 +++++++-------
 hald/hald_runner.c                          |    2 +-
 hald/hald_runner.h                          |    2 +-
 hald/linux/addons/addon-acpi.c              |    2 --
 hald/linux/addons/addon-cpufreq-userspace.c |    5 -----
 hald/linux/addons/addon-cpufreq.c           |    6 +++---
 hald/linux/addons/addon-storage.c           |    2 +-
 hald/linux/addons/addon-usb-csr.c           |   10 +++++-----
 hald/linux/blockdev.c                       |   10 +++++-----
 hald/linux/coldplug.c                       |    4 ++--
 hald/linux/device.c                         |    5 -----
 hald/linux/hal-file-monitor.c               |    2 ++
 hald/linux/hotplug.c                        |    2 +-
 hald/linux/pmu.c                            |    4 ----
 hald/linux/probing/probe-pc-floppy.c        |    3 +--
 hald/linux/probing/probe-serial.c           |    3 +--
 hald/linux/probing/probe-smbios.c           |   25 ++++++++++++++++++-------
 hald/linux/probing/probe-volume.c           |   14 ++++++--------
 hald/mmap_cache.c                           |    5 -----
 hald/util.c                                 |    2 +-
 libhal-storage/libhal-storage.c             |   23 +----------------------
 libhal/libhal.c                             |   27 ++++++++++-----------------
 partutil/partutil.c                         |    2 --
 tools/hal-storage-closetray.c               |    2 +-
 tools/hal-storage-eject.c                   |    2 +-
 tools/hal-storage-mount.c                   |   17 +----------------
 tools/hal-storage-shared.c                  |    7 ++-----
 tools/linux/hal-ipw-killswitch-linux.c      |    3 +--
 34 files changed, 80 insertions(+), 141 deletions(-)

New commits:
commit 5d4605190053c89af40c76ea84f2f11ea4fcd14e
Author: Danny Kukawka <danny.kukawka at web.de>
Date:   Fri Apr 18 20:41:51 2008 +0200

    fixed a bunch of compiler warnings from the Intel compiler
    
    Fixed a bunch of compiler warnings from the Intel compiler
    (cce/icc 10.1.015). Closed a small memory leak in
    linux/hal-file-monitor.c

diff --git a/hald-runner/runner.c b/hald-runner/runner.c
index 1184ce2..0ca2aac 100644
--- a/hald-runner/runner.c
+++ b/hald-runner/runner.c
@@ -252,7 +252,7 @@ run_request_run (run_request *r, DBusConnection *con, DBusMessage *msg, GPid *ou
 	char *program_dir = NULL;
 	GList *list;
 
-	printf("Run started %s (%d) (%d) \n!", r->argv[0], r->timeout,
+	printf("Run started %s (%u) (%d) \n!", r->argv[0], r->timeout,
 		r->error_on_stderr);
 	if (r->input != NULL) {
 		stdin_p = &stdin_v; 
diff --git a/hald-runner/runner.h b/hald-runner/runner.h
index c053381..d063784 100644
--- a/hald-runner/runner.h
+++ b/hald-runner/runner.h
@@ -50,9 +50,9 @@ gboolean run_request_run(run_request *r, DBusConnection *con, DBusMessage *msg,
 void run_kill_udi(gchar *udi);
 
 /* Kill all running request*/
-void run_kill_all();
+void run_kill_all(void);
 
 /* initialise the actual runner data */
-void run_init();
+void run_init(void);
 
 #endif /*  RUNNER_H */
diff --git a/hald/create_cache.c b/hald/create_cache.c
index bc1cfba..cdc8c9a 100644
--- a/hald/create_cache.c
+++ b/hald/create_cache.c
@@ -300,7 +300,7 @@ static void remember_jump_position(struct fdi_context *fdi_ctx)
 	if (fdi_ctx->depth >= HAL_MAX_INDENT_DEPTH)
 		DIE(("Rule depth overflow"));
 	fdi_ctx->match_at_depth[fdi_ctx->depth++] = fdi_ctx->position;
-};
+}
 
 static void set_jump_position(struct fdi_context *fdi_ctx)
 {
diff --git a/hald/device_info.c b/hald/device_info.c
index 22f1836..2381612 100644
--- a/hald/device_info.c
+++ b/hald/device_info.c
@@ -804,7 +804,7 @@ handle_match (struct rule *rule, HalDevice *d)
 		return FALSE;
 	}
 
-	return FALSE;
+	// return FALSE;
 }
 
 /* we have finished the callouts for a device, now add it to the gdl */
diff --git a/hald/device_store.c b/hald/device_store.c
index ff27dbd..191e251 100644
--- a/hald/device_store.c
+++ b/hald/device_store.c
@@ -364,7 +364,7 @@ void
 hal_device_store_print (HalDeviceStore *store)
 {
 	fprintf (stderr, "===============================================\n");
-        fprintf (stderr, "Dumping %d devices\n", 
+        fprintf (stderr, "Dumping %u devices\n", 
 		 g_slist_length (store->devices));
 	fprintf (stderr, "===============================================\n");
 	hal_device_store_foreach (store, 
diff --git a/hald/hald.h b/hald/hald.h
index 7c55e62..1960595 100644
--- a/hald/hald.h
+++ b/hald/hald.h
@@ -49,8 +49,8 @@ HalDeviceStore *hald_get_tdl (void);
 
 void hald_compute_udi (gchar *dst, gsize dstsize, const gchar *format, ...);
 
-void property_atomic_update_begin ();
-void property_atomic_update_end ();
+void property_atomic_update_begin (void);
+void property_atomic_update_end (void);
 
 extern dbus_bool_t hald_is_verbose;
 extern dbus_bool_t hald_use_syslog;
diff --git a/hald/hald_dbus.c b/hald/hald_dbus.c
index b324804..819ab9c 100644
--- a/hald/hald_dbus.c
+++ b/hald/hald_dbus.c
@@ -1109,7 +1109,7 @@ foreach_property_append (HalDevice *device,
 	case HAL_PROPERTY_TYPE_STRLIST:
 	{
 		DBusMessageIter iter_var, iter_array;
-		HalDeviceStrListIter iter;
+		HalDeviceStrListIter hd_iter;
 
 		dbus_message_iter_open_container (&iter_dict_entry,
 						  DBUS_TYPE_VARIANT,
@@ -1122,11 +1122,11 @@ foreach_property_append (HalDevice *device,
 						  DBUS_TYPE_STRING_AS_STRING,
 						  &iter_array);
 
-		for (hal_device_property_strlist_iter_init (device, key, &iter);
-		     hal_device_property_strlist_iter_is_valid (&iter);
-		     hal_device_property_strlist_iter_next (&iter)) {
+		for (hal_device_property_strlist_iter_init (device, key, &hd_iter);
+		     hal_device_property_strlist_iter_is_valid (&hd_iter);
+		     hal_device_property_strlist_iter_next (&hd_iter)) {
 			const char *v;
-			v = hal_device_property_strlist_iter_get_value (&iter);
+			v = hal_device_property_strlist_iter_get_value (&hd_iter);
 
 			dbus_message_iter_append_basic (&iter_array, 
 							DBUS_TYPE_STRING,
@@ -5618,7 +5618,7 @@ hald_dbus_session_active_changed (CKTracker *tracker, CKSession *session, void *
 	}
 
 	extra_env[1] = g_strdup_printf ("HALD_SESSION_ACTIVE_CHANGED_SESSION_ID=%s", ck_session_get_id (session));
-	extra_env[2] = g_strdup_printf ("HALD_SESSION_ACTIVE_CHANGED_SESSION_UID=%d", ck_session_get_user (session));
+	extra_env[2] = g_strdup_printf ("HALD_SESSION_ACTIVE_CHANGED_SESSION_UID=%u", ck_session_get_user (session));
 	extra_env[3] = g_strdup_printf ("HALD_SESSION_ACTIVE_CHANGED_SESSION_IS_ACTIVE=%s", 
 					ck_session_is_active (session) ? "true" : "false");
 
@@ -5660,7 +5660,7 @@ hald_dbus_session_added (CKTracker *tracker, CKSession *session, void *user_data
 	}
 
 	extra_env[1] = g_strdup_printf ("HALD_SESSION_ADD_SESSION_ID=%s", ck_session_get_id (session));
-	extra_env[2] = g_strdup_printf ("HALD_SESSION_ADD_SESSION_UID=%d", ck_session_get_user (session));
+	extra_env[2] = g_strdup_printf ("HALD_SESSION_ADD_SESSION_UID=%u", ck_session_get_user (session));
 	extra_env[3] = g_strdup_printf ("HALD_SESSION_ADD_SESSION_IS_ACTIVE=%s", 
 					ck_session_is_active (session) ? "true" : "false");
 
diff --git a/hald/hald_runner.c b/hald/hald_runner.c
index 400c90b..c8bec82 100644
--- a/hald/hald_runner.c
+++ b/hald/hald_runner.c
@@ -451,7 +451,7 @@ add_basic_env (DBusMessageIter * iter, const gchar * udi)
 				add_env (iter, s, ck_session_is_active (session) ? "true" : "false");
 				g_free (s);
 				s = g_strdup_printf ("CK_SESSION_UID_%s", session_id);
-				p = g_strdup_printf ("%d", ck_session_get_user (session));
+				p = g_strdup_printf ("%u", ck_session_get_user (session));
 				add_env (iter, s, p);
 				g_free (s);
 				g_free (p);
diff --git a/hald/hald_runner.h b/hald/hald_runner.h
index 0356132..6580993 100644
--- a/hald/hald_runner.h
+++ b/hald/hald_runner.h
@@ -92,7 +92,7 @@ hald_runner_run_method(HalDevice *device,
                        gpointer data1, gpointer data2);
 
 void hald_runner_kill_device(HalDevice *device);
-void hald_runner_kill_all();
+void hald_runner_kill_all(void);
 
 /* called by the core to tell the runner a device was finalized */
 void runner_device_finalized (HalDevice *device);
diff --git a/hald/linux/addons/addon-acpi.c b/hald/linux/addons/addon-acpi.c
index de49c80..ea4ad30 100644
--- a/hald/linux/addons/addon-acpi.c
+++ b/hald/linux/addons/addon-acpi.c
@@ -303,8 +303,6 @@ main (int argc, char **argv)
 		 * sleep for 5s and try to reconnect (again). */
 		sleep (5);
 	}
-
-	return 1;
 }
 
 /* vim:set sw=8 noet: */
diff --git a/hald/linux/addons/addon-cpufreq-userspace.c b/hald/linux/addons/addon-cpufreq-userspace.c
index ab1680f..be7bab1 100644
--- a/hald/linux/addons/addon-cpufreq-userspace.c
+++ b/hald/linux/addons/addon-cpufreq-userspace.c
@@ -353,7 +353,6 @@ static gboolean adjust_speed(struct userspace_interface *iface)
 {
 	GSList		*cpus	 = (GSList*)iface->cpus;
 	GSList		*it	 = NULL;
-	int		ret	 = 0;
 	int		cpu_load = 0;
 
 	for (it = cpus; it != NULL; it = g_slist_next(it)) {
@@ -380,19 +379,15 @@ static gboolean adjust_speed(struct userspace_interface *iface)
 			iface->current_speed = 0;
 			HAL_DEBUG(("jumped to max (%d kHz)", 
 				   g_a_i(iface->speeds_kHz, iface->current_speed)));
-			ret = 1;
 		}
 	} else if (cpu_load > config.up_threshold && iface->current_speed > 0) {
 		iface->current_speed = increase_speed(iface);
 		HAL_DEBUG(("increased to %d kHz", g_a_i(iface->speeds_kHz, iface->current_speed)));
-		ret = 1;
 	} else if (cpu_load < (int)g_a_i(iface->demotion, iface->current_speed) &&
 		   iface->current_speed < iface->last_step) {
 		iface->current_speed = decrease_speed(iface);
 		HAL_DEBUG(("decreased to %d kHz", g_a_i(iface->speeds_kHz, iface->current_speed)));
-		ret = -1;
 	} else {
-		ret = 0;
 		HAL_DEBUG(("Speed not changed"));
 	}
 
diff --git a/hald/linux/addons/addon-cpufreq.c b/hald/linux/addons/addon-cpufreq.c
index 040ebd9..86d8ebc 100644
--- a/hald/linux/addons/addon-cpufreq.c
+++ b/hald/linux/addons/addon-cpufreq.c
@@ -689,9 +689,9 @@ static gboolean set_governors(DBusConnection *connection, DBusMessage *message,
 
 	/** clear all previous cpufreq_objs */
 	if (g_slist_length(cpufreq_objs) > 0) {
-		GSList *it = NULL;
- 		for (it = cpufreq_objs; it != NULL; it = g_slist_next(it)) {
-			struct cpufreq_obj *obj = it->data; 
+		GSList *iter = NULL;
+ 		for (iter = cpufreq_objs; iter != NULL; iter = g_slist_next(iter)) {
+			struct cpufreq_obj *obj = iter->data; 
 			obj->free(obj->iface);
 			free(obj->iface);
 			free(obj);
diff --git a/hald/linux/addons/addon-storage.c b/hald/linux/addons/addon-storage.c
index 8d6d4b8..fff22d6 100644
--- a/hald/linux/addons/addon-storage.c
+++ b/hald/linux/addons/addon-storage.c
@@ -279,7 +279,7 @@ enum {
 };
 
 static gboolean poll_for_media (gpointer user_data);
-static gboolean poll_for_media_force ();
+static gboolean poll_for_media_force (void);
 
 static int interval_in_seconds = 2;
 
diff --git a/hald/linux/addons/addon-usb-csr.c b/hald/linux/addons/addon-usb-csr.c
index 4dfecdc..fbb2254 100644
--- a/hald/linux/addons/addon-usb-csr.c
+++ b/hald/linux/addons/addon-usb-csr.c
@@ -68,7 +68,7 @@ static GMainLoop *main_loop;
 static const char *device_udi;
 
 /* prototypes */
-static struct usb_device *find_device (const char *hal_device_udi, PropertyCacheItem *pci);
+static struct usb_device *find_device (PropertyCacheItem *pci);
 
 static PropertyCacheItem* 
 property_cache_item_get (const char *hal_device_udi)
@@ -129,7 +129,7 @@ check_battery (const char *hal_device_udi, PropertyCacheItem *pci)
 	HAL_DEBUG (("Is dual: %d", is_dual));
 	addr = is_dual? 1<<8 : 0;
 
-	curr_device = find_device (hal_device_udi, pci);
+	curr_device = find_device (pci);
 	if (curr_device == NULL)	{
 		HAL_ERROR (("Device %s not found", hal_device_udi));
 		return;
@@ -170,7 +170,7 @@ check_battery (const char *hal_device_udi, PropertyCacheItem *pci)
 
 /* TODO: Is it linux-specific way to find the device? */
 static struct usb_device* 
-find_device (const char *hal_device_udi, PropertyCacheItem *pci)
+find_device (PropertyCacheItem *pci)
 {
 	struct usb_bus* curr_bus;
 	char LUdirname[5];
@@ -224,7 +224,7 @@ is_the_device (const char *hal_device_udi)
 }
 
 static void
-device_removed (LibHalContext *ctx, const char *hal_device_udi)
+device_removed (const char *hal_device_udi)
 {
 	/* this device is removed */
 	if (is_the_device (hal_device_udi)) {
@@ -245,7 +245,7 @@ property_modified (LibHalContext *ctx,
 		if (is_removed) {
 			HAL_DEBUG (("** Main Property %s removed: %s", key, hal_device_udi));
 			/* probably we'll have to exit if this is our device */
-			device_removed (ctx, hal_device_udi);
+			device_removed (hal_device_udi);
 		}
 	} else
 		/* "Secondary" property modified */
diff --git a/hald/linux/blockdev.c b/hald/linux/blockdev.c
index ceba51f..6042558 100644
--- a/hald/linux/blockdev.c
+++ b/hald/linux/blockdev.c
@@ -1760,12 +1760,12 @@ udev_get_device_file_for_sysfs_path (const char *sysfs_path)
 
         if (!g_spawn_sync("/", 
                           (char **) argv, 
-                          NULL,           /* envp */
-                          0,              /* flags */
-                          NULL,           /* child_setup */
-                          NULL,           /* user_data */
+                          NULL,           			/* envp */
+                          G_SPAWN_LEAVE_DESCRIPTORS_OPEN, 	/* flags */
+                          NULL,           			/* child_setup */
+                          NULL,           			/* user_data */
                           &u_stdout,
-                          NULL,           /* stderr */
+                          NULL,           			/* stderr */
                           &u_exit_status,
                           &g_error)) {
                 HAL_ERROR (("Error spawning udevinfo: %s", g_error->message));
diff --git a/hald/linux/coldplug.c b/hald/linux/coldplug.c
index 7e65951..1d10131 100644
--- a/hald/linux/coldplug.c
+++ b/hald/linux/coldplug.c
@@ -158,7 +158,7 @@ hal_util_init_sysfs_to_udev_map (void)
 	sysfs_to_udev_map = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, udev_info_free);
 
 	/* get udevroot */
-	if (g_spawn_sync ("/", udevroot_argv, NULL, 0, NULL, NULL,
+	if (g_spawn_sync ("/", udevroot_argv, NULL, G_SPAWN_LEAVE_DESCRIPTORS_OPEN, NULL, NULL,
 			  &udevinfo_stdout,
 			  NULL,
 			  &udevinfo_exitcode,
@@ -179,7 +179,7 @@ hal_util_init_sysfs_to_udev_map (void)
 	HAL_INFO (("dev_root is %s", dev_root));
 
 	/* get udevdb export */
-	if (g_spawn_sync ("/", udevdb_export_argv, NULL, 0, NULL, NULL,
+	if (g_spawn_sync ("/", udevdb_export_argv, NULL, G_SPAWN_LEAVE_DESCRIPTORS_OPEN, NULL, NULL,
 			  &udevinfo_stdout,
 			  NULL,
 			  &udevinfo_exitcode,
diff --git a/hald/linux/device.c b/hald/linux/device.c
index 2014b88..770f522 100644
--- a/hald/linux/device.c
+++ b/hald/linux/device.c
@@ -3104,12 +3104,7 @@ static gboolean
 backlight_compute_udi (HalDevice *d)
 {
 	gchar udi[256];
-	const char *dir;
-	const char *name;
 
-	dir = hal_device_property_get_string (d, "linux.sysfs_path");
-
-	name = hal_util_get_last_element(dir);
 	hald_compute_udi (udi, sizeof (udi),
 			  "%s_backlight",
 			  hal_device_property_get_string (d, "info.parent"));
diff --git a/hald/linux/hal-file-monitor.c b/hald/linux/hal-file-monitor.c
index 29a2578..c671ce4 100644
--- a/hald/linux/hal-file-monitor.c
+++ b/hald/linux/hal-file-monitor.c
@@ -410,6 +410,8 @@ handle_inotify_event (HalFileMonitor        *monitor,
         if (ievent->mask & IN_IGNORED) {
                 file_monitor_remove_watch (monitor, watch);
         }
+	
+	g_free(freeme);
 }
 
 static gboolean
diff --git a/hald/linux/hotplug.c b/hald/linux/hotplug.c
index 797251a..16ec1b4 100644
--- a/hald/linux/hotplug.c
+++ b/hald/linux/hotplug.c
@@ -116,7 +116,7 @@ hotplug_event_begin_sysfs (HotplugEvent *hotplug_event)
 	if (hotplug_event->type == HOTPLUG_EVENT_SYSFS && d != NULL) {
 		HotplugEventType type;
 
-		type = hal_device_property_get_int (d, "linux.hotplug_type");
+		type = (HotplugEventType) hal_device_property_get_int (d, "linux.hotplug_type");
 		if (type == HOTPLUG_EVENT_SYSFS_DEVICE) {
 			HAL_INFO (("%s is a device (store)", hotplug_event->sysfs.sysfs_path));
 			hotplug_event->type = HOTPLUG_EVENT_SYSFS_DEVICE;
diff --git a/hald/linux/pmu.c b/hald/linux/pmu.c
index 0222cb3..71f94cf 100644
--- a/hald/linux/pmu.c
+++ b/hald/linux/pmu.c
@@ -78,7 +78,6 @@ battery_refresh (HalDevice *d, PMUDevHandler *handler)
 {
 	const char *path;
 	int flags;
-	int last_full;
 
 	path = hal_device_property_get_string (d, "linux.pmu_path");
 	if (path == NULL)
@@ -123,9 +122,6 @@ battery_refresh (HalDevice *d, PMUDevHandler *handler)
 		else
 			hal_device_property_set_int (d, "battery.charge_level.rate", -current);
 
-		current = hal_device_property_get_int (d, "battery.charge_level.current");
-		last_full = hal_device_property_get_int (d, "battery.charge_level.last_full");
-
 		/* TODO: could read some pmu file? */
 		device_pm_calculate_time (d);
 		device_pm_calculate_percentage (d);
diff --git a/hald/linux/probing/probe-pc-floppy.c b/hald/linux/probing/probe-pc-floppy.c
index 7a66987..b8e3c71 100644
--- a/hald/linux/probing/probe-pc-floppy.c
+++ b/hald/linux/probing/probe-pc-floppy.c
@@ -46,7 +46,6 @@ main (int argc, char *argv[])
 {
 	int fd;
 	int ret;
-	char *udi;
 	char *device_file;
 	char name[256];
 	struct floppy_drive_struct ds;
@@ -56,7 +55,7 @@ main (int argc, char *argv[])
 	/* assume failure */
 	ret = 1;
 
-	if ((udi = getenv ("UDI")) == NULL)
+	if (getenv ("UDI") == NULL)
 		goto out;
 	if ((device_file = getenv ("HAL_PROP_BLOCK_DEVICE")) == NULL)
 		goto out;
diff --git a/hald/linux/probing/probe-serial.c b/hald/linux/probing/probe-serial.c
index b70f82b..df5a749 100644
--- a/hald/linux/probing/probe-serial.c
+++ b/hald/linux/probing/probe-serial.c
@@ -46,7 +46,6 @@ main (int argc, char *argv[])
 {
 	int fd;
 	int ret;
-	char *udi;
 	char *device_file;
 	struct serial_struct ss;
 
@@ -57,7 +56,7 @@ main (int argc, char *argv[])
 	
 	setup_logger ();
 
-	if ((udi = getenv ("UDI")) == NULL) {
+	if (getenv ("UDI") == NULL) {
 		HAL_ERROR (("UDI not set"));
 		goto out;
 	}
diff --git a/hald/linux/probing/probe-smbios.c b/hald/linux/probing/probe-smbios.c
index 4d5551c..6085599 100644
--- a/hald/linux/probing/probe-smbios.c
+++ b/hald/linux/probing/probe-smbios.c
@@ -29,6 +29,7 @@
 #endif
 
 #include <ctype.h>
+#include <errno.h>
 #include <fcntl.h>
 #include <stdint.h>
 #include <stdio.h>
@@ -101,7 +102,6 @@ main (int argc, char *argv[])
 	char *nbuf;
 	int dmipipe[2];
 	int nullfd;
-	int tmp_ret;
 	FILE *f;
 	int dmiparser_state = DMIPARSER_STATE_IGNORE;
 
@@ -153,9 +153,20 @@ main (int argc, char *argv[])
 		exit(1);
 	}
 
-	tmp_ret = pipe (dmipipe);	
-	f = fdopen (dmipipe[0], "r");
-	nullfd = open ("/dev/null", O_RDONLY);
+	if(pipe (dmipipe) == -1) {
+		HAL_ERROR(("Could not create pipe (error: '%s'), exit!", strerror(errno)));
+		exit(1);
+	}	
+
+	if ((f = fdopen (dmipipe[0], "r")) == NULL) {
+		HAL_ERROR(("Could not open file (error: '%s'), exit!", strerror(errno)));
+		exit(1);
+	}
+
+	if ((nullfd = open ("/dev/null", O_RDONLY)) == -1){
+		HAL_ERROR(("Could not open /dev/null (error: '%s'), exit!", strerror(errno)));
+		exit(1);
+	}
 	
 	/* fork the child process */
 	switch (fork ()) {
@@ -187,7 +198,7 @@ main (int argc, char *argv[])
 	/* read the output of the child */
 	while(fgets (buf, sizeof(buf), f) != NULL)
 	{
-		int i;
+		int j;
 		unsigned int len;
 		unsigned int tabs = 0;
 
@@ -243,8 +254,8 @@ main (int argc, char *argv[])
 		nbuf = &buf[1];
 
 		/* removes the trailing spaces */
-		for (i = len - 2; isspace (nbuf[i]) && i >= 0; --i)
-			nbuf[i] = '\0';
+		for (j = len - 2; isspace (nbuf[j]) && j >= 0; --j)
+			nbuf[j] = '\0';
 
 		if (dmiparser_state == DMIPARSER_STATE_BIOS) {
 			setstr (nbuf, "Vendor:", "system.firmware.vendor");
diff --git a/hald/linux/probing/probe-volume.c b/hald/linux/probing/probe-volume.c
index 61eb96a..4293e90 100644
--- a/hald/linux/probing/probe-volume.c
+++ b/hald/linux/probing/probe-volume.c
@@ -89,7 +89,7 @@ strdup_valid_utf8 (const char *str)
 
 
 static void
-set_volume_id_values (LibHalContext *ctx, const char *udi, LibHalChangeSet *cs, struct volume_id *vid)
+set_volume_id_values (LibHalChangeSet *cs, struct volume_id *vid)
 {
 	char buf[256];
 	const char *usage;
@@ -153,8 +153,7 @@ set_volume_id_values (LibHalContext *ctx, const char *udi, LibHalChangeSet *cs,
 }
 
 static void
-advanced_disc_detect (LibHalContext *ctx, const char *udi, LibHalChangeSet *cs,
-                      int fd, const char *device_file)
+advanced_disc_detect (LibHalChangeSet *cs, int fd, const char *device_file)
 {
 	/* the discs block size */
 	unsigned short bs; 
@@ -312,7 +311,6 @@ main (int argc, char *argv[])
 	LibHalContext *ctx = NULL;
 	DBusError error;
 	char *parent_udi;
-	char *sysfs_path;
 	struct volume_id *vid;
 	char *stordev_dev_file;
 	char *partition_number_str;
@@ -346,7 +344,7 @@ main (int argc, char *argv[])
 		goto out;
 	if ((parent_udi = getenv ("HAL_PROP_INFO_PARENT")) == NULL)
 		goto out;
-	if ((sysfs_path = getenv ("HAL_PROP_LINUX_SYSFS_PATH")) == NULL)
+	if (getenv ("HAL_PROP_LINUX_SYSFS_PATH") == NULL)
 		goto out;
 	partition_number_str = getenv ("HAL_PROP_VOLUME_PARTITION_NUMBER");
 	if (partition_number_str != NULL)
@@ -436,7 +434,7 @@ main (int argc, char *argv[])
 		case CDS_XA_2_2:
 			libhal_changeset_set_property_bool (cs, "volume.disc.has_data", TRUE);
 			HAL_DEBUG(("Disc in %s has data", device_file));
-			advanced_disc_detect (ctx, udi, cs, fd, device_file);
+			advanced_disc_detect (cs, fd, device_file);
 			break;
 		case CDS_NO_INFO:	/* blank or invalid CD */
 			libhal_changeset_set_property_bool (cs, "volume.disc.is_blank", TRUE);
@@ -633,7 +631,7 @@ main (int argc, char *argv[])
 			}
 
 			if (vid_ret == 0) {
-				set_volume_id_values(ctx, udi, cs, vid);
+				set_volume_id_values(cs, vid);
 				if (disc_may_have_data) {
 					libhal_changeset_set_property_bool (cs, "volume.disc.is_blank", FALSE);
 					libhal_changeset_set_property_bool (cs, "volume.disc.has_data", TRUE);
@@ -670,7 +668,7 @@ main (int argc, char *argv[])
 							if (volume_id_probe_all (
 								    vid, vol_probe_offset + part_offset, 0) == 0) {
 
-								set_volume_id_values(ctx, udi, cs, vid);
+								set_volume_id_values(cs, vid);
 							}
 
 							/* and we're done */
diff --git a/hald/mmap_cache.c b/hald/mmap_cache.c
index ac35685..6125cf0 100644
--- a/hald/mmap_cache.c
+++ b/hald/mmap_cache.c
@@ -91,7 +91,6 @@ int di_rules_init (void)
 	return 0;
 }
 
-static gboolean regen_cache_done;
 static gint regen_cache_success;
 
 static void 
@@ -110,8 +109,6 @@ regen_cache_cb (HalDevice *d,
 	} else {
 		regen_cache_success = FALSE;
 	}
-
-	regen_cache_done = TRUE;
 }
 
 
@@ -140,8 +137,6 @@ regen_cache (void)
 		}
 	}
 
-	regen_cache_done = FALSE;
-
 	hald_runner_run_sync (NULL, 
 			      "hald-generate-fdi-cache",
 			      extra_env,
diff --git a/hald/util.c b/hald/util.c
index 29da72e..51f5d8a 100644
--- a/hald/util.c
+++ b/hald/util.c
@@ -1056,7 +1056,7 @@ hal_util_hexdump (const void *mem, unsigned int size)
 	const char *buf = (const char *) mem;
 
 	n = 0;
-	printf ("Dumping %d=0x%x bytes\n", size, size);
+	printf ("Dumping %u=0x%x bytes\n", size, size);
 	while (n < size) {
 
 		printf ("0x%04x: ", n);
diff --git a/libhal-storage/libhal-storage.c b/libhal-storage/libhal-storage.c
index 4868ff9..bd15014 100644
--- a/libhal-storage/libhal-storage.c
+++ b/libhal-storage/libhal-storage.c
@@ -191,15 +191,6 @@ out:
 	return result;
 }
 
-static void
-fixup_string (char *s)
-{
-	/* TODO: first strip leading and trailing whitespace */
-	/*g_strstrip (s);*/
-
-	/* TODO: could do nice things on all-upper case strings */
-}
-
 /* volume may be NULL (e.g. if drive supports removable media) */
 char *
 libhal_drive_policy_compute_display_name (LibHalDrive *drive, LibHalVolume *volume, LibHalStoragePolicy *policy)
@@ -241,8 +232,6 @@ libhal_drive_policy_compute_display_name (LibHalDrive *drive, LibHalVolume *volu
 		}
 	}
 
-	fixup_string (vendormodel_str);
-
 	if (drive_type==LIBHAL_DRIVE_TYPE_CDROM) {
 
 		/* Optical drive handling */
@@ -363,21 +352,13 @@ libhal_volume_policy_compute_display_name (LibHalDrive *drive, LibHalVolume *vol
 	char *name;
 	char *size_str;
 	const char *volume_label;
-	const char *model;
-	const char *vendor;
 	LibHalDriveType drive_type;
-	dbus_bool_t drive_is_hotpluggable;
 	dbus_bool_t drive_is_removable;
-	LibHalDriveCdromCaps drive_cdrom_caps;
 	char buf[MAX_STRING_SZ];
 
 	volume_label = libhal_volume_get_label (volume);
-	model = libhal_drive_get_model (drive);
-	vendor = libhal_drive_get_vendor (drive);
 	drive_type = libhal_drive_get_type (drive);
-	drive_is_hotpluggable = libhal_drive_is_hotpluggable (drive);
 	drive_is_removable = libhal_drive_uses_removable_media (drive);
-	drive_cdrom_caps = libhal_drive_get_cdrom_caps (drive);
 
 	size_str = libhal_volume_policy_compute_size_as_string (volume);
 
@@ -1966,7 +1947,7 @@ libhal_drive_policy_default_get_managed_keyword_secondary (LibHalContext *hal_ct
 dbus_bool_t
 libhal_drive_policy_is_mountable (LibHalDrive *drive, LibHalStoragePolicy *policy)
 {
-	printf ("should_mount=%d, no_partitions_hint=%d\n", drive->should_mount, drive->no_partitions_hint);
+	printf ("should_mount=%u, no_partitions_hint=%u\n", drive->should_mount, drive->no_partitions_hint);
 
 	return drive->should_mount && drive->no_partitions_hint;
 }
@@ -2007,10 +1988,8 @@ mopts_collect (LibHalContext *hal_ctx, const char *namespace, int namespace_len,
 	}
 
 	for (libhal_psi_init (&it, properties); libhal_psi_has_more (&it); libhal_psi_next (&it)) {
-		int type;
 		char *key;
 		
-		type = libhal_psi_get_type (&it);
 		key = libhal_psi_get_key (&it);
 		if (libhal_psi_get_type (&it) == LIBHAL_PROPERTY_TYPE_BOOLEAN &&
 		    strncmp (key, namespace, namespace_len - 1) == 0) {
diff --git a/libhal/libhal.c b/libhal/libhal.c
index be98d43..08c5481 100644
--- a/libhal/libhal.c
+++ b/libhal/libhal.c
@@ -225,21 +225,17 @@ struct LibHalPropertySet_s {
  * Represents a property. Opaque.
  */
 struct LibHalProperty_s {
-	int type;		     /**< Type of property */
-	char *key;		     /**< ASCII string */
+	LibHalPropertyType type;	     	/**< Type of property */
+	char *key;		     		/**< ASCII string */
 
 	/** Possible values of the property */
 	union {
-		char *str_value;     /**< UTF-8 zero-terminated string */
-		dbus_int32_t int_value;
-				     /**< 32-bit signed integer */
-		dbus_uint64_t uint64_value;
-				     /**< 64-bit unsigned integer */
-		double double_value; /**< IEEE754 double precision float */
-		dbus_bool_t bool_value;
-				     /**< Truth value */
-
-		char **strlist_value; /**< List of UTF-8 zero-terminated strings */
+		char *str_value;     		/**< UTF-8 zero-terminated string */
+		dbus_int32_t int_value;         /**< 32-bit signed integer */
+		dbus_uint64_t uint64_value;     /**< 64-bit unsigned integer */
+		double double_value; 		/**< IEEE754 double precision float */
+		dbus_bool_t bool_value;		/**< Truth value */
+		char **strlist_value; 		/**< List of UTF-8 zero-terminated strings */
 	} v;
 
 	UT_hash_handle hh;		/*makes this hashable*/
@@ -427,7 +423,6 @@ static LibHalPropertySet *
 get_property_set (DBusMessageIter *iter)
 {
 	LibHalPropertySet *result;
-	LibHalProperty *p_last;
 	DBusMessageIter dict_iter;
 
 	result = malloc (sizeof (LibHalPropertySet));
@@ -455,8 +450,6 @@ get_property_set (DBusMessageIter *iter)
 
 	dbus_message_iter_recurse (iter, &dict_iter);
 
-	p_last = NULL;
-
 	while (dbus_message_iter_get_arg_type (&dict_iter) == DBUS_TYPE_DICT_ENTRY)
 	{
 		DBusMessageIter dict_entry_iter, var_iter;
@@ -481,7 +474,7 @@ get_property_set (DBusMessageIter *iter)
 
 		dbus_message_iter_recurse (&dict_entry_iter, &var_iter);
 
-		p->type = dbus_message_iter_get_arg_type (&var_iter);
+		p->type = (LibHalPropertyType) dbus_message_iter_get_arg_type (&var_iter);
 
 		if(!libhal_property_fill_value_from_variant (p, &var_iter))
 			goto oom;
@@ -1303,7 +1296,7 @@ libhal_device_get_property_type (LibHalContext *ctx, const char *udi, const char
 	DBusMessage *message;
 	DBusMessage *reply;
 	DBusMessageIter iter, reply_iter;
-	int type;
+	LibHalPropertyType type;
 	DBusError _error;
 
 	LIBHAL_CHECK_LIBHALCONTEXT(ctx, LIBHAL_PROPERTY_TYPE_INVALID); /* or return NULL? */
diff --git a/partutil/partutil.c b/partutil/partutil.c
index c623ca2..9c2930f 100644
--- a/partutil/partutil.c
+++ b/partutil/partutil.c
@@ -776,7 +776,6 @@ part_table_parse_apple (int fd, guint64 offset, guint64 size)
 		/* more stuff */
 	} __attribute__ ((packed)) mac_part;
 	int block_size;
-	int block_count;
 	int map_count;
 
 	HAL_INFO (("Entering Apple parser"));
@@ -798,7 +797,6 @@ part_table_parse_apple (int fd, guint64 offset, guint64 size)
 	}
 
 	block_size = GUINT16_FROM_BE (mac_header.block_size);
-	block_count = GUINT32_FROM_BE (mac_header.block_count); /* num blocks on whole disk */
 
 	HAL_INFO (("Mac MAGIC found, block_size=%d", block_size));
 
diff --git a/tools/hal-storage-closetray.c b/tools/hal-storage-closetray.c
index ef7405d..43cc733 100644
--- a/tools/hal-storage-closetray.c
+++ b/tools/hal-storage-closetray.c
@@ -48,7 +48,7 @@ usage (void)
 }
 
 
-void static
+static void
 unknown_closetray_error (const char *detail)
 {
 	fprintf (stderr, "org.freedesktop.Hal.Device.Storage.UnknownFailure\n");
diff --git a/tools/hal-storage-eject.c b/tools/hal-storage-eject.c
index 81d1c8f..3fb9dfb 100644
--- a/tools/hal-storage-eject.c
+++ b/tools/hal-storage-eject.c
@@ -50,7 +50,7 @@ usage (void)
 }
 
 
-void static
+static void
 unknown_eject_error (const char *detail)
 {
 	fprintf (stderr, "org.freedesktop.Hal.Device.%s.UnknownFailure\n", devtype);
diff --git a/tools/hal-storage-mount.c b/tools/hal-storage-mount.c
index 3220734..3fa59f6 100644
--- a/tools/hal-storage-mount.c
+++ b/tools/hal-storage-mount.c
@@ -585,12 +585,6 @@ handle_mount (LibHalContext *hal_ctx,
 		explicit_mount_point_given = FALSE;
 		if (strlen (mount_point) == 0) {
 			char *p;
-			const char *label;
-			
-			if (volume != NULL)
-				label = libhal_volume_get_label (volume);
-			else
-				label = NULL;
 			
 			if (label != NULL) {
 				/* best - use label */
@@ -693,7 +687,7 @@ handle_mount (LibHalContext *hal_ctx,
 						unknown_error ("option uid is malformed");
 					}
 #ifdef DEBUG
-					printf ("%s with uid %d\n", allow, uid);
+					printf ("%s with uid %u\n", allow, uid);
 #endif
 					wants_to_change_uid = TRUE;
 
@@ -792,15 +786,6 @@ handle_mount (LibHalContext *hal_ctx,
 #ifdef HAVE_POLKIT
         if (invoked_by_syscon_name != NULL) {
                 char *polkit_result;
-                char *action_params[] = {
-                        "fstype", "",
-                        "mount-point", "",
-                        "mount-options", "",
-                        NULL};
-
-                action_params[1] = mount_do_fstype;
-                action_params[3] = mount_dir;
-                action_params[5] = mount_option_commasep;
 
                 dbus_error_init (&error);
                 polkit_result = libhal_device_is_caller_privileged (hal_ctx,
diff --git a/tools/hal-storage-shared.c b/tools/hal-storage-shared.c
index eba5440..b10be10 100644
--- a/tools/hal-storage-shared.c
+++ b/tools/hal-storage-shared.c
@@ -485,7 +485,7 @@ line_found:
 	if (!g_spawn_sync ("/",
 			   args,
 			   NULL,
-			   0,
+			   G_SPAWN_LEAVE_DESCRIPTORS_OPEN,
 			   NULL,
 			   NULL,
 			   &sout,
@@ -550,9 +550,7 @@ handle_eject (DBusConnection *system_bus,
 	int na;
 	int fd;
 	int num_excl_tries;
-#ifdef HAVE_POLKIT
         DBusError error;
-#endif
 
 	/* When called here all the file systems from this device are
 	 * already unmounted. That's actually guaranteed; see
@@ -650,7 +648,7 @@ try_open_excl_again:
 	if (!g_spawn_sync ("/",
 			   args,
 			   NULL,
-			   0,
+			   G_SPAWN_LEAVE_DESCRIPTORS_OPEN,
 			   NULL,
 			   NULL,
 			   &sout,
@@ -675,7 +673,6 @@ try_open_excl_again:
         if (!libhal_drive_is_media_detection_automatic (drive)) {
                 DBusMessage *message;
                 DBusMessage *reply;
-                DBusError error;
 
                 message = dbus_message_new_method_call ("org.freedesktop.Hal",
                                                         udi,
diff --git a/tools/linux/hal-ipw-killswitch-linux.c b/tools/linux/hal-ipw-killswitch-linux.c
index 5376810..1f1a648 100644
--- a/tools/linux/hal-ipw-killswitch-linux.c
+++ b/tools/linux/hal-ipw-killswitch-linux.c
@@ -37,8 +37,7 @@ int main(int argc,char** argv) {
 	char *udi;
 	char *parent;
 	char *iface;
-	int i;
-	char kill_status;
+	int i, kill_status;
 	char **udis;
 	int num_udis;
 	FILE *fd;


More information about the hal-commit mailing list