[poppler] poppler/CachedFile.cc

Pino Toscano pino at kemper.freedesktop.org
Tue Apr 6 15:13:55 PDT 2010


 poppler/CachedFile.cc |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 3f302fdd78cd78873bf5376af84e83741a8daadb
Author: Pino Toscano <pino at kde.org>
Date:   Tue Apr 6 23:58:46 2010 +0200

    use a GooVector<bool> instead of a non-standard variable-length-array

diff --git a/poppler/CachedFile.cc b/poppler/CachedFile.cc
index 46627c3..95cc58b 100644
--- a/poppler/CachedFile.cc
+++ b/poppler/CachedFile.cc
@@ -73,7 +73,7 @@ int CachedFile::cache(const GooVector<ByteRange> &origRanges)
 {
   GooVector<int> loadChunks;
   int numChunks = length/CachedFileChunkSize + 1;
-  char chunkNeeded[numChunks];
+  GooVector<bool> chunkNeeded(numChunks);
   int startChunk, endChunk;
   GooVector<ByteRange> chunk_ranges, all;
   ByteRange range;
@@ -86,7 +86,7 @@ int CachedFile::cache(const GooVector<ByteRange> &origRanges)
     ranges = &all;
   }
 
-  memset(&chunkNeeded, 0, numChunks);
+  memset(&chunkNeeded[0], 0, sizeof(bool) * numChunks);
   for (size_t i = 0; i < ranges->size(); i++) {
 
     if ((*ranges)[i].length == 0) continue;
@@ -100,7 +100,7 @@ int CachedFile::cache(const GooVector<ByteRange> &origRanges)
     endChunk = end / CachedFileChunkSize;
     for (int chunk = startChunk; chunk <= endChunk; chunk++) {
       if ((*chunks)[chunk].state == chunkStateNew) {
-           chunkNeeded[chunk] = 1;
+           chunkNeeded[chunk] = true;
       }
     }
   }


More information about the poppler mailing list