ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Keiron Liddle <kei...@aftexsw.com>
Subject Re: Last few bytes in bzip2 not identical [keiron@aftexsw.com]
Date Thu, 29 Nov 2001 13:46:06 GMT
Hi Magesh,

After a bit of a look the problem is that the combinedCRC is always wrong 
when there is more than one block.

If I changed this line:
     combinedCRC = (combinedCRC << 1) | (combinedCRC >> 31);

to this code:
     int a = (combinedCRC << 1);
     int b = (combinedCRC >>> 31);
     combinedCRC = a | b;

Then it seems to work. I don't really know how these operators work. The 
original was simply a copy from the c code, which looks like it works 
slightly differently. Something about signed integers possibly.
You should probably put a note in the code (since it is different from the 
c) to explain what is happening.

Regards,
Keiron.

On 2001.11.28 19:28 umagesh@icarus.apache.org wrote:
> Keiron:
> After making bzip2 and bunzip2 into Ant tasks, it has been included to
> generate bz2 compressed files in nightly runs.  Please visit
> 
> http://jakarta.apache.org/builds/jakarta-ant/nightly/2001-11-28/
> 
> The file jakarta-ant-1.5alpha-src.tar.bz2 has been created with
> the CBizp2OutputStream class that you have so generously contributed.
> 
> However, I am not able to decompress it using bzip2.  TO find out
> what was wrong with the ant-generated bzip2 file, I downloaded
> the gz version of the file, extracted the tar file from it using
> gzip and bzipped it again.  WHen comparing these 2 files, I find that
> the file sizes are exactly the same.  But when I did a binary diff,
> I find that there is a difference in 4 bytes:
> 
> The size of the bzip file using your version or native bzip2 is
> 1283934
> 
> Byte #      value (java version)    value (native)
> 1283930     97                      73
> 1283931     129                     133
> 1283932     173                     72
> 1283933     98                      87
> 
> 
> All I notice is that the difference is at the tail end of the
> file (last but 4 bytes).  Do you know why this would happen?
> I am trying my best to debug, but your help here would be
> really appreciated.
> 
> Thanks,
> Magesh
> 
> 

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message