From 1db75d2445df486d71acddf33abfdc69f8782e7a Mon Sep 17 00:00:00 2001 From: Duncan Mac-Vicar P Date: Tue, 18 Jul 2006 10:41:01 +0000 Subject: [PATCH] - Don't read the stream character wise but reading blocks, as advised by matz profiling. --- zypp/Digest.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/zypp/Digest.cc b/zypp/Digest.cc index e78070e..5af2abe 100644 --- a/zypp/Digest.cc +++ b/zypp/Digest.cc @@ -193,17 +193,19 @@ namespace zypp { return string(); char buf[bufsize]; - size_t num; + size_t num = 0; Digest digest; if(!digest.create(name)) return string(); + while(is.good()) { - for(num = 0; num < bufsize && is.get(buf[num]).good(); ++num); - - if(num && !digest.update(buf, num)) + int readed; + is.read(buf, bufsize); + readed = is.gcount(); + if(readed && !digest.update(buf, readed)) return string(); } -- 2.7.4