[gnome-color-manager] Process the DMI data harder, as it appears laptop vendors are often in a rush when shipping products
- From: Richard Hughes <rhughes src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-color-manager] Process the DMI data harder, as it appears laptop vendors are often in a rush when shipping products
- Date: Wed, 2 Dec 2009 13:22:08 +0000 (UTC)
commit f5a4a0c48c17fcd7b675a94f96dbcbd2d60475ad
Author: Richard Hughes <richard hughsie com>
Date: Wed Dec 2 13:21:09 2009 +0000
Process the DMI data harder, as it appears laptop vendors are often in a rush when shipping products...
src/gcm-dmi.c | 15 ++++++++++++---
1 files changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/src/gcm-dmi.c b/src/gcm-dmi.c
index ed48ea9..44d6b1a 100644
--- a/src/gcm-dmi.c
+++ b/src/gcm-dmi.c
@@ -80,9 +80,18 @@ gcm_dmi_get_data (const gchar *filename)
g_error_free (error);
}
- /* get rid of the newline */
- if (data != NULL)
- g_strdelimit (data, "\n", '\0');
+ /* process the random chars and trailing spaces */
+ if (data != NULL) {
+ g_strdelimit (data, "\t_", ' ');
+ g_strdelimit (data, "\n\r", '\0');
+ g_strchomp (data);
+ }
+
+ /* don't return an empty string */
+ if (data != NULL && data[0] == '\0') {
+ g_free (data);
+ data = NULL;
+ }
return data;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]