[SCM] Samba Shared Repository - branch v3-2-test updated - release-3-2-0pre2-3277-ge504256

Volker Lendecke vlendec at samba.org
Mon Dec 15 11:53:25 GMT 2008


The branch, v3-2-test has been updated
       via  e504256f84927c9b22df3945a3e95baaa9bf7063 (commit)
      from  73039cd49521e724a8351a353e9ae1d342be1352 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test


- Log -----------------------------------------------------------------
commit e504256f84927c9b22df3945a3e95baaa9bf7063
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Dec 15 12:46:04 2008 +0100

    Fix bug 5969: Optimize smbclient put command
    
    This used to be checkin 3f0406f6 to master

-----------------------------------------------------------------------

Summary of changes:
 source/lib/xfile.c |   25 ++++++++++++++++++++-----
 1 files changed, 20 insertions(+), 5 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/lib/xfile.c b/source/lib/xfile.c
index e44a92d..aba49b6 100644
--- a/source/lib/xfile.c
+++ b/source/lib/xfile.c
@@ -354,12 +354,27 @@ int x_fgetc(XFILE *f)
 /* simulate fread */
 size_t x_fread(void *p, size_t size, size_t nmemb, XFILE *f)
 {
+	size_t remaining = size * nmemb;
 	size_t total = 0;
-	while (total < size*nmemb) {
-		int c = x_fgetc(f);
-		if (c == EOF) break;
-		(total+(char *)p)[0] = (char)c;
-		total++;
+
+	while (remaining > 0) {
+		size_t thistime;
+
+		x_fillbuf(f);
+
+		if (f->bufused == 0) {
+			f->flags |= X_FLAG_EOF;
+			break;
+		}
+
+		thistime = MIN(f->bufused, remaining);
+
+		memcpy((char *)p+total, f->next, thistime);
+
+		f->next += thistime;
+		f->bufused -= thistime;
+		remaining -= thistime;
+		total += thistime;
 	}
 	return total/size;
 }


-- 
Samba Shared Repository


More information about the samba-cvs mailing list