diff options
author | Richard Hughes <richard@hughsie.com> | 2009-09-11 09:19:47 +0100 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2009-09-11 09:45:41 +0100 |
commit | de7c4bcc3736bf72b83b40f3f2168dce076053a1 (patch) | |
tree | cba47ddc9853028504cf907ba3da3f857f38fc62 | |
parent | 40e554865d3a298d5a31a26bf05680557d388570 (diff) | |
parent | 309325949f85a648488a9c54c9f69e2df7fc60dc (diff) |
Fix conflicts in the merge
-rw-r--r-- | configure.ac | 123 | ||||
-rw-r--r-- | src/Makefile.am | 4 | ||||
-rw-r--r-- | src/dkp-daemon.c | 2 | ||||
-rw-r--r-- | src/dkp-device-list.c | 2 | ||||
-rw-r--r-- | src/dkp-device.c | 2 | ||||
-rw-r--r-- | src/dkp-history.c | 46 | ||||
-rw-r--r-- | src/dkp-qos.c | 8 | ||||
-rw-r--r-- | src/dkp-wakeups.c | 2 | ||||
-rw-r--r-- | src/linux/dkp-device-csr.c | 13 | ||||
-rw-r--r-- | src/linux/dkp-device-hid.c | 13 | ||||
-rw-r--r-- | src/linux/dkp-device-supply.c | 45 | ||||
-rw-r--r-- | src/linux/dkp-device-wup.c | 8 | ||||
-rw-r--r-- | src/linux/dkp-input.c | 2 |
13 files changed, 119 insertions, 151 deletions
diff --git a/configure.ac b/configure.ac index 38cc79f..0d521e3 100644 --- a/configure.ac +++ b/configure.ac @@ -67,80 +67,63 @@ AC_SUBST(slashlibdir) #### gcc warning flags dnl --------------------------------------------------------------------------- -dnl - Extra verbose warning switches, disable if needed +dnl - Extra verbose warning switches dnl --------------------------------------------------------------------------- -if test "$GCC" = "yes"; then - CPPFLAGS="$CPPFLAGS -Werror -Wcast-align -Wno-uninitialized" - CPPFLAGS="$CPPFLAGS -Wall -Wformat-security" -# CPPFLAGS="$CPPFLAGS -Wall" +CPPFLAGS="$CPPFLAGS -DG_DISABLE_SINGLE_INCLUDES -DGTK_DISABLE_SINGLE_INCLUDES" +CPPFLAGS="$CPPFLAGS -DG_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED" +CPPFLAGS="$CPPFLAGS -DGDK_MULTIHEAD_SAFE -DGTK_MULTIHEAD_SAFE" +CPPFLAGS="$CPPFLAGS -DGSEAL_ENABLE" + +dnl --------------------------------------------------------------------------- +dnl - Use strict options (default enabled for devs, disabled in releases) +dnl --------------------------------------------------------------------------- +dnl if .git directory is present, considering we are working in the repository +if test -d ".git"; then + default_strict=yes +else + default_strict=no fi -if test "x$GCC" = "xyes"; then - changequote(,)dnl - case " $CFLAGS " in - *[\ \ ]-Wall[\ \ ]*) ;; - *) CFLAGS="$CFLAGS -Wall" ;; - esac - - case " $CFLAGS " in - *[\ \ ]-Wchar-subscripts[\ \ ]*) ;; - *) CFLAGS="$CFLAGS -Wchar-subscripts" ;; - esac - - case " $CFLAGS " in - *[\ \ ]-Wmissing-declarations[\ \ ]*) ;; - *) CFLAGS="$CFLAGS -Wmissing-declarations" ;; - esac - - case " $CFLAGS " in - *[\ \ ]-Wnested-externs[\ \ ]*) ;; - *) CFLAGS="$CFLAGS -Wnested-externs" ;; - esac - - case " $CFLAGS " in - *[\ \ ]-Wpointer-arith[\ \ ]*) ;; - *) CFLAGS="$CFLAGS -Wpointer-arith" ;; - esac - - case " $CFLAGS " in - *[\ \ ]-Wcast-align[\ \ ]*) ;; - *) CFLAGS="$CFLAGS -Wcast-align" ;; - esac - - case " $CFLAGS " in - *[\ \ ]-Wsign-compare[\ \ ]*) ;; - *) CFLAGS="$CFLAGS -Wsign-compare" ;; - esac - - case " $CFLAGS " in - *[\ \ ]-Wno-strict-aliasing[\ \ ]*) ;; - *) CFLAGS="$CFLAGS -Wno-strict-aliasing" ;; - esac - - - if test "x$enable_ansi" = "xyes"; then - case " $CFLAGS " in - *[\ \ ]-ansi[\ \ ]*) ;; - *) CFLAGS="$CFLAGS -ansi" ;; - esac - - case " $CFLAGS " in - *[\ \ ]-D_POSIX_C_SOURCE*) ;; - *) CFLAGS="$CFLAGS -D_POSIX_C_SOURCE=199309L" ;; - esac - - case " $CFLAGS " in - *[\ \ ]-D_BSD_SOURCE[\ \ ]*) ;; - *) CFLAGS="$CFLAGS -D_BSD_SOURCE" ;; - esac - - case " $CFLAGS " in - *[\ \ ]-pedantic[\ \ ]*) ;; - *) CFLAGS="$CFLAGS -pedantic" ;; - esac - fi - changequote([,])dnl +AC_ARG_ENABLE(strict, AC_HELP_STRING([--enable-strict], + [Enable strict compilation options]), enable_strict=$enableval, + enable_strict=$default_strict) +if test x$enable_strict != xno; then + if test "$GCC" = "yes"; then + WARNINGFLAGS_C="$WARNINGFLAGS_C -Werror" + fi +fi + +if test "$GCC" = "yes"; then + WARNINGFLAGS_C="$WARNINGFLAGS_C -Wall" + WARNINGFLAGS_C="$WARNINGFLAGS_C -Wcast-align -Wno-uninitialized" + WARNINGFLAGS_C="$WARNINGFLAGS_C -Wmissing-declarations" +# WARNINGFLAGS_C="$WARNINGFLAGS_C -Wredundant-decls" + WARNINGFLAGS_C="$WARNINGFLAGS_C -Wpointer-arith" + WARNINGFLAGS_C="$WARNINGFLAGS_C -Wcast-align" + WARNINGFLAGS_C="$WARNINGFLAGS_C -Wwrite-strings" + WARNINGFLAGS_C="$WARNINGFLAGS_C -Winit-self" + WARNINGFLAGS_C="$WARNINGFLAGS_C -Wreturn-type" + WARNINGFLAGS_C="$WARNINGFLAGS_C -Wformat-nonliteral" + WARNINGFLAGS_C="$WARNINGFLAGS_C -Wformat-security" + WARNINGFLAGS_C="$WARNINGFLAGS_C -Wmissing-include-dirs" + WARNINGFLAGS_C="$WARNINGFLAGS_C -Wmissing-format-attribute" +# WARNINGFLAGS_C="$WARNINGFLAGS_C -Wclobbered" +# WARNINGFLAGS_C="$WARNINGFLAGS_C -Wempty-body" +# WARNINGFLAGS_C="$WARNINGFLAGS_C -Wignored-qualifiers" + WARNINGFLAGS_C="$WARNINGFLAGS_C -Wsign-compare" + WARNINGFLAGS_C="$WARNINGFLAGS_C -Wtype-limits" + WARNINGFLAGS_C="$WARNINGFLAGS_C -Wuninitialized" + WARNINGFLAGS_C="$WARNINGFLAGS_C -Waggregate-return" + WARNINGFLAGS_C="$WARNINGFLAGS_C -Wdeclaration-after-statement" +# WARNINGFLAGS_C="$WARNINGFLAGS_C -Wshadow" + WARNINGFLAGS_C="$WARNINGFLAGS_C -Wno-strict-aliasing" +# WARNINGFLAGS_C="$WARNINGFLAGS_C -Winline" +# WARNINGFLAGS_C="$WARNINGFLAGS_C -Wmissing-parameter-type" +# WARNINGFLAGS_C="$WARNINGFLAGS_C -Woverride-init" +else + WARNINGFLAGS_C="" fi +AC_SUBST(WARNINGFLAGS_C) PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.6.0]) AC_SUBST(GLIB_CFLAGS) diff --git a/src/Makefile.am b/src/Makefile.am index 631e53f..9809ef5 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -108,6 +108,10 @@ devkit_power_daemon_LDADD += \ linux/libdkpshared.a endif +devkit_power_daemon_CFLAGS = \ + $(WARNINGFLAGS_C) \ + $(NULL) + servicedir = $(datadir)/dbus-1/system-services service_in_files = org.freedesktop.DeviceKit.Power.service.in service_DATA = $(service_in_files:.service.in=.service) diff --git a/src/dkp-daemon.c b/src/dkp-daemon.c index b3c400c..c44fcb8 100644 --- a/src/dkp-daemon.c +++ b/src/dkp-daemon.c @@ -83,8 +83,6 @@ struct DkpDaemonPrivate gboolean kernel_has_swap_space; }; -static void dkp_daemon_class_init (DkpDaemonClass *klass); -static void dkp_daemon_init (DkpDaemon *seat); static void dkp_daemon_finalize (GObject *object); static gboolean dkp_daemon_get_on_battery_local (DkpDaemon *daemon); static gboolean dkp_daemon_get_low_battery_local (DkpDaemon *daemon); diff --git a/src/dkp-device-list.c b/src/dkp-device-list.c index d6d5591..bb21ca1 100644 --- a/src/dkp-device-list.c +++ b/src/dkp-device-list.c @@ -30,8 +30,6 @@ #include "dkp-native.h" #include "dkp-device-list.h" -static void dkp_device_list_class_init (DkpDeviceListClass *klass); -static void dkp_device_list_init (DkpDeviceList *list); static void dkp_device_list_finalize (GObject *object); #define DKP_DEVICE_LIST_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), DKP_TYPE_DEVICE_LIST, DkpDeviceListPrivate)) diff --git a/src/dkp-device.c b/src/dkp-device.c index 869b4c2..df57313 100644 --- a/src/dkp-device.c +++ b/src/dkp-device.c @@ -82,8 +82,6 @@ struct DkpDevicePrivate gchar *recall_url; }; -static void dkp_device_class_init (DkpDeviceClass *klass); -static void dkp_device_init (DkpDevice *device); static gboolean dkp_device_register_device (DkpDevice *device); enum diff --git a/src/dkp-history.c b/src/dkp-history.c index e383e02..ad72d1a 100644 --- a/src/dkp-history.c +++ b/src/dkp-history.c @@ -32,8 +32,6 @@ #include "dkp-stats-obj.h" #include "dkp-history-obj.h" -static void dkp_history_class_init (DkpHistoryClass *klass); -static void dkp_history_init (DkpHistory *history); static void dkp_history_finalize (GObject *object); #define DKP_HISTORY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), DKP_TYPE_HISTORY, DkpHistoryPrivate)) @@ -110,14 +108,14 @@ dkp_history_array_limit_resolution (GPtrArray *array, guint max_num) { const DkpHistoryObj *obj; DkpHistoryObj *nobj; - gfloat div; + gfloat division; guint length; gint i; guint last; guint first; GPtrArray *new; DkpDeviceState state = DKP_DEVICE_STATE_UNKNOWN; - guint64 time = 0; + guint64 time_s = 0; gdouble value = 0; guint64 count = 0; guint step = 1; @@ -142,32 +140,32 @@ dkp_history_array_limit_resolution (GPtrArray *array, guint max_num) obj = (const DkpHistoryObj *) g_ptr_array_index (array, 0); first = obj->time; - div = (first - last) / (gfloat) max_num; - egg_debug ("Using a x division of %f (first=%i,last=%i)", div, first, last); + division = (first - last) / (gfloat) max_num; + egg_debug ("Using a x division of %f (first=%i,last=%i)", division, first, last); /* Reduces the number of points to a pre-set level using a time * division algorithm so we don't keep diluting the previous * data with a conventional 1-in-x type algorithm. */ for (i=length-1; i>=0; i--) { obj = (const DkpHistoryObj *) g_ptr_array_index (array, i); - preset = last + (div * (gfloat) step); + preset = last + (division * (gfloat) step); /* if state changed or we went over the preset do a new point */ if (count > 0 && (obj->time > preset || obj->state != state)) { nobj = dkp_history_obj_new (); - nobj->time = time / count; + nobj->time = time_s / count; nobj->value = value / count; nobj->state = state; g_ptr_array_add (new, nobj); step++; - time = obj->time; + time_s = obj->time; value = obj->value; state = obj->state; count = 1; } else { count++; - time += obj->time; + time_s += obj->time; value += obj->value; } } @@ -175,7 +173,7 @@ dkp_history_array_limit_resolution (GPtrArray *array, guint max_num) /* only add if nonzero */ if (count > 0) { nobj = dkp_history_obj_new (); - nobj->time = time / count; + nobj->time = time_s / count; nobj->value = value / count; nobj->state = state; g_ptr_array_add (new, nobj); @@ -275,7 +273,7 @@ dkp_history_get_profile_data (DkpHistory *history, gboolean charging) DkpStatsObj *stats; GPtrArray *array; GPtrArray *data; - guint time; + guint time_s; gdouble value; gdouble total_value = 0.0f; @@ -312,12 +310,12 @@ dkp_history_get_profile_data (DkpHistory *history, gboolean charging) goto cont; } - time = obj->time - obj_old->time; + time_s = obj->time - obj_old->time; /* use the accuracy field as a counter for now */ if ((charging && obj->state == DKP_DEVICE_STATE_CHARGING) || (!charging && obj->state == DKP_DEVICE_STATE_DISCHARGING)) { stats = (DkpStatsObj *) g_ptr_array_index (data, bin); - stats->value += time; + stats->value += time_s; stats->accuracy++; } } @@ -736,7 +734,7 @@ dkp_history_set_rate_data (DkpHistory *history, gdouble rate) * dkp_history_set_time_full_data: **/ gboolean -dkp_history_set_time_full_data (DkpHistory *history, gint64 time) +dkp_history_set_time_full_data (DkpHistory *history, gint64 time_s) { DkpHistoryObj *obj; @@ -746,18 +744,18 @@ dkp_history_set_time_full_data (DkpHistory *history, gint64 time) return FALSE; if (history->priv->state == DKP_DEVICE_STATE_UNKNOWN) return FALSE; - if (time < 0) + if (time_s < 0) return FALSE; - if (history->priv->time_full_last == time) + if (history->priv->time_full_last == time_s) return FALSE; /* add to array and schedule save file */ - obj = dkp_history_obj_create ((gdouble) time, history->priv->state); + obj = dkp_history_obj_create ((gdouble) time_s, history->priv->state); g_ptr_array_add (history->priv->data_time_full, obj); dkp_history_schedule_save (history); /* save last value */ - history->priv->time_full_last = time; + history->priv->time_full_last = time_s; return TRUE; } @@ -766,7 +764,7 @@ dkp_history_set_time_full_data (DkpHistory *history, gint64 time) * dkp_history_set_time_empty_data: **/ gboolean -dkp_history_set_time_empty_data (DkpHistory *history, gint64 time) +dkp_history_set_time_empty_data (DkpHistory *history, gint64 time_s) { DkpHistoryObj *obj; @@ -776,18 +774,18 @@ dkp_history_set_time_empty_data (DkpHistory *history, gint64 time) return FALSE; if (history->priv->state == DKP_DEVICE_STATE_UNKNOWN) return FALSE; - if (time < 0) + if (time_s < 0) return FALSE; - if (history->priv->time_empty_last == time) + if (history->priv->time_empty_last == time_s) return FALSE; /* add to array and schedule save file */ - obj = dkp_history_obj_create ((gdouble) time, history->priv->state); + obj = dkp_history_obj_create ((gdouble) time_s, history->priv->state); g_ptr_array_add (history->priv->data_time_empty, obj); dkp_history_schedule_save (history); /* save last value */ - history->priv->time_empty_last = time; + history->priv->time_empty_last = time_s; return TRUE; } diff --git a/src/dkp-qos.c b/src/dkp-qos.c index 8e52e38..e1d4c60 100644 --- a/src/dkp-qos.c +++ b/src/dkp-qos.c @@ -41,8 +41,6 @@ #include "dkp-qos-obj.h" #include "dkp-qos-glue.h" -static void dkp_qos_class_init (DkpQosClass *klass); -static void dkp_qos_init (DkpQos *qos); static void dkp_qos_finalize (GObject *object); #define DKP_QOS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), DKP_TYPE_QOS, DkpQosPrivate)) @@ -566,11 +564,11 @@ dkp_qos_init (DkpQos *qos) /* TODO: need to load persistent values */ /* setup lowest */ - for (i=0; i<DKP_QOS_TYPE_UNKNOWN; i++) + for (i=0; i<DKP_QOS_TYPE_LAST; i++) qos->priv->last[i] = dkp_qos_get_lowest (qos, i); /* setup minimum */ - for (i=0; i<DKP_QOS_TYPE_UNKNOWN; i++) + for (i=0; i<DKP_QOS_TYPE_LAST; i++) qos->priv->minimum[i] = -1; qos->priv->fd[DKP_QOS_TYPE_CPU_DMA] = open ("/dev/cpu_dma_latency", O_WRONLY); @@ -615,7 +613,7 @@ dkp_qos_finalize (GObject *object) qos->priv = DKP_QOS_GET_PRIVATE (qos); /* close files */ - for (i=0; i<DKP_QOS_TYPE_UNKNOWN; i++) { + for (i=0; i<DKP_QOS_TYPE_LAST; i++) { if (qos->priv->fd[i] > 0) close (qos->priv->fd[i]); } diff --git a/src/dkp-wakeups.c b/src/dkp-wakeups.c index c081ae3..fb8918e 100644 --- a/src/dkp-wakeups.c +++ b/src/dkp-wakeups.c @@ -35,8 +35,6 @@ #include "dkp-wakeups-glue.h" #include "dkp-wakeups-obj.h" -static void dkp_wakeups_class_init (DkpWakeupsClass *klass); -static void dkp_wakeups_init (DkpWakeups *wakeups); static void dkp_wakeups_finalize (GObject *object); static gboolean dkp_wakeups_timerstats_enable (DkpWakeups *wakeups); diff --git a/src/linux/dkp-device-csr.c b/src/linux/dkp-device-csr.c index 4dd833a..b2f5d8a 100644 --- a/src/linux/dkp-device-csr.c +++ b/src/linux/dkp-device-csr.c @@ -28,6 +28,7 @@ #include <glib.h> #include <glib/gstdio.h> +#include <glib/gprintf.h> #include <glib/gi18n-lib.h> #include <glib-object.h> #include <gudev/gudev.h> @@ -61,8 +62,6 @@ struct DkpDeviceCsrPrivate struct usb_device *device; }; -static void dkp_device_csr_class_init (DkpDeviceCsrClass *klass); - G_DEFINE_TYPE (DkpDeviceCsr, dkp_device_csr, DKP_TYPE_DEVICE) #define DKP_DEVICE_CSR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), DKP_TYPE_CSR, DkpDeviceCsrPrivate)) @@ -101,13 +100,13 @@ dkp_device_csr_find_device (DkpDeviceCsr *csr) for (curr_bus = usb_busses; curr_bus != NULL; curr_bus = curr_bus->next) { /* egg_debug ("Checking bus: [%s]", curr_bus->dirname); */ - if (g_strcasecmp (dir_name, curr_bus->dirname)) + if (g_ascii_strcasecmp (dir_name, curr_bus->dirname)) continue; for (curr_device = curr_bus->devices; curr_device != NULL; curr_device = curr_device->next) { /* egg_debug ("Checking port: [%s]", curr_device->filename); */ - if (g_strcasecmp (filename, curr_device->filename)) + if (g_ascii_strcasecmp (filename, curr_device->filename)) continue; egg_debug ("Matched device: [%s][%s][%04X:%04X]", curr_bus->dirname, curr_device->filename, @@ -221,7 +220,7 @@ static gboolean dkp_device_csr_refresh (DkpDevice *device) { gboolean ret = FALSE; - GTimeVal time; + GTimeVal timeval; DkpDeviceCsr *csr = DKP_DEVICE_CSR (device); usb_dev_handle *handle = NULL; char buf[80]; @@ -229,8 +228,8 @@ dkp_device_csr_refresh (DkpDevice *device) gdouble percentage; guint written; - g_get_current_time (&time); - g_object_set (device, "update-time", (guint64) time.tv_sec, NULL); + g_get_current_time (&timeval); + g_object_set (device, "update-time", (guint64) timeval.tv_sec, NULL); /* For dual receivers C502, C504 and C505, the mouse is the * second device and uses an addr of 1 in the value and index diff --git a/src/linux/dkp-device-hid.c b/src/linux/dkp-device-hid.c index 9a31481..9ecf08e 100644 --- a/src/linux/dkp-device-hid.c +++ b/src/linux/dkp-device-hid.c @@ -30,6 +30,7 @@ #include <glib.h> #include <glib/gstdio.h> +#include <glib/gprintf.h> #include <glib/gi18n-lib.h> #include <glib-object.h> #include <gudev/gudev.h> @@ -90,8 +91,6 @@ struct DkpDeviceHidPrivate int fd; }; -static void dkp_device_hid_class_init (DkpDeviceHidClass *klass); - G_DEFINE_TYPE (DkpDeviceHid, dkp_device_hid, DKP_TYPE_DEVICE) #define DKP_DEVICE_HID_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), DKP_TYPE_HID, DkpDeviceHidPrivate)) @@ -173,8 +172,8 @@ dkp_device_hid_convert_device_technology (const gchar *type) { if (type == NULL) return DKP_DEVICE_TECHNOLOGY_UNKNOWN; - if (strcasecmp (type, "pb") == 0 || - strcasecmp (type, "pbac") == 0) + if (g_ascii_strcasecmp (type, "pb") == 0 || + g_ascii_strcasecmp (type, "pbac") == 0) return DKP_DEVICE_TECHNOLOGY_LEAD_ACID; return DKP_DEVICE_TECHNOLOGY_UNKNOWN; } @@ -381,15 +380,15 @@ dkp_device_hid_refresh (DkpDevice *device) { gboolean set = FALSE; gboolean ret = FALSE; - GTimeVal time; + GTimeVal timeval; guint i; struct hiddev_event ev[64]; int rd; DkpDeviceHid *hid = DKP_DEVICE_HID (device); /* reset time */ - g_get_current_time (&time); - g_object_set (device, "update-time", (guint64) time.tv_sec, NULL); + g_get_current_time (&timeval); + g_object_set (device, "update-time", (guint64) timeval.tv_sec, NULL); /* read any data */ rd = read (hid->priv->fd, ev, sizeof (ev)); diff --git a/src/linux/dkp-device-supply.c b/src/linux/dkp-device-supply.c index 1cc4f0d..05ce8fa 100644 --- a/src/linux/dkp-device-supply.c +++ b/src/linux/dkp-device-supply.c @@ -28,6 +28,7 @@ #include <glib.h> #include <glib/gstdio.h> +#include <glib/gprintf.h> #include <glib/gi18n-lib.h> #include <glib-object.h> #include <gudev/gudev.h> @@ -53,8 +54,6 @@ struct DkpDeviceSupplyPrivate gboolean enable_poll; }; -static void dkp_device_supply_class_init (DkpDeviceSupplyClass *klass); - G_DEFINE_TYPE (DkpDeviceSupply, dkp_device_supply, DKP_TYPE_DEVICE) #define DKP_DEVICE_SUPPLY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), DKP_TYPE_SUPPLY, DkpDeviceSupplyPrivate)) @@ -213,7 +212,7 @@ dkp_device_supply_get_online (DkpDevice *device, gboolean *online) static void dkp_device_supply_calculate_rate (DkpDeviceSupply *supply) { - guint time; + guint time_s; gdouble energy; gdouble energy_rate; GTimeVal now; @@ -232,9 +231,9 @@ dkp_device_supply_calculate_rate (DkpDeviceSupply *supply) /* get the time difference */ g_get_current_time (&now); - time = now.tv_sec - supply->priv->energy_old_timespec.tv_sec; + time_s = now.tv_sec - supply->priv->energy_old_timespec.tv_sec; - if (time == 0) + if (time_s == 0) return; /* get the difference in charge */ @@ -243,7 +242,7 @@ dkp_device_supply_calculate_rate (DkpDeviceSupply *supply) return; /* probably okay */ - energy_rate = energy * 3600 / time; + energy_rate = energy * 3600 / time_s; g_object_set (device, "energy-rate", energy_rate, NULL); } @@ -256,19 +255,19 @@ dkp_device_supply_convert_device_technology (const gchar *type) if (type == NULL) return DKP_DEVICE_TECHNOLOGY_UNKNOWN; /* every case combination of Li-Ion is commonly used.. */ - if (strcasecmp (type, "li-ion") == 0 || - strcasecmp (type, "lion") == 0) + if (g_ascii_strcasecmp (type, "li-ion") == 0 || + g_ascii_strcasecmp (type, "lion") == 0) return DKP_DEVICE_TECHNOLOGY_LITHIUM_ION; - if (strcasecmp (type, "pb") == 0 || - strcasecmp (type, "pbac") == 0) + if (g_ascii_strcasecmp (type, "pb") == 0 || + g_ascii_strcasecmp (type, "pbac") == 0) return DKP_DEVICE_TECHNOLOGY_LEAD_ACID; - if (strcasecmp (type, "lip") == 0 || - strcasecmp (type, "lipo") == 0 || - strcasecmp (type, "li-poly") == 0) + if (g_ascii_strcasecmp (type, "lip") == 0 || + g_ascii_strcasecmp (type, "lipo") == 0 || + g_ascii_strcasecmp (type, "li-poly") == 0) return DKP_DEVICE_TECHNOLOGY_LITHIUM_POLYMER; - if (strcasecmp (type, "nimh") == 0) + if (g_ascii_strcasecmp (type, "nimh") == 0) return DKP_DEVICE_TECHNOLOGY_NICKEL_METAL_HYDRIDE; - if (strcasecmp (type, "lifo") == 0) + if (g_ascii_strcasecmp (type, "lifo") == 0) return DKP_DEVICE_TECHNOLOGY_LITHIUM_IRON_PHOSPHATE; return DKP_DEVICE_TECHNOLOGY_UNKNOWN; } @@ -445,15 +444,15 @@ dkp_device_supply_refresh_battery (DkpDeviceSupply *supply) } status = g_strstrip (sysfs_get_string (native_path, "status")); - if (strcasecmp (status, "charging") == 0) + if (g_ascii_strcasecmp (status, "charging") == 0) state = DKP_DEVICE_STATE_CHARGING; - else if (strcasecmp (status, "discharging") == 0) + else if (g_ascii_strcasecmp (status, "discharging") == 0) state = DKP_DEVICE_STATE_DISCHARGING; - else if (strcasecmp (status, "full") == 0) + else if (g_ascii_strcasecmp (status, "full") == 0) state = DKP_DEVICE_STATE_FULLY_CHARGED; - else if (strcasecmp (status, "empty") == 0) + else if (g_ascii_strcasecmp (status, "empty") == 0) state = DKP_DEVICE_STATE_EMPTY; - else if (strcasecmp (status, "unknown") == 0) + else if (g_ascii_strcasecmp (status, "unknown") == 0) state = DKP_DEVICE_STATE_UNKNOWN; else { egg_warning ("unknown status string: %s", status); @@ -697,7 +696,7 @@ static gboolean dkp_device_supply_refresh (DkpDevice *device) { gboolean ret; - GTimeVal time; + GTimeVal timeval; DkpDeviceSupply *supply = DKP_DEVICE_SUPPLY (device); DkpDeviceType type; @@ -706,8 +705,8 @@ dkp_device_supply_refresh (DkpDevice *device) supply->priv->poll_timer_id = 0; } - g_get_current_time (&time); - g_object_set (device, "update-time", (guint64) time.tv_sec, NULL); + g_get_current_time (&timeval); + g_object_set (device, "update-time", (guint64) timeval.tv_sec, NULL); g_object_get (device, "type", &type, NULL); switch (type) { case DKP_DEVICE_TYPE_LINE_POWER: diff --git a/src/linux/dkp-device-wup.c b/src/linux/dkp-device-wup.c index c0b5db5..d321342 100644 --- a/src/linux/dkp-device-wup.c +++ b/src/linux/dkp-device-wup.c @@ -74,8 +74,6 @@ struct DkpDeviceWupPrivate int fd; }; -static void dkp_device_wup_class_init (DkpDeviceWupClass *klass); - G_DEFINE_TYPE (DkpDeviceWup, dkp_device_wup, DKP_TYPE_DEVICE) #define DKP_DEVICE_WUP_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), DKP_TYPE_WUP, DkpDeviceWupPrivate)) @@ -393,7 +391,7 @@ static gboolean dkp_device_wup_refresh (DkpDevice *device) { gboolean ret = FALSE; - GTimeVal time; + GTimeVal timeval; gchar *data = NULL; DkpDeviceWup *wup = DKP_DEVICE_WUP (device); @@ -412,8 +410,8 @@ dkp_device_wup_refresh (DkpDevice *device) } /* reset time */ - g_get_current_time (&time); - g_object_set (device, "update-time", (guint64) time.tv_sec, NULL); + g_get_current_time (&timeval); + g_object_set (device, "update-time", (guint64) timeval.tv_sec, NULL); out: g_free (data); diff --git a/src/linux/dkp-input.c b/src/linux/dkp-input.c index e36f603..59b4cf4 100644 --- a/src/linux/dkp-input.c +++ b/src/linux/dkp-input.c @@ -56,8 +56,6 @@ struct DkpInputPrivate DkpDaemon *daemon; }; -static void dkp_input_class_init (DkpInputClass *klass); - G_DEFINE_TYPE (DkpInput, dkp_input, G_TYPE_OBJECT) #define DKP_INPUT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), DKP_TYPE_INPUT, DkpInputPrivate)) |