From: ishmal Date: Fri, 21 Apr 2006 21:40:32 +0000 (+0000) Subject: minor speedup X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=5726e06be80f6fa9ffbc5658663114185cb13c78;p=inkscape.git minor speedup --- diff --git a/src/dom/util/ziptool.cpp b/src/dom/util/ziptool.cpp index e6d46557b..b3c5ec9b0 100644 --- a/src/dom/util/ziptool.cpp +++ b/src/dom/util/ziptool.cpp @@ -1261,17 +1261,21 @@ void Deflater::encodeDistStatic(unsigned int len, unsigned int dist) /** - * + * This method does the dirty work of dictionary + * compression. Basically it looks for redundant + * strings and has the current duplicate refer back + * to the previous one. */ bool Deflater::compressWindow() { + unsigned int windowSize = window.size(); //### Compress as much of the window as possible int i=0; std::vector::iterator iter; for (iter=window.begin() ; iter!=window.end() ; iter++) windowBuf[i++] = *iter; - while (windowPos < window.size()) + while (windowPos < windowSize) { //### Find best match, if any unsigned int bestMatchLen = 0; @@ -1280,18 +1284,22 @@ bool Deflater::compressWindow() { for (unsigned int lookBack=0 ; lookBack= windowPos) - lookAheadMax = windowPos - lookBack; - if (lookAheadMax > 258) - lookAheadMax = 258; - for (lookAhead = 0 ; lookAhead= windowPos) + lookAheadMax = windowPos - lookBack; + if (lookAheadMax > 258) + lookAheadMax = 258; + for (lookAhead = 1 ; lookAhead bestMatchLen) {