Skip to content

Commit

Permalink
Minor fixes and requested code changes
Browse files Browse the repository at this point in the history
  • Loading branch information
cytrinox committed Nov 13, 2021
1 parent e58084d commit 559e1e1
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/common/image.c
Original file line number Diff line number Diff line change
Expand Up @@ -1793,7 +1793,7 @@ void dt_image_refresh_makermodel(dt_image_t *img)
if(!img->camera_maker[0] || !img->camera_model[0] || !img->camera_alias[0])
{
// We need to use the exif values, so let's get rawspeed to munge them
int found = dt_rawspeed_lookup_makermodel(img->exif_maker, img->exif_model,
gboolean found = dt_rawspeed_lookup_makermodel(img->exif_maker, img->exif_model,
img->camera_maker, sizeof(img->camera_maker),
img->camera_model, sizeof(img->camera_model),
img->camera_alias, sizeof(img->camera_alias));
Expand Down
12 changes: 6 additions & 6 deletions src/common/imageio_libraw.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ static gboolean _supported_image(const gchar *filename)



int dt_libraw_lookup_makermodel(const char *maker, const char *model,
char *mk, int mk_len, char *md, int md_len,
char *al, int al_len)
gboolean dt_libraw_lookup_makermodel(const char *maker, const char *model,
char *mk, int mk_len, char *md, int md_len,
char *al, int al_len)
{
int got_it_done = FALSE;
gboolean got_it_done = FALSE;

if(g_str_equal(maker, "Canon"))
{
Expand Down Expand Up @@ -101,7 +101,7 @@ dt_imageio_retval_t dt_imageio_open_libraw(dt_image_t *img, const char *filename
// But seems to be the best available. libraw crx decoder can actually
// decode the raw data, but internal metadata like wb_coeffs, crops etc.
// are not populated into libraw structure.
if(raw->color.cam_mul[0] == 0.0)
if(raw->color.cam_mul[0] == 0.0 || isnan(raw->color.cam_mul[0]))
{
libraw_close(raw);
return DT_IMAGEIO_FILE_CORRUPTED;
Expand Down Expand Up @@ -187,7 +187,7 @@ dt_imageio_retval_t dt_imageio_open_libraw(dt_image_t *img, const char *filename
return DT_IMAGEIO_OK;

error:
printf("libraw error: %s\n", libraw_strerror(libraw_err));
fprintf(stderr, "libraw error: %s\n", libraw_strerror(libraw_err));
libraw_close(raw);
return err;
}
Expand Down
4 changes: 2 additions & 2 deletions src/common/imageio_rawspeed.cc
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ static void dt_rawspeed_load_meta() {
}
}

int dt_rawspeed_lookup_makermodel(const char *maker, const char *model,
gboolean dt_rawspeed_lookup_makermodel(const char *maker, const char *model,
char *mk, int mk_len, char *md, int md_len,
char *al, int al_len)
{
int got_it_done = FALSE;
gboolean got_it_done = FALSE;
try {
dt_rawspeed_load_meta();
const Camera *cam = meta->getCamera(maker, model, "");
Expand Down
6 changes: 3 additions & 3 deletions src/common/imageio_rawspeed.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ extern "C" {
#include "common/image.h"
#include "common/mipmap_cache.h"

int dt_rawspeed_lookup_makermodel(const char *maker, const char *model,
char *mk, int mk_len, char *md, int md_len,
char *al, int al_len);
gboolean dt_rawspeed_lookup_makermodel(const char *maker, const char *model,
char *mk, int mk_len, char *md, int md_len,
char *al, int al_len);

uint32_t dt_rawspeed_crop_dcraw_filters(uint32_t filters, uint32_t crop_x, uint32_t crop_y);

Expand Down

0 comments on commit 559e1e1

Please sign in to comment.