View | Details | Raw Unified
Collapse All | Expand All

(-) squashfs2.0/squashfs-tools/mksquashfs.c (-3 / +10 lines)
 Lines 62-67    Link Here 
int total_compressed = 0, total_uncompressed = 0;
int total_compressed = 0, total_uncompressed = 0;
int fd;
int fd;
unsigned char* read_buffer_base;
/* superblock attributes */
/* superblock attributes */
int noI = 0, noD = 0, check_data = 0, block_size = SQUASHFS_FILE_SIZE, block_log;
int noI = 0, noD = 0, check_data = 0, block_size = SQUASHFS_FILE_SIZE, block_log;
 Lines 853-862    Link Here 
	return start_bytes;
	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 *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;	
	*start += avail_bytes;	
	return v;
	return v;
}
}
 Lines 923-929    Link Here 
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)
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 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];
	struct file_info *dupl_ptr = bytes ? dupl[checksum] : frag_dups[fragment_checksum];
 Lines 1043-1049    Link Here 
	close(file);
	close(file);
	if(whole_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;
			*duplicate_file = TRUE;
			goto wr_inode;
			goto wr_inode;
		}
		}
(-) squashfs2.0/squashfs-tools/read_fs.c (-1 / +1 lines)
 Lines 420-426    Link Here 
	printf("Read existing filesystem, %d inodes scanned\n", files);
	printf("Read existing filesystem, %d inodes scanned\n", files);
	if(inode.inode_type == SQUASHFS_DIR_TYPE) {
	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) {
						inode.offset, inode.file_size, sBlk, push_directory_entry)) == NULL) {
			ERROR("read_filesystem: Could not read root directory\n");
			ERROR("read_filesystem: Could not read root directory\n");
			goto error;
			goto error;