From: Duncan Mac-Vicar P Date: Tue, 18 Jul 2006 10:41:01 +0000 (+0000) Subject: - Don't read the stream character wise but reading blocks, X-Git-Tag: BASE-SuSE-SLE-10-SP2-Branch~537 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1db75d2445df486d71acddf33abfdc69f8782e7a;p=platform%2Fupstream%2Flibzypp.git - Don't read the stream character wise but reading blocks, as advised by matz profiling. --- 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(); }