[poppler] Branch 'poppler-0.8' - poppler/Page.cc
Albert Astals Cid
aacid at kemper.freedesktop.org
Mon May 26 11:52:34 PDT 2008
poppler/Page.cc | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
New commits:
commit be0e8d98a8aae2f826079e86d1a1238bf6c36f51
Author: Albert Astals Cid <aacid at kde.org>
Date: Mon May 26 20:51:06 2008 +0200
Move variables only used inside the loop inside the loop, fix delete of uninitialized data due to my previous patch
diff --git a/poppler/Page.cc b/poppler/Page.cc
index 90417e1..3da5976 100644
--- a/poppler/Page.cc
+++ b/poppler/Page.cc
@@ -455,12 +455,8 @@ GBool Page::loadThumb(unsigned char **data_out,
int *width_out, int *height_out,
int *rowstride_out)
{
- ImageStream *imgstr;
- unsigned char *pixbufdata;
unsigned int pixbufdatasize;
- int row, col;
int width, height, bits;
- unsigned char *p;
Object obj1, fetched_thumb;
Dict *dict;
GfxColorSpace *colorSpace;
@@ -519,14 +515,14 @@ GBool Page::loadThumb(unsigned char **data_out,
}
if (data_out) {
- pixbufdata = (unsigned char *) gmalloc(pixbufdatasize);
- p = pixbufdata;
- imgstr = new ImageStream(str, width,
+ unsigned char *pixbufdata = (unsigned char *) gmalloc(pixbufdatasize);
+ unsigned char *p = pixbufdata;
+ ImageStream *imgstr = new ImageStream(str, width,
colorMap->getNumPixelComps(),
colorMap->getBits());
imgstr->reset();
- for (row = 0; row < height; ++row) {
- for (col = 0; col < width; ++col) {
+ for (int row = 0; row < height; ++row) {
+ for (int col = 0; col < width; ++col) {
Guchar pix[gfxColorMaxComps];
GfxRGB rgb;
@@ -539,6 +535,7 @@ GBool Page::loadThumb(unsigned char **data_out,
}
}
*data_out = pixbufdata;
+ delete imgstr;
}
success = gTrue;
@@ -550,7 +547,6 @@ GBool Page::loadThumb(unsigned char **data_out,
if (rowstride_out)
*rowstride_out = width * 3;
- delete imgstr;
delete colorMap;
fail1:
fetched_thumb.free();
More information about the poppler
mailing list