changeset 2114:8f1a6f05903c

Use new constant FD_MAGICK = 0x12345678u
author Laurent Monin <zas@norz.org>
date Thu, 30 Aug 2012 04:22:32 +0200
parents cd964ad91212
children d61b1c2699bd
files src/filedata.c src/filedata.h src/typedefs.h src/view_file_icon.c
diffstat 4 files changed, 20 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/src/filedata.c	Wed Aug 29 23:27:52 2012 +0200
+++ b/src/filedata.c	Thu Aug 30 04:22:32 2012 +0200
@@ -392,7 +392,7 @@
 	fd->date = st->st_mtime;
 	fd->mode = st->st_mode;
 	fd->ref = 1;
-	fd->magick = 0x12345678;
+	fd->magick = FD_MAGICK;
 	
 	if (disable_sidecars) fd->disable_grouping = TRUE;
 
@@ -515,13 +515,13 @@
 #endif
 {
 	if (fd == NULL) return NULL;
-	if (fd->magick != 0x12345678)
+	if (fd->magick != FD_MAGICK)
 #ifdef DEBUG_FILEDATA
 		DEBUG_0("fd magick mismatch @ %s:%d  fd=%p", file, line, fd);
 #else
 		DEBUG_0("fd magick mismatch fd=%p", fd);
 #endif
-	g_assert(fd->magick == 0x12345678);
+	g_assert(fd->magick == FD_MAGICK);
 	fd->ref++;
 
 #ifdef DEBUG_FILEDATA
@@ -534,7 +534,7 @@
 
 static void file_data_free(FileData *fd)
 {
-	g_assert(fd->magick == 0x12345678);
+	g_assert(fd->magick == FD_MAGICK);
 	g_assert(fd->ref == 0);
 
 	metadata_cache_free(fd);
@@ -560,13 +560,13 @@
 #endif
 {
 	if (fd == NULL) return;
-	if (fd->magick != 0x12345678)
+	if (fd->magick != FD_MAGICK)
 #ifdef DEBUG_FILEDATA
 		DEBUG_0("fd magick mismatch @ %s:%d  fd=%p", file, line, fd);
 #else
 		DEBUG_0("fd magick mismatch fd=%p", fd);
 #endif
-	g_assert(fd->magick == 0x12345678);
+	g_assert(fd->magick == FD_MAGICK);
 	
 	fd->ref--;
 #ifdef DEBUG_FILEDATA
@@ -666,11 +666,11 @@
 		{
 		FileData *fd = work->data;
 		work = work->next;
-		g_assert(fd->magick == 0x12345678);
+		g_assert(fd->magick == FD_MAGICK);
 		DEBUG_2("basename: %p %s", fd, fd->name);
 		if (fd->parent) 
 			{
-			g_assert(fd->parent->magick == 0x12345678);
+			g_assert(fd->parent->magick == FD_MAGICK);
 			DEBUG_2("                  parent: %p", fd->parent);
 			}
 		s_work = fd->sidecar_files;
@@ -678,7 +678,7 @@
 			{
 			FileData *sfd = s_work->data;
 			s_work = s_work->next;
-			g_assert(sfd->magick == 0x12345678);
+			g_assert(sfd->magick == FD_MAGICK);
 			DEBUG_2("                  sidecar: %p %s", sfd, sfd->name);
 			}
 		
@@ -746,7 +746,7 @@
 	while (work)
 		{
 		FileData *sfd = work->data;
-		g_assert(sfd->magick == 0x12345678);
+		g_assert(sfd->magick == FD_MAGICK);
 		g_assert(sfd->parent == NULL && sfd->sidecar_files == NULL);
 		sfd->parent = parent_fd;
 		new_sidecars = g_list_prepend(new_sidecars, sfd);
@@ -760,8 +760,8 @@
 
 static void file_data_disconnect_sidecar_file(FileData *target, FileData *sfd)
 {
-	g_assert(target->magick == 0x12345678);
-	g_assert(sfd->magick == 0x12345678);
+	g_assert(target->magick == FD_MAGICK);
+	g_assert(sfd->magick == FD_MAGICK);
 	g_assert(g_list_find(target->sidecar_files, sfd));
 
 	file_data_ref(target);
--- a/src/filedata.h	Wed Aug 29 23:27:52 2012 +0200
+++ b/src/filedata.h	Thu Aug 30 04:22:32 2012 +0200
@@ -18,6 +18,8 @@
 #define DEBUG_FILEDATA
 #endif
 
+#define FD_MAGICK 0x12345678u
+
 gchar *text_from_size(gint64 size);
 gchar *text_from_size_abrev(gint64 size);
 const gchar *text_from_time(time_t t);
--- a/src/typedefs.h	Wed Aug 29 23:27:52 2012 +0200
+++ b/src/typedefs.h	Thu Aug 30 04:22:32 2012 +0200
@@ -487,7 +487,7 @@
 };
 
 struct _FileData {
-	gint magick;
+	guint magick;
 	gint type;
 	gchar *original_path; /* key to file_data_pool hash table */
 	gchar *path;
--- a/src/view_file_icon.c	Wed Aug 29 23:27:52 2012 +0200
+++ b/src/view_file_icon.c	Thu Aug 30 04:22:32 2012 +0200
@@ -99,7 +99,7 @@
 		IconData *id;
 
 		fd = work->data;
-		g_assert(fd->magick == 0x12345678);
+		g_assert(fd->magick == FD_MAGICK);
 		id = g_new0(IconData, 1);
 
 		id->selected = SELECTION_NONE;
@@ -895,7 +895,7 @@
 			{
 			IconData *id = work->data;
 			FileData *fd = id->fd;
-			g_assert(fd->magick == 0x12345678);
+			g_assert(fd->magick == FD_MAGICK);
 			b += fd->size;
 
 			work = work->next;
@@ -917,7 +917,7 @@
 		{
 		IconData *id = work->data;
 		FileData *fd = id->fd;
-		g_assert(fd->magick == 0x12345678);
+		g_assert(fd->magick == FD_MAGICK);
 
 		list = g_list_prepend(list, file_data_ref(fd));
 		
@@ -995,7 +995,7 @@
 		FileData *fd = id->fd;
 		gboolean mark_val, selected;
 
-		g_assert(fd->magick == 0x12345678);
+		g_assert(fd->magick == FD_MAGICK);
 
 		mark_val = file_data_get_mark(fd, n);
 		selected = (id->selected & SELECTION_SELECTED);
@@ -2163,7 +2163,7 @@
 		gchar *link;
 		GtkStateType state = GTK_STATE_NORMAL;
 
-		g_assert(id->fd->magick == 0x12345678);
+		g_assert(id->fd->magick == FD_MAGICK);
 
 		link = islink(id->fd->path) ? GQ_LINK_STR : "";
 		if (id->fd->sidecar_files)