cd->have_date = TRUE;
}
-void cache_sim_data_set_checksum(CacheData *cd, long checksum)
+void cache_sim_data_set_checksum(CacheData *cd, glong checksum)
{
if (!cd) return;
gint width;
gint height;
time_t date;
- long checksum;
+ glong checksum;
guchar md5sum[16];
ImageSimilarityData *sim;
void cache_sim_data_set_dimensions(CacheData *cd, gint w, gint h);
void cache_sim_data_set_date(CacheData *cd, time_t date);
-void cache_sim_data_set_checksum(CacheData *cd, long checksum);
+void cache_sim_data_set_checksum(CacheData *cd, glong checksum);
void cache_sim_data_set_md5sum(CacheData *cd, guchar digest[16]);
void cache_sim_data_set_similarity(CacheData *cd, ImageSimilarityData *sd);
gint cache_sim_data_filled(ImageSimilarityData *sd);
parent = gtk_tree_view_get_bin_window(GTK_TREE_VIEW(ct->listview));
- pb = gdk_pixbuf_new_from_xpm_data((const char **)marker_xpm);
+ pb = gdk_pixbuf_new_from_xpm_data((const gchar **)marker_xpm);
gdk_pixbuf_render_pixmap_and_mask(pb, &pixmap, &mask, 128);
gdk_pixbuf_unref(pb);
}
static cmsHPROFILE color_man_cache_load_profile(ColorManProfileType type, const gchar *file,
- unsigned char *data, guint data_len)
+ guchar *data, guint data_len)
{
cmsHPROFILE profile = NULL;
}
static ColorManCache *color_man_cache_new(ColorManProfileType in_type, const gchar *in_file,
- unsigned char *in_data, guint in_data_len,
+ guchar *in_data, guint in_data_len,
ColorManProfileType out_type, const gchar *out_file,
gint has_alpha)
{
}
static ColorManCache *color_man_cache_get(ColorManProfileType in_type, const gchar *in_file,
- unsigned char *in_data, guint in_data_len,
+ guchar *in_data, guint in_data_len,
ColorManProfileType out_type, const gchar *out_file,
gint has_alpha)
{
static ColorMan *color_man_new_real(ImageWindow *imd, GdkPixbuf *pixbuf,
ColorManProfileType input_type, const gchar *input_file,
- unsigned char *input_data, guint input_data_len,
+ guchar *input_data, guint input_data_len,
ColorManProfileType screen_type, const gchar *screen_file)
{
ColorMan *cm;
}
ColorMan *color_man_new_embedded(ImageWindow *imd, GdkPixbuf *pixbuf,
- unsigned char *input_data, guint input_data_len,
+ guchar *input_data, guint input_data_len,
ColorManProfileType screen_type, const gchar *screen_file)
{
return color_man_new_real(imd, pixbuf,
}
ColorMan *color_man_new_embedded(ImageWindow *imd, GdkPixbuf *pixbuf,
- unsigned char *input_data, guint input_data_len,
+ guchar *input_data, guint input_data_len,
ColorManProfileType screen_type, const gchar *screen_file)
{
/* no op */
ColorManProfileType input_type, const gchar *input_file,
ColorManProfileType screen_type, const gchar *screen_file);
ColorMan *color_man_new_embedded(ImageWindow *imd, GdkPixbuf *pixbuf,
- unsigned char *input_data, guint input_data_len,
+ guchar *input_data, guint input_data_len,
ColorManProfileType screen_type, const gchar *screen_file);
void color_man_free(ColorMan *cm);
* Logging functions
*/
-gint log_domain_printf(const char *domain, const gchar *format, ...)
+gint log_domain_printf(const gchar *domain, const gchar *format, ...)
{
va_list ap;
gchar buf[4096];
previous = tv;
started = 1;
- g_snprintf(timestr, sizeof(timestr), "%5d.%06d (+%05d.%06d)", (int)tv.tv_sec, (int)tv.tv_usec, (int)delta.tv_sec, (int)delta.tv_usec);
+ g_snprintf(timestr, sizeof(timestr), "%5d.%06d (+%05d.%06d)", (gint)tv.tv_sec, (gint)tv.tv_usec, (gint)delta.tv_sec, (gint)delta.tv_usec);
return timestr;
}
#define DOMAIN_DEBUG "debug"
#define DOMAIN_INFO "info"
-gint log_domain_printf(const char *domain, const gchar *format, ...) G_GNUC_PRINTF(2, 3);
+gint log_domain_printf(const gchar *domain, const gchar *format, ...) G_GNUC_PRINTF(2, 3);
#define log_printf(...) log_domain_printf(DOMAIN_INFO, __VA_ARGS__)
#ifdef DEBUG
FileData *fd;
- long checksum;
+ glong checksum;
gchar *md5sum;
gint width;
gint height;
if (ed->total)
{
- gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(ed->vd->progress), (double)ed->count / ed->total);
+ gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(ed->vd->progress), (gdouble)ed->count / ed->total);
}
gtk_progress_bar_set_text(GTK_PROGRESS_BAR(ed->vd->progress), (text) ? text : "");
#include "ui_fileops.h"
-static double exif_rational_to_double(ExifRational *r, gint sign)
+static gdouble exif_rational_to_double(ExifRational *r, gint sign)
{
if (!r || r->den == 0.0) return 0.0;
- if (sign) return (double)((int)r->num) / (double)((int)r->den);
- return (double)r->num / r->den;
+ if (sign) return (gdouble)((gint)r->num) / (gdouble)((gint)r->den);
+ return (gdouble)r->num / r->den;
}
-static double exif_get_rational_as_double(ExifData *exif, const gchar *key)
+static gdouble exif_get_rational_as_double(ExifData *exif, const gchar *key)
{
ExifRational *r;
gint sign;
return s;
}
-static double get_crop_factor(ExifData *exif)
+static gdouble get_crop_factor(ExifData *exif)
{
- double res_unit_tbl[] = {0.0, 25.4, 25.4, 10.0, 1.0, 0.001 };
- double xres = exif_get_rational_as_double(exif, "Exif.Photo.FocalPlaneXResolution");
- double yres = exif_get_rational_as_double(exif, "Exif.Photo.FocalPlaneYResolution");
+ gdouble res_unit_tbl[] = {0.0, 25.4, 25.4, 10.0, 1.0, 0.001 };
+ gdouble xres = exif_get_rational_as_double(exif, "Exif.Photo.FocalPlaneXResolution");
+ gdouble yres = exif_get_rational_as_double(exif, "Exif.Photo.FocalPlaneYResolution");
gint res_unit;
gint w, h;
- double xsize, ysize, size, ratio;
+ gdouble xsize, ysize, size, ratio;
if (xres == 0.0 || yres == 0.0) return 0.0;
r = exif_get_rational(exif, "Exif.Photo.ExposureTime", NULL);
if (r && r->num && r->den)
{
- double n = (double)r->den / (double)r->num;
+ gdouble n = (gdouble)r->den / (gdouble)r->num;
return g_strdup_printf("%s%.0fs", n > 1.0 ? "1/" : "",
n > 1.0 ? n : 1.0 / n);
}
r = exif_get_rational(exif, "Exif.Photo.ShutterSpeedValue", NULL);
if (r && r->num && r->den)
{
- double n = pow(2.0, exif_rational_to_double(r, TRUE));
+ gdouble n = pow(2.0, exif_rational_to_double(r, TRUE));
/* Correct exposure time to avoid values like 1/91s (seen on Minolta DImage 7) */
- if (n > 1.0 && (int)n - ((int)(n/10))*10 == 1) n--;
+ if (n > 1.0 && (gint)n - ((gint)(n/10))*10 == 1) n--;
return g_strdup_printf("%s%.0fs", n > 1.0 ? "1/" : "",
n > 1.0 ? floor(n) : 1.0 / n);
static gchar *exif_build_formatted_Aperture(ExifData *exif)
{
- double n;
+ gdouble n;
n = exif_get_rational_as_double(exif, "Exif.Photo.FNumber");
if (n == 0.0) n = exif_get_rational_as_double(exif, "Exif.Photo.ApertureValue");
{
ExifRational *r;
gint sign;
- double n;
+ gdouble n;
r = exif_get_rational(exif, "Exif.Photo.ExposureBiasValue", &sign);
if (!r) return NULL;
static gchar *exif_build_formatted_FocalLength(ExifData *exif)
{
- double n;
+ gdouble n;
n = exif_get_rational_as_double(exif, "Exif.Photo.FocalLength");
if (n == 0.0) return NULL;
static gchar *exif_build_formatted_FocalLength35mmFilm(ExifData *exif)
{
gint n;
- double f, c;
+ gdouble f, c;
if (exif_get_integer(exif, "Exif.Photo.FocalLengthIn35mmFilm", &n) && n != 0)
{
{
ExifRational *r;
gint sign;
- double n;
+ gdouble n;
r = exif_get_rational(exif, "Exif.Photo.SubjectDistance", &sign);
if (!r) return NULL;
- if ((long)r->num == (long)0xffffffff) return g_strdup(_("infinity"));
- if ((long)r->num == 0) return g_strdup(_("unknown"));
+ if ((glong)r->num == (glong)0xffffffff) return g_strdup(_("infinity"));
+ if ((glong)r->num == 0) return g_strdup(_("unknown"));
n = exif_rational_to_double(r, sign);
if (n == 0.0) return _("unknown");
if (!rx || !ry) return NULL;
units = exif_get_data_as_text(exif, "Exif.Image.ResolutionUnit");
- text = g_strdup_printf("%0.f x %0.f (%s/%s)", rx->den ? (double)rx->num / rx->den : 1.0,
- ry->den ? (double)ry->num / ry->den : 1.0,
+ text = g_strdup_printf("%0.f x %0.f (%s/%s)", rx->den ? (gdouble)rx->num / rx->den : 1.0,
+ ry->den ? (gdouble)ry->num / ry->den : 1.0,
_("dot"), (units) ? units : _("unknown"));
g_free(units);
NNN.: the data in this segment
*/
-gint exif_jpeg_segment_find(unsigned char *data, guint size,
+gint exif_jpeg_segment_find(guchar *data, guint size,
guchar app_marker, const gchar *magic, guint magic_len,
guint *seg_offset, guint *seg_length)
{
return FALSE;
}
-gint exif_jpeg_parse_color(ExifData *exif, unsigned char *data, guint size)
+gint exif_jpeg_parse_color(ExifData *exif, guchar *data, guint size)
{
guint seg_offset = 0;
guint seg_length = 0;
if (chunk_count > 0)
{
- unsigned char *cp_data;
+ guchar *cp_data;
guint cp_length = 0;
guint i;
struct _ExifTextList
{
gint value;
- const gchar* description;
+ const gchar *description;
};
#define EXIF_TEXT_LIST_END { -1, NULL }
#define EXIF_TIFD_SIZE 12
-guint16 exif_byte_get_int16(unsigned char *f, ExifByteOrder bo);
-guint32 exif_byte_get_int32(unsigned char *f, ExifByteOrder bo);
-void exif_byte_put_int16(unsigned char *f, guint16 n, ExifByteOrder bo);
-void exif_byte_put_int32(unsigned char *f, guint32 n, ExifByteOrder bo);
+guint16 exif_byte_get_int16(guchar *f, ExifByteOrder bo);
+guint32 exif_byte_get_int32(guchar *f, ExifByteOrder bo);
+void exif_byte_put_int16(guchar *f, guint16 n, ExifByteOrder bo);
+void exif_byte_put_int32(guchar *f, guint32 n, ExifByteOrder bo);
ExifItem *exif_item_new(ExifFormatType format, guint tag,
guint elements, const ExifMarker *marker);
ExifFormatType src_format, ExifByteOrder bo);
gint exif_parse_IFD_table(ExifData *exif,
- unsigned char *tiff, guint offset,
+ guchar *tiff, guint offset,
guint size, ExifByteOrder bo,
gint level,
const ExifMarker *list);
-gint exif_tiff_directory_offset(unsigned char *data, const guint len,
+gint exif_tiff_directory_offset(guchar *data, const guint len,
guint *offset, ExifByteOrder *bo);
-gint exif_tiff_parse(ExifData *exif, unsigned char *tiff, guint size, ExifMarker *list);
+gint exif_tiff_parse(ExifData *exif, guchar *tiff, guint size, ExifMarker *list);
gchar *exif_text_list_find_value(ExifTextList *list, guint value);
return item;
break;
case EXIF_FORMAT_BYTE_UNSIGNED:
- item->data_len = sizeof(char) * elements;
+ item->data_len = sizeof(gchar) * elements;
break;
case EXIF_FORMAT_STRING:
- item->data_len = sizeof(char) * elements;
+ item->data_len = sizeof(gchar) * elements;
break;
case EXIF_FORMAT_SHORT_UNSIGNED:
item->data_len = sizeof(guint16) * elements;
item->data_len = sizeof(ExifRational) * elements;
break;
case EXIF_FORMAT_BYTE:
- item->data_len = sizeof(char) * elements;
+ item->data_len = sizeof(gchar) * elements;
break;
case EXIF_FORMAT_UNDEFINED:
- item->data_len = sizeof(char) * elements;
+ item->data_len = sizeof(gchar) * elements;
break;
case EXIF_FORMAT_SHORT:
item->data_len = sizeof(gint16) * elements;
item->data_len = sizeof(float) * elements;
break;
case EXIF_FORMAT_DOUBLE:
- item->data_len = sizeof(double) * elements;
+ item->data_len = sizeof(gdouble) * elements;
break;
}
g_free(item);
}
-char *exif_item_get_tag_name(ExifItem *item)
+gchar *exif_item_get_tag_name(ExifItem *item)
{
if (!item || !item->marker) return NULL;
return g_strdup(item->marker->key);
return item->elements;
}
-char *exif_item_get_data(ExifItem *item, guint *data_len)
+gchar *exif_item_get_data(ExifItem *item, guint *data_len)
{
if (data_len)
*data_len = item->data_len;
}
-char *exif_item_get_description(ExifItem *item)
+gchar *exif_item_get_description(ExifItem *item)
{
if (!item || !item->marker) return NULL;
return g_strdup(_(item->marker->description));
}
-const char *exif_item_get_format_name(ExifItem *item, gint brief)
+const gchar *exif_item_get_format_name(ExifItem *item, gint brief)
{
if (!item || !item->marker) return NULL;
return (brief) ? ExifFormatList[item->format].short_name : ExifFormatList[item->format].description;
for (i = 0 ; i < ne; i++)
{
- unsigned char c = ((char *)data)[i];
+ guchar c = ((gchar *)data)[i];
if (c < 32 || c > 127) c = '.';
g_string_append_printf(string, "%c", c);
}
{
spacer = "";
}
- g_string_append_printf(string, "%s%02x", spacer, ((char *)data)[i]);
+ g_string_append_printf(string, "%s%02x", spacer, ((gchar *)data)[i]);
}
return string;
/* note: the align_buf is used to avoid alignment issues (on sparc) */
-guint16 exif_byte_get_int16(unsigned char *f, ExifByteOrder bo)
+guint16 exif_byte_get_int16(guchar *f, ExifByteOrder bo)
{
guint16 align_buf;
return GUINT16_FROM_BE(align_buf);
}
-guint32 exif_byte_get_int32(unsigned char *f, ExifByteOrder bo)
+guint32 exif_byte_get_int32(guchar *f, ExifByteOrder bo)
{
guint32 align_buf;
return GUINT32_FROM_BE(align_buf);
}
-void exif_byte_put_int16(unsigned char *f, guint16 n, ExifByteOrder bo)
+void exif_byte_put_int16(guchar *f, guint16 n, ExifByteOrder bo)
{
guint16 align_buf;
memcpy(f, &align_buf, sizeof(guint16));
}
-void exif_byte_put_int32(unsigned char *f, guint32 n, ExifByteOrder bo)
+void exif_byte_put_int32(guchar *f, guint32 n, ExifByteOrder bo)
{
guint32 align_buf;
case EXIF_FORMAT_STRING:
memcpy(dest, src, len);
/* string is NULL terminated, make sure this is true */
- if (((char *)dest)[len - 1] != '\0') ((char *)dest)[len - 1] = '\0';
+ if (((gchar *)dest)[len - 1] != '\0') ((gchar *)dest)[len - 1] = '\0';
break;
case EXIF_FORMAT_SHORT_UNSIGNED:
case EXIF_FORMAT_SHORT:
ExifRational r;
rational_from_data(&r, src + i * bs, bo);
- if (r.den) ((double *)dest)[i] = (double)r.num / r.den;
+ if (r.den) ((gdouble *)dest)[i] = (gdouble)r.num / r.den;
}
break;
}
}
-static gint exif_parse_IFD_entry(ExifData *exif, unsigned char *tiff, guint offset,
+static gint exif_parse_IFD_entry(ExifData *exif, guchar *tiff, guint offset,
guint size, ExifByteOrder bo,
gint level,
const ExifMarker *list)
}
gint exif_parse_IFD_table(ExifData *exif,
- unsigned char *tiff, guint offset,
+ guchar *tiff, guint offset,
guint size, ExifByteOrder bo,
gint level,
const ExifMarker *list)
*-------------------------------------------------------------------
*/
-gint exif_tiff_directory_offset(unsigned char *data, const guint len,
+gint exif_tiff_directory_offset(guchar *data, const guint len,
guint *offset, ExifByteOrder *bo)
{
if (len < 8) return FALSE;
return (*offset < len);
}
-gint exif_tiff_parse(ExifData *exif, unsigned char *tiff, guint size, ExifMarker *list)
+gint exif_tiff_parse(ExifData *exif, guchar *tiff, guint size, ExifMarker *list)
{
ExifByteOrder bo;
guint offset;
*/
static ExifMarker jpeg_color_marker = { 0x8773, EXIF_FORMAT_UNDEFINED, -1, "Exif.Image.InterColorProfile", NULL, NULL };
-void exif_add_jpeg_color_profile(ExifData *exif, unsigned char *cp_data, guint cp_length)
+void exif_add_jpeg_color_profile(ExifData *exif, guchar *cp_data, guint cp_length)
{
ExifItem *item = exif_item_new(jpeg_color_marker.format, jpeg_color_marker.tag, 1,
&jpeg_color_marker);
}
static gint exif_jpeg_parse(ExifData *exif,
- unsigned char *data, guint size,
+ guchar *data, guint size,
ExifMarker *list)
{
guint seg_offset = 0;
return res;
}
-unsigned char *exif_get_color_profile(ExifData *exif, guint *data_len)
+guchar *exif_get_color_profile(ExifData *exif, guint *data_len)
{
ExifItem *prof_item = exif_get_item(exif, "Exif.Image.InterColorProfile");
if (prof_item && exif_item_get_format_id(prof_item) == EXIF_FORMAT_UNDEFINED)
- return (unsigned char*) exif_item_get_data(prof_item, data_len);
+ return (guchar *) exif_item_get_data(prof_item, data_len);
return NULL;
}
return NULL;
}
-static gint map_file(const gchar *path, void **mapping, int *size)
+static gint map_file(const gchar *path, void **mapping, gint *size)
{
- int fd;
+ gint fd;
struct stat fs;
fd = open(path, O_RDONLY);
return 0;
}
-static gint unmap_file(void *mapping, int size)
+static gint unmap_file(void *mapping, gint size)
{
if (munmap(mapping, size) == -1)
{
{
ExifData *exif;
void *f;
- int size, res;
+ gint size, res;
gchar *pathl;
if (!path) return NULL;
exif->items = NULL;
exif->current = NULL;
- res = exif_jpeg_parse(exif, (unsigned char *)f, size, ExifKnownMarkersList);
+ res = exif_jpeg_parse(exif, (guchar *)f, size, ExifKnownMarkersList);
if (res == -2)
{
- res = exif_tiff_parse(exif, (unsigned char *)f, size, ExifKnownMarkersList);
+ res = exif_tiff_parse(exif, (guchar *)f, size, ExifKnownMarkersList);
}
if (res != 0)
default:
break;
case FORMAT_RAW_EXIF_TIFF:
- res = exif_tiff_parse(exif, (unsigned char*)f + offset, size - offset,
+ res = exif_tiff_parse(exif, (guchar *)f + offset, size - offset,
ExifKnownMarkersList);
break;
case FORMAT_RAW_EXIF_JPEG:
- res = exif_jpeg_parse(exif, (unsigned char*)f + offset, size - offset,
+ res = exif_jpeg_parse(exif, (guchar *)f + offset, size - offset,
ExifKnownMarkersList);
break;
case FORMAT_RAW_EXIF_IFD_II:
case FORMAT_RAW_EXIF_IFD_MM:
- res = exif_parse_IFD_table(exif, (unsigned char*)f, offset, size - offset,
+ res = exif_parse_IFD_table(exif, (guchar *)f, offset, size - offset,
(exif_type == FORMAT_RAW_EXIF_IFD_II) ?
EXIF_BYTE_ORDER_INTEL : EXIF_BYTE_ORDER_MOTOROLA,
0, ExifKnownMarkersList);
case FORMAT_RAW_EXIF_PROPRIETARY:
if (exif_parse_func)
{
- res = exif_parse_func((unsigned char*)f + offset, size - offset, exif);
+ res = exif_parse_func((guchar *)f + offset, size - offset, exif);
}
break;
}
#define EXIF_DATA_AS_TEXT_MAX_COUNT 16
-gchar *exif_item_get_string(ExifItem *item, int idx)
+gchar *exif_item_get_string(ExifItem *item, gint idx)
{
return exif_item_get_data_as_text(item);
}
if (ne == 1 && marker->list)
{
gchar *result;
- unsigned char val;
+ guchar val;
if (item->format == EXIF_FORMAT_BYTE_UNSIGNED ||
item->format == EXIF_FORMAT_UNDEFINED)
{
- val = ((unsigned char *)data)[0];
+ val = ((guchar *)data)[0];
}
else
{
- val = (unsigned char)(((signed char *)data)[0]);
+ val = (guchar)(((signed gchar *)data)[0]);
}
result = exif_text_list_find_value(marker->list, (guint)val);
for (i = 0; i < ne; i++)
{
g_string_append_printf(string, "%s%ld", (i > 0) ? ", " : "",
- (unsigned long int)((guint32 *)data)[i]);
+ (gulong)((guint32 *)data)[i]);
}
break;
case EXIF_FORMAT_RATIONAL_UNSIGNED:
r = &((ExifRational *)data)[i];
g_string_append_printf(string, "%s%ld/%ld", (i > 0) ? ", " : "",
- (unsigned long)r->num, (unsigned long)r->den);
+ (gulong)r->num, (gulong)r->den);
}
break;
case EXIF_FORMAT_SHORT:
for (i = 0; i < ne; i++)
{
g_string_append_printf(string, "%s%ld", (i > 0) ? ", " : "",
- (long int)((gint32 *)data)[i]);
+ (glong)((gint32 *)data)[i]);
}
break;
case EXIF_FORMAT_RATIONAL:
r = &((ExifRational *)data)[i];
g_string_append_printf(string, "%s%ld/%ld", (i > 0) ? ", " : "",
- (long)r->num, (long)r->den);
+ (glong)r->num, (glong)r->den);
}
break;
case EXIF_FORMAT_FLOAT:
for (i = 0; i < ne; i++)
{
g_string_append_printf(string, "%s%f", (i > 0) ? ", " : "",
- ((double *)data)[i]);
+ ((gdouble *)data)[i]);
}
break;
}
fprintf(f, "----------------------------------------------------\n");
}
-int exif_write(ExifData *exif)
+gint exif_write(ExifData *exif)
{
log_printf("Not compiled with EXIF write support");
return 0;
return NULL;
}
-int exif_item_delete(ExifData *exif, ExifItem *item)
+gint exif_item_delete(ExifData *exif, ExifItem *item)
{
return 0;
}
-int exif_item_set_string(ExifItem *item, const char *str)
+gint exif_item_set_string(ExifItem *item, const gchar *str)
{
return 0;
}
void exif_free_fd(FileData *fd, ExifData *exif);
-int exif_write(ExifData *exif);
+gint exif_write(ExifData *exif);
void exif_free(ExifData *exif);
gchar *exif_get_data_as_text(ExifData *exif, const gchar *key);
ExifItem *exif_get_next_item(ExifData *exif);
-char *exif_item_get_tag_name(ExifItem *item);
+gchar *exif_item_get_tag_name(ExifItem *item);
guint exif_item_get_tag_id(ExifItem *item);
guint exif_item_get_elements(ExifItem *item);
-char *exif_item_get_data(ExifItem *item, guint *data_len);
-char *exif_item_get_description(ExifItem *item);
+gchar *exif_item_get_data(ExifItem *item, guint *data_len);
+gchar *exif_item_get_description(ExifItem *item);
guint exif_item_get_format_id(ExifItem *item);
-const char *exif_item_get_format_name(ExifItem *item, gint brief);
+const gchar *exif_item_get_format_name(ExifItem *item, gint brief);
gchar *exif_item_get_data_as_text(ExifItem *item);
gint exif_item_get_integer(ExifItem *item, gint *value);
ExifRational *exif_item_get_rational(ExifItem *item, gint *sign);
-gchar *exif_item_get_string(ExifItem *item, int idx);
+gchar *exif_item_get_string(ExifItem *item, gint idx);
const gchar *exif_get_description_by_key(const gchar *key);
const gchar *exif_get_tag_description_by_key(const gchar *key);
gchar *exif_get_formatted_by_key(ExifData *exif, const gchar *key, gint *key_valid);
-int exif_item_delete(ExifData *exif, ExifItem *item);
-int exif_item_set_string(ExifItem *item, const char *str);
+gint exif_item_delete(ExifData *exif, ExifItem *item);
+gint exif_item_set_string(ExifItem *item, const gchar *str);
-unsigned char *exif_get_color_profile(ExifData *exif, guint *data_len);
+guchar *exif_get_color_profile(ExifData *exif, guint *data_len);
/* jpeg embedded icc support */
-void exif_add_jpeg_color_profile(ExifData *exif, unsigned char *cp_data, guint cp_length);
+void exif_add_jpeg_color_profile(ExifData *exif, guchar *cp_data, guint cp_length);
-gint exif_jpeg_segment_find(unsigned char *data, guint size,
+gint exif_jpeg_segment_find(guchar *data, guint size,
guchar app_marker, const gchar *magic, guint magic_len,
guint *seg_offset, guint *seg_length);
-gint exif_jpeg_parse_color(ExifData *exif, unsigned char *data, guint size);
+gint exif_jpeg_parse_color(ExifData *exif, guchar *data, guint size);
/*raw support */
-gint format_raw_img_exif_offsets_fd(int fd, const gchar *path,
- unsigned char *header_data, const guint header_len,
+gint format_raw_img_exif_offsets_fd(gint fd, const gchar *path,
+ guchar *header_data, const guint header_len,
guint *image_offset, guint *exif_offset);
}
if (size < (gint64)1048576)
{
- return g_strdup_printf(_("%.1f K"), (double)size / 1024.0);
+ return g_strdup_printf(_("%.1f K"), (gdouble)size / 1024.0);
}
if (size < (gint64)1073741824)
{
- return g_strdup_printf(_("%.1f MB"), (double)size / 1048576.0);
+ return g_strdup_printf(_("%.1f MB"), (gdouble)size / 1048576.0);
}
- /* to avoid overflowing the double, do division in two steps */
+ /* to avoid overflowing the gdouble, do division in two steps */
size /= 1048576;
- return g_strdup_printf(_("%.1f GB"), (double)size / 1024.0);
+ return g_strdup_printf(_("%.1f GB"), (gdouble)size / 1024.0);
}
/* note: returned string is valid until next call to text_from_time() */
static void file_data_check_sidecars(FileData *fd)
{
- int base_len;
+ gint base_len;
GString *fname;
FileData *parent_fd = NULL;
GList *work;
static gint sidecar_file_priority(const gchar *path)
{
- const char *extension = extension_from_path(path);
- int i = 1;
+ const gchar *extension = extension_from_path(path);
+ gint i = 1;
GList *work;
if (extension == NULL)
gchar *pathl;
GList *dlist = NULL;
GList *flist = NULL;
- int (*stat_func)(const char *path, struct stat *buf);
+ gint (*stat_func)(const gchar *path, struct stat *buf);
g_assert(files || dirs);
static void file_data_update_ci_dest_preserve_ext(FileData *fd, const gchar *dest_path)
{
- const char *extension = extension_from_path(fd->change->source);
+ const gchar *extension = extension_from_path(fd->change->source);
gchar *base = remove_extension_from_path(dest_path);
gchar *old_path = fd->change->dest;
*-----------------------------------------------------------------------------
*/
-static gint canon_cr2_tiff_entry(unsigned char *data, const guint len, guint offset, ExifByteOrder bo,
+static gint canon_cr2_tiff_entry(guchar *data, const guint len, guint offset, ExifByteOrder bo,
guint *image_offset, gint *jpeg_encoding)
{
guint tag;
return TRUE;
}
-static gint canon_cr2_tiff_table(unsigned char *data, const guint len, guint offset, ExifByteOrder bo,
+static gint canon_cr2_tiff_table(guchar *data, const guint len, guint offset, ExifByteOrder bo,
guint *image_offset)
{
gint jpeg_encoding = FALSE;
return exif_byte_get_int32(data + offset + count * EXIF_TIFD_SIZE, bo);
}
-gint format_canon_raw_cr2(unsigned char *data, const guint len,
+gint format_canon_raw_cr2(guchar *data, const guint len,
guint *image_offset, guint *exif_offset)
{
guint jpeg_offset = 0;
#define CRW_HEADER_SIZE 26
#define CRW_DIR_ENTRY_SIZE 10
-gint format_canon_raw_crw(unsigned char *data, const guint len,
+gint format_canon_raw_crw(guchar *data, const guint len,
guint *image_offset, guint *exif_offset)
{
guint block_offset;
}
#endif
-gint format_canon_makernote(ExifData *exif, unsigned char *tiff, guint offset,
+gint format_canon_makernote(ExifData *exif, guchar *tiff, guint offset,
guint size, ExifByteOrder bo)
{
ExifItem *item;
#include "exif-int.h"
-gint format_canon_raw_crw(unsigned char *data, const guint len,
+gint format_canon_raw_crw(guchar *data, const guint len,
guint *image_offset, guint *exif_offset);
-gint format_canon_raw_cr2(unsigned char *data, const guint len,
+gint format_canon_raw_cr2(guchar *data, const guint len,
guint *image_offset, guint *exif_offset);
#define FORMAT_RAW_CANON { "crw", \
"Canon cr2", format_canon_raw_cr2 }
-gint format_canon_makernote(ExifData *exif, unsigned char *tiff, guint offset,
+gint format_canon_makernote(ExifData *exif, guchar *tiff, guint offset,
guint size, ExifByteOrder bo);
#define FORMAT_EXIF_CANON { FORMAT_EXIF_MATCH_MAKE, "Canon", 5, "Canon", format_canon_makernote }
*/
-gint format_fuji_raw(unsigned char *data, const guint len,
+gint format_fuji_raw(guchar *data, const guint len,
guint *image_offset, guint *exif_offset)
{
guint io;
-gint format_fuji_makernote(ExifData *exif, unsigned char *tiff, guint offset,
+gint format_fuji_makernote(ExifData *exif, guchar *tiff, guint offset,
guint size, ExifByteOrder bo)
{
- unsigned char *data;
+ guchar *data;
guint ifdstart;
if (offset + 8 + 4 >= size) return FALSE;
#include "exif-int.h"
-gint format_fuji_raw(unsigned char *data, const guint len,
+gint format_fuji_raw(guchar *data, const guint len,
guint *image_offset, guint *exif_offset);
"Fuji raw", format_fuji_raw }
-gint format_fuji_makernote(ExifData *exif, unsigned char *tiff, guint offset,
+gint format_fuji_makernote(ExifData *exif, guchar *tiff, guint offset,
guint size, ExifByteOrder bo);
#define FORMAT_EXIF_FUJI { FORMAT_EXIF_MATCH_MAKERNOTE, "FUJIFILM", 8, "Fujifilm", format_fuji_makernote }
*-----------------------------------------------------------------------------
*/
-static guint nikon_tiff_table(unsigned char *data, const guint len, guint offset, ExifByteOrder bo,
+static guint nikon_tiff_table(guchar *data, const guint len, guint offset, ExifByteOrder bo,
gint level,
guint *image_offset, guint *jpeg_len);
-static void nikon_tiff_entry(unsigned char *data, const guint len, guint offset, ExifByteOrder bo,
+static void nikon_tiff_entry(guchar *data, const guint len, guint offset, ExifByteOrder bo,
gint level,
guint *image_offset, guint *image_length, guint *jpeg_start, guint *jpeg_len)
{
}
}
-static guint nikon_tiff_table(unsigned char *data, const guint len, guint offset, ExifByteOrder bo,
+static guint nikon_tiff_table(guchar *data, const guint len, guint offset, ExifByteOrder bo,
gint level,
guint *image_offset, guint *image_length)
{
return exif_byte_get_int32(data + offset + count * EXIF_TIFD_SIZE, bo);
}
-gint format_nikon_raw(unsigned char *data, const guint len,
+gint format_nikon_raw(guchar *data, const guint len,
guint *image_offset, guint *exif_offset)
{
guint i_off = 0;
};
-gint format_nikon_makernote(ExifData *exif, unsigned char *tiff, guint offset,
+gint format_nikon_makernote(ExifData *exif, guchar *tiff, guint offset,
guint size, ExifByteOrder bo)
{
- unsigned char *data;
+ guchar *data;
ExifItem *item;
if (offset + 8 + 4 >= size) return FALSE;
#include "exif-int.h"
-gint format_nikon_raw(unsigned char *data, const guint len,
+gint format_nikon_raw(guchar *data, const guint len,
guint *image_offset, guint *exif_offset);
#define FORMAT_RAW_NIKON { "nef", \
FORMAT_RAW_EXIF_TIFF, NULL, \
"Samsung raw", format_nikon_raw }
-gint format_nikon_makernote(ExifData *exif, unsigned char *tiff, guint offset,
+gint format_nikon_makernote(ExifData *exif, guchar *tiff, guint offset,
guint size, ExifByteOrder bo);
#define FORMAT_EXIF_NIKON { FORMAT_EXIF_MATCH_MAKERNOTE, "Nikon\x00", 6, "Nikon", format_nikon_makernote }, \
*-----------------------------------------------------------------------------
*/
-static guint olympus_tiff_table(unsigned char *data, const guint len, guint offset, ExifByteOrder bo,
+static guint olympus_tiff_table(guchar *data, const guint len, guint offset, ExifByteOrder bo,
gint level,
guint *image_offset, guint *exif_offset);
-static void olympus_tiff_entry(unsigned char *data, const guint len, guint offset, ExifByteOrder bo,
+static void olympus_tiff_entry(guchar *data, const guint len, guint offset, ExifByteOrder bo,
gint level,
guint *image_offset, guint *exif_offset)
{
}
}
-static guint olympus_tiff_table(unsigned char *data, const guint len, guint offset, ExifByteOrder bo,
+static guint olympus_tiff_table(guchar *data, const guint len, guint offset, ExifByteOrder bo,
gint level,
guint *image_offset, guint *exif_offset)
{
return exif_byte_get_int32(data + offset + count * EXIF_TIFD_SIZE, bo);
}
-gint format_olympus_raw(unsigned char *data, const guint len,
+gint format_olympus_raw(guchar *data, const guint len,
guint *image_offset, guint *exif_offset)
{
guint i_off = 0;
EXIF_TEXT_LIST_END
};
-gint format_olympus_makernote(ExifData *exif, unsigned char *tiff, guint offset,
+gint format_olympus_makernote(ExifData *exif, guchar *tiff, guint offset,
guint size, ExifByteOrder bo)
{
- unsigned char *data;
+ guchar *data;
ExifItem *item;
if (offset + 8 + 4 >= size) return FALSE;
#include "exif-int.h"
-gint format_olympus_raw(unsigned char *data, const guint len,
+gint format_olympus_raw(guchar *data, const guint len,
guint *image_offset, guint *exif_offset);
"Olympus raw", format_olympus_raw }
-gint format_olympus_makernote(ExifData *exif, unsigned char *tiff, guint offset,
+gint format_olympus_makernote(ExifData *exif, guchar *tiff, guint offset,
guint size, ExifByteOrder bo);
#define FORMAT_EXIF_OLYMPUS { FORMAT_EXIF_MATCH_MAKERNOTE, "OLYMP\x00\x01", 7, \
};
-static guint tiff_table(unsigned char *data, const guint len, guint offset, ExifByteOrder bo,
+static guint tiff_table(guchar *data, const guint len, guint offset, ExifByteOrder bo,
guint tag, ExifFormatType type,
guint *result_offset, guint *result_count)
{
return exif_byte_get_int32(data + offset + count * 12, bo);
}
-static gint format_tiff_find_tag_data(unsigned char *data, const guint len,
+static gint format_tiff_find_tag_data(guchar *data, const guint len,
guint tag, ExifFormatType type,
guint *result_offset, guint *result_count)
{
return FALSE;
}
-static FormatRawEntry *format_raw_find(unsigned char *data, const guint len)
+static FormatRawEntry *format_raw_find(guchar *data, const guint len)
{
gint n;
gint tiff;
}
static gint format_raw_parse(FormatRawEntry *entry,
- unsigned char *data, const guint len,
+ guchar *data, const guint len,
guint *image_offset, guint *exif_offset)
{
guint io = 0;
return TRUE;
}
-gint format_raw_img_exif_offsets(unsigned char *data, const guint len,
+gint format_raw_img_exif_offsets(guchar *data, const guint len,
guint *image_offset, guint *exif_offset)
{
FormatRawEntry *entry;
}
-FormatRawExifType format_raw_exif_offset(unsigned char *data, const guint len, guint *exif_offset,
+FormatRawExifType format_raw_exif_offset(guchar *data, const guint len, guint *exif_offset,
FormatRawExifParseFunc *exif_parse_func)
{
FormatRawEntry *entry;
}
-gint format_raw_img_exif_offsets_fd(int fd, const gchar *path,
- unsigned char *header_data, const guint header_len,
+gint format_raw_img_exif_offsets_fd(gint fd, const gchar *path,
+ guchar *header_data, const guint header_len,
guint *image_offset, guint *exif_offset)
{
FormatRawEntry *entry;
}
-static FormatExifEntry *format_exif_makernote_find(ExifData *exif, unsigned char *tiff,
+static FormatExifEntry *format_exif_makernote_find(ExifData *exif, guchar *tiff,
guint offset, guint size)
{
ExifItem *make;
return FALSE;
}
-gint format_exif_makernote_parse(ExifData *exif, unsigned char *tiff, guint offset,
+gint format_exif_makernote_parse(ExifData *exif, guchar *tiff, guint offset,
guint size, ExifByteOrder bo)
{
FormatExifEntry *entry;
*/
#if DEBUG_RAW_TIFF
-static guint format_debug_tiff_table(unsigned char *data, const guint len, guint offset,
+static guint format_debug_tiff_table(guchar *data, const guint len, guint offset,
ExifByteOrder bo, gint level);
-static void format_debug_tiff_entry(unsigned char *data, const guint len, guint offset,
+static void format_debug_tiff_entry(guchar *data, const guint len, guint offset,
ExifByteOrder bo, gint level)
{
guint tag;
}
}
-static guint format_debug_tiff_table(unsigned char *data, const guint len, guint offset,
+static guint format_debug_tiff_table(guchar *data, const guint len, guint offset,
ExifByteOrder bo, gint level)
{
guint count;
return exif_byte_get_int32(data + offset + count * EXIF_TIFD_SIZE, bo);
}
-gint format_debug_tiff_raw(unsigned char *data, const guint len,
+gint format_debug_tiff_raw(guchar *data, const guint len,
guint *image_offset, guint *exif_offset)
{
ExifByteOrder bo;
FORMAT_RAW_EXIF_PROPRIETARY
} FormatRawExifType;
-typedef gint (* FormatRawParseFunc)(unsigned char *data, const guint len,
+typedef gint (* FormatRawParseFunc)(guchar *data, const guint len,
guint *image_offset, guint *exif_offset);
-typedef gint (* FormatRawExifParseFunc)(unsigned char *data, const guint len,
+typedef gint (* FormatRawExifParseFunc)(guchar *data, const guint len,
ExifData *exif);
-gint format_raw_img_exif_offsets(unsigned char *data, const guint len,
+gint format_raw_img_exif_offsets(guchar *data, const guint len,
guint *image_offset, guint *exif_offset);
-gint format_raw_img_exif_offsets_fd(int fd, const gchar *path,
- unsigned char *header_data, const guint header_len,
+gint format_raw_img_exif_offsets_fd(gint fd, const gchar *path,
+ guchar *header_data, const guint header_len,
guint *image_offset, guint *exif_offset);
-FormatRawExifType format_raw_exif_offset(unsigned char *data, const guint len, guint *exif_offset,
+FormatRawExifType format_raw_exif_offset(guchar *data, const guint len, guint *exif_offset,
FormatRawExifParseFunc *exif_parse_func);
FORMAT_EXIF_MATCH_MAKERNOTE
} FormatExifMatchType;
-typedef gint (* FormatExifParseFunc)(ExifData *exif, unsigned char *tiff, guint offset,
+typedef gint (* FormatExifParseFunc)(ExifData *exif, guchar *tiff, guint offset,
guint size, ExifByteOrder bo);
-gint format_exif_makernote_parse(ExifData *exif, unsigned char *tiff, guint offset,
+gint format_exif_makernote_parse(ExifData *exif, guchar *tiff, guint offset,
guint size, ExifByteOrder bo);
"Tiff debugger MM", format_debug_tiff_raw }
/* used for debugging only */
-gint format_debug_tiff_raw(unsigned char *data, const guint len,
+gint format_debug_tiff_raw(guchar *data, const guint len,
guint *image_offset, guint *exif_offset);
#endif
/* FIXME: use the coordinates correctly */
gint i;
gulong max = 0;
- double logmax;
+ gdouble logmax;
if (!histogram) return 0;
g_free(hd);
}
-static HistoryData *history_list_find_by_key(const gchar* key)
+static HistoryData *history_list_find_by_key(const gchar *key)
{
GList *work = history_list;
return NULL;
}
-const gchar *history_list_find_last_path_by_key(const gchar* key)
+const gchar *history_list_find_last_path_by_key(const gchar *key)
{
HistoryData *hd;
void history_list_item_move(const gchar *key, const gchar *path, gint direction);
void history_list_item_remove(const gchar *key, const gchar *path);
-const gchar *history_list_find_last_path_by_key(const gchar* key);
+const gchar *history_list_find_last_path_by_key(const gchar *key);
/* the returned GList is internal, don't free it */
GList *history_list_get_by_key(const gchar *key);
static gint image_loader_begin(ImageLoader *il)
{
- int b;
- unsigned int offset = 0;
+ gint b;
+ guint offset = 0;
if (!il->loader || il->pixbuf) return FALSE;
ColorManProfileType screen_type;
const gchar *input_file;
const gchar *screen_file;
- unsigned char *profile = NULL;
+ guchar *profile = NULL;
guint profile_len;
if (imd->cm) return FALSE;
if (!tab->compression_done && mem_size > 0)
{
- buf = g_strdup_printf("%.1f%%", (double)tab->byte_size / mem_size * 100.0);
+ buf = g_strdup_printf("%.1f%%", (gdouble)tab->byte_size / mem_size * 100.0);
gtk_label_set_text(GTK_LABEL(tab->label_compression), buf);
g_free(buf);
static gchar *mode_number(mode_t m)
{
- int mb, mu, mg, mo;
+ gint mb, mu, mg, mo;
mb = mu = mg = mo = 0;
return lc->box;
}
-static char num_to_text_char(gint n)
+static gchar num_to_text_char(gint n)
{
switch (n)
{
#undef CB
-static const char *menu_ui_description =
+static const gchar *menu_ui_description =
"<ui>"
" <menubar name='MainMenu'>"
" <menu action='FileMenu'>"
void layout_image_lirc_init(LayoutWindow *lw)
{
- int flags;
+ gint flags;
DEBUG_1("Initializing LIRC...");
lirc_fd = lirc_init(GQ_APPNAME_LC, get_debug_level() > 0);
#ifndef G_OS_UNIX
return g_strdup(filename);
#else
- const char *notilde;
- const char *slash;
- const char *home;
+ const gchar *notilde;
+ const gchar *slash;
+ const gchar *home;
if (filename[0] != '~')
return g_strdup(filename);
parse_command_line_add_file(file_path, path, file, list, collection_list);
}
-static void parse_command_line(int argc, char *argv[], gchar **path, gchar **file,
+static void parse_command_line(gint argc, gchar *argv[], gchar **path, gchar **file,
GList **cmd_list, GList **collection_list,
gchar **geometry)
{
}
}
-static void parse_command_line_for_debug_option(int argc, char *argv[])
+static void parse_command_line_for_debug_option(gint argc, gchar *argv[])
{
#ifdef DEBUG
const gchar *debug_option = "--debug";
exit_program_final();
}
-int main(int argc, char *argv[])
+gint main(gint argc, gchar *argv[])
{
LayoutWindow *lw;
gchar *path = NULL;
DEBUG_1("biggest day contains %d images", day_max);
- grid = (gint)(sqrt((double)day_max) + 0.5) * (PAN_THUMB_SIZE + PAN_SHADOW_OFFSET * 2 + PAN_THUMB_GAP);
+ grid = (gint)(sqrt((gdouble)day_max) + 0.5) * (PAN_THUMB_SIZE + PAN_SHADOW_OFFSET * 2 + PAN_THUMB_GAP);
day_width = MAX(PAN_CAL_DAY_WIDTH, grid);
day_height = MAX(PAN_CAL_DAY_HEIGHT, grid);
PanItem *pi_day;
gint dx, dy;
gint n = 0;
- char fake_path[20];
+ gchar fake_path[20];
dt = pan_date_to_time(year, month, day);
a = 2*PI * group->diameter / parent->circumference;
- x = (gint)((double)radius * cos(parent->angle + a / 2));
- y = (gint)((double)radius * sin(parent->angle + a / 2));
+ x = (gint)((gdouble)radius * cos(parent->angle + a / 2));
+ y = (gint)((gdouble)radius * sin(parent->angle + a / 2));
parent->angle += a;
group->width = pi_box->width;
group->height = pi_box->y + pi_box->height;
- group->diameter = (int)sqrt(group->width * group->width + group->height * group->height);
+ group->diameter = (gint)sqrt(group->width * group->width + group->height * group->height);
group->children = NULL;
list = pan_list_tree(dir_fd, SORT_NAME, TRUE, pw->ignore_symlinks);
- grid_size = (gint)sqrt((double)g_list_length(list));
+ grid_size = (gint)sqrt((gdouble)g_list_length(list));
if (pw->size > PAN_IMAGE_SIZE_THUMB_LARGE)
{
grid_size = grid_size * (512 + PAN_THUMB_GAP) * pw->image_size / 100;
&rx, &ry, &rw, &rh))
{
gdk_pixbuf_composite(pi->pixbuf, pixbuf, rx - x, ry - y, rw, rh,
- (double) tx - x,
- (double) ty - y,
+ (gdouble) tx - x,
+ (gdouble) ty - y,
1.0, 1.0, GDK_INTERP_NEAREST,
255);
}
if (pi->pixbuf)
{
gdk_pixbuf_composite(pi->pixbuf, pixbuf, rx - x, ry - y, rw, rh,
- (double) pi->x - x,
- (double) pi->y - y,
+ (gdouble) pi->x - x,
+ (gdouble) pi->y - y,
1.0, 1.0, GDK_INTERP_NEAREST,
pi->color_a);
}
rx = ry = 0;
if (pr->scale)
{
- rx = (double)(pr->x_scroll + event->x - pr->x_offset) / pr->scale;
- ry = (double)(pr->y_scroll + event->y - pr->y_offset) / pr->scale;
+ rx = (gdouble)(pr->x_scroll + event->x - pr->x_offset) / pr->scale;
+ ry = (gdouble)(pr->y_scroll + event->y - pr->y_offset) / pr->scale;
}
pi = pan_item_find_by_coord(pw, PAN_ITEM_BOX, rx, ry, "info");
x2 = ((pr->x_scroll + pr->vis_width) / pr->tile_width) * pr->tile_width + pr->tile_width;
y2 = ((pr->y_scroll + pr->vis_height) / pr->tile_height) * pr->tile_height + pr->tile_height;
- return !((double)st->x * pr->scale > (double)x2 ||
- (double)(st->x + pr->source_tile_width) * pr->scale < (double)x1 ||
- (double)st->y * pr->scale > (double)y2 ||
- (double)(st->y + pr->source_tile_height) * pr->scale < (double)y1);
+ return !((gdouble)st->x * pr->scale > (gdouble)x2 ||
+ (gdouble)(st->x + pr->source_tile_width) * pr->scale < (gdouble)x1 ||
+ (gdouble)st->y * pr->scale > (gdouble)y2 ||
+ (gdouble)(st->y + pr->source_tile_height) * pr->scale < (gdouble)y1);
}
static SourceTile *pr_source_tile_new(PixbufRenderer *pr, gint x, gint y)
}
else
{
- double scale_x, scale_y;
+ gdouble scale_x, scale_y;
gint sx, sy, sw, sh;
if (pr->image_width == 0 || pr->image_height == 0) return FALSE;
- scale_x = (double)pr->width / pr->image_width;
- scale_y = (double)pr->height / pr->image_height;
+ scale_x = (gdouble)pr->width / pr->image_width;
+ scale_y = (gdouble)pr->height / pr->image_height;
- sx = (double)(it->x + x) / scale_x;
- sy = (double)(it->y + y) / scale_y;
- sw = (double)w / scale_x;
- sh = (double)h / scale_y;
+ sx = (gdouble)(it->x + x) / scale_x;
+ sy = (gdouble)(it->y + y) / scale_y;
+ sw = (gdouble)w / scale_x;
+ sh = (gdouble)h / scale_y;
if (pr->width < PR_MIN_SCALE_SIZE || pr->height < PR_MIN_SCALE_SIZE) fast = TRUE;
st = work->data;
work = work->next;
- stx = floor((double)st->x * scale_x);
- sty = floor((double)st->y * scale_y);
- stw = ceil((double)(st->x + pr->source_tile_width) * scale_x) - stx;
- sth = ceil((double)(st->y + pr->source_tile_height) * scale_y) - sty;
+ stx = floor((gdouble)st->x * scale_x);
+ sty = floor((gdouble)st->y * scale_y);
+ stw = ceil((gdouble)(st->x + pr->source_tile_width) * scale_x) - stx;
+ sth = ceil((gdouble)(st->y + pr->source_tile_height) * scale_y) - sty;
if (pr_clip_region(stx, sty, stw, sth,
it->x + x, it->y + y, w, h,
}
else
{
- double offset_x;
- double offset_y;
+ gdouble offset_x;
+ gdouble offset_y;
/* may need to use unfloored stx,sty values here */
- offset_x = (double)(stx - it->x);
- offset_y = (double)(sty - it->y);
+ offset_x = (gdouble)(stx - it->x);
+ offset_y = (gdouble)(sty - it->y);
gdk_pixbuf_scale(st->pixbuf, it->pixbuf, rx - it->x, ry - it->y, rw, rh,
- (double) 0.0 + offset_x,
- (double) 0.0 + offset_y,
+ (gdouble) 0.0 + offset_x,
+ (gdouble) 0.0 + offset_y,
scale_x, scale_y,
(fast) ? GDK_INTERP_NEAREST : pr->zoom_quality);
draw = TRUE;
tiles = (pr->vis_width / pr->tile_width + 1) * (pr->vis_height / pr->tile_height + 1);
tile_max = MAX(tiles * pr->tile_width * pr->tile_height * 3,
- (gint)((double)pr->tile_cache_max * 1048576.0 * pr->scale));
+ (gint)((gdouble)pr->tile_cache_max * 1048576.0 * pr->scale));
}
else
{
static void pr_tile_coords_map_orientation(PixbufRenderer *pr,
- double tile_x, double tile_y, /* coordinates of the tile */
+ gdouble tile_x, gdouble tile_y, /* coordinates of the tile */
gint image_w, gint image_h,
- double tile_w, double tile_h,
- double *res_x, double *res_y)
+ gdouble tile_w, gdouble tile_h,
+ gdouble *res_x, gdouble *res_y)
{
*res_x = tile_x;
*res_y = tile_y;
else if (pr->zoom == 1.0 || pr->scale == 1.0)
{
- double src_x, src_y;
+ gdouble src_x, src_y;
gint pb_x, pb_y;
gint pb_w, pb_h;
pr_tile_coords_map_orientation(pr, it->x, it->y,
if (has_alpha)
{
gdk_pixbuf_composite_color(pr->pixbuf, it->pixbuf, pb_x, pb_y, pb_w, pb_h,
- (double) 0.0 - src_x,
- (double) 0.0 - src_y,
+ (gdouble) 0.0 - src_x,
+ (gdouble) 0.0 - src_y,
1.0, 1.0, GDK_INTERP_NEAREST,
255, it->x + pb_x, it->y + pb_y,
PR_ALPHA_CHECK_SIZE, PR_ALPHA_CHECK1, PR_ALPHA_CHECK2);
}
else
{
- double scale_x, scale_y;
- double src_x, src_y;
+ gdouble scale_x, scale_y;
+ gdouble src_x, src_y;
gint pb_x, pb_y;
gint pb_w, pb_h;
if (pr->image_width == 0 || pr->image_height == 0) return;
- scale_x = (double)pr->width / pr->image_width;
- scale_y = (double)pr->height / pr->image_height;
+ scale_x = (gdouble)pr->width / pr->image_width;
+ scale_y = (gdouble)pr->height / pr->image_height;
pr_tile_coords_map_orientation(pr, it->x / scale_x, it->y /scale_y ,
pr->image_width, pr->image_height,
if (!has_alpha)
{
gdk_pixbuf_scale(pr->pixbuf, it->pixbuf, pb_x, pb_y, pb_w, pb_h,
- (double) 0.0 - src_x * scale_x,
- (double) 0.0 - src_y * scale_y,
+ (gdouble) 0.0 - src_x * scale_x,
+ (gdouble) 0.0 - src_y * scale_y,
scale_x, scale_y,
(fast) ? GDK_INTERP_NEAREST : pr->zoom_quality);
}
else
{
gdk_pixbuf_composite_color(pr->pixbuf, it->pixbuf, pb_x, pb_y, pb_w, pb_h,
- (double) 0.0 - src_x * scale_x,
- (double) 0.0 - src_y * scale_y,
+ (gdouble) 0.0 - src_x * scale_x,
+ (gdouble) 0.0 - src_y * scale_y,
scale_x, scale_y,
(fast) ? GDK_INTERP_NEAREST : pr->zoom_quality,
255, it->x + pb_x, it->y + pb_y,
break;
case PR_SCROLL_RESET_CENTER:
/* center new image */
- pr->x_scroll = ((double)pr->image_width / 2.0 * pr->scale) - pr->vis_width / 2;
- pr->y_scroll = ((double)pr->image_height / 2.0 * pr->scale) - pr->vis_height / 2;
+ pr->x_scroll = ((gdouble)pr->image_width / 2.0 * pr->scale) - pr->vis_width / 2;
+ pr->y_scroll = ((gdouble)pr->image_height / 2.0 * pr->scale) - pr->vis_height / 2;
break;
case PR_SCROLL_RESET_TOPLEFT:
default:
dst_x = x * pr->width - pr->vis_width / 2 - pr->x_scroll + CLAMP(pr->subpixel_x_scroll, -1.0, 1.0);
dst_y = y * pr->height - pr->vis_height / 2 - pr->y_scroll + CLAMP(pr->subpixel_y_scroll, -1.0, 1.0);
- pr->subpixel_x_scroll = dst_x - (int)dst_x;
- pr->subpixel_y_scroll = dst_y - (int)dst_y;
+ pr->subpixel_x_scroll = dst_x - (gint)dst_x;
+ pr->subpixel_y_scroll = dst_y - (gint)dst_y;
- pixbuf_renderer_scroll(pr, (int)dst_x, (int)dst_y);
+ pixbuf_renderer_scroll(pr, (gint)dst_x, (gint)dst_y);
}
height += 2;
}
- x1 = (gint)floor((double)x * pr->scale);
- y1 = (gint)floor((double)y * pr->scale);
- x2 = (gint)ceil((double)(x + width) * pr->scale);
- y2 = (gint)ceil((double)(y + height) * pr->scale);
+ x1 = (gint)floor((gdouble)x * pr->scale);
+ y1 = (gint)floor((gdouble)y * pr->scale);
+ x2 = (gint)ceil((gdouble)(x + width) * pr->scale);
+ y2 = (gint)ceil((gdouble)(y + height) * pr->scale);
pr_queue(pr, x1, y1, x2 - x1, y2 - y1, FALSE, TILE_RENDER_AREA, TRUE, TRUE);
}
*-----------------------------------------------------------------------------
*/
-gboolean pixbuf_to_file_as_png(GdkPixbuf *pixbuf, const char *filename)
+gboolean pixbuf_to_file_as_png(GdkPixbuf *pixbuf, const gchar *filename)
{
GError *error = NULL;
gint ret;
#define PIXBUF_UTIL_H
-gboolean pixbuf_to_file_as_png (GdkPixbuf *pixbuf, const char *filename);
+gboolean pixbuf_to_file_as_png (GdkPixbuf *pixbuf, const gchar *filename);
gboolean pixbuf_to_file_as_jpg(GdkPixbuf *pixbuf, const gchar *filename, gint quality);
static void slideshow_delay_cb(GtkWidget *spin, gpointer data)
{
c_options->slideshow.delay = (gint)(gtk_spin_button_get_value(GTK_SPIN_BUTTON(spin)) *
- (double)SLIDESHOW_SUBSECOND_PRECISION + 0.01);
+ (gdouble)SLIDESHOW_SUBSECOND_PRECISION + 0.01);
}
/*
c_options->slideshow.delay = options->slideshow.delay;
spin = pref_spin_new(group, _("Delay between image change:"), _("seconds"),
SLIDESHOW_MIN_SECONDS, SLIDESHOW_MAX_SECONDS, 1.0, 1,
- options->slideshow.delay ? (double)options->slideshow.delay / SLIDESHOW_SUBSECOND_PRECISION : 10.0,
+ options->slideshow.delay ? (gdouble)options->slideshow.delay / SLIDESHOW_SUBSECOND_PRECISION : 10.0,
G_CALLBACK(slideshow_delay_cb), NULL);
gtk_spin_button_set_update_policy(GTK_SPIN_BUTTON(spin), GTK_UPDATE_ALWAYS);
c_options->image.zoom_increment = options->image.zoom_increment;
spin = pref_spin_new(group, _("Zoom increment:"), NULL,
- 0.1, 4.0, 0.1, 1, (double)options->image.zoom_increment / 10.0,
+ 0.1, 4.0, 0.1, 1, (gdouble)options->image.zoom_increment / 10.0,
G_CALLBACK(zoom_increment_cb), NULL);
gtk_spin_button_set_update_policy(GTK_SPIN_BUTTON(spin), GTK_UPDATE_ALWAYS);
static PaperUnits paper_unit_default(void)
{
- const char *result;
+ const gchar *result;
#if 0
/* this is not used because it is not even slightly portable */
#include <langinfo.h>
static gint print_preview_unit(gdouble points)
{
- return (int)(points / PRINT_PREVIEW_SCALE);
+ return (gint)(points / PRINT_PREVIEW_SCALE);
}
static void print_proof_size(PrintWindow *pw, gdouble *width, gdouble *height)
static sig_atomic_t pipe_handler_error = FALSE;
static PipeError *pipe_handler_data = NULL;
-static void pipe_handler_sigpipe_cb(int fd)
+static void pipe_handler_sigpipe_cb(gint fd)
{
pipe_handler_error = TRUE;
}
klass = G_OBJECT_CLASS(GTK_SETTINGS_GET_CLASS(settings));
if (g_object_class_find_property(klass, "gtk-xft-dpi"))
{
- int int_dpi;
+ gint int_dpi;
g_object_get(settings, "gtk-xft-dpi", &int_dpi, NULL);
dpi = (gdouble)int_dpi / PANGO_SCALE;
}
return TRUE;
}
-static void remote_server_client_add(RemoteConnection *rc, int fd)
+static void remote_server_client_add(RemoteConnection *rc, gint fd)
{
RemoteClient *client;
GIOChannel *channel;
static gboolean remote_server_read_cb(GIOChannel *source, GIOCondition condition, gpointer data)
{
RemoteConnection *rc = data;
- int fd;
- unsigned int alen;
+ gint fd;
+ guint alen;
fd = accept(rc->fd, NULL, &alen);
if (fd == -1)
RemoteConnection *rc;
struct sockaddr_un addr;
gint sun_path_len;
- int fd;
+ gint fd;
GIOChannel *channel;
if (remote_server_exists(path))
struct stat st;
struct sockaddr_un addr;
gint sun_path_len;
- int fd;
+ gint fd;
if (stat(path, &st) != 0 || !S_ISSOCK(st.st_mode)) return NULL;
static sig_atomic_t sigpipe_occured = FALSE;
-static void sighandler_sigpipe(int sig)
+static void sighandler_sigpipe(gint sig)
{
sigpipe_occured = TRUE;
}
}
}
-GList *remote_build_list(GList *list, int argc, char *argv[], GList **errors)
+GList *remote_build_list(GList *list, gint argc, gchar *argv[], GList **errors)
{
gint i;
typedef struct _RemoteConnection RemoteConnection;
-typedef void RemoteReadFunc(RemoteConnection *rc, const char *text, gpointer data);
+typedef void RemoteReadFunc(RemoteConnection *rc, const gchar *text, gpointer data);
struct _RemoteConnection {
gint server;
- int fd;
+ gint fd;
gchar *path;
gint channel_id;
void remote_close(RemoteConnection *rc);
-GList *remote_build_list(GList *list, int argc, char *argv[], GList **errors);
+GList *remote_build_list(GList *list, gint argc, gchar *argv[], GList **errors);
void remote_help(void);
void remote_control(const gchar *arg_exec, GList *remote_list, const gchar *path,
GList *cmd_list, GList *collection_list);
* while closing file releases file descriptor we need to call fsync(). */
#if defined(HAVE_FFLUSH) || defined(HAVE_FSYNC)
if (ssi->secure_save) {
- int fail = 0;
+ gint fail = 0;
#ifdef HAVE_FFLUSH
fail = (fflush(ssi->fp) == EOF);
g_free(sd);
}
-static int image_sim_channel_eq_sort_cb(const void *a, const void *b)
+static gint image_sim_channel_eq_sort_cb(const void *a, const void *b)
{
gint *pa = (void *)a;
gint *pb = (void *)b;
while (src_list)
{
- gint p = (double)rand() / ((double)RAND_MAX + 1.0) * g_list_length(src_list);
+ gint p = (gdouble)rand() / ((gdouble)RAND_MAX + 1.0) * g_list_length(src_list);
work = g_list_nth(src_list, p);
list = g_list_prepend(list, work->data);
src_list = g_list_remove(src_list, work->data);
{
gint w, h;
- if (((double)tl->max_w / pw) < ((double)tl->max_h / ph))
+ if (((gdouble)tl->max_w / pw) < ((gdouble)tl->max_h / ph))
{
w = tl->max_w;
- h = (double)w / pw * ph;
+ h = (gdouble)w / pw * ph;
if (h < 1) h = 1;
}
else
{
h = tl->max_h;
- w = (double)h / ph * pw;
+ w = (gdouble)h / ph * pw;
if (w < 1) w = 1;
}
}
#if 0
-gint thumb_from_xpm_d(const char **data, gint max_w, gint max_h, GdkPixmap **pixmap, GdkBitmap **mask)
+gint thumb_from_xpm_d(const gchar **data, gint max_w, gint max_h, GdkPixmap **pixmap, GdkBitmap **mask)
{
GdkPixbuf *pixbuf;
gint w, h;
return ret;
}
-gint access_file(const gchar *s, int mode)
+gint access_file(const gchar *s, gint mode)
{
gchar *sl;
gint ret;
return ret;
}
-gint mkdir_utf8(const gchar *s, int mode)
+gint mkdir_utf8(const gchar *s, gint mode)
{
gchar *sl;
gint ret;
if (!fi || !fo) return FALSE;
- while ((b = fread(buf, sizeof(char), sizeof(buf), fi)) && b != 0)
+ while ((b = fread(buf, sizeof(gchar), sizeof(buf), fi)) && b != 0)
{
- if (fwrite(buf, sizeof(char), b, fo) != b)
+ if (fwrite(buf, sizeof(gchar), b, fo) != b)
{
fclose(fi);
fclose(fo);
gint64 filesize(const gchar *s);
time_t filetime(const gchar *s);
gint filetime_set(const gchar *s, time_t tval);
-gint access_file(const gchar *s, int mode);
+gint access_file(const gchar *s, gint mode);
gint unlink_file(const gchar *s);
gint symlink_utf8(const gchar *source, const gchar *target);
-gint mkdir_utf8(const gchar *s, int mode);
+gint mkdir_utf8(const gchar *s, gint mode);
gint rmdir_utf8(const gchar *s);
gint copy_file_attributes(const gchar *s, const gchar *t, gint perms, gint mtime);
gint copy_file(const gchar *s, const gchar *t);
return ok;
}
-static gboolean file_util_rename_dir_prepare(UtilityData *ud, const char *new_path)
+static gboolean file_util_rename_dir_prepare(UtilityData *ud, const gchar *new_path)
{
gboolean ok;
GList *work;
}
-static void file_util_rename_dir_full(FileData *fd, const char *new_path, GtkWidget *parent, UtilityPhase phase)
+static void file_util_rename_dir_full(FileData *fd, const gchar *new_path, GtkWidget *parent, UtilityPhase phase)
{
UtilityData *ud;
file_util_dialog_run(ud);
}
-static void file_util_create_dir_full(FileData *fd, const char *dest_path, GtkWidget *parent, UtilityPhase phase)
+static void file_util_create_dir_full(FileData *fd, const gchar *dest_path, GtkWidget *parent, UtilityPhase phase)
{
UtilityData *ud;
f = popen(command, "r");
if (!f) return NULL;
- while ((l = fread(buf, sizeof(char), sizeof(buf), f)) > 0)
+ while ((l = fread(buf, sizeof(gchar), sizeof(buf), f)) > 0)
{
if (!result)
{