[Pkg-wmaker-commits] [wmbattery] 93/241: * Correct issue with the statically allocated string returned by get_acpi_value that caused it to only look at last full capacity and never really at design capacity.
Doug Torrance
dtorrance-guest at moszumanska.debian.org
Mon Aug 24 23:37:39 UTC 2015
This is an automated email from the git hooks/post-receive script.
dtorrance-guest pushed a commit to branch master
in repository wmbattery.
commit eb1b931cd2612490f85db271aa630eadc78ca9a9
Author: Joey Hess <joey at kitenet.net>
Date: Sat Dec 22 22:31:28 2007 -0500
* Correct issue with the statically allocated string returned by
get_acpi_value that caused it to only look at last full capacity and never
really at design capacity.
---
acpi.c | 17 +++++++++++------
debian/changelog | 8 ++++++++
2 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/acpi.c b/acpi.c
index 2e6bd41..667888a 100644
--- a/acpi.c
+++ b/acpi.c
@@ -140,20 +140,25 @@ char *get_acpi_value (const char *file, const char *key) {
*/
int get_acpi_batt_capacity(int battery) {
int dcap, lcap;
- char *dcaps=get_acpi_value(acpi_batt_info[battery], acpi_labels[label_design_capacity]);
- char *lcaps=get_acpi_value(acpi_batt_info[battery], acpi_labels[label_last_full_capacity]);
- if (dcaps == NULL)
+ char *s;
+
+ s=get_acpi_value(acpi_batt_info[battery], acpi_labels[label_design_capacity]);
+ if (s == NULL)
dcap=0; /* battery not present */
else
- dcap=atoi(dcaps);
+ dcap=atoi(s);
+
/* This is ACPI's broken way of saying that there is no battery. */
if (dcap == 655350)
return 0;
- if (lcaps != NULL) {
- lcap=atoi(lcaps);
+
+ s=get_acpi_value(acpi_batt_info[battery], acpi_labels[label_last_full_capacity]);
+ if (s != NULL) {
+ lcap=atoi(s);
if (lcap > dcap)
return lcap;
}
+
return dcap;
}
diff --git a/debian/changelog b/debian/changelog
index 5d86bec..027e4ac 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+wmbattery (2.33) unstable; urgency=low
+
+ * Correct issue with the statically allocated string returned by
+ get_acpi_value that caused it to only look at last full capacity and never
+ really at design capacity.
+
+ -- Joey Hess <joeyh at debian.org> Sat, 22 Dec 2007 22:26:38 -0500
+
wmbattery (2.32) unstable; urgency=low
* Guard some divisions against division by zero. I've never seen that
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-wmaker/wmbattery.git
More information about the Pkg-wmaker-commits
mailing list