summaryrefslogtreecommitdiff
authorsimon <simon>2002-11-08 15:20:59 (UTC)
committer simon <simon>2002-11-08 15:20:59 (UTC)
commitd8ac5b68b504536136347547816992b1cf605cd4 (patch) (unidiff)
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) (ignore 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
@@ -1843,49 +1843,49 @@ void Gfx::opBeginText(Object args[], int numArgs) {
1843} 1843}
1844 1844
1845void Gfx::opEndText(Object args[], int numArgs) { 1845void Gfx::opEndText(Object args[], int numArgs) {
1846} 1846}
1847 1847
1848//------------------------------------------------------------------------ 1848//------------------------------------------------------------------------
1849// text state operators 1849// text state operators
1850//------------------------------------------------------------------------ 1850//------------------------------------------------------------------------
1851 1851
1852void Gfx::opSetCharSpacing(Object args[], int numArgs) { 1852void Gfx::opSetCharSpacing(Object args[], int numArgs) {
1853 state->setCharSpace(args[0].getNum()); 1853 state->setCharSpace(args[0].getNum());
1854 out->updateCharSpace(state); 1854 out->updateCharSpace(state);
1855} 1855}
1856 1856
1857void Gfx::opSetFont(Object args[], int numArgs) { 1857void Gfx::opSetFont(Object args[], int numArgs) {
1858 GfxFont *font; 1858 GfxFont *font;
1859 1859
1860 if (!(font = res->lookupFont(args[0].getName()))) { 1860 if (!(font = res->lookupFont(args[0].getName()))) {
1861 return; 1861 return;
1862 } 1862 }
1863 if (printCommands) { 1863 if (printCommands) {
1864 printf(" font: tag=%s name='%s' %g\n", 1864 printf(" font: tag=%s name='%s' %g\n",
1865 font->getTag()->getCString(), 1865 font->getTag()->getCString(),
1866 font->getName() ? font->getName()->getCString() : "???", 1866 font->getName() ? font->getName()->getCString() : "???",
1867 args[1].getNum()); 1867 static_cast<double>(args[1].getNum()));
1868 fflush(stdout); 1868 fflush(stdout);
1869 } 1869 }
1870 state->setFont(font, args[1].getNum()); 1870 state->setFont(font, args[1].getNum());
1871 fontChanged = gTrue; 1871 fontChanged = gTrue;
1872} 1872}
1873 1873
1874void Gfx::opSetTextLeading(Object args[], int numArgs) { 1874void Gfx::opSetTextLeading(Object args[], int numArgs) {
1875 state->setLeading(args[0].getNum()); 1875 state->setLeading(args[0].getNum());
1876} 1876}
1877 1877
1878void Gfx::opSetTextRender(Object args[], int numArgs) { 1878void Gfx::opSetTextRender(Object args[], int numArgs) {
1879 state->setRender(args[0].getInt()); 1879 state->setRender(args[0].getInt());
1880 out->updateRender(state); 1880 out->updateRender(state);
1881} 1881}
1882 1882
1883void Gfx::opSetTextRise(Object args[], int numArgs) { 1883void Gfx::opSetTextRise(Object args[], int numArgs) {
1884 state->setRise(args[0].getNum()); 1884 state->setRise(args[0].getNum());
1885 out->updateRise(state); 1885 out->updateRise(state);
1886} 1886}
1887 1887
1888void Gfx::opSetWordSpacing(Object args[], int numArgs) { 1888void Gfx::opSetWordSpacing(Object args[], int numArgs) {
1889 state->setWordSpace(args[0].getNum()); 1889 state->setWordSpace(args[0].getNum());
1890 out->updateWordSpace(state); 1890 out->updateWordSpace(state);
1891} 1891}
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
@@ -128,49 +128,49 @@ void Object::free() {
128 break; 128 break;
129 } 129 }
130#ifdef DEBUG_MEM 130#ifdef DEBUG_MEM
131 --numAlloc[type]; 131 --numAlloc[type];
132#endif 132#endif
133 type = objNone; 133 type = objNone;
134} 134}
135 135
136char *Object::getTypeName() { 136char *Object::getTypeName() {
137 return objTypeNames[type]; 137 return objTypeNames[type];
138} 138}
139 139
140void Object::print(FILE *f) { 140void Object::print(FILE *f) {
141 Object obj; 141 Object obj;
142 int i; 142 int i;
143 143
144 switch (type) { 144 switch (type) {
145 case objBool: 145 case objBool:
146 fprintf(f, "%s", booln ? "true" : "false"); 146 fprintf(f, "%s", booln ? "true" : "false");
147 break; 147 break;
148 case objInt: 148 case objInt:
149 fprintf(f, "%d", intg); 149 fprintf(f, "%d", intg);
150 break; 150 break;
151 case objReal: 151 case objReal:
152 fprintf(f, "%g", real); 152 fprintf(f, "%g", static_cast<double>(real));
153 break; 153 break;
154 case objString: 154 case objString:
155 fprintf(f, "("); 155 fprintf(f, "(");
156 fwrite(string->getCString(), 1, string->getLength(), stdout); 156 fwrite(string->getCString(), 1, string->getLength(), stdout);
157 fprintf(f, ")"); 157 fprintf(f, ")");
158 break; 158 break;
159 case objName: 159 case objName:
160 fprintf(f, "/%s", name); 160 fprintf(f, "/%s", name);
161 break; 161 break;
162 case objNull: 162 case objNull:
163 fprintf(f, "null"); 163 fprintf(f, "null");
164 break; 164 break;
165 case objArray: 165 case objArray:
166 fprintf(f, "["); 166 fprintf(f, "[");
167 for (i = 0; i < arrayGetLength(); ++i) { 167 for (i = 0; i < arrayGetLength(); ++i) {
168 if (i > 0) 168 if (i > 0)
169 fprintf(f, " "); 169 fprintf(f, " ");
170 arrayGetNF(i, &obj); 170 arrayGetNF(i, &obj);
171 obj.print(f); 171 obj.print(f);
172 obj.free(); 172 obj.free();
173 } 173 }
174 fprintf(f, "]"); 174 fprintf(f, "]");
175 break; 175 break;
176 case objDict: 176 case objDict:
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
@@ -209,52 +209,52 @@ Page::Page(XRef *xrefA, int numA, Dict *pageDict, PageAttrs *attrsA,
209 ok = gFalse; 209 ok = gFalse;
210} 210}
211 211
212Page::~Page() { 212Page::~Page() {
213 delete attrs; 213 delete attrs;
214 annots.free(); 214 annots.free();
215 contents.free(); 215 contents.free();
216} 216}
217 217
218void Page::display(OutputDev *out, fouble dpi, int rotate, 218void Page::display(OutputDev *out, fouble dpi, int rotate,
219 Links *links, Catalog *catalog) { 219 Links *links, Catalog *catalog) {
220#ifndef PDF_PARSER_ONLY 220#ifndef PDF_PARSER_ONLY
221 PDFRectangle *box, *cropBox; 221 PDFRectangle *box, *cropBox;
222 Gfx *gfx; 222 Gfx *gfx;
223 Object obj; 223 Object obj;
224 Link *link; 224 Link *link;
225 int i; 225 int i;
226 Annots *annotList; 226 Annots *annotList;
227 227
228 box = getBox(); 228 box = getBox();
229 cropBox = getCropBox(); 229 cropBox = getCropBox();
230 230
231 if (printCommands) { 231 if (printCommands) {
232 printf("***** MediaBox = ll:%g,%g ur:%g,%g\n", 232 printf("***** MediaBox = ll:%g,%g ur:%g,%g\n",
233 box->x1, box->y1, box->x2, box->y2); 233 static_cast<double>(box->x1), static_cast<double>(box->y1), static_cast<double>(box->x2), static_cast<double>(box->y2));
234 if (isCropped()) { 234 if (isCropped()) {
235 printf("***** CropBox = ll:%g,%g ur:%g,%g\n", 235 printf("***** CropBox = ll:%g,%g ur:%g,%g\n",
236 cropBox->x1, cropBox->y1, cropBox->x2, cropBox->y2); 236 static_cast<double>(cropBox->x1), static_cast<double>(cropBox->y1), static_cast<double>(cropBox->x2), static_cast<double>(cropBox->y2));
237 } 237 }
238 printf("***** Rotate = %d\n", attrs->getRotate()); 238 printf("***** Rotate = %d\n", attrs->getRotate());
239 } 239 }
240 240
241 rotate += getRotate(); 241 rotate += getRotate();
242 if (rotate >= 360) { 242 if (rotate >= 360) {
243 rotate -= 360; 243 rotate -= 360;
244 } else if (rotate < 0) { 244 } else if (rotate < 0) {
245 rotate += 360; 245 rotate += 360;
246 } 246 }
247 gfx = new Gfx(xref, out, num, attrs->getResourceDict(), 247 gfx = new Gfx(xref, out, num, attrs->getResourceDict(),
248 dpi, box, isCropped(), cropBox, rotate, printCommands); 248 dpi, box, isCropped(), cropBox, rotate, printCommands);
249 contents.fetch(xref, &obj); 249 contents.fetch(xref, &obj);
250 if (!obj.isNull()) { 250 if (!obj.isNull()) {
251 gfx->display(&obj); 251 gfx->display(&obj);
252 } 252 }
253 obj.free(); 253 obj.free();
254 254
255 // draw links 255 // draw links
256 if (links) { 256 if (links) {
257 for (i = 0; i < links->getNumLinks(); ++i) { 257 for (i = 0; i < links->getNumLinks(); ++i) {
258 link = links->getLink(i); 258 link = links->getLink(i);
259 out->drawLink(link, catalog); 259 out->drawLink(link, catalog);
260 } 260 }