comparison src/filedata.c @ 1000:4fe8f9656107

For the sake of consistency, use glib basic types everywhere.
author zas_
date Tue, 26 Aug 2008 22:22:51 +0000
parents d2701a5864c5
children 3096a47232ec
comparison
equal deleted inserted replaced
999:bbed8e9a5d33 1000:4fe8f9656107
88 { 88 {
89 return g_strdup_printf(_("%d bytes"), (gint)size); 89 return g_strdup_printf(_("%d bytes"), (gint)size);
90 } 90 }
91 if (size < (gint64)1048576) 91 if (size < (gint64)1048576)
92 { 92 {
93 return g_strdup_printf(_("%.1f K"), (double)size / 1024.0); 93 return g_strdup_printf(_("%.1f K"), (gdouble)size / 1024.0);
94 } 94 }
95 if (size < (gint64)1073741824) 95 if (size < (gint64)1073741824)
96 { 96 {
97 return g_strdup_printf(_("%.1f MB"), (double)size / 1048576.0); 97 return g_strdup_printf(_("%.1f MB"), (gdouble)size / 1048576.0);
98 } 98 }
99 99
100 /* to avoid overflowing the double, do division in two steps */ 100 /* to avoid overflowing the gdouble, do division in two steps */
101 size /= 1048576; 101 size /= 1048576;
102 return g_strdup_printf(_("%.1f GB"), (double)size / 1024.0); 102 return g_strdup_printf(_("%.1f GB"), (gdouble)size / 1024.0);
103 } 103 }
104 104
105 /* note: returned string is valid until next call to text_from_time() */ 105 /* note: returned string is valid until next call to text_from_time() */
106 const gchar *text_from_time(time_t t) 106 const gchar *text_from_time(time_t t)
107 { 107 {
366 return fd; 366 return fd;
367 } 367 }
368 368
369 static void file_data_check_sidecars(FileData *fd) 369 static void file_data_check_sidecars(FileData *fd)
370 { 370 {
371 int base_len; 371 gint base_len;
372 GString *fname; 372 GString *fname;
373 FileData *parent_fd = NULL; 373 FileData *parent_fd = NULL;
374 GList *work; 374 GList *work;
375 375
376 if (fd->disable_grouping || !sidecar_file_priority(fd->extension)) 376 if (fd->disable_grouping || !sidecar_file_priority(fd->extension))
675 675
676 676
677 677
678 static gint sidecar_file_priority(const gchar *path) 678 static gint sidecar_file_priority(const gchar *path)
679 { 679 {
680 const char *extension = extension_from_path(path); 680 const gchar *extension = extension_from_path(path);
681 int i = 1; 681 gint i = 1;
682 GList *work; 682 GList *work;
683 683
684 if (extension == NULL) 684 if (extension == NULL)
685 return 0; 685 return 0;
686 686
807 DIR *dp; 807 DIR *dp;
808 struct dirent *dir; 808 struct dirent *dir;
809 gchar *pathl; 809 gchar *pathl;
810 GList *dlist = NULL; 810 GList *dlist = NULL;
811 GList *flist = NULL; 811 GList *flist = NULL;
812 int (*stat_func)(const char *path, struct stat *buf); 812 gint (*stat_func)(const gchar *path, struct stat *buf);
813 813
814 g_assert(files || dirs); 814 g_assert(files || dirs);
815 815
816 if (files) *files = NULL; 816 if (files) *files = NULL;
817 if (dirs) *dirs = NULL; 817 if (dirs) *dirs = NULL;
1476 g_free(old_path); 1476 g_free(old_path);
1477 } 1477 }
1478 1478
1479 static void file_data_update_ci_dest_preserve_ext(FileData *fd, const gchar *dest_path) 1479 static void file_data_update_ci_dest_preserve_ext(FileData *fd, const gchar *dest_path)
1480 { 1480 {
1481 const char *extension = extension_from_path(fd->change->source); 1481 const gchar *extension = extension_from_path(fd->change->source);
1482 gchar *base = remove_extension_from_path(dest_path); 1482 gchar *base = remove_extension_from_path(dest_path);
1483 gchar *old_path = fd->change->dest; 1483 gchar *old_path = fd->change->dest;
1484 1484
1485 fd->change->dest = g_strconcat(base, extension, NULL); 1485 fd->change->dest = g_strconcat(base, extension, NULL);
1486 file_data_update_planned_change_hash(fd, old_path, fd->change->dest); 1486 file_data_update_planned_change_hash(fd, old_path, fd->change->dest);