Update to 0.7.90

- Adjust default hal callout path (#547049) (Temporaily use
    --with-hal-callouts-dir=%{_libexecdir}/scripts)
This commit is contained in:
Todd Zullinger 2010-02-14 21:17:16 +00:00
parent a0e44ace36
commit cc817b7437
5 changed files with 17 additions and 169 deletions

View File

@ -1 +1 @@
libgpod-0.7.2.tar.gz
libgpod-0.7.90.tar.gz

View File

@ -1,44 +0,0 @@
--- libgpod-0.7.2/src/itdb_itunesdb.c 2009-12-10 14:39:04.000000000 +0000
+++ libgpod-0.7.2.new/src/itdb_itunesdb.c 2009-12-10 14:56:22.000000000 +0000
@@ -811,6 +811,22 @@ static inline guint64 get64bint (FConten
}
+/* Try to convert from UTF-16 to UTF-8 and handle partial characters
+ * at the end of the string */
+static char *utf16_to_utf8_with_partial (gunichar2 *entry_utf16)
+{
+ GError *error = NULL;
+ char *entry_utf8;
+ glong items_read;
+
+ entry_utf8 = g_utf16_to_utf8 (entry_utf16, -1, &items_read, NULL, &error);
+ if (entry_utf8 == NULL && g_error_matches (error, G_CONVERT_ERROR, G_CONVERT_ERROR_PARTIAL_INPUT)) {
+ g_error_free (error);
+ entry_utf8 = g_utf16_to_utf8 (entry_utf16, items_read, NULL, NULL, NULL);
+ }
+
+ return entry_utf8;
+}
/* Fix little endian UTF16 String to correct byteorder if necessary
@@ -1302,7 +1318,7 @@ static char *extract_mhod_string (FConte
entry_utf16 = g_new0 (gunichar2, (len+2)/2);
if (seek_get_n_bytes (cts, (gchar *)entry_utf16, seek+16, len)) {
fixup_little_utf16 (entry_utf16);
- entry_utf8= g_utf16_to_utf8 (entry_utf16, -1, NULL, NULL, NULL);
+ entry_utf8 = utf16_to_utf8_with_partial (entry_utf16);
g_free (entry_utf16);
} else {
g_free (entry_utf16);
@@ -1317,6 +1333,9 @@ static char *extract_mhod_string (FConte
}
}
+ if (entry_utf8 == NULL)
+ return NULL;
+
if (g_utf8_validate (entry_utf8, -1, NULL)) {
return entry_utf8;
} else {

View File

@ -1,111 +0,0 @@
diff --git a/src/itdb_itunesdb.c b/src/itdb_itunesdb.c
index c41e758..3f352e1 100644
--- a/src/itdb_itunesdb.c
+++ b/src/itdb_itunesdb.c
@@ -1286,6 +1286,45 @@ static gint32 get_mhod_type (FContents *cts, glong seek, guint32 *ml)
return type;
}
+static char *extract_mhod_string (FContents *cts, glong seek)
+{
+ gunichar2 *entry_utf16;
+ char *entry_utf8;
+ gint string_type;
+ gsize len;
+
+ /* type of string: 0x02: UTF8, 0x01 or 0x00: UTF16 LE */
+ string_type = get32lint (cts, seek);
+ len = get32lint (cts, seek+4); /* length of string */
+ g_return_val_if_fail (len < G_MAXUINT - 2, NULL);
+ if (string_type != 0x02) {
+ /* UTF-16 string */
+ entry_utf16 = g_new0 (gunichar2, (len+2)/2);
+ if (seek_get_n_bytes (cts, (gchar *)entry_utf16, seek+16, len)) {
+ fixup_little_utf16 (entry_utf16);
+ entry_utf8= g_utf16_to_utf8 (entry_utf16, -1, NULL, NULL, NULL);
+ g_free (entry_utf16);
+ } else {
+ g_free (entry_utf16);
+ return NULL;
+ }
+ } else {
+ /* UTF-8 string */
+ entry_utf8 = g_new0 (gchar, len+1);
+ if (!seek_get_n_bytes (cts, entry_utf8, seek+16, len)) {
+ g_free (entry_utf8);
+ return NULL;
+ }
+ }
+
+ if (g_utf8_validate (entry_utf8, -1, NULL)) {
+ return entry_utf8;
+ } else {
+ g_free (entry_utf8);
+ return NULL;
+ }
+}
+
/* Returns the contents of the mhod at position @mhod_seek. This can
be a simple string or something more complicated as in the case for
Itdb_SPLPREF OR Itdb_SPLRULES.
@@ -1303,12 +1342,10 @@ static gint32 get_mhod_type (FContents *cts, glong seek, guint32 *ml)
static MHODData get_mhod (FImport *fimp, glong mhod_seek, guint32 *ml)
{
- gunichar2 *entry_utf16 = NULL;
MHODData result;
gint32 xl;
guint32 mhod_len;
gint32 header_length;
- guint32 string_type;
gulong seek;
FContents *cts;
@@ -1384,34 +1421,9 @@ static MHODData get_mhod (FImport *fimp, glong mhod_seek, guint32 *ml)
case MHOD_ID_SORT_ALBUMARTIST:
case MHOD_ID_SORT_COMPOSER:
case MHOD_ID_SORT_TVSHOW:
- /* type of string: 0x02: UTF8, 0x01 or 0x00: UTF16 LE */
- string_type = get32lint (cts, seek);
- xl = get32lint (cts, seek+4); /* length of string */
- g_return_val_if_fail (xl < G_MAXUINT - 2, result);
- if (string_type != 0x02)
- {
- entry_utf16 = g_new0 (gunichar2, (xl+2)/2);
- if (seek_get_n_bytes (cts, (gchar *)entry_utf16, seek+16, xl))
- {
- fixup_little_utf16 (entry_utf16);
- result.data.string = g_utf16_to_utf8 (entry_utf16, -1,
- NULL, NULL, NULL);
- g_free (entry_utf16);
- }
- else
- { /* error */
- g_free (entry_utf16);
- return result; /* *ml==-1, result.valid==FALSE */
- }
- }
- else
- {
- result.data.string = g_new0 (gchar, xl+1);
- if (!seek_get_n_bytes (cts, result.data.string, seek+16, xl))
- { /* error */
- g_free (entry_utf16);
- return result; /* *ml==-1, result.valid==FALSE */
- }
+ result.data.string = extract_mhod_string (cts, seek);
+ if (result.data.string == NULL) {
+ return result;
}
break;
case MHOD_ID_PODCASTURL:
--- libgpod-0.7.2/src/itdb_itunesdb.c.old 2009-10-19 16:53:13.000000000 +0100
+++ libgpod-0.7.2/src/itdb_itunesdb.c 2009-10-19 16:53:57.000000000 +0100
@@ -1423,6 +1423,7 @@ static MHODData get_mhod (FImport *fimp,
case MHOD_ID_SORT_TVSHOW:
result.data.string = extract_mhod_string (cts, seek);
if (result.data.string == NULL) {
+ *ml = mhod_len;
return result;
}
break;

View File

@ -2,25 +2,24 @@
Summary: Library to access the contents of an iPod
Name: libgpod
Version: 0.7.2
Release: 6%{?dist}
Version: 0.7.90
Release: 1%{?dist}
License: LGPLv2+
Group: System Environment/Libraries
URL: http://www.gtkpod.org/libgpod.html
Source0: http://downloads.sourceforge.net/gtkpod/%{name}-%{version}.tar.gz
# See http://www.redhat.com/archives/fedora-selinux-list/2009-January/msg00005.html
Patch0: 0001-Use-var-run-hald-as-mount-dir-for-hal-callout.patch
# http://gitorious.org/~teuf/libgpod/teuf-sandbox/commit/3847494a513b5ef04d7abbe55c3d95dbcd836ef6
# https://bugzilla.redhat.com/show_bug.cgi?id=517642
Patch1: libgpod-utf16-parsing.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=542176
Patch2: libgpod-handle-partial-utf16.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
BuildRequires: docbook-style-xsl
BuildRequires: glib2-devel
BuildRequires: gtk2-devel
BuildRequires: gettext
BuildRequires: hal-devel
BuildRequires: intltool
BuildRequires: libimobiledevice-devel >= 0.9.7
BuildRequires: libplist-devel >= 1.0
BuildRequires: libusb1-devel
BuildRequires: libxml2-devel
BuildRequires: libxslt
BuildRequires: perl(XML::Parser)
@ -28,6 +27,7 @@ BuildRequires: pygobject2-devel
Buildrequires: python-devel
Buildrequires: python-mutagen
Buildrequires: sg3_utils-devel
Buildrequires: sqlite-devel
Buildrequires: swig
Requires: hal
@ -56,7 +56,7 @@ libgpod.
Summary: API documentation for the libgpod library
Group: Documentation
License: GFDL
%if 0%{?fedora} > 10
%if 0%{?fedora}
BuildArch: noarch
%endif
Requires: %{name} = %{version}-%{release}
@ -83,15 +83,13 @@ libgpod library.
%prep
%setup -q
%patch0 -p1 -b .selinux
%patch1 -p1 -b .utf16
%patch2 -p1 -b .partial-utf16
# remove execute perms on the python examples as they'll be installed in %doc
%{__chmod} -x bindings/python/examples/*.py
%build
%configure
%configure --with-hal-callouts-dir=%{_libexecdir}/scripts
%{__make} %{?_smp_mflags}
@ -117,7 +115,7 @@ libgpod library.
%doc AUTHORS ChangeLog COPYING NEWS README*
%{_bindir}/*
%{_libdir}/*.so.*
%{_libdir}/hal/scripts/*
%{_libexecdir}/scripts/*
%{_datadir}/hal/fdi/policy/20thirdparty/*.fdi
@ -144,6 +142,11 @@ libgpod library.
%changelog
* Tue Feb 09 2010 Todd Zullinger <tmz@pobox.com> - 0.7.90-1
- Update to 0.7.90
- Adjust default hal callout path (#547049)
(Temporaily use --with-hal-callouts-dir=%%{_libexecdir}/scripts)
* Thu Dec 10 2009 Bastien Nocera <bnocera@redhat.com> 0.7.2-6
- Handle partial UTF-16 strings (#542176)

View File

@ -1 +1 @@
1ec69c3a19fb071b1639cdcaf68463c1 libgpod-0.7.2.tar.gz
b81988f262074a0712362dd10673951c libgpod-0.7.90.tar.gz