Update to colord-0.1.33.

This commit is contained in:
ajacoutot 2013-04-18 13:57:14 +00:00
parent c5a3b4938a
commit ec6da280e4
8 changed files with 19 additions and 281 deletions

View File

@ -1,11 +1,10 @@
# $OpenBSD: Makefile,v 1.24 2013/03/31 19:46:48 ajacoutot Exp $
# $OpenBSD: Makefile,v 1.25 2013/04/18 13:57:14 ajacoutot Exp $
COMMENT= device color profile management daemon
V= 0.1.32
V= 0.1.33
DISTNAME= colord-${V}
EXTRACT_SUFX= .tar.xz
REVISION= 0
SHARED_LIBS += colordprivate 0.1 # 1.19
SHARED_LIBS += colord 0.3 # 1.19

View File

@ -1,2 +1,2 @@
SHA256 (colord-0.1.32.tar.xz) = xwNKjyGUjURYxj9M9f1w7myqtQjOCPM6l1Kw8Amcq+o=
SIZE (colord-0.1.32.tar.xz) = 992544
SHA256 (colord-0.1.33.tar.xz) = L5CPl0asLpH9vU2Kk7oGAZogT2r1I2LaUMiwkM+IvY0=
SIZE (colord-0.1.33.tar.xz) = 1042780

View File

