2008.05.23 18:55 "[Tiff] Unitialized Variable Caused a Problem in TIFFCP", by Gene Amtower

2008.05.26 15:22 "Re: [Tiff] beta2 release - lfind() problem on Win64", by Frank Warmerdam

In trying to compile libtiff 4.0 beta 2 on Win64 with MSVC 8, I've

> encountered the following warning which I think needs fixing:

tif_dirinfo.c(508): warning C4133: 'function': incompatible types -
*' to 'unsigned int *' from 'size_t

The problem is that the call to lfind() on Win64 is redirected to

> _lfind() from search.h. For its 3rd argument, it hasn't been updated to > size_t * (pointer to 64-bits) and still uses unsigned int * (pointer to

32-bits). I'm not quite sure what the best solution is at this time. On the one hand, there's a comment that says we should use a binary search. If we did use bsearch(), then it will fix the problem since bsearch() on VC8 has been updated to use size_t (unlike _lfind). On the other hand, I'm not convinced that the array it's trying to search in is sorted. Well, I haven't actually looked but I assume it isn't sorted since it would have been just as easy to call bsearch() instead of lfind().

Any thoughts?

Edward,

The field list is in sorted by key id, not name.

It is a scary practice, but passing a size_t * in place of an int * should work on little endian machines since it just means the function will only use the lower order 4 bytes of the value.

So, I'm inclined to take no action on this and leave the warning as a clue to a questionable practice. Frankly I hate using stuff like lfind() and bsearch() since it is amazing how varied the actual implementations and interfaces can be.

I have created a bugzilla ticket to track this issue:

   http://bugzilla.maptools.org/show_bug.cgi?id=1889

Best regards,
--
---------------------------------------+--------------------------------------

I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam@pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam

and watch the world go round - Rush    | President OSGeo, http://osgeo.org