Changeset 1218


Ignore:
Timestamp:
08/03/06 14:18:50 (14 years ago)
Author:
curtis
Message:

More bugfixes for overwriteIFDValue. Seems to be working pretty well now.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/loci/formats/TiffTools.java

    r1214 r1218  
    17081708        int newCount = DataTools.bytesToInt(bytes, 4, false); 
    17091709        int newOffset = DataTools.bytesToInt(bytes, 8, false); 
     1710        boolean terminate = false; 
    17101711        if (DEBUG) { 
    17111712          debug("overwriteIFDValue:\n\told: (tag=" + oldTag + "; type=" + 
     
    17211722          if (DEBUG) debug("overwriteIFDValue: new entry is inline"); 
    17221723        } 
     1724        else if (oldOffset + 
     1725          oldCount * BYTES_PER_ELEMENT[oldType] == raf.length()) 
     1726        { 
     1727          // old entry was already at EOF; overwrite it 
     1728          newOffset = oldOffset; 
     1729          terminate = true; 
     1730          if (DEBUG) debug("overwriteIFDValue: old entry is at EOF"); 
     1731        } 
    17231732        else if (newCount <= oldCount) { 
    17241733          // new entry is as small or smaller than old entry; overwrite it 
    17251734          newOffset = oldOffset; 
    17261735          if (DEBUG) debug("overwriteIFDValue: new entry is <= old entry"); 
    1727         } 
    1728         else if (oldOffset + BYTES_PER_ELEMENT[oldType] == raf.length()) { 
    1729           // old entry was already at EOF; overwrite it 
    1730           newOffset = oldOffset; 
    1731           if (DEBUG) debug("overwriteIFDValue: old entry is at EOF"); 
    17321736        } 
    17331737        else { 
     
    17461750          raf.write(extra); 
    17471751        } 
     1752        if (terminate) raf.setLength(raf.getFilePointer()); 
    17481753        return; 
    17491754      } 
Note: See TracChangeset for help on using the changeset viewer.