[babl/wip/pippin/inverted-cmyk: 9/11] babl-fish: print error message instead of blowing stack
- From: Øyvind "pippin" Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [babl/wip/pippin/inverted-cmyk: 9/11] babl-fish: print error message instead of blowing stack
- Date: Fri, 16 Nov 2018 20:52:26 +0000 (UTC)
commit 658a12b0f3c444700b24a5b282fc4ab51a7313a3
Author: Øyvind Kolås <pippin gimp org>
Date: Fri Nov 16 01:50:22 2018 +0100
babl-fish: print error message instead of blowing stack
babl/babl-fish.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
---
diff --git a/babl/babl-fish.c b/babl/babl-fish.c
index d64f2d8..d23481f 100644
--- a/babl/babl-fish.c
+++ b/babl/babl-fish.c
@@ -104,11 +104,13 @@ match_conversion (Babl *conversion,
{
void **data = inout;
+
if ((Babl *) conversion->conversion.destination == (Babl *) *data)
{
*data = (void *) conversion;
return 1;
}
+
return 0;
}
@@ -123,14 +125,26 @@ babl_conversion_find (const void *source,
if (BABL (source)->type.from_list)
babl_list_each (BABL (source)->type.from_list, match_conversion, &data);
if (data != (void*)destination) /* didn't change */
+ {
return data;
+ }
data = NULL;
if (BABL (source)->class_type == BABL_MODEL)
{
const Babl *srgb_source = BABL (source)->model.model ? BABL (source)->model.model:source;
const Babl *srgb_destination = BABL (destination)->model.model ? BABL
(destination)->model.model:destination;
- Babl *reference = babl_conversion_find (srgb_source, srgb_destination);
+
+
+ Babl *reference;
+
+ if (srgb_source == source && srgb_destination == destination)
+ {
+ fprintf (stderr, "expected finding model conversion %s to %s", babl_get_name (source), babl_get_name
(destination));
+ return NULL;
+ }
+
+ reference = babl_conversion_find (srgb_source, srgb_destination);
/* when conversions are sought between models, with non-sRGB chromaticities,
we create the needed conversions from existing ones on the fly, and
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]