[prev in list] [next in list] [prev in thread] [next in thread] 

List:       batik-dev
Subject:    answer to a comment on some code in WMFRecordStore
From:       Hervé_Girod <herve.girod () club-internet ! fr>
Date:       2007-03-31 8:11:45
Message-ID: 460E17C1.7000701 () club-internet ! fr
[Download RAW message or body]

Hello !!

I just saw that someone has made a comment about some part of the code 
handling META_DIBBITBLT operand in WMFRecordStore class. Basically, the 
code does :

 *case* WMFConstants.META_DIBBITBLT:
   {
     ..., get operand characteristics
     *int* len = 2*recSize - 18;
     *if* (len > 0) {
       *byte*[] bitmap = *new* *byte*[len];
       *for* (*int* i = 0; i < len; i++)
       bitmap[i] = is.readByte();
     } *else* {
       /// what does this mean?? len <= 0 ??
/       mr.numPoints = recSize;
       mr.functionId = functionId;
       *for* (*int* i = 0; i < len; i++) is.readByte();
     }
  ...

The (//len <= 0//) stuff is here because often, "in the wild", WMF records are found
faulty (sometimes even when generated with PPT !!). The test is to be sure that there
is really something in the bitmap, to avoid a possible Exception. To be honest, I did \
not found exemples of faulty WMF files for the DIBBITBLT operand, but for another \
ones, and I had in that case to add this sort of code to handle it.

Herve




---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic