summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/egg-discrete.c4
-rw-r--r--src/gpm-load.c2
2 files changed, 3 insertions, 3 deletions
diff --git a/src/egg-discrete.c b/src/egg-discrete.c
index a051282..fe910cc 100644
--- a/src/egg-discrete.c
+++ b/src/egg-discrete.c
@@ -47,7 +47,7 @@ egg_discrete_from_percent (guint percentage, guint levels)
egg_warning ("levels is 0!");
return 0;
}
- return ((gfloat) percentage * (gfloat) (levels - 1)) / 100.0f;
+ return (guint) ((((gfloat) percentage * (gfloat) (levels - 1)) / 100.0f) + 0.5f);
}
/**
@@ -69,7 +69,7 @@ egg_discrete_to_percent (guint discrete, guint levels)
egg_warning ("levels is 0!");
return 0;
}
- return (guint) ((gfloat) discrete * (100.0f / (gfloat) (levels - 1)));
+ return (guint) (((gfloat) discrete * (100.0f / (gfloat) (levels - 1))) + 0.5f);
}
/**
diff --git a/src/gpm-load.c b/src/gpm-load.c
index eab0129..3b0f572 100644
--- a/src/gpm-load.c
+++ b/src/gpm-load.c
@@ -192,7 +192,7 @@ gpm_load_get_cpu_values (long unsigned *cpu_idle, long unsigned *cpu_total)
*cpu_total = cpu_user + cpu_nice + cpu_system + *cpu_idle;
ret = TRUE;
out:
- if (!fd)
+ if (fd)
fclose (fd);
return ret;
}