diff -ru squashfs2.0/squashfs-tools/mksquashfs.c squashfs2.0.amd64/squashfs-tools/mksquashfs.c --- squashfs2.0/squashfs-tools/mksquashfs.c 2004-05-21 00:18:12.000000000 +0200 +++ squashfs2.0.amd64/squashfs-tools/mksquashfs.c 2004-06-16 19:47:42.410180000 +0200 @@ -62,6 +62,7 @@ int total_compressed = 0, total_uncompressed = 0; int fd; +unsigned char* read_buffer_base; /* superblock attributes */ int noI = 0, noD = 0, check_data = 0, block_size = SQUASHFS_FILE_SIZE, block_log; @@ -853,10 +854,14 @@ return start_bytes; } +void setup_read_buffer(void* p) +{ + read_buffer_base = (unsigned char*) p; +} unsigned char *read_from_buffer(unsigned int *start, unsigned int avail_bytes) { - unsigned char *v = (unsigned char *) *start; + unsigned char *v = read_buffer_base + *start; *start += avail_bytes; return v; } @@ -923,7 +928,8 @@ struct file_info *duplicate(unsigned char *(get_next_file_block)(unsigned int *, unsigned int), unsigned int file_start, int bytes, unsigned int **block_list, int *start, int blocks, struct fragment **fragment, char *frag_data, int frag_bytes) { unsigned short checksum = get_checksum(get_next_file_block, file_start, bytes); - unsigned short fragment_checksum = get_checksum(read_from_buffer, (unsigned int) frag_data, frag_bytes); + setup_read_buffer(frag_data); + unsigned short fragment_checksum = get_checksum(read_from_buffer, 0, frag_bytes); struct file_info *dupl_ptr = bytes ? dupl[checksum] : frag_dups[fragment_checksum]; @@ -1043,7 +1049,8 @@ close(file); if(whole_file) { - if(duplicate_checking && (dupl_ptr = duplicate(read_from_buffer, (unsigned int) c_buffer, file_bytes, &block_listp, &start, blocks, &fragment, buff, frag_bytes)) == NULL) { + setup_read_buffer(c_buffer); + if(duplicate_checking && (dupl_ptr = duplicate(read_from_buffer, 0, file_bytes, &block_listp, &start, blocks, &fragment, buff, frag_bytes)) == NULL) { *duplicate_file = TRUE; goto wr_inode; } diff -ru squashfs2.0/squashfs-tools/read_fs.c squashfs2.0.amd64/squashfs-tools/read_fs.c --- squashfs2.0/squashfs-tools/read_fs.c 2004-05-19 01:17:29.000000000 +0200 +++ squashfs2.0.amd64/squashfs-tools/read_fs.c 2004-06-16 19:49:28.740016000 +0200 @@ -420,7 +420,7 @@ printf("Read existing filesystem, %d inodes scanned\n", files); if(inode.inode_type == SQUASHFS_DIR_TYPE) { - if((directory_table = squashfs_readdir(fd, !((int) root_name), sBlk->directory_table_start + inode.start_block, + if((directory_table = squashfs_readdir(fd, !root_name, sBlk->directory_table_start + inode.start_block, inode.offset, inode.file_size, sBlk, push_directory_entry)) == NULL) { ERROR("read_filesystem: Could not read root directory\n"); goto error;