Search
j0ke.net Open Build Service
>
Projects
>
devel
:
tools
:
building
>
fdupes
> fdupes-speedup.patch
Sign Up
|
Log In
Username
Password
Cancel
Overview
Repositories
Revisions
Requests
Users
Advanced
Attributes
Meta
File fdupes-speedup.patch of Package fdupes
Index: fdupes.c =================================================================== --- fdupes.c.orig 2010-02-15 15:36:58.000000000 +0100 +++ fdupes.c 2010-02-15 15:38:11.091108207 +0100 @@ -259,7 +259,7 @@ } while (fsize > 0) { - toread = (fsize % CHUNK_SIZE) ? (fsize % CHUNK_SIZE) : CHUNK_SIZE; + toread = (fsize >= CHUNK_SIZE) ? CHUNK_SIZE : fsize; if (fread(chunk, toread, 1, file) != 1) { errormsg("error reading from file %s\n", filename); return NULL; @@ -561,22 +561,23 @@ int confirmmatch(FILE *file1, FILE *file2) { - unsigned char c1; - unsigned char c2; + unsigned char c1[8192]; + unsigned char c2[8192]; size_t r1; size_t r2; + int res; fseek(file1, 0, SEEK_SET); fseek(file2, 0, SEEK_SET); do { - r1 = fread(&c1, sizeof(c1), 1, file1); - r2 = fread(&c2, sizeof(c2), 1, file2); + r1 = fread(c1, sizeof(unsigned char), sizeof(c1), file1); + r2 = fread(c2, sizeof(unsigned char), sizeof(c2), file2); - if (c1 != c2) return 0; /* file contents are different */ + if (r1 != r2) return 0; /* file lengths are different */ + res = memcmp(c1, c2, r1); + if ( 0 != res ) return 0; /* file contents are different */ } while (r1 && r2); - - if (r1 != r2) return 0; /* file lengths are different */ return 1; }