AWARE [SYSTEMS] Imaging expertise for the Delphi developer
AWare Systems, Imaging expertise for the Delphi developer, Home TIFF and LibTiff Mailing List Archive

LibTiff Mailing List

TIFF and LibTiff Mailing List Archive
May 2007

Previous Thread
Next Thread

Previous by Thread
Next by Thread

Previous by Date
Next by Date

Contact

The TIFF Mailing List Homepage
This list is run by Frank Warmerdam
Archive maintained by AWare Systems



Valid HTML 4.01!



Thread

2007.05.04 11:51 "TIFFSetField and float values", by <mikk@go2.pl>
2007.05.04 12:18 "Re: TIFFSetField and float values", by Andrey Kiselev
2007.05.04 12:46 "Re: TIFFSetField and float values", by <mikk@go2.pl>
2007.05.04 13:02 "Re: TIFFSetField and float values", by Joris Van Damme
2007.05.04 13:13 "Re: TIFFSetField and float values", by Toby Thain
2007.05.04 13:20 "Re: TIFFSetField and float values", by Joris Van Damme
2007.05.04 21:06 "TIFFSetField and float values", by Mahmoudi Wafa

2007.05.04 13:13 "Re: TIFFSetField and float values", by Toby Thain

On 4-May-07, at 10:02 AM, Joris wrote:

> mikk,
>
> mikk wrote:
>> Oh, my, I've found the reason. Digging into the source code I  
>> realized
>> that TIFFSetField
>> gets the parameter from va_arg as double:
>> (From tif_dir.c,v 1.72 2006/03/15 12:49:35, line 234:)
>> // ...
>> case TIFFTAG_XRESOLUTION:
>>         td->td_xresolution = (float) va_arg(ap, double);
>>         break;
>> // ...
>>
>> When I pass argument of type double, the tag saves the value  
>> properly.
>> Looks like an error in documentation (TIFFSetField.3tiff.html)?
>
> I would agree... but I suspect other compilers may behave  
> differently. I suspect that passing a float, as per documentation,  
> would work for most, but passing a double will work for all.

In standard C, floats are always promoted to double in function  
arguments.

--Toby

> I've also tried changing the code you quote from tif_dir.c to va_arg 
> (ap,float), but that doesn't work on our Borland compilers at all  
> (and likely it will not work on most other compilers either, I  
> think). So I'm about to propose to change the documention to  
> specify a double parameter as part of the next update.
>
>
> Best regards,
>
> Joris Van Damme
> info@awaresystems.be
> http://www.awaresystems.be/
> Download your free TIFF tag viewer for windows here:
> http://www.awaresystems.be/imaging/tiff/astifftagviewer.html
>
> _______________________________________________
> Tiff mailing list: Tiff@lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/tiff
> http://www.remotesensing.org/libtiff/