diff options
Diffstat (limited to 'xpdf/pdftoppm.cc')
-rw-r--r-- | xpdf/pdftoppm.cc | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/xpdf/pdftoppm.cc b/xpdf/pdftoppm.cc index cfc7236..17c0bbf 100644 --- a/xpdf/pdftoppm.cc +++ b/xpdf/pdftoppm.cc @@ -8,6 +8,14 @@ #include <aconf.h> #include <stdio.h> +#ifdef _WIN32 +# include <io.h> +# include <fcntl.h> +#endif +#ifdef DEBUG_FP_LINUX +# include <fenv.h> +# include <fpu_control.h> +#endif #include "parseargs.h" #include "gmem.h" #include "GString.h" @@ -24,7 +32,6 @@ static int lastPage = 0; static int resolution = 150; static GBool mono = gFalse; static GBool gray = gFalse; -static char enableT1libStr[16] = ""; static char enableFreeTypeStr[16] = ""; static char antialiasStr[16] = ""; static char vectorAntialiasStr[16] = ""; @@ -46,10 +53,6 @@ static ArgDesc argDesc[] = { "generate a monochrome PBM file"}, {"-gray", argFlag, &gray, 0, "generate a grayscale PGM file"}, -#if HAVE_T1LIB_H - {"-t1lib", argString, enableT1libStr, sizeof(enableT1libStr), - "enable t1lib font rasterizer: yes, no"}, -#endif #if HAVE_FREETYPE_FREETYPE_H | HAVE_FREETYPE_H {"-freetype", argString, enableFreeTypeStr, sizeof(enableFreeTypeStr), "enable FreeType font rasterizer: yes, no"}, @@ -91,6 +94,21 @@ int main(int argc, char *argv[]) { int exitCode; int pg; +#ifdef DEBUG_FP_LINUX + // enable exceptions on floating point div-by-zero + feenableexcept(FE_DIVBYZERO); + // force 64-bit rounding: this avoids changes in output when minor + // code changes result in spills of x87 registers; it also avoids + // differences in output with valgrind's 64-bit floating point + // emulation (yes, this is a kludge; but it's pretty much + // unavoidable given the x87 instruction set; see gcc bug 323 for + // more info) + fpu_control_t cw; + _FPU_GETCW(cw); + cw = (cw & ~_FPU_EXTENDED) | _FPU_DOUBLE; + _FPU_SETCW(cw); +#endif + exitCode = 99; // parse args @@ -112,11 +130,6 @@ int main(int argc, char *argv[]) { // read config file globalParams = new GlobalParams(cfgFileName); globalParams->setupBaseFonts(NULL); - if (enableT1libStr[0]) { - if (!globalParams->setEnableT1lib(enableT1libStr)) { - fprintf(stderr, "Bad '-t1lib' value on command line\n"); - } - } if (enableFreeTypeStr[0]) { if (!globalParams->setEnableFreeType(enableFreeTypeStr)) { fprintf(stderr, "Bad '-freetype' value on command line\n"); @@ -182,6 +195,9 @@ int main(int argc, char *argv[]) { doc->displayPage(splashOut, pg, resolution, resolution, 0, gFalse, gTrue, gFalse); if (!strcmp(ppmRoot, "-")) { +#ifdef _WIN32 + _setmode(_fileno(stdout), _O_BINARY); +#endif splashOut->getBitmap()->writePNMFile(stdout); } else { ppmFile = GString::format("{0:s}-{1:06d}.{2:s}", |