[poppler] poppler/CachedFile.cc

Albert Astals Cid aacid at kde.org
Wed Apr 7 11:04:45 PDT 2010


A Dimecres, 7 d'abril de 2010, Hib Eris va escriure:
> Hi Pino,
> 
> Thank you for improving my code. Just a question: I see you are using
> 'bool'. Often I see the use of 'gBool' in poppler's code. What is
> preferred in poppler?

Usually GBool is preferred for the sake of consistency.

Albert

> 
> Hib
> 
> 
> On Wed, Apr 7, 2010 at 12:13 AM, Pino Toscano
> 
> <pino at kemper.freedesktop.org> wrote:
> >  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;
> >       }
> >     }
> >   }
> > _______________________________________________
> > poppler mailing list
> > poppler at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/poppler
> 
> _______________________________________________
> poppler mailing list
> poppler at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/poppler


More information about the poppler mailing list