[libgsf] OLE: sort the same way on input as on output
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgsf] OLE: sort the same way on input as on output
- Date: Thu, 8 Dec 2011 19:44:22 +0000 (UTC)
commit 790369463f6f1ccb46bfb6558b344758a9ac974e
Author: Morten Welinder <terra gnome org>
Date: Thu Dec 8 14:43:59 2011 -0500
OLE: sort the same way on input as on output
ChangeLog | 3 +++
gsf/gsf-infile-msole.c | 15 +++++----------
2 files changed, 8 insertions(+), 10 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 71e1878..56cc00c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2011-12-08 Morten Welinder <terra gnome org>
+ * gsf/gsf-infile-msole.c (ole_dirent_cmp): Use
+ gsf_msole_sorting_key_cmp.
+
* gsf/gsf-msole-utils.c (gsf_msole_sorting_key_new)
(gsf_msole_sorting_key_free, gsf_msole_sorting_key_cmp): New
functions.
diff --git a/gsf/gsf-infile-msole.c b/gsf/gsf-infile-msole.c
index 1b5bce8..b9cd6c2 100644
--- a/gsf/gsf-infile-msole.c
+++ b/gsf/gsf-infile-msole.c
@@ -29,6 +29,7 @@
#include <gsf/gsf-impl-utils.h>
#include <gsf/gsf-utils.h>
#include <gsf/gsf-msole-impl.h>
+#include <gsf/gsf-msole-utils.h>
#include <gsf/gsf-input-proxy.h>
#include <string.h>
@@ -46,7 +47,7 @@ typedef struct {
typedef struct {
char *name;
- char *collation_name;
+ GsfMSOleSortingKey *key;
int index;
size_t size;
gboolean use_sb;
@@ -267,13 +268,7 @@ ole_info_get_sb_file (GsfInfileMSOle *parent)
static gint
ole_dirent_cmp (MSOleDirent const *a, MSOleDirent const *b)
{
- g_return_val_if_fail (a, 0);
- g_return_val_if_fail (b, 0);
-
- g_return_val_if_fail (a->collation_name, 0);
- g_return_val_if_fail (b->collation_name, 0);
-
- return strcmp (b->collation_name, a->collation_name);
+ return gsf_msole_sorting_key_cmp (a->key, b->key);
}
/* Parse dirent number @entry and recursively handle its siblings and children.
@@ -361,7 +356,7 @@ ole_dirent_new (GsfInfileMSOle *ole, guint32 entry, MSOleDirent *parent,
/* be really anal in the face of screwups */
if (dirent->name == NULL)
dirent->name = g_strdup ("");
- dirent->collation_name = g_utf8_collate_key (dirent->name, -1);
+ dirent->key = gsf_msole_sorting_key_new (dirent->name);
#if 0
printf ("%c '%s' :\tsize = %d\tfirst_block = 0x%x\n",
@@ -392,7 +387,7 @@ ole_dirent_free (MSOleDirent *dirent)
g_return_if_fail (dirent != NULL);
g_free (dirent->name);
- g_free (dirent->collation_name);
+ gsf_msole_sorting_key_free (dirent->key);
for (tmp = dirent->children; tmp; tmp = tmp->next)
ole_dirent_free ((MSOleDirent *)tmp->data);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]