Use new constant FD_MAGICK = 0x12345678u
authorLaurent Monin <zas@norz.org>
Thu, 30 Aug 2012 02:22:32 +0000 (04:22 +0200)
committerLaurent Monin <zas@norz.org>
Thu, 30 Aug 2012 02:22:32 +0000 (04:22 +0200)
src/filedata.c
src/filedata.h
src/typedefs.h
src/view_file_icon.c

index 60ad952..7d84027 100644 (file)
@@ -392,7 +392,7 @@ static FileData *file_data_new(const gchar *path_utf8, struct stat *st, gboolean
        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 @@ FileData *file_data_ref(FileData *fd)
 #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 @@ FileData *file_data_ref(FileData *fd)
 
 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 @@ void file_data_unref(FileData *fd)
 #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 @@ static void file_data_check_sidecars(const GList *basename_list)
                {
                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 @@ static void file_data_check_sidecars(const GList *basename_list)
                        {
                        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 @@ static void file_data_check_sidecars(const GList *basename_list)
        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_check_sidecars(const GList *basename_list)
 
 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);
index bd8d4fe..558b592 100644 (file)
@@ -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);
index 76c7306..befef17 100644 (file)
@@ -487,7 +487,7 @@ struct _FileDataChangeInfo {
 };
 
 struct _FileData {
-       gint magick;
+       guint magick;
        gint type;
        gchar *original_path; /* key to file_data_pool hash table */
        gchar *path;
index 1a7fe3c..0c12496 100644 (file)
@@ -99,7 +99,7 @@ static gint iconlist_read(FileData *dir_fd, GList **list)
                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 @@ guint vficon_selection_count(ViewFile *vf, gint64 *bytes)
                        {
                        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 @@ GList *vficon_selection_get_list(ViewFile *vf)
                {
                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 @@ void vficon_mark_to_selection(ViewFile *vf, gint mark, MarkToSelectionMode mode)
                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 @@ static void vficon_cell_data_cb(GtkTreeViewColumn *tree_column, GtkCellRenderer
                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)