hal: Branch 'master'
Danny Kukawka
dkukawka at kemper.freedesktop.org
Sun Aug 6 09:29:00 PDT 2006
hald-runner/runner.c | 3 ++-
hald/device.c | 8 ++++----
hald/hald_dbus.c | 4 ++--
hald/linux2/addons/addon-acpi-buttons-toshiba.c | 8 ++++----
hald/property.c | 2 +-
libhal-storage/libhal-storage.c | 2 +-
libhal/libhal.c | 6 +++---
tools/hal-storage-eject.c | 3 +--
tools/hal-storage-mount.c | 9 +++------
tools/hal-storage-unmount.c | 3 +--
tools/hal_get_property.c | 4 ++--
tools/lshal.c | 10 +++++-----
12 files changed, 29 insertions(+), 33 deletions(-)
New commits:
diff-tree 732e625134171daf032c9dc39067efe68d6b41b8 (from 5248f077b0ff0087c0d37464713ee36febeee189)
Author: Danny Kukawka <danny.kukawka at web.de>
Date: Sun Aug 6 18:26:29 2006 +0200
fixed several compiler warnings (warn_unused_result and format stuff)
This fixes several compiler warnings from warn_unused_result compiler
flag and some "format '%*' expects type 'x', but argument z has type 'xy'"
warnings on 64bit systems.
diff --git a/hald-runner/runner.c b/hald-runner/runner.c
index 7d33748..a2d1a21 100644
--- a/hald-runner/runner.c
+++ b/hald-runner/runner.c
@@ -259,7 +259,8 @@ run_request_run(run_request *r, DBusConn
g_free (program_dir);
if (r->input) {
- write(stdin_v, r->input, strlen(r->input));
+ if (write(stdin_v, r->input, strlen(r->input)) != (ssize_t) strlen(r->input));
+ printf("Warning: Error while wite r->input (%s) to stdin_v.\n", r->input);
close(stdin_v);
}
diff --git a/hald/device.c b/hald/device.c
index eca5a7a..a1d91f7 100644
--- a/hald/device.c
+++ b/hald/device.c
@@ -567,7 +567,7 @@ hal_device_property_get_as_string (HalDe
snprintf (buf, bufsize, "%d", hal_property_get_int (prop));
break;
case HAL_PROPERTY_TYPE_UINT64:
- snprintf (buf, bufsize, "%lld", hal_property_get_uint64 (prop));
+ snprintf (buf, bufsize, "%llu", (long long unsigned int) hal_property_get_uint64 (prop));
break;
case HAL_PROPERTY_TYPE_DOUBLE:
snprintf (buf, bufsize, "%f", hal_property_get_double (prop));
@@ -946,9 +946,9 @@ hal_device_print (HalDevice *device)
break;
case HAL_PROPERTY_TYPE_UINT64:
- fprintf (stderr, " %s = %lld 0x%llx (uint64)\n", key,
- hal_property_get_uint64 (p),
- hal_property_get_uint64 (p));
+ fprintf (stderr, " %s = %llu 0x%llx (uint64)\n", key,
+ (long long unsigned int) hal_property_get_uint64 (p),
+ (long long unsigned int) hal_property_get_uint64 (p));
break;
case HAL_PROPERTY_TYPE_DOUBLE:
diff --git a/hald/hald_dbus.c b/hald/hald_dbus.c
index 6daef8d..3f2eab7 100644
--- a/hald/hald_dbus.c
+++ b/hald/hald_dbus.c
@@ -2896,14 +2896,14 @@ hald_exec_method (HalDevice *d, DBusConn
{
dbus_int64_t value;
dbus_message_iter_get_basic (&iter, &value);
- g_string_append_printf (stdin_str, "%lld", value);
+ g_string_append_printf (stdin_str, "%lld", (long long int) value);
break;
}
case DBUS_TYPE_UINT64:
{
dbus_uint64_t value;
dbus_message_iter_get_basic (&iter, &value);
- g_string_append_printf (stdin_str, "%llu", value);
+ g_string_append_printf (stdin_str, "%llu", (long long unsigned int) value);
break;
}
case DBUS_TYPE_DOUBLE:
diff --git a/hald/linux2/addons/addon-acpi-buttons-toshiba.c b/hald/linux2/addons/addon-acpi-buttons-toshiba.c
index 8b12165..b100280 100644
--- a/hald/linux2/addons/addon-acpi-buttons-toshiba.c
+++ b/hald/linux2/addons/addon-acpi-buttons-toshiba.c
@@ -63,8 +63,8 @@ toshiba_key_flush (void)
fprintf (fp, "hotkey_ready:0\n");
fclose (fp);
fp = fopen (TOSHIBA_ACPI_KEYS, "r+");
- fscanf (fp, "hotkey_ready: %d\nhotkey: 0x%4x",
- &hotkey_ready, &value);
+ if (fscanf (fp, "hotkey_ready: %d\nhotkey: 0x%4x", &hotkey_ready, &value) < 2)
+ dbg ("Warning: failure while parse %s", TOSHIBA_ACPI_KEYS);
}
if (fp)
fclose (fp);
@@ -84,8 +84,8 @@ toshiba_key_ready (int *value)
if (!fp)
return FALSE;
- fscanf (fp, "hotkey_ready: %1d\nhotkey: 0x%4x",
- &hotkey_ready, value);
+ if (fscanf (fp, "hotkey_ready: %1d\nhotkey: 0x%4x", &hotkey_ready, value) < 2)
+ dbg ("Warning: failure while parse %s", TOSHIBA_ACPI_KEYS);
if (hotkey_ready) {
fprintf (fp, "hotkey_ready:0\n");
diff --git a/hald/property.c b/hald/property.c
index 706a31f..2caeb2b 100644
--- a/hald/property.c
+++ b/hald/property.c
@@ -216,7 +216,7 @@ hal_property_to_string (HalProperty *pro
case HAL_PROPERTY_TYPE_INT32:
return g_strdup_printf ("%d", prop->v.int_value);
case HAL_PROPERTY_TYPE_UINT64:
- return g_strdup_printf ("%lld", prop->v.uint64_value);
+ return g_strdup_printf ("%llu", (long long unsigned int) prop->v.uint64_value);
case HAL_PROPERTY_TYPE_BOOLEAN:
/* FIXME: Maybe use 1 and 0 here instead? */
return g_strdup (prop->v.bool_value ? "true" : "false");
diff --git a/libhal-storage/libhal-storage.c b/libhal-storage/libhal-storage.c
index 845e006..c572298 100644
--- a/libhal-storage/libhal-storage.c
+++ b/libhal-storage/libhal-storage.c
@@ -177,7 +177,7 @@ libhal_volume_policy_compute_size_as_str
((double)size)/((double)cur), sizes_str[cur_str]);
result = strdup (buf);
} else {
- snprintf (buf, MAX_STRING_SZ, "%lld%s", size / cur, sizes_str[cur_str]);
+ snprintf (buf, MAX_STRING_SZ, "%llu%s", (long long unsigned int) size / cur, sizes_str[cur_str]);
result = strdup (buf);
}
goto out;
diff --git a/libhal/libhal.c b/libhal/libhal.c
index 4df2568..c4c8034 100644
--- a/libhal/libhal.c
+++ b/libhal/libhal.c
@@ -2452,9 +2452,9 @@ libhal_device_print (LibHalContext *ctx,
libhal_psi_get_int (&i));
break;
case LIBHAL_PROPERTY_TYPE_UINT64:
- printf (" %s = %lld = 0x%llx (uint64)\n", key,
- libhal_psi_get_uint64 (&i),
- libhal_psi_get_uint64 (&i));
+ printf (" %s = %llu = 0x%llx (uint64)\n", key,
+ (long long unsigned int) libhal_psi_get_uint64 (&i),
+ (long long unsigned int) libhal_psi_get_uint64 (&i));
break;
case LIBHAL_PROPERTY_TYPE_BOOLEAN:
printf (" %s = %s (bool)\n", key,
diff --git a/tools/hal-storage-eject.c b/tools/hal-storage-eject.c
index cb6316a..6cb8ab4 100644
--- a/tools/hal-storage-eject.c
+++ b/tools/hal-storage-eject.c
@@ -187,8 +187,7 @@ main (int argc, char *argv[])
#endif
/* read from stdin */
- fgets (eject_options, sizeof (eject_options), stdin);
- if (strlen (eject_options) > 0)
+ if (strlen (fgets (eject_options, sizeof (eject_options), stdin)) > 0)
eject_options [strlen (eject_options) - 1] = '\0';
/* validate that input from stdin is UTF-8 */
if (!g_utf8_validate (eject_options, -1, &end))
diff --git a/tools/hal-storage-mount.c b/tools/hal-storage-mount.c
index 597c50e..37d7d6b 100644
--- a/tools/hal-storage-mount.c
+++ b/tools/hal-storage-mount.c
@@ -501,14 +501,11 @@ handle_mount (LibHalContext *hal_ctx,
/* TODO: sanity check that what hal exports is correct (cf. Martin Pitt's email) */
/* read from stdin */
- fgets (mount_point, sizeof (mount_point), stdin);
- fgets (mount_fstype, sizeof (mount_fstype), stdin);
- fgets (mount_options, sizeof (mount_options), stdin);
- if (strlen (mount_point) > 0)
+ if (strlen (fgets (mount_point, sizeof (mount_point), stdin)) > 0)
mount_point [strlen (mount_point) - 1] = '\0';
- if (strlen (mount_fstype) > 0)
+ if (strlen (fgets (mount_fstype, sizeof (mount_fstype), stdin)) > 0)
mount_fstype [strlen (mount_fstype) - 1] = '\0';
- if (strlen (mount_options) > 0)
+ if (strlen (fgets (mount_options, sizeof (mount_options), stdin)) > 0)
mount_options [strlen (mount_options) - 1] = '\0';
/* validate that input from stdin is UTF-8 */
if (!g_utf8_validate (mount_point, -1, &end))
diff --git a/tools/hal-storage-unmount.c b/tools/hal-storage-unmount.c
index bf10f00..112adc2 100644
--- a/tools/hal-storage-unmount.c
+++ b/tools/hal-storage-unmount.c
@@ -132,8 +132,7 @@ main (int argc, char *argv[])
#endif
/* read from stdin */
- fgets (unmount_options, sizeof (unmount_options), stdin);
- if (strlen (unmount_options) > 0)
+ if (strlen (fgets (unmount_options, sizeof (unmount_options), stdin)) > 0)
unmount_options [strlen (unmount_options) - 1] = '\0';
/* validate that input from stdin is UTF-8 */
if (!g_utf8_validate (unmount_options, -1, &end))
diff --git a/tools/hal_get_property.c b/tools/hal_get_property.c
index b1c5db0..6df4a16 100644
--- a/tools/hal_get_property.c
+++ b/tools/hal_get_property.c
@@ -194,8 +194,8 @@ main (int argc, char *argv[])
if (is_verbose)
printf ("Type is uint64 (shown in %s)\n",
(is_hex ? "hexadecimal" : "decimal"));
- printf ((is_hex ? "%llx\n" : "%lld\n"),
- libhal_device_get_property_uint64 (hal_ctx, udi, key, &error));
+ printf ((is_hex ? "%llx\n" : "%llu\n"),
+ (long long unsigned int) libhal_device_get_property_uint64 (hal_ctx, udi, key, &error));
break;
case LIBHAL_PROPERTY_TYPE_DOUBLE:
if (is_verbose)
diff --git a/tools/lshal.c b/tools/lshal.c
index 5e103f8..799e973 100644
--- a/tools/lshal.c
+++ b/tools/lshal.c
@@ -125,10 +125,10 @@ print_props (const char *udi)
break;
case LIBHAL_PROPERTY_TYPE_UINT64:
- printf (" %s = %lld (0x%llx) (uint64)\n",
+ printf (" %s = %llu (0x%llx) (uint64)\n",
libhal_psi_get_key (&it),
- libhal_psi_get_uint64 (&it),
- libhal_psi_get_uint64 (&it));
+ (long long unsigned int) libhal_psi_get_uint64 (&it),
+ (long long unsigned int) libhal_psi_get_uint64 (&it));
break;
case LIBHAL_PROPERTY_TYPE_DOUBLE:
@@ -420,8 +420,8 @@ print_property (const char *udi, const c
case LIBHAL_PROPERTY_TYPE_UINT64:
{
dbus_uint64_t value = libhal_device_get_property_uint64 (hal_ctx, udi, key, &error);
- printf (long_list?"*** new value: %lld (0x%llx) (uint64)\n":"%lld (0x%llx)",
- value, value);
+ printf (long_list?"*** new value: %llu (0x%llx) (uint64)\n":"%llu (0x%llx)",
+ (long long unsigned int) value, (long long unsigned int) value);
}
break;
case LIBHAL_PROPERTY_TYPE_DOUBLE:
More information about the hal-commit
mailing list