@ -1,70 +0,0 @@
$OpenBSD: patch-client_cd-create-profile_c,v 1.1 2013/03/31 19:41:23 ajacoutot Exp $
FIXED upstream (not committed just yet)
cd-create-profile.c:326: warning: declaration of 'tgamma' shadows a global declaration
/usr/include/math.h:201: warning: shadowed declaration is here
cd-create-profile.c:460: warning: declaration of 'gamma' shadows a global declaration
/usr/include/math.h:238: warning: shadowed declaration is here
--- client/cd-create-profile.c.orig Sun Mar 31 12:28:09 2013
+++ client/cd-create-profile.c Sun Mar 31 12:29:36 2013
@@ -323,7 +323,7 @@ cd_util_create_standard_space (CdUtilPrivate *priv,
const GNode *tmp;
gboolean ret;
gchar *endptr = NULL;
- gdouble tgamma;
+ gdouble cd_tgamma;
/* parse gamma */
tmp = cd_dom_get_node (dom, root, "gamma");
@@ -346,7 +346,7 @@ cd_util_create_standard_space (CdUtilPrivate *priv,
transfer[1] = transfer[0];
transfer[2] = transfer[0];
} else {
- tgamma = g_ascii_strtod (data, &endptr);
+ cd_tgamma = g_ascii_strtod (data, &endptr);
if (endptr != NULL && endptr[0] != '\0') {
ret = FALSE;
g_set_error (error, 1, 0,
@@ -354,7 +354,7 @@ cd_util_create_standard_space (CdUtilPrivate *priv,
data);
goto out;
}
- transfer[0] = cmsBuildGamma (NULL, tgamma);
+ transfer[0] = cmsBuildGamma (NULL, cd_tgamma);
transfer[1] = transfer[0];
transfer[2] = transfer[0];
}
@@ -457,7 +457,7 @@ cd_util_create_temperature (CdUtilPrivate *priv,
const guint size = 256;
gboolean ret;
gchar *endptr = NULL;
- gdouble gamma;
+ gdouble cd_gamma;
guint16 data[3][256];
guint i;
guint temp;
@@ -487,7 +487,7 @@ cd_util_create_temperature (CdUtilPrivate *priv,
g_set_error_literal (error, 1, 0, "XML error, expected gamma");
goto out;
}
- gamma = g_ascii_strtod (cd_dom_get_node_data (tmp), &endptr);
+ cd_gamma = g_ascii_strtod (cd_dom_get_node_data (tmp), &endptr);
if (endptr != NULL && endptr[0] != '\0') {
ret = FALSE;
g_set_error (error, 1, 0,
@@ -499,11 +499,11 @@ cd_util_create_temperature (CdUtilPrivate *priv,
/* generate the VCGT table */
cd_color_get_blackbody_rgb (temp, &white_point);
for (i = 0; i < size; i++) {
- data[0][i] = pow ((gdouble) i / size, 1.0 / gamma) *
+ data[0][i] = pow ((gdouble) i / size, 1.0 / cd_gamma) *
0xffff * white_point.R;
- data[1][i] = pow ((gdouble) i / size, 1.0 / gamma) *
+ data[1][i] = pow ((gdouble) i / size, 1.0 / cd_gamma) *
0xffff * white_point.G;
- data[2][i] = pow ((gdouble) i / size, 1.0 / gamma) *
+ data[2][i] = pow ((gdouble) i / size, 1.0 / cd_gamma) *
0xffff * white_point.B;
}

View File

@ -1,11 +1,11 @@
$OpenBSD: patch-configure,v 1.9 2013/03/31 19:41:23 ajacoutot Exp $
$OpenBSD: patch-configure,v 1.10 2013/04/18 13:57:14 ajacoutot Exp $
Fix DATADIRNAME: see LOCALBASE/share/aclocal/{glib-gettext.m4,intltool.m4}
/var/lib -> /var/db
--- configure.orig Thu Mar 28 11:16:11 2013
+++ configure Sat Mar 30 16:25:48 2013
--- configure.orig Mon Apr 1 23:03:05 2013
+++ configure Thu Apr 18 15:51:58 2013
@@ -13906,6 +13906,9 @@ else
fi
@ -16,7 +16,7 @@ Fix DATADIRNAME: see LOCALBASE/share/aclocal/{glib-gettext.m4,intltool.m4}
*)
DATADIRNAME=lib
;;
@@ -17763,7 +17766,7 @@ fi
@@ -17813,7 +17816,7 @@ _ACEOF
fi
# per-machine directory

View File

@ -1,192 +0,0 @@
$OpenBSD: patch-lib_colord_cd-icc_c,v 1.1 2013/03/31 19:41:23 ajacoutot Exp $
From e13946311e57981d060225a3ec67a76e825d0248 Mon Sep 17 00:00:00 2001
From: Richard Hughes <richard@hughsie.com>
Date: Thu, 28 Mar 2013 14:42:39 +0000
Subject: [PATCH] trivial: Add a gobject-introspection element-type
From 9f7ef87460b4b40103c59ea8a3839dc8706a7d53 Mon Sep 17 00:00:00 2001
From: Richard Hughes <richard@hughsie.com>
Date: Thu, 28 Mar 2013 14:43:45 +0000
Subject: [PATCH] trivial: Sanity check the written profile size to be less than 16Mb
From 653d0569dd960f607b58ec6b9ee91bf867fdb039 Mon Sep 17 00:00:00 2001
From: Richard Hughes <richard@hughsie.com>
Date: Thu, 28 Mar 2013 14:44:38 +0000
Subject: [PATCH] trivial: Be more paranoid when writing ICC wchar_t values
From 085b32b6ca9802bbfce509fcb5bf8bf231afaa48 Mon Sep 17 00:00:00 2001
From: Richard Hughes <richard@hughsie.com>
Date: Thu, 28 Mar 2013 15:24:00 +0000
Subject: [PATCH] Ensure mbstowcs() has an LC_CTYPE of 'en_US.UTF-8'
--- lib/colord/cd-icc.c.orig Sun Mar 31 21:33:15 2013
+++ lib/colord/cd-icc.c Sun Mar 31 21:33:47 2013
@@ -28,6 +28,7 @@
#include <glib.h>
#include <lcms2.h>
+#include <locale.h>
#include <string.h>
#include <stdlib.h>
@@ -813,10 +814,14 @@ out:
static wchar_t *
utf8_to_wchar_t (const char *src)
{
+ const gchar *orig_locale;
gssize len;
gssize converted;
wchar_t *buf = NULL;
+ /* switch the locale to a known UTF-8 LC_CTYPE */
+ orig_locale = setlocale (LC_CTYPE, NULL);
+ setlocale (LC_CTYPE, "en_US.UTF-8");
len = mbstowcs (NULL, src, 0);
if (len < 0) {
g_warning ("Invalid UTF-8 in string %s", src);
@@ -828,28 +833,49 @@ utf8_to_wchar_t (const char *src)
g_assert (converted != -1);
buf[converted] = '\0';
out:
+ setlocale (LC_CTYPE, orig_locale);
return buf;
}
/**
- * _cmsDictAddEntryAscii:
+ * cd_util_write_dict_entry:
**/
-static cmsBool
-_cmsDictAddEntryAscii (cmsHANDLE dict,
- const gchar *key,
- const gchar *value)
+static gboolean
+cd_util_write_dict_entry (cmsHANDLE dict,
+ const gchar *key,
+ const gchar *value,
+ GError **error)
{
- cmsBool ret = FALSE;
+ gboolean ret = FALSE;
wchar_t *mb_key = NULL;
wchar_t *mb_value = NULL;
mb_key = utf8_to_wchar_t (key);
- if (mb_key == NULL)
+ if (mb_key == NULL) {
+ g_set_error (error,
+ CD_ICC_ERROR,
+ CD_ICC_ERROR_FAILED_TO_SAVE,
+ "Failed to write invalid ASCII key: '%s'",
+ key);
goto out;
+ }
mb_value = utf8_to_wchar_t (value);
- if (mb_value == NULL)
+ if (mb_value == NULL) {
+ g_set_error (error,
+ CD_ICC_ERROR,
+ CD_ICC_ERROR_FAILED_TO_SAVE,
+ "Failed to write invalid ASCII value: '%s'",
+ value);
goto out;
+ }
ret = cmsDictAddEntry (dict, mb_key, mb_value, NULL, NULL);
+ if (!ret) {
+ g_set_error_literal (error,
+ CD_ICC_ERROR,
+ CD_ICC_ERROR_FAILED_TO_SAVE,
+ "Failed to write dict entry");
+ goto out;
+ }
out:
g_free (mb_key);
g_free (mb_value);
@@ -889,8 +915,11 @@ cd_util_mlu_object_parse (const gchar *locale, const g
/* untranslated version */
if (locale == NULL || locale[0] == '\0') {
+ wtext = utf8_to_wchar_t (utf8_text);
+ if (wtext == NULL)
+ goto out;
obj = g_new0 (CdMluObject, 1);
- obj->wtext = utf8_to_wchar_t (utf8_text);
+ obj->wtext = wtext;
goto out;
}
@@ -946,6 +975,7 @@ cd_util_write_tag_localized (CdIcc *icc,
CdMluObject *obj;
cmsMLU *mlu = NULL;
const gchar *locale;
+ const gchar *value;
gboolean ret = TRUE;
GList *keys;
GList *l;
@@ -957,10 +987,13 @@ cd_util_write_tag_localized (CdIcc *icc,
array = g_ptr_array_new_with_free_func (cd_util_mlu_object_free);
for (l = keys; l != NULL; l = l->next) {
locale = l->data;
- obj = cd_util_mlu_object_parse (locale,
- g_hash_table_lookup (hash, locale));
- if (obj == NULL)
+ value = g_hash_table_lookup (hash, locale);
+ obj = cd_util_mlu_object_parse (locale, value);
+ if (obj == NULL) {
+ g_warning ("failed to parse localized text: %s[%s]",
+ value, locale);
continue;
+ }
g_ptr_array_add (array, obj);
}
@@ -1053,7 +1086,7 @@ cd_icc_save_file (CdIcc *icc,
GError *error_local = NULL;
GList *l;
GList *md_keys = NULL;
- gsize length;
+ gsize length = 0;
guint i;
g_return_val_if_fail (CD_IS_ICC (icc), FALSE);
@@ -1089,7 +1122,10 @@ cd_icc_save_file (CdIcc *icc,
for (l = md_keys; l != NULL; l = l->next) {
key = l->data;
value = g_hash_table_lookup (priv->metadata, key);
- _cmsDictAddEntryAscii (dict, key, value);
+ ret = cd_util_write_dict_entry (dict, key,
+ value, error);
+ if (!ret)
+ goto out;
}
}
ret = cmsWriteTag (priv->lcms_profile, cmsSigMetaTag, dict);
@@ -1152,6 +1188,18 @@ cd_icc_save_file (CdIcc *icc,
goto out;
}
+ /* sanity check to 16Mb */
+ if (length == 0 || length > 16 * 1024 * 1024) {
+ ret = FALSE;
+ g_set_error (error,
+ CD_ICC_ERROR,
+ CD_ICC_ERROR_FAILED_TO_SAVE,
+ "failed to save ICC file, requested %" G_GSIZE_FORMAT
+ "bytes and limit is 16Mb",
+ length);
+ goto out;
+ }
+
/* allocate and get profile data */
data = g_new0 (gchar, length);
ret = cmsSaveProfileToMem (priv->lcms_profile,
@@ -1648,7 +1696,7 @@ out:
* This function will only return results if the profile was loaded with the
* %CD_ICC_LOAD_FLAGS_NAMED_COLORS flag.
*
- * Return value: (transfer container): An array of #CdColorSwatch
+ * Return value: (transfer container) (element-type CdColorSwatch): An array of color swatches
*
* Since: 0.1.32
**/

View File

@ -1,10 +1,10 @@
$OpenBSD: patch-src_cd-main_c,v 1.7 2013/03/31 19:41:23 ajacoutot Exp $
$OpenBSD: patch-src_cd-main_c,v 1.8 2013/04/18 13:57:14 ajacoutot Exp $
/var/lib -> /var/db
--- src/cd-main.c.orig Tue Feb 19 09:45:45 2013
+++ src/cd-main.c Sat Mar 30 16:25:48 2013
@@ -2424,7 +2424,7 @@ main (int argc, char *argv[])
--- src/cd-main.c.orig Mon Apr 1 21:45:32 2013
+++ src/cd-main.c Thu Apr 18 15:51:58 2013
@@ -2429,7 +2429,7 @@ main (int argc, char *argv[])
/* connect to the mapping db */
priv->mapping_db = cd_mapping_db_new ();
ret = cd_mapping_db_load (priv->mapping_db,
@ -13,7 +13,7 @@ $OpenBSD: patch-src_cd-main_c,v 1.7 2013/03/31 19:41:23 ajacoutot Exp $
&error);
if (!ret) {
g_warning ("CdMain: failed to load mapping database: %s",
@@ -2436,7 +2436,7 @@ main (int argc, char *argv[])
@@ -2441,7 +2441,7 @@ main (int argc, char *argv[])
/* connect to the device db */
priv->device_db = cd_device_db_new ();
ret = cd_device_db_load (priv->device_db,

View File

@ -1,9 +1,9 @@
$OpenBSD: patch-src_cd-profile_c,v 1.6 2013/03/31 19:46:48 ajacoutot Exp $
$OpenBSD: patch-src_cd-profile_c,v 1.7 2013/04/18 13:57:14 ajacoutot Exp $
/var/lib -> /var/db
--- src/cd-profile.c.orig Mon Mar 25 23:41:41 2013
+++ src/cd-profile.c Sun Mar 31 21:43:51 2013
--- src/cd-profile.c.orig Mon Apr 1 21:44:16 2013
+++ src/cd-profile.c Thu Apr 18 15:51:58 2013
@@ -401,7 +401,7 @@ cd_profile_install_system_wide (CdProfile *profile, GE
goto out;
}
@ -22,7 +22,7 @@ $OpenBSD: patch-src_cd-profile_c,v 1.6 2013/03/31 19:46:48 ajacoutot Exp $
if (g_str_has_prefix (priv->filename,
DATADIR "/color")) {
ret = FALSE;
@@ -1415,7 +1415,7 @@ cd_profile_set_filename (CdProfile *profile,
@@ -1420,7 +1420,7 @@ cd_profile_set_filename (CdProfile *profile,
}
/* find out if we have a GResource copy */

View File

@ -1,4 +1,4 @@
@comment $OpenBSD: PLIST,v 1.12 2013/03/31 19:41:23 ajacoutot Exp $
@comment $OpenBSD: PLIST,v 1.13 2013/04/18 13:57:14 ajacoutot Exp $
@conflict shared-color-profiles-*
@conflict shared-color-profiles-extra-*
@pkgpath graphics/colord
@ -69,6 +69,7 @@ share/color/icc/colord/CIE-RGB.icc
share/color/icc/colord/ColorMatchRGB.icc
share/color/icc/colord/Crayons.icc
share/color/icc/colord/DonRGB4.icc
share/color/icc/colord/ECI-RGBv1.icc
share/color/icc/colord/ECI-RGBv2.icc
share/color/icc/colord/EktaSpacePS5.icc
share/color/icc/colord/Gamma5000K.icc