[gnome-color-manager] trivial: add a length parameter to gcm_edid_parse()



commit 0ecbc5dffe4721eaa3667fbf66f287b79e2aa462
Author: Richard Hughes <richard hughsie com>
Date:   Fri Jul 23 14:59:37 2010 +0100

    trivial: add a length parameter to gcm_edid_parse()

 libcolor-glib/gcm-edid.c      |    2 +-
 libcolor-glib/gcm-edid.h      |    1 +
 libcolor-glib/gcm-self-test.c |    5 +++--
 src/gcm-device-xrandr.c       |    2 +-
 tools/gcm-dump-edid.c         |    5 +++--
 5 files changed, 9 insertions(+), 6 deletions(-)
---
diff --git a/libcolor-glib/gcm-edid.c b/libcolor-glib/gcm-edid.c
index 99b430a..bfa5826 100644
--- a/libcolor-glib/gcm-edid.c
+++ b/libcolor-glib/gcm-edid.c
@@ -289,7 +289,7 @@ gcm_edid_parse_string (const guint8 *data)
  * gcm_edid_parse:
  **/
 gboolean
-gcm_edid_parse (GcmEdid *edid, const guint8 *data, GError **error)
+gcm_edid_parse (GcmEdid *edid, const guint8 *data, gsize length, GError **error)
 {
 	gboolean ret = TRUE;
 	guint i;
diff --git a/libcolor-glib/gcm-edid.h b/libcolor-glib/gcm-edid.h
index e650203..546fac9 100644
--- a/libcolor-glib/gcm-edid.h
+++ b/libcolor-glib/gcm-edid.h
@@ -63,6 +63,7 @@ GcmEdid		*gcm_edid_new				(void);
 void		 gcm_edid_reset				(GcmEdid		*edid);
 gboolean	 gcm_edid_parse				(GcmEdid		*edid,
 							 const guint8		*data,
+							 gsize			 length,
 							 GError			**error);
 const gchar	*gcm_edid_get_monitor_name		(GcmEdid		*edid);
 const gchar	*gcm_edid_get_vendor_name		(GcmEdid		*edid);
diff --git a/libcolor-glib/gcm-self-test.c b/libcolor-glib/gcm-self-test.c
index f584d7c..8a7928d 100644
--- a/libcolor-glib/gcm-self-test.c
+++ b/libcolor-glib/gcm-self-test.c
@@ -221,12 +221,13 @@ gcm_test_edid_test_parse_edid_file (GcmEdid *edid, const gchar *filename, GcmEdi
 	gfloat mygamma;
 	gboolean ret;
 	GError *error = NULL;
+	gsize length = 0;
 
-	ret = g_file_get_contents (filename, &data, NULL, &error);
+	ret = g_file_get_contents (filename, &data, &length, &error);
 	g_assert_no_error (error);
 	g_assert (ret);
 
-	ret = gcm_edid_parse (edid, (const guint8 *) data, &error);
+	ret = gcm_edid_parse (edid, (const guint8 *) data, length, &error);
 	g_assert_no_error (error);
 	g_assert (ret);
 
diff --git a/src/gcm-device-xrandr.c b/src/gcm-device-xrandr.c
index f87ad73..31f8988 100644
--- a/src/gcm-device-xrandr.c
+++ b/src/gcm-device-xrandr.c
@@ -242,7 +242,7 @@ gcm_device_xrandr_set_from_output (GcmDevice *device, GcmX11Output *output, GErr
 	/* parse the EDID to get a output specific name */
 	ret = gcm_x11_output_get_edid_data (output, &data, &length, NULL);
 	if (ret) {
-		ret = gcm_edid_parse (priv->edid, data, NULL);
+		ret = gcm_edid_parse (priv->edid, data, length, NULL);
 		if (!ret) {
 			g_set_error (error, 1, 0, "failed to parse edid");
 			goto out;
diff --git a/tools/gcm-dump-edid.c b/tools/gcm-dump-edid.c
index eaeb778..20d4d2b 100644
--- a/tools/gcm-dump-edid.c
+++ b/tools/gcm-dump-edid.c
@@ -46,9 +46,10 @@ gcm_dump_edid_filename (const gchar *filename)
 	gboolean ret;
 	GError *error = NULL;
 	GcmEdid *edid = NULL;
+	gsize length = 0;
 
 	/* load */
-	ret = g_file_get_contents (filename, &data, NULL, &error);
+	ret = g_file_get_contents (filename, &data, &length, &error);
 	if (!ret) {
 		g_print ("Cannot load file contents: %s\n", error->message);
 		goto out;
@@ -56,7 +57,7 @@ gcm_dump_edid_filename (const gchar *filename)
 
 	/* parse */
 	edid = gcm_edid_new ();
-	ret = gcm_edid_parse (edid, (const guint8 *) data, &error);
+	ret = gcm_edid_parse (edid, (const guint8 *) data, length, &error);
 	if (!ret) {
 		g_print ("Cannot parse EDID contents: %s\n", error->message);
 		goto out;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]