New upstream version

- Add a new tool 'cd-iccdump' that can dump V4 and V2 profiles
- Add translated descriptions to the ICC profiles
This commit is contained in:
Richard Hughes 2013-03-28 17:33:34 +00:00
parent 6ebcc20103
commit fa16efc21e
4 changed files with 186 additions and 13 deletions

1
.gitignore vendored
View File

@ -29,3 +29,4 @@
/colord-0.1.29.tar.xz /colord-0.1.29.tar.xz
/colord-0.1.30.tar.xz /colord-0.1.30.tar.xz
/colord-0.1.31.tar.xz /colord-0.1.31.tar.xz
/colord-0.1.32.tar.xz

163
colord-master.patch Normal file
View File

@ -0,0 +1,163 @@
diff --git a/lib/colord/cd-icc.c b/lib/colord/cd-icc.c
index c3f3d87..2554d78 100644
--- a/lib/colord/cd-icc.c
+++ b/lib/colord/cd-icc.c
@@ -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 gchar *utf8_text)
/* 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,

View File

@ -18,12 +18,15 @@
Summary: Color daemon Summary: Color daemon
Name: colord Name: colord
Version: 0.1.31 Version: 0.1.32
Release: 1%{?dist} Release: 1%{?dist}
License: GPLv2+ and LGPLv2+ License: GPLv2+ and LGPLv2+
URL: http://www.freedesktop.org/software/colord/ URL: http://www.freedesktop.org/software/colord/
Source0: http://www.freedesktop.org/software/colord/releases/%{name}-%{version}.tar.xz Source0: http://www.freedesktop.org/software/colord/releases/%{name}-%{version}.tar.xz
# Update to master branch
Patch0: colord-master.patch
BuildRequires: dbus-devel BuildRequires: dbus-devel
BuildRequires: docbook-utils BuildRequires: docbook-utils
BuildRequires: gettext BuildRequires: gettext
@ -103,6 +106,7 @@ This may be useful for CMYK soft-proofing or for extra device support.
%prep %prep
%setup -q %setup -q
%patch0 -p1 -b .master
%build %build
# we can't use _hardened_build here, see # we can't use _hardened_build here, see
@ -196,11 +200,6 @@ glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || :
# common colorspaces # common colorspaces
%dir %{_icccolordir}/colord %dir %{_icccolordir}/colord
%{_icccolordir}/colord/AdobeRGB1998.icc %{_icccolordir}/colord/AdobeRGB1998.icc
%{_icccolordir}/colord/AppleRGB.icc
%{_icccolordir}/colord/CIE-RGB.icc
%{_icccolordir}/colord/ColorMatchRGB.icc
%{_icccolordir}/colord/NTSC-RGB.icc
%{_icccolordir}/colord/PAL-RGB.icc
%{_icccolordir}/colord/ProPhotoRGB.icc %{_icccolordir}/colord/ProPhotoRGB.icc
%{_icccolordir}/colord/SMPTE-C-RGB.icc %{_icccolordir}/colord/SMPTE-C-RGB.icc
%{_icccolordir}/colord/sRGB.icc %{_icccolordir}/colord/sRGB.icc
@ -211,9 +210,7 @@ glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || :
%endif %endif
# monitor test profiles # monitor test profiles
%{_icccolordir}/colord/bluish.icc %{_icccolordir}/colord/Bluish.icc
%{_icccolordir}/colord/SwappedRedAndGreen.icc
%{_icccolordir}/colord/gamma*.icc
# named color profiles # named color profiles
%{_icccolordir}/colord/x11-colors.icc %{_icccolordir}/colord/x11-colors.icc
@ -237,16 +234,23 @@ glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || :
%endif %endif
# other colorspaces not often used # other colorspaces not often used
%{_icccolordir}/colord/AppleRGB.icc
%{_icccolordir}/colord/BestRGB.icc %{_icccolordir}/colord/BestRGB.icc
%{_icccolordir}/colord/BetaRGB.icc %{_icccolordir}/colord/BetaRGB.icc
%{_icccolordir}/colord/BruceRGB.icc %{_icccolordir}/colord/BruceRGB.icc
%{_icccolordir}/colord/CIE-RGB.icc
%{_icccolordir}/colord/ColorMatchRGB.icc
%{_icccolordir}/colord/DonRGB4.icc %{_icccolordir}/colord/DonRGB4.icc
%{_icccolordir}/colord/ECI-RGBv2.icc %{_icccolordir}/colord/ECI-RGBv2.icc
%{_icccolordir}/colord/EktaSpacePS5.icc %{_icccolordir}/colord/EktaSpacePS5.icc
%{_icccolordir}/colord/Gamma*.icc
%{_icccolordir}/colord/NTSC-RGB.icc
%{_icccolordir}/colord/PAL-RGB.icc
%{_icccolordir}/colord/SwappedRedAndGreen.icc
%{_icccolordir}/colord/WideGamutRGB.icc %{_icccolordir}/colord/WideGamutRGB.icc
# other named color profiles not generally useful # other named color profiles not generally useful
%{_icccolordir}/colord/crayons.icc %{_icccolordir}/colord/Crayons.icc
%files devel %files devel
%{_includedir}/colord-1 %{_includedir}/colord-1
@ -260,6 +264,11 @@ glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || :
%{_datadir}/gtk-doc/html/colord/* %{_datadir}/gtk-doc/html/colord/*
%changelog %changelog
* Thu Mar 28 2013 Richard Hughes <richard@hughsie.com> 0.1.32-1
- New upstream version
- Add a new tool 'cd-iccdump' that can dump V4 and V2 profiles
- Add translated descriptions to the ICC profiles
* Mon Mar 18 2013 Richard Hughes <richard@hughsie.com> 0.1.31-1 * Mon Mar 18 2013 Richard Hughes <richard@hughsie.com> 0.1.31-1
- New upstream version - New upstream version
- Calculate the display calibration based on the Lab and target display gamma - Calculate the display calibration based on the Lab and target display gamma
@ -269,7 +278,7 @@ glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || :
- Fix the gamut warning to check primaries wider than CIERGB and ProPhoto - Fix the gamut warning to check primaries wider than CIERGB and ProPhoto
- Move the private sensor libraries out of the pure lib space - Move the private sensor libraries out of the pure lib space
* Mon Feb 17 2013 Richard Hughes <richard@hughsie.com> 0.1.30-1 * Mon Feb 18 2013 Richard Hughes <richard@hughsie.com> 0.1.30-1
- New upstream version - New upstream version
- Append -private to the driver libraries as they have no headers installed - Append -private to the driver libraries as they have no headers installed
- Do not show duplicate profiles when icc-profiles-openicc is installed - Do not show duplicate profiles when icc-profiles-openicc is installed
@ -287,7 +296,7 @@ glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || :
- Install various helper libraries for access to hardware - Install various helper libraries for access to hardware
- Set the additional 'OwnerCmdline' metadata on each device - Set the additional 'OwnerCmdline' metadata on each device
* Fri Jan 16 2013 Richard Hughes <richard@hughsie.com> 0.1.28-2 * Fri Jan 18 2013 Richard Hughes <richard@hughsie.com> 0.1.28-2
- Backport some fixes from upstream for gnome-settings-daemon. - Backport some fixes from upstream for gnome-settings-daemon.
* Wed Jan 16 2013 Richard Hughes <richard@hughsie.com> 0.1.28-1 * Wed Jan 16 2013 Richard Hughes <richard@hughsie.com> 0.1.28-1

View File

@ -1 +1 @@
3b880ff2c785b83320286b3ae350531b colord-0.1.31.tar.xz fecd86425982d48b1545fe30e38a381d colord-0.1.32.tar.xz