faubackup2/src/rsync rsync.cpp,1.3,1.4

Martin Waitz <[email protected]> Tue, 07 Jun 2005 12:37:11 +0000
Newsgroups gmane.comp.sysutils.backup.faubackup.cvs
Message-ID <[email protected]>
Update of /cvsroot/faubackup/faubackup2/src/rsync
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8018/src/rsync

Modified Files:
	rsync.cpp 
Log Message:
new calculation of blocksize

Index: rsync.cpp
===================================================================
RCS file: /cvsroot/faubackup/faubackup2/src/rsync/rsync.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** rsync.cpp	7 Jun 2005 10:31:16 -0000	1.3
--- rsync.cpp	7 Jun 2005 12:37:07 -0000	1.4
***************
*** 3,6 ****
--- 3,7 ----
  #include <rsync/rsync_wrapper.h>
  #include <cmath>
+ #include <cstring>
  #define STAT_CHAR_ARRAY_SIZE 200
  #define MIN_RSYNC_BLOCKSIZE 1024
***************
*** 27,41 ****
  	size_t blocksize;
  
! 	blocksize = (size_t) sqrtl(fileSize);
! 
! 	/* making 2^x blocksize */
! 	size_t temp;
! 	temp = (size_t) fabs(log(blocksize) / log(2));
! 	blocksize = (size_t)pow(2, temp + 1);
  
  	if(blocksize < MIN_RSYNC_BLOCKSIZE)
  		blocksize = MIN_RSYNC_BLOCKSIZE;
  
! 	output.information("rsync " + fileName + " with blocksize: " + int2string(blocksize), DEBUG_OUTPUT);
  	result = rdiff_sig(file, blocksize, &out, &stats);
  	if(result != RS_DONE) {
--- 28,38 ----
  	size_t blocksize;
  
! 	// this is somthing like: blocksize = sqrt(fileSize)
! 	blocksize = 1 << (ffsll(fileSize) / 2);
  
  	if(blocksize < MIN_RSYNC_BLOCKSIZE)
  		blocksize = MIN_RSYNC_BLOCKSIZE;
  
! 	output.information("rsync " + fileName + " with blocksize: " + int2string(blocksize), NORMAL_OUTPUT);
  	result = rdiff_sig(file, blocksize, &out, &stats);
  	if(result != RS_DONE) {



-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.  How far can you shotput
a projector? How fast can you ride your desk chair down the office luge track?
If you want to score the big prize, get to know the little guy.  
Play to win an NEC 61" plasma display: http://www.necitguy.com/?r=20