Division by zero fixed (Hans Petter Selasky).

This commit is contained in:
Andrey Kiselev 2004-11-09 20:27:47 +00:00
parent c8d0b4f0ec
commit f3ac753d34

View File

@ -1,4 +1,4 @@
/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_color.c,v 1.7 2003-12-24 22:02:04 dron Exp $ */
/* $Id: tif_color.c,v 1.8 2004-11-09 20:27:47 dron Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@ -170,7 +170,7 @@ TIFFCIELabToRGBInit(TIFFCIELabToRGB* cielab,
#define SHIFT 16
#define FIX(x) ((int32)((x) * (1L<<SHIFT) + 0.5))
#define ONE_HALF ((int32)(1<<(SHIFT-1)))
#define Code2V(c, RB, RW, CR) ((((c)-(int32)(RB))*(float)(CR))/(float)((RW)-(RB)))
#define Code2V(c, RB, RW, CR) ((((c)-(int32)(RB))*(float)(CR))/(float)(((RW)-(RB)) ? ((RW)-(RB)) : 1))
#define CLAMP(f,min,max) ((f)<(min)?(min):(f)>(max)?(max):(f))
void
@ -265,4 +265,4 @@ TIFFYCbCrToRGBInit(TIFFYCbCrToRGB* ycbcr, float *luma, float *refBlackWhite)
#undef ONE_HALF
#undef FIX
/* vim: set ts=8 sts=8 sw=8 noet: */