gnome-power-manager r2881 - in trunk: . src
- From: rhughes svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-power-manager r2881 - in trunk: . src
- Date: Thu, 14 Aug 2008 17:00:08 +0000 (UTC)
Author: rhughes
Date: Thu Aug 14 17:00:08 2008
New Revision: 2881
URL: http://svn.gnome.org/viewvc/gnome-power-manager?rev=2881&view=rev
Log:
2008-08-14 Richard Hughes <richard hughsie com>
* src/gpm-cell-array.c:
Add some g_return_val_if_fail()'s to try to debug #547766
Modified:
trunk/ChangeLog
trunk/src/gpm-cell-array.c
Modified: trunk/src/gpm-cell-array.c
==============================================================================
--- trunk/src/gpm-cell-array.c (original)
+++ trunk/src/gpm-cell-array.c Thu Aug 14 17:00:08 2008
@@ -96,7 +96,6 @@
{
GpmCellUnit *unit;
- g_return_val_if_fail (cell_array != NULL, NULL);
g_return_val_if_fail (GPM_IS_CELL_ARRAY (cell_array), NULL);
unit = &(cell_array->priv->unit);
@@ -110,7 +109,6 @@
guint
gpm_cell_array_get_num_cells (GpmCellArray *cell_array)
{
- g_return_val_if_fail (cell_array != NULL, 0);
g_return_val_if_fail (GPM_IS_CELL_ARRAY (cell_array), 0);
return cell_array->priv->array->len;
@@ -124,7 +122,6 @@
{
GpmCellUnit *unit;
- g_return_val_if_fail (cell_array != NULL, 0);
g_return_val_if_fail (GPM_IS_CELL_ARRAY (cell_array), 0);
unit = &(cell_array->priv->unit);
@@ -139,7 +136,6 @@
{
GpmCellUnit *unit;
- g_return_val_if_fail (cell_array != NULL, 0);
g_return_val_if_fail (GPM_IS_CELL_ARRAY (cell_array), 0);
unit = &(cell_array->priv->unit);
@@ -154,7 +150,6 @@
{
GpmCell *cell;
- g_return_val_if_fail (cell_array != NULL, NULL);
g_return_val_if_fail (GPM_IS_CELL_ARRAY (cell_array), NULL);
if (id > cell_array->priv->array->len) {
@@ -178,6 +173,8 @@
guint action_time;
gint difference;
+ g_return_val_if_fail (GPM_IS_CELL_ARRAY (cell_array), 0);
+
/* clear old values (except previous charge rate) */
unit = &(cell_array->priv->unit);
gpm_cell_unit_init (unit);
@@ -222,6 +219,8 @@
static void
gpm_cell_perhaps_recall_cb (GpmCell *cell, gchar *oem_vendor, gchar *website, GpmCellArray *cell_array)
{
+ g_return_if_fail (GPM_IS_CELL_ARRAY (cell_array));
+
/* only emit this once per startup */
if (cell_array->priv->done_recall == FALSE) {
/* just proxy it to the engine layer */
@@ -237,6 +236,8 @@
static void
gpm_cell_low_capacity_cb (GpmCell *cell, guint capacity, GpmCellArray *cell_array)
{
+ g_return_if_fail (GPM_IS_CELL_ARRAY (cell_array));
+
/* only emit this once per startup */
if (cell_array->priv->done_capacity == FALSE) {
/* just proxy it to the GUI layer */
@@ -266,6 +267,8 @@
guint length;
guint i;
+ g_return_val_if_fail (GPM_IS_CELL_ARRAY (cell_array), FALSE);
+
/* clear old values (except previous charge rate) */
unit = &(cell_array->priv->unit);
gpm_cell_unit_init (unit);
@@ -444,6 +447,8 @@
guint length;
guint i;
+ g_return_val_if_fail (GPM_IS_CELL_ARRAY (cell_array), NULL);
+
unit = &(cell_array->priv->unit);
/* invalid if not primary */
@@ -488,6 +493,8 @@
gfloat accuracy;
GpmCellUnit *unit;
+ g_return_val_if_fail (GPM_IS_CELL_ARRAY (cell_array), FALSE);
+
/* do we trust the profile enough to make a decision? */
unit = &(cell_array->priv->unit);
if (unit->kind == GPM_CELL_UNIT_KIND_PRIMARY) {
@@ -525,6 +532,8 @@
GpmWarningsState warnings_state;
GpmCellUnit *unit;
+ g_return_if_fail (GPM_IS_CELL_ARRAY (cell_array));
+
unit = &(cell_array->priv->unit);
gpm_debug ("printing combined new device:");
@@ -588,6 +597,8 @@
GpmCellUnit *unit;
guint old_percent;
+ g_return_if_fail (GPM_IS_CELL_ARRAY (cell_array));
+
unit = &(cell_array->priv->unit);
/* save the old percentage so we can compare it later */
@@ -617,6 +628,8 @@
{
GpmCellUnit *unit;
+ g_return_if_fail (GPM_IS_CELL_ARRAY (cell_array));
+
unit = &(cell_array->priv->unit);
/* recalculate */
@@ -649,6 +662,8 @@
{
GpmCellUnit *unit;
+ g_return_if_fail (GPM_IS_CELL_ARRAY (cell_array));
+
unit = &(cell_array->priv->unit);
/* recalculate */
@@ -680,6 +695,8 @@
const gchar *cell_device_id;
GpmCell *cell;
+ g_return_val_if_fail (GPM_IS_CELL_ARRAY (cell_array), 0);
+
length = cell_array->priv->array->len;
for (i=0;i<length;i++) {
cell = (GpmCell *) g_ptr_array_index (cell_array->priv->array, i);
@@ -704,6 +721,8 @@
gboolean matches = FALSE;
gchar *rettype;
+ g_return_val_if_fail (GPM_IS_CELL_ARRAY (cell_array), FALSE);
+
device = hal_gdevice_new ();
ret = hal_gdevice_set_udi (device, udi);
if (!ret) {
@@ -738,6 +757,8 @@
gchar *config_id;
guint length;
+ g_return_val_if_fail (GPM_IS_CELL_ARRAY (cell_array), FALSE);
+
length = cell_array->priv->array->len;
/* if we have no devices, don't try to get refresh anything */
if (length == 0) {
@@ -779,6 +800,8 @@
const gchar *kind_string;
gboolean ret;
+ g_return_val_if_fail (GPM_IS_CELL_ARRAY (cell_array), FALSE);
+
unit = &(cell_array->priv->unit);
/* check type */
@@ -833,6 +856,8 @@
gboolean ret;
GpmCellUnit *unit;
+ g_return_val_if_fail (GPM_IS_CELL_ARRAY (cell_array), FALSE);
+
unit = &(cell_array->priv->unit);
/* we treat phones as hotpluggable devices only */
@@ -867,7 +892,6 @@
{
GpmCellUnit *unit;
- g_return_val_if_fail (cell_array != NULL, FALSE);
g_return_val_if_fail (GPM_IS_CELL_ARRAY (cell_array), FALSE);
unit = &(cell_array->priv->unit);
@@ -894,6 +918,8 @@
guint length;
guint i;
+ g_return_if_fail (GPM_IS_CELL_ARRAY (cell_array));
+
length = cell_array->priv->array->len;
/* iterate thru all the devices to free */
for (i=0;i<length;i++) {
@@ -913,7 +939,6 @@
gboolean
gpm_cell_array_refresh (GpmCellArray *cell_array)
{
- g_return_val_if_fail (cell_array != NULL, FALSE);
g_return_val_if_fail (GPM_IS_CELL_ARRAY (cell_array), FALSE);
/* free all, then re-coldplug */
@@ -939,7 +964,6 @@
GpmCellUnit *unit;
gboolean plural = FALSE;
- g_return_val_if_fail (cell_array != NULL, NULL);
g_return_val_if_fail (GPM_IS_CELL_ARRAY (cell_array), NULL);
unit = &(cell_array->priv->unit);
@@ -1055,6 +1079,8 @@
gint index;
GpmCell *cell;
+ g_return_val_if_fail (GPM_IS_CELL_ARRAY (cell_array), FALSE);
+
/* is this UDI in our array? */
index = gpm_cell_array_index_device_id (cell_array, udi);
if (index == -1) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]