Skip to content

Commit

Permalink
For the sake of consistency, use glib basic types everywhere.
Browse files Browse the repository at this point in the history
  • Loading branch information
Laurent Monin committed Aug 26, 2008
1 parent aea00af commit c1006fb
Show file tree
Hide file tree
Showing 54 changed files with 281 additions and 281 deletions.
2 changes: 1 addition & 1 deletion src/cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ void cache_sim_data_set_date(CacheData *cd, time_t date)
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;

Expand Down
4 changes: 2 additions & 2 deletions src/cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ struct _CacheData
gint width;
gint height;
time_t date;
long checksum;
glong checksum;
guchar md5sum[16];
ImageSimilarityData *sim;

Expand All @@ -64,7 +64,7 @@ CacheData *cache_sim_data_load(const gchar *path);

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);
Expand Down
2 changes: 1 addition & 1 deletion src/collect-table.c
Original file line number Diff line number Diff line change
Expand Up @@ -1335,7 +1335,7 @@ static void collection_table_insert_marker(CollectTable *ct, CollectInfo *info,

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);

Expand Down
12 changes: 6 additions & 6 deletions src/color-man.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ static void color_man_cache_unref(ColorManCache *cc)
}

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;

Expand Down Expand Up @@ -134,7 +134,7 @@ static cmsHPROFILE color_man_cache_load_profile(ColorManProfileType type, const
}

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)
{
Expand Down Expand Up @@ -251,7 +251,7 @@ static ColorManCache *color_man_cache_find(ColorManProfileType in_type, const gc
}

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)
{
Expand Down Expand Up @@ -355,7 +355,7 @@ static gint color_man_idle_cb(gpointer data)

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;
Expand Down Expand Up @@ -402,7 +402,7 @@ void color_man_start_bg(ColorMan *cm, ColorManDoneFunc done_func, gpointer done_
}

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,
Expand Down Expand Up @@ -440,7 +440,7 @@ ColorMan *color_man_new(ImageWindow *imd, GdkPixbuf *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 */
Expand Down
2 changes: 1 addition & 1 deletion src/color-man.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ ColorMan *color_man_new(ImageWindow *imd, GdkPixbuf *pixbuf,
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);

Expand Down
4 changes: 2 additions & 2 deletions src/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* 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];
Expand Down Expand Up @@ -118,7 +118,7 @@ const gchar *get_exec_time(void)
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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#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
Expand Down
2 changes: 1 addition & 1 deletion src/dupe.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ struct _DupeItem

FileData *fd;

long checksum;
glong checksum;
gchar *md5sum;
gint width;
gint height;
Expand Down
2 changes: 1 addition & 1 deletion src/editors.c
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ static void editor_verbose_window_progress(EditorData *ed, const gchar *text)

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 : "");
Expand Down
48 changes: 24 additions & 24 deletions src/exif-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@
#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;
Expand Down Expand Up @@ -86,14 +86,14 @@ static gchar *remove_common_prefix(gchar *s, gchar *t)
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;

Expand Down Expand Up @@ -211,17 +211,17 @@ static gchar *exif_build_formatted_ShutterSpeed(ExifData *exif)
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);
Expand All @@ -231,7 +231,7 @@ static gchar *exif_build_formatted_ShutterSpeed(ExifData *exif)

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");
Expand All @@ -244,7 +244,7 @@ static gchar *exif_build_formatted_ExposureBias(ExifData *exif)
{
ExifRational *r;
gint sign;
double n;
gdouble n;

r = exif_get_rational(exif, "Exif.Photo.ExposureBiasValue", &sign);
if (!r) return NULL;
Expand All @@ -255,7 +255,7 @@ static gchar *exif_build_formatted_ExposureBias(ExifData *exif)

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;
Expand All @@ -265,7 +265,7 @@ static gchar *exif_build_formatted_FocalLength(ExifData *exif)
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)
{
Expand Down Expand Up @@ -295,13 +295,13 @@ static gchar *exif_build_formatted_SubjectDistance(ExifData *exif)
{
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");
Expand Down Expand Up @@ -369,8 +369,8 @@ static gchar *exif_build_formatted_Resolution(ExifData *exif)
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);
Expand Down Expand Up @@ -586,7 +586,7 @@ void exif_free_fd(FileData *fd, ExifData *exif)
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)
{
Expand Down Expand Up @@ -625,7 +625,7 @@ gint exif_jpeg_segment_find(unsigned char *data, guint size,
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;
Expand Down Expand Up @@ -674,7 +674,7 @@ gint exif_jpeg_parse_color(ExifData *exif, unsigned char *data, guint size)

if (chunk_count > 0)
{
unsigned char *cp_data;
guchar *cp_data;
guint cp_length = 0;
guint i;

Expand Down
16 changes: 8 additions & 8 deletions src/exif-int.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ struct _ExifMarker
struct _ExifTextList
{
gint value;
const gchar* description;
const gchar *description;
};

#define EXIF_TEXT_LIST_END { -1, NULL }
Expand Down Expand Up @@ -143,25 +143,25 @@ void exif_write_data_list(ExifData *exif, FILE *f, gint human_readable_list);
#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);
void exif_item_copy_data(ExifItem *item, void *src, guint len,
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);

Expand Down
Loading

0 comments on commit c1006fb

Please sign in to comment.