diff options
author | nima <nima@abc39116-655e-4be6-ad55-d661dc543056> | 2008-08-06 06:59:35 +0000 |
---|---|---|
committer | nima <nima@abc39116-655e-4be6-ad55-d661dc543056> | 2008-08-06 06:59:35 +0000 |
commit | 78f950bf54293a9afeb0e9aea46009a883eb5b5b (patch) | |
tree | bc7749cd0b92e013232b417bf0e96143d82bb46a | |
parent | f3c71346a009f1b88a3acc29a66fa6a9c01b124d (diff) | |
download | python-dmidecode-78f950bf54293a9afeb0e9aea46009a883eb5b5b.tar.gz python-dmidecode-78f950bf54293a9afeb0e9aea46009a883eb5b5b.tar.xz python-dmidecode-78f950bf54293a9afeb0e9aea46009a883eb5b5b.zip |
More fixes on recent commits (by me), and more conversions on functions.
git-svn-id: svn://svn.autonomy.net.au/python-dmidecode@44 abc39116-655e-4be6-ad55-d661dc543056
-rw-r--r-- | dmidecode.c | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/dmidecode.c b/dmidecode.c index 5e2db78..d32aa00 100644 --- a/dmidecode.c +++ b/dmidecode.c @@ -2322,15 +2322,15 @@ static PyObject *dmi_battery_capacity(u16 code, u8 multiplier) { static PyObject *dmi_battery_voltage(u16 code) { PyObject *data; - if(code==0) PyString_FromString("Unknown"); - else PyString_FromFormat("%u mV", code); + if(code==0) data = PyString_FromString("Unknown"); + else data = PyString_FromFormat("%u mV", code); return data; } static PyObject *dmi_battery_maximum_error(u8 code) { PyObject *data; - if(code==0xFF) PyString_FromString("Unknown"); - else PyString_FromFormat("%u%%", code); + if(code==0xFF) data = PyString_FromString("Unknown"); + else data = PyString_FromFormat("%u%%", code); return data; } @@ -2338,28 +2338,31 @@ static PyObject *dmi_battery_maximum_error(u8 code) { ** 3.3.24 System Reset (Type 23) */ -static const char *dmi_system_reset_boot_option(u8 code) { +static PyObject *dmi_system_reset_boot_option(u8 code) { static const char *option[]={ "Operating System", /* 0x1 */ "System Utilities", "Do Not Reboot" /* 0x3 */ }; + PyObject *data; - if(code>=0x1) - return option[code-0x1]; - return out_of_spec; + if(code>=0x1) data = PyString_FromString(option[code-0x1]); + else data = PyString_FromString(out_of_spec); + return data; } -static const char *dmi_system_reset_count(u16 code, char *_) { - if(code==0xFFFF) sprintf(_, "Unknown"); - else sprintf(_, "%u", code); - return _; +static PyObject *dmi_system_reset_count(u16 code) { + PyObject *data; + if(code==0xFFFF) data = PyString_FromString("Unknown"); + else data = PyInt_FromLong(code); + return data; } -static const char *dmi_system_reset_timer(u16 code, char *_) { - if(code==0xFFFF) sprintf(_, "Unknown"); - else sprintf(_, "%u min", code); - return _; +static PyObject *dmi_system_reset_timer(u16 code) { + PyObject *data; + if(code==0xFFFF) data = PyString_FromString("Unknown"); + else data = PyString_FromFormat("%u min", code); + return data; } /******************************************************************************* |