gthumb r2222 - in trunk: . libgthumb
- From: mjc svn gnome org
- To: svn-commits-list gnome org
- Subject: gthumb r2222 - in trunk: . libgthumb
- Date: Sat, 26 Jan 2008 01:23:02 +0000 (GMT)
Author: mjc
Date: Sat Jan 26 01:23:01 2008
New Revision: 2222
URL: http://svn.gnome.org/viewvc/gthumb?rev=2222&view=rev
Log:
2008-01-25 Michael J. Chudobiak <mjc svn gnome org>
* libgthumb/file-data.c: (free_metadata_entry), (free_metadata),
(file_data_new), (file_data_dup), (file_data_unref),
(file_data_update), (file_data_update_info),
(file_data_insert_metadata):
* libgthumb/gth-exif-utils.c:
* libgthumb/gth-exif-utils.h:
Corrected free_metadata function to stop crashes. Moved from
gth-exif-utils.c to file-data.c.
Modified:
trunk/ChangeLog
trunk/libgthumb/file-data.c
trunk/libgthumb/gth-exif-utils.c
trunk/libgthumb/gth-exif-utils.h
Modified: trunk/libgthumb/file-data.c
==============================================================================
--- trunk/libgthumb/file-data.c (original)
+++ trunk/libgthumb/file-data.c Sat Jan 26 01:23:01 2008
@@ -36,6 +36,31 @@
#define MAX_COMMENT_LEN 60
+static void
+free_metadata_entry (GthMetadata *entry)
+{
+ if (entry != NULL) {
+ g_free (entry->full_name);
+ g_free (entry->display_name);
+ g_free (entry->value);
+ g_free (entry);
+ }
+}
+
+static void
+free_metadata (FileData *fd)
+{
+ if (fd->metadata != NULL) {
+ g_list_foreach (fd->metadata, (GFunc) free_metadata_entry, NULL);
+ g_list_free (fd->metadata);
+ fd->metadata = NULL;
+ }
+
+ fd->exif_data_loaded = FALSE;
+ fd->exif_time = (time_t) 0;
+}
+
+
GType
file_data_get_type (void)
{
@@ -80,9 +105,7 @@
DateTime sorts. The tag in memory is refreshed if the file mtime has
changed, so it is recorded as well. */
- fd->exif_data_loaded = FALSE;
- fd->exif_time = 0;
- fd->metadata = NULL;
+ free_metadata (fd);
fd->error = FALSE;
fd->thumb_loaded = FALSE;
@@ -135,9 +158,9 @@
fd->size = source->size;
fd->ctime = source->ctime;
fd->mtime = source->mtime;
- fd->exif_data_loaded = source->exif_data_loaded;
- fd->exif_time = source->exif_time;
- fd->metadata = dup_metadata (source->metadata);
+ fd->exif_data_loaded = FALSE;
+ fd->exif_time = 0;
+ fd->metadata = NULL;
fd->error = source->error;
fd->thumb_loaded = source->thumb_loaded;
fd->thumb_created = source->thumb_created;
@@ -161,8 +184,7 @@
if (fd->comment_data != NULL)
comment_data_free (fd->comment_data);
g_free (fd->comment);
- if (fd->metadata != NULL)
- free_metadata (fd->metadata);
+ free_metadata (fd);
g_free (fd);
}
}
@@ -195,7 +217,6 @@
fd->size = 0L;
fd->mtime = 0;
fd->ctime = 0;
- fd->exif_data_loaded = FALSE;
fd->mime_type = NULL;
return;
}
@@ -210,13 +231,7 @@
fd->mtime = info->mtime;
fd->ctime = info->ctime;
- /* update metadata only if required */
- if ((old_mtime != fd->mtime) && fd->exif_data_loaded) {
- fd->exif_data_loaded = FALSE;
- if (fd->metadata != NULL)
- free_metadata (fd->metadata);
- file_data_insert_metadata (fd);
- }
+ free_metadata (fd);
gnome_vfs_file_info_unref (info);
}
@@ -250,7 +265,6 @@
fd->size = 0L;
fd->mtime = 0;
fd->ctime = 0;
- fd->exif_data_loaded = FALSE;
fd->mime_type = NULL;
return;
}
@@ -264,13 +278,7 @@
fd->mtime = info->mtime;
fd->ctime = info->ctime;
- /* update metadata only if required */
- if ((old_mtime != fd->mtime) && fd->exif_data_loaded) {
- fd->exif_data_loaded = FALSE;
- if (fd->metadata != NULL)
- free_metadata (fd->metadata);
- file_data_insert_metadata (fd);
- }
+ free_metadata (fd);
gnome_vfs_file_info_unref (info);
}
@@ -321,7 +329,7 @@
{
g_return_if_fail (fd != NULL);
- if (fd->exif_data_loaded)
+ if (fd->exif_data_loaded == TRUE)
return;
fd->metadata = update_metadata (fd->metadata, fd->path, fd->mime_type);
Modified: trunk/libgthumb/gth-exif-utils.c
==============================================================================
--- trunk/libgthumb/gth-exif-utils.c (original)
+++ trunk/libgthumb/gth-exif-utils.c Sat Jan 26 01:23:01 2008
@@ -620,49 +620,6 @@
}
-void free_metadata_entry (GthMetadata *entry)
-{
- if (entry != NULL) {
- g_free (entry->full_name);
- g_free (entry->display_name);
- g_free (entry->value);
- g_free (entry);
- }
-}
-
-void free_metadata (GList *metadata)
-{
- g_list_foreach (metadata, (GFunc) free_metadata_entry, NULL);
- g_list_free (metadata);
-}
-
-GList * dup_metadata (GList *source_list)
-{
- if (source_list == NULL)
- return NULL;
-
- GList *new_list = NULL;
-
- while (source_list)
- {
- GthMetadata *source_entry = source_list->data;
- GthMetadata *new_entry = g_new0 (GthMetadata, 1);
-
- new_entry->full_name = g_strdup (source_entry->full_name);
- new_entry->display_name = g_strdup (source_entry->display_name);
- new_entry->value = g_strdup (source_entry->value);
- new_entry->category = source_entry->category;
- new_entry->position = source_entry->position;
- new_entry->writeable = source_entry->writeable;
-
- new_list = g_list_prepend (new_list, new_entry);
-
- source_list = source_list->next;
- }
-
- return g_list_reverse (new_list);
-}
-
GList * read_exiv2_file (const char *uri, GList *metadata);
GList * read_exiv2_sidecar (const char *uri, GList *metadata);
Modified: trunk/libgthumb/gth-exif-utils.h
==============================================================================
--- trunk/libgthumb/gth-exif-utils.h (original)
+++ trunk/libgthumb/gth-exif-utils.h Sat Jan 26 01:23:01 2008
@@ -100,9 +100,7 @@
GthTransform transform);
GList * gth_read_exiv2 (const char *filename,
GList *metadata);
-void free_metadata (GList *metadata);
GList * update_metadata (GList *metadata,
const char *uri,
const char *mime_type);
-GList * dup_metadata (GList *source_list);
#endif /* EXIF_UTILS_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]