[gnome-color-manager] Use cmsOpenProfileFromFile() and hope for profiles with embedded IDs



commit 678eb6389c080e890a053bb223053de6e89e8f00
Author: Richard Hughes <richard hughsie com>
Date:   Tue Apr 26 18:11:49 2011 +0100

    Use cmsOpenProfileFromFile() and hope for profiles with embedded IDs
    
    This reduces memory allocation at startup from 4.82Mb to 3.06Mb (no IDs)
    or 2.91Mb (all IDs)

 src/gcm-session.c |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)
---
diff --git a/src/gcm-session.c b/src/gcm-session.c
index 3182ddb..646a8dd 100644
--- a/src/gcm-session.c
+++ b/src/gcm-session.c
@@ -1242,13 +1242,8 @@ gcm_session_get_md5_for_filename (const gchar *filename,
 	gsize length;
 	cmsHPROFILE lcms_profile = NULL;
 
-	/* read file */
-	ret = g_file_get_contents (filename, &data, &length, error);
-	if (!ret)
-		goto out;
-
 	/* get the internal profile id, if it exists */
-	lcms_profile = cmsOpenProfileFromMem (data, length);
+	lcms_profile = cmsOpenProfileFromFile (filename, "r");
 	if (lcms_profile == NULL) {
 		ret = FALSE;
 		g_set_error_literal (error, 1, 0,
@@ -1260,6 +1255,9 @@ gcm_session_get_md5_for_filename (const gchar *filename,
 		goto out;
 
 	/* generate checksum */
+	ret = g_file_get_contents (filename, &data, &length, error);
+	if (!ret)
+		goto out;
 	checksum = g_compute_checksum_for_data (G_CHECKSUM_MD5,
 						(const guchar *) data,
 						length);



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