SHA256
1
0
forked from pool/fdupes
fdupes/0008-speedup-the-file-compare.patch
Michal Vyskocil ebd601a9d7 Accepting request 138346 from home:mvyskocil:branches:utilities
- update to 1.5.0-PR2
  * new "--summarize" option
  * new  "--recurse:" selective recursion option
  * new "--noprompt" option for totally automated deletion of
  duplicate files.
  * sorts duplicates (old to new) for consistent order when
  listing or deleteing duplicate files.
  * tests for early matching of files, which should help speed up
  the matching process when large files are involved.
  * warns whenever a file cannot be deleted.
  * bugfixes (proper file closing, zero-length files, ...)
- add -p/--permissions switch so files with different permissions or uid/gid
  are not considered as duplicates (bnc#784670)
  * this mode is a default one for fdupes macro
- refresh all patches
- drop the fdupes-sort-output.diff - use the upstream mtime sorting
- add the debian patches - see spec file for details

OBS-URL: https://build.opensuse.org/request/show/138346
OBS-URL: https://build.opensuse.org/package/show/utilities/fdupes?expand=0&rev=6
2012-10-16 11:48:01 +00:00

40 lines
1.3 KiB
Diff

From c2bd76bb103b3a5b873bee72fbacce6bbe58bbe2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de>
Date: Fri, 12 Oct 2012 15:20:53 +0200
Subject: [PATCH 08/10] speedup the file compare
Use aligned reads for md5 computation, saves another memcpy.
https://bugzilla.novell.com/show_bug.cgi?id=406825
---
fdupes.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/fdupes.c b/fdupes.c
index 1e9e620..678f31f 100644
--- a/fdupes.c
+++ b/fdupes.c
@@ -370,7 +370,7 @@ char *getcrcsignatureuntil(char *filename, off_t max_read)
}
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);
fclose(file); // bugfix
@@ -606,8 +606,8 @@ int confirmmatch(FILE *file1, FILE *file2)
fseek(file2, 0, SEEK_SET);
do {
- r1 = fread(c1, 1, sizeof(c1), file1);
- r2 = fread(c2, 1, sizeof(c2), file2);
+ r1 = fread(c1, sizeof(unsigned char), sizeof(c1), file1);
+ r2 = fread(c2, sizeof(unsigned char), sizeof(c2), file2);
if (r1 != r2) return 0; /* file lengths are different */
if (memcmp (c1, c2, r1)) return 0; /* file contents are different */
--
1.7.11.5