summaryrefslogtreecommitdiffstats
path: root/src/extension/internal
diff options
context:
space:
mode:
authorKris De Gussem <kris.degussem@gmail.com>2012-02-15 07:25:29 +0000
committerKris <Kris.De.Gussem@hotmail.com>2012-02-15 07:25:29 +0000
commit8edcffdc305b2c09a4f9b886fee12ecfc48a0e24 (patch)
tree2365a85f9cae27fb1f8053ff69f445b02304c12e /src/extension/internal
parentSnap to grid/guide lines perpendicularly (diff)
downloadinkscape-8edcffdc305b2c09a4f9b886fee12ecfc48a0e24.tar.gz
inkscape-8edcffdc305b2c09a4f9b886fee12ecfc48a0e24.zip
cppcheck
(bzr r10977)
Diffstat (limited to 'src/extension/internal')
-rw-r--r--src/extension/internal/filter/paint.h3
-rw-r--r--src/extension/internal/odf.cpp3
-rw-r--r--src/extension/internal/pdfinput/pdf-parser.cpp157
3 files changed, 79 insertions, 84 deletions
diff --git a/src/extension/internal/filter/paint.h b/src/extension/internal/filter/paint.h
index b7909a512..debdd7d79 100644
--- a/src/extension/internal/filter/paint.h
+++ b/src/extension/internal/filter/paint.h
@@ -918,7 +918,6 @@ Posterize::get_filter_text (Inkscape::Extension::Extension * ext)
transf << "0";
int levels = ext->get_param_int("levels") + 1;
const gchar *effecttype = ext->get_param_enum("type");
- float val = 0.0;
if (levels == 1) {
if ((g_ascii_strcasecmp("dented", effecttype) == 0)) {
transf << " 1 0 1";
@@ -927,7 +926,7 @@ Posterize::get_filter_text (Inkscape::Extension::Extension * ext)
}
} else {
for ( int step = 1 ; step <= levels ; step++ ) {
- val = (float) step / levels;
+ float val = (float) step / levels;
transf << " " << val;
if ((g_ascii_strcasecmp("dented", effecttype) == 0)) {
transf << " " << (val - ((float) 1 / (3 * levels))) << " " << (val + ((float) 1 / (2 * levels)));
diff --git a/src/extension/internal/odf.cpp b/src/extension/internal/odf.cpp
index 3e0afdd8e..bb9fd3d85 100644
--- a/src/extension/internal/odf.cpp
+++ b/src/extension/internal/odf.cpp
@@ -569,7 +569,6 @@ void SingularValueDecomposition::calculate()
// Main iteration loop for the singular values.
int pp = p-1;
- int iter = 0;
//double eps = pow(2.0,-52.0);
//double tiny = pow(2.0,-966.0);
//let's just calculate these now
@@ -749,7 +748,6 @@ void SingularValueDecomposition::calculate()
}
}
e[p-2] = f;
- iter = iter + 1;
}
break;
@@ -789,7 +787,6 @@ void SingularValueDecomposition::calculate()
}
k++;
}
- iter = 0;
p--;
}
break;
diff --git a/src/extension/internal/pdfinput/pdf-parser.cpp b/src/extension/internal/pdfinput/pdf-parser.cpp
index 554822dea..1c21fbca3 100644
--- a/src/extension/internal/pdfinput/pdf-parser.cpp
+++ b/src/extension/internal/pdfinput/pdf-parser.cpp
@@ -363,10 +363,9 @@ PdfParser::~PdfParser() {
void PdfParser::parse(Object *obj, GBool topLevel) {
Object obj2;
- int i;
if (obj->isArray()) {
- for (i = 0; i < obj->arrayGetLength(); ++i) {
+ for (int i = 0; i < obj->arrayGetLength(); ++i) {
obj->arrayGet(i, &obj2);
if (!obj2.isStream()) {
error(-1, const_cast<char*>("Weird page contents"));
@@ -2339,7 +2338,7 @@ void PdfParser::doShowText(GooString *s) {
#else
Unicode u[8];
#endif
- double x, y, dx, dy, curX, curY, tdx, tdy, lineX, lineY;
+ double x, y, dx, dy, tdx, tdy;
double originX, originY, tOriginX, tOriginY;
double oldCTM[6], newCTM[6];
double *mat;
@@ -2347,7 +2346,7 @@ void PdfParser::doShowText(GooString *s) {
Dict *resDict;
Parser *oldParser;
char *p;
- int len, n, uLen, i;
+ int len, n, uLen;
font = state->getFont();
wMode = font->getWMode();
@@ -2357,7 +2356,7 @@ void PdfParser::doShowText(GooString *s) {
// handle a Type 3 char
if (font->getType() == fontType3 && 0) {//out->interpretType3Chars()) {
mat = state->getCTM();
- for (i = 0; i < 6; ++i) {
+ for (int i = 0; i < 6; ++i) {
oldCTM[i] = mat[i];
}
mat = state->getTextMat();
@@ -2377,10 +2376,10 @@ void PdfParser::doShowText(GooString *s) {
newCTM[0] *= state->getHorizScaling();
newCTM[2] *= state->getHorizScaling();
state->textTransformDelta(0, state->getRise(), &riseX, &riseY);
- curX = state->getCurX();
- curY = state->getCurY();
- lineX = state->getLineX();
- lineY = state->getLineY();
+ double curX = state->getCurX();
+ double curY = state->getCurY();
+ double lineX = state->getLineX();
+ double lineY = state->getLineY();
oldParser = parser;
p = s->getCString();
len = s->getLength();
@@ -2518,7 +2517,7 @@ void PdfParser::doImage(Object * /*ref*/, Stream *str, GBool inlineImg)
{
Dict *dict, *maskDict;
int width, height;
- int bits, maskBits;
+ int bits;
StreamColorSpaceMode csMode;
GBool mask;
GBool invert;
@@ -2679,78 +2678,78 @@ void PdfParser::doImage(Object * /*ref*/, Stream *str, GBool inlineImg)
dict->lookup(const_cast<char*>("Mask"), &maskObj);
dict->lookup(const_cast<char*>("SMask"), &smaskObj);
if (smaskObj.isStream()) {
- // soft mask
- if (inlineImg) {
- goto err1;
- }
- maskStr = smaskObj.getStream();
- maskDict = smaskObj.streamGetDict();
- maskDict->lookup(const_cast<char*>("Width"), &obj1);
- if (obj1.isNull()) {
- obj1.free();
- maskDict->lookup(const_cast<char*>("W"), &obj1);
- }
- if (!obj1.isInt()) {
- goto err2;
- }
- maskWidth = obj1.getInt();
- obj1.free();
- maskDict->lookup(const_cast<char*>("Height"), &obj1);
- if (obj1.isNull()) {
- obj1.free();
- maskDict->lookup(const_cast<char*>("H"), &obj1);
- }
- if (!obj1.isInt()) {
- goto err2;
- }
- maskHeight = obj1.getInt();
- obj1.free();
- maskDict->lookup(const_cast<char*>("BitsPerComponent"), &obj1);
- if (obj1.isNull()) {
- obj1.free();
- maskDict->lookup(const_cast<char*>("BPC"), &obj1);
- }
- if (!obj1.isInt()) {
- goto err2;
- }
- maskBits = obj1.getInt();
- obj1.free();
- maskDict->lookup(const_cast<char*>("ColorSpace"), &obj1);
- if (obj1.isNull()) {
- obj1.free();
- maskDict->lookup(const_cast<char*>("CS"), &obj1);
- }
- if (obj1.isName()) {
- res->lookupColorSpace(obj1.getName(), &obj2);
- if (!obj2.isNull()) {
- obj1.free();
- obj1 = obj2;
- } else {
- obj2.free();
- }
- }
+ // soft mask
+ if (inlineImg) {
+ goto err1;
+ }
+ maskStr = smaskObj.getStream();
+ maskDict = smaskObj.streamGetDict();
+ maskDict->lookup(const_cast<char*>("Width"), &obj1);
+ if (obj1.isNull()) {
+ obj1.free();
+ maskDict->lookup(const_cast<char*>("W"), &obj1);
+ }
+ if (!obj1.isInt()) {
+ goto err2;
+ }
+ maskWidth = obj1.getInt();
+ obj1.free();
+ maskDict->lookup(const_cast<char*>("Height"), &obj1);
+ if (obj1.isNull()) {
+ obj1.free();
+ maskDict->lookup(const_cast<char*>("H"), &obj1);
+ }
+ if (!obj1.isInt()) {
+ goto err2;
+ }
+ maskHeight = obj1.getInt();
+ obj1.free();
+ maskDict->lookup(const_cast<char*>("BitsPerComponent"), &obj1);
+ if (obj1.isNull()) {
+ obj1.free();
+ maskDict->lookup(const_cast<char*>("BPC"), &obj1);
+ }
+ if (!obj1.isInt()) {
+ goto err2;
+ }
+ int maskBits = obj1.getInt();
+ obj1.free();
+ maskDict->lookup(const_cast<char*>("ColorSpace"), &obj1);
+ if (obj1.isNull()) {
+ obj1.free();
+ maskDict->lookup(const_cast<char*>("CS"), &obj1);
+ }
+ if (obj1.isName()) {
+ res->lookupColorSpace(obj1.getName(), &obj2);
+ if (!obj2.isNull()) {
+ obj1.free();
+ obj1 = obj2;
+ } else {
+ obj2.free();
+ }
+ }
#ifdef POPPLER_NEW_COLOR_SPACE_API
- maskColorSpace = GfxColorSpace::parse(&obj1, NULL);
+ maskColorSpace = GfxColorSpace::parse(&obj1, NULL);
#else
- maskColorSpace = GfxColorSpace::parse(&obj1);
+ maskColorSpace = GfxColorSpace::parse(&obj1);
#endif
- obj1.free();
- if (!maskColorSpace || maskColorSpace->getMode() != csDeviceGray) {
- goto err1;
- }
- maskDict->lookup(const_cast<char*>("Decode"), &obj1);
- if (obj1.isNull()) {
- obj1.free();
- maskDict->lookup(const_cast<char*>("D"), &obj1);
- }
- maskColorMap = new GfxImageColorMap(maskBits, &obj1, maskColorSpace);
- obj1.free();
- if (!maskColorMap->isOk()) {
- delete maskColorMap;
- goto err1;
- }
- //~ handle the Matte entry
- haveSoftMask = gTrue;
+ obj1.free();
+ if (!maskColorSpace || maskColorSpace->getMode() != csDeviceGray) {
+ goto err1;
+ }
+ maskDict->lookup(const_cast<char*>("Decode"), &obj1);
+ if (obj1.isNull()) {
+ obj1.free();
+ maskDict->lookup(const_cast<char*>("D"), &obj1);
+ }
+ maskColorMap = new GfxImageColorMap(maskBits, &obj1, maskColorSpace);
+ obj1.free();
+ if (!maskColorMap->isOk()) {
+ delete maskColorMap;
+ goto err1;
+ }
+ //~ handle the Matte entry
+ haveSoftMask = gTrue;
} else if (maskObj.isArray()) {
// color key mask
for (i = 0;