AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

2000.04.28 02:38 "VC++ Release build causes problems", by Peter Montgomery
2000.04.28 04:32 "Re: VC++ Release build causes problems", by Roy Darrall
2000.04.28 06:16 "VC++ Release build causes problems", by Peter Montgomery
2000.04.28 06:25 "VC++ Release build causes problems", by Peter Montgomery
2000.04.28 09:19 "VC++ Release build causes problems", by John Aldridge
2000.04.28 17:49 "Re: VC++ Release build causes problems", by Daniel McCoy
2000.04.29 00:27 "VC++ Release build causes problems", by Peter Montgomery
2000.04.28 17:27 "VC++ Release build causes problems", by Peter Montgomery
2000.04.28 18:33 "Re: VC++ Release build causes problems", by Jan Nijtmans
2000.04.28 20:39 "Re: VC++ Release build causes problems", by Daniel McCoy

2000.04.28 20:39 "Re: VC++ Release build causes problems", by Daniel McCoy

Peter Montgomery wrote:

unsigned char VCCCompilerFix;

   VCCCompilerFix = 255;

   for (code = 255; code >= 0; code--) {

    sp->dec_codetab[code].value = VCCCompilerFix;

    sp->dec_codetab[code].firstchar = VCCCompilerFix;

       sp->dec_codetab[code].length = 1;
      sp->dec_codetab[code].next = NULL;

VCCCompilerFix--;

> }

Jan Nijtmans wrote:

How about:

   code = 255;
   do {
      sp->dec_codetab[code].value = code;
      sp->dec_codetab[code].firstchar = code;
      sp->dec_codetab[code].length = 1;
      sp->dec_codetab[code].next = NULL;
   } while (code--)

It's just as efficient as the original code, and now it's save to make the "code" variable an unsigned char. Wouldn't that make everybody happy?

Excellent solution.

Seems like a reasonable compromise.

Just for curiosity and and a little perspective on this situation, I browsed some code history.

The first record I have of that particular loop, with int index initializing unsigned char, is dated 1989. So when blaming libtiff for something, just keep in mind that this library has been mature software for a long time.

Dan McCoy    Pixar   mccoy@pixar.com