SHA256
3
0
forked from pool/fdupes
fdupes/0008-speedup-the-file-compare.patch
Tomáš Chvátal faab425747 - Update to upstream git repo on github
- Refresh patches:
  * fdupes-makefile.patch
  * 0008-speedup-the-file-compare.patch
  * 0010-add-permissions-mode.patch
  * 0011-add-an-option-to-sort-duplicate-files-by-name.patch
  * 50_bts284274_hardlinkreplace.dpatch
- Upstreamed patch:
  * 0004-Large-file-support-for-2GB-files-bts447601.patch
- Remove whitespace from fdupes.macros file
- Cleanup with spec-cleaner
  - Obey rpm-opt-flags
  - run test phase

OBS-URL: https://build.opensuse.org/package/show/utilities/fdupes?expand=0&rev=12
2015-08-03 19:29:01 +00:00

37 lines
1.4 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(-)
Index: fdupes-fdupes-1.51/fdupes.c
===================================================================
--- fdupes-fdupes-1.51.orig/fdupes.c
+++ fdupes-fdupes-1.51/fdupes.c
@@ -370,7 +370,7 @@ char *getcrcsignatureuntil(char *filenam
}
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);
@@ -606,8 +606,8 @@ int confirmmatch(FILE *file1, FILE *file
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 */