summaryrefslogtreecommitdiff
authorsimon <simon>2002-11-08 15:20:59 (UTC)
committer simon <simon>2002-11-08 15:20:59 (UTC)
commitd8ac5b68b504536136347547816992b1cf605cd4 (patch) (side-by-side diff)
tree7e90b9c23b78c7c67b5433bebd6a29e3e98e4bac
parent447735be20fad2642617e3ba4f7ef0b598f597db (diff)
downloadopie-d8ac5b68b504536136347547816992b1cf605cd4.zip
opie-d8ac5b68b504536136347547816992b1cf605cd4.tar.gz
opie-d8ac5b68b504536136347547816992b1cf605cd4.tar.bz2
- a couple of fixes like this one:
- fprintf(f, "%g", real); + fprintf(f, "%g", static_cast<double>(real)); with 'real' being a fouble object. as fprintf is a c function with variable arguments one cannot pass non-primitive objects through it and there is no way for the compiler to figure out the right conversion operator, so we give it a helping hand :)
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/unsupported/qpdf/xpdf/Gfx.cc2
-rw-r--r--noncore/unsupported/qpdf/xpdf/Object.cc2
-rw-r--r--noncore/unsupported/qpdf/xpdf/Page.cc4
3 files changed, 4 insertions, 4 deletions
diff --git a/noncore/unsupported/qpdf/xpdf/Gfx.cc b/noncore/unsupported/qpdf/xpdf/Gfx.cc
index 17d613e..f016c0e 100644
--- a/noncore/unsupported/qpdf/xpdf/Gfx.cc
+++ b/noncore/unsupported/qpdf/xpdf/Gfx.cc
@@ -1819,97 +1819,97 @@ void Gfx::doEndPath() {
}
//------------------------------------------------------------------------
// path clipping operators
//------------------------------------------------------------------------
void Gfx::opClip(Object args[], int numArgs) {
clip = clipNormal;
}
void Gfx::opEOClip(Object args[], int numArgs) {
clip = clipEO;
}
//------------------------------------------------------------------------
// text object operators
//------------------------------------------------------------------------
void Gfx::opBeginText(Object args[], int numArgs) {
state->setTextMat(1, 0, 0, 1, 0, 0);
state->textMoveTo(0, 0);
out->updateTextMat(state);
out->updateTextPos(state);
fontChanged = gTrue;
}
void Gfx::opEndText(Object args[], int numArgs) {
}
//------------------------------------------------------------------------
// text state operators
//------------------------------------------------------------------------
void Gfx::opSetCharSpacing(Object args[], int numArgs) {
state->setCharSpace(args[0].getNum());
out->updateCharSpace(state);
}
void Gfx::opSetFont(Object args[], int numArgs) {
GfxFont *font;
if (!(font = res->lookupFont(args[0].getName()))) {
return;
}
if (printCommands) {
printf(" font: tag=%s name='%s' %g\n",
font->getTag()->getCString(),
font->getName() ? font->getName()->getCString() : "???",
- args[1].getNum());
+ static_cast<double>(args[1].getNum()));
fflush(stdout);
}
state->setFont(font, args[1].getNum());
fontChanged = gTrue;
}
void Gfx::opSetTextLeading(Object args[], int numArgs) {
state->setLeading(args[0].getNum());
}
void Gfx::opSetTextRender(Object args[], int numArgs) {
state->setRender(args[0].getInt());
out->updateRender(state);
}
void Gfx::opSetTextRise(Object args[], int numArgs) {
state->setRise(args[0].getNum());
out->updateRise(state);
}
void Gfx::opSetWordSpacing(Object args[], int numArgs) {
state->setWordSpace(args[0].getNum());
out->updateWordSpace(state);
}
void Gfx::opSetHorizScaling(Object args[], int numArgs) {
state->setHorizScaling(args[0].getNum());
out->updateHorizScaling(state);
fontChanged = gTrue;
}
//------------------------------------------------------------------------
// text positioning operators
//------------------------------------------------------------------------
void Gfx::opTextMove(Object args[], int numArgs) {
fouble tx, ty;
tx = state->getLineX() + args[0].getNum();
ty = state->getLineY() + args[1].getNum();
state->textMoveTo(tx, ty);
out->updateTextPos(state);
}
void Gfx::opTextMoveSet(Object args[], int numArgs) {
fouble tx, ty;
tx = state->getLineX() + args[0].getNum();
diff --git a/noncore/unsupported/qpdf/xpdf/Object.cc b/noncore/unsupported/qpdf/xpdf/Object.cc
index 6d92c6a..77f1317 100644
--- a/noncore/unsupported/qpdf/xpdf/Object.cc
+++ b/noncore/unsupported/qpdf/xpdf/Object.cc
@@ -104,97 +104,97 @@ void Object::free() {
delete string;
break;
case objName:
gfree(name);
break;
case objArray:
if (!array->decRef()) {
delete array;
}
break;
case objDict:
if (!dict->decRef()) {
delete dict;
}
break;
case objStream:
if (!stream->decRef()) {
delete stream;
}
break;
case objCmd:
gfree(cmd);
break;
default:
break;
}
#ifdef DEBUG_MEM
--numAlloc[type];
#endif
type = objNone;
}
char *Object::getTypeName() {
return objTypeNames[type];
}
void Object::print(FILE *f) {
Object obj;
int i;
switch (type) {
case objBool:
fprintf(f, "%s", booln ? "true" : "false");
break;
case objInt:
fprintf(f, "%d", intg);
break;
case objReal:
- fprintf(f, "%g", real);
+ fprintf(f, "%g", static_cast<double>(real));
break;
case objString:
fprintf(f, "(");
fwrite(string->getCString(), 1, string->getLength(), stdout);
fprintf(f, ")");
break;
case objName:
fprintf(f, "/%s", name);
break;
case objNull:
fprintf(f, "null");
break;
case objArray:
fprintf(f, "[");
for (i = 0; i < arrayGetLength(); ++i) {
if (i > 0)
fprintf(f, " ");
arrayGetNF(i, &obj);
obj.print(f);
obj.free();
}
fprintf(f, "]");
break;
case objDict:
fprintf(f, "<<");
for (i = 0; i < dictGetLength(); ++i) {
fprintf(f, " /%s ", dictGetKey(i));
dictGetValNF(i, &obj);
obj.print(f);
obj.free();
}
fprintf(f, " >>");
break;
case objStream:
fprintf(f, "<stream>");
break;
case objRef:
fprintf(f, "%d %d R", ref.num, ref.gen);
break;
case objCmd:
fprintf(f, "%s", cmd);
break;
case objError:
fprintf(f, "<error>");
break;
case objEOF:
fprintf(f, "<EOF>");
break;
diff --git a/noncore/unsupported/qpdf/xpdf/Page.cc b/noncore/unsupported/qpdf/xpdf/Page.cc
index 9cc08c4..aead7da 100644
--- a/noncore/unsupported/qpdf/xpdf/Page.cc
+++ b/noncore/unsupported/qpdf/xpdf/Page.cc
@@ -185,97 +185,97 @@ Page::Page(XRef *xrefA, int numA, Dict *pageDict, PageAttrs *attrsA,
pageDict->lookupNF("Annots", &annots);
if (!(annots.isRef() || annots.isArray() || annots.isNull())) {
error(-1, "Page annotations object (page %d) is wrong type (%s)",
num, annots.getTypeName());
annots.free();
goto err2;
}
// contents
pageDict->lookupNF("Contents", &contents);
if (!(contents.isRef() || contents.isArray() ||
contents.isNull())) {
error(-1, "Page contents object (page %d) is wrong type (%s)",
num, contents.getTypeName());
contents.free();
goto err1;
}
return;
err2:
annots.initNull();
err1:
contents.initNull();
ok = gFalse;
}
Page::~Page() {
delete attrs;
annots.free();
contents.free();
}
void Page::display(OutputDev *out, fouble dpi, int rotate,
Links *links, Catalog *catalog) {
#ifndef PDF_PARSER_ONLY
PDFRectangle *box, *cropBox;
Gfx *gfx;
Object obj;
Link *link;
int i;
Annots *annotList;
box = getBox();
cropBox = getCropBox();
if (printCommands) {
printf("***** MediaBox = ll:%g,%g ur:%g,%g\n",
- box->x1, box->y1, box->x2, box->y2);
+ static_cast<double>(box->x1), static_cast<double>(box->y1), static_cast<double>(box->x2), static_cast<double>(box->y2));
if (isCropped()) {
printf("***** CropBox = ll:%g,%g ur:%g,%g\n",
- cropBox->x1, cropBox->y1, cropBox->x2, cropBox->y2);
+ static_cast<double>(cropBox->x1), static_cast<double>(cropBox->y1), static_cast<double>(cropBox->x2), static_cast<double>(cropBox->y2));
}
printf("***** Rotate = %d\n", attrs->getRotate());
}
rotate += getRotate();
if (rotate >= 360) {
rotate -= 360;
} else if (rotate < 0) {
rotate += 360;
}
gfx = new Gfx(xref, out, num, attrs->getResourceDict(),
dpi, box, isCropped(), cropBox, rotate, printCommands);
contents.fetch(xref, &obj);
if (!obj.isNull()) {
gfx->display(&obj);
}
obj.free();
// draw links
if (links) {
for (i = 0; i < links->getNumLinks(); ++i) {
link = links->getLink(i);
out->drawLink(link, catalog);
}
out->dump();
}
// draw non-link annotations
//~ need to reset CTM ???
annotList = new Annots(xref, annots.fetch(xref, &obj));
obj.free();
if (annotList->getNumAnnots() > 0) {
if (printCommands) {
printf("***** Annotations\n");
}
for (i = 0; i < annotList->getNumAnnots(); ++i) {
annotList->getAnnot(i)->draw(gfx);
}
out->dump();
}
delete annotList;
delete gfx;
#endif
}