From 2610a3462d1ac3f20cba8f16dd07cba8a8c2fbef Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Sun, 15 Aug 1999 21:06:36 +0000 Subject: [PATCH] Break everything except bonobo-image-x-pdf :-) New cleaner xpdf IO code. use make bonobo-image-x-pdf in xpdf to compile. --- pdf/goo/Makefile.in | 16 +++++++--------- pdf/xpdf/ChangeLog | 7 +++++++ pdf/xpdf/Makefile.am | 8 +++++++- pdf/xpdf/Makefile.in | 19 +++++++++++-------- pdf/xpdf/Object.h | 5 +++-- pdf/xpdf/PDFDoc.cc | 34 +++++++--------------------------- pdf/xpdf/PDFDoc.h | 5 +++-- pdf/xpdf/Stream.cc | 20 ++++++++++---------- pdf/xpdf/Stream.h | 33 +++++++++++++++++---------------- pdf/xpdf/XRef.h | 3 ++- pdf/xpdf/bonobo-image-x-pdf.cc | 23 ++++++++++++++++++----- pdf/xpdf/gpdf.cc | 4 +++- pdf/xpdf/pdfimages.cc | 2 +- pdf/xpdf/pdfinfo.cc | 2 +- pdf/xpdf/pdftopbm.cc | 2 +- pdf/xpdf/pdftops.cc | 2 +- pdf/xpdf/pdftotext.cc | 2 +- pdf/xpdf/xpdf.cc | 2 +- 18 files changed, 101 insertions(+), 88 deletions(-) diff --git a/pdf/goo/Makefile.in b/pdf/goo/Makefile.in index 5881ce2f..e1c47240 100644 --- a/pdf/goo/Makefile.in +++ b/pdf/goo/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated automatically by automake 1.4 from Makefile.am +# Makefile.in generated automatically by automake 1.4a from Makefile.am # Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation @@ -46,9 +46,10 @@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) +INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_FLAG = transform = @program_transform_name@ NORMAL_INSTALL = : @@ -96,16 +97,13 @@ PACKAGE = @PACKAGE@ PTHREAD_LIB = @PTHREAD_LIB@ RANLIB = @RANLIB@ STRIP = @STRIP@ +USE_SYMBOL_UNDERSCORE = @USE_SYMBOL_UNDERSCORE@ VERSION = @VERSION@ XPM_LIBS = @XPM_LIBS@ YACC = @YACC@ ZVT_LIBS = @ZVT_LIBS@ cflags_set = @cflags_set@ cxxflags_set = @cxxflags_set@ -t1_CFLAGS = @t1_CFLAGS@ -t1_LIBS = @t1_LIBS@ -t1x_CFLAGS = @t1x_CFLAGS@ -t1x_LIBS = @t1x_LIBS@ lib_LIBRARIES = libgoo.a @@ -145,7 +143,7 @@ DIST_COMMON = Makefile.am Makefile.in DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) -TAR = tar +TAR = gtar GZIP_ENV = --best DEP_FILES = .deps/GString.P .deps/gfile.P .deps/gmem.P .deps/gmempp.P \ .deps/parseargs.P @@ -278,7 +276,7 @@ distdir: $(DISTFILES) @for file in $(DISTFILES); do \ d=$(srcdir); \ if test -d $$d/$$file; then \ - cp -pr $$/$$file $(distdir)/$$file; \ + cp -pr $$d/$$file $(distdir)/$$file; \ else \ test -f $(distdir)/$$file \ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ @@ -358,7 +356,7 @@ uninstall: uninstall-am all-am: Makefile $(LIBRARIES) all-redirect: all-am install-strip: - $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install + $(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install installdirs: $(mkinstalldirs) $(DESTDIR)$(libdir) diff --git a/pdf/xpdf/ChangeLog b/pdf/xpdf/ChangeLog index 1e6617ca..7989d7db 100644 --- a/pdf/xpdf/ChangeLog +++ b/pdf/xpdf/ChangeLog @@ -1,3 +1,10 @@ +1999-08-15 Michael Meeks + + * Now bonobo-image-x-pdf works, but everything else + is broken: use + + make bonobo-image-xpdf to compile... + 1999-08-11 Michael Meeks * bonobo-image-x-pdf.cc: Fixed innumerable bugs, diff --git a/pdf/xpdf/Makefile.am b/pdf/xpdf/Makefile.am index 6c6ceb02..7d2be720 100644 --- a/pdf/xpdf/Makefile.am +++ b/pdf/xpdf/Makefile.am @@ -13,8 +13,9 @@ endif bin_PROGRAMS = pdftops pdftotext pdfinfo pdftopbm pdfimages $(gui) bonobo-image-x-pdf -common_sources = \ +common_sources = \ Array.cc \ + BaseFile.h \ Catalog.cc \ Dict.cc \ Error.cc \ @@ -51,9 +52,14 @@ gpdf_LDADD = \ bonobo_image_x_pdf_SOURCES = \ $(common_sources) \ + BonoboFile.h \ + BonoboFile.cc \ GOutputDev.cc \ bonobo-image-x-pdf.cc +bonobo_image_x_pdf_CFLAGS = \ + -DBONOBO_IO + bonobo_image_x_pdf_LDADD = \ ../goo/libgoo.a \ $(GTK_LIBS) \ diff --git a/pdf/xpdf/Makefile.in b/pdf/xpdf/Makefile.in index d221b625..10af0b63 100644 --- a/pdf/xpdf/Makefile.in +++ b/pdf/xpdf/Makefile.in @@ -112,7 +112,7 @@ INCLUDES = -I$(top_srcdir)/goo -I$(top_srcdir)/ltk -DGPDF_GLADE_DIR=\""$(gla bin_PROGRAMS = pdftops pdftotext pdfinfo pdftopbm pdfimages $(gui) bonobo-image-x-pdf -common_sources = Array.cc Catalog.cc Dict.cc Error.cc FontEncoding.cc FontEncoding.h FontFile.cc FontFile.h FontInfo.h Gfx.cc GfxFont.cc GfxState.cc Lexer.cc Link.cc Object.cc OutputDev.cc Page.cc Params.cc Parser.cc PDFDoc.cc Stream.cc TextOutputDev.cc XRef.cc +common_sources = Array.cc BaseFile.h Catalog.cc Dict.cc Error.cc FontEncoding.cc FontEncoding.h FontFile.cc FontFile.h FontInfo.h Gfx.cc GfxFont.cc GfxState.cc Lexer.cc Link.cc Object.cc OutputDev.cc Page.cc Params.cc Parser.cc PDFDoc.cc Stream.cc TextOutputDev.cc XRef.cc gpdf_CFLAGS = @@ -123,7 +123,10 @@ gpdf_SOURCES = $(common_sources) GOutputDev.cc gpdf.cc gpdf_LDADD = $(EXTRA_GNOME_LIBS) ../goo/libgoo.a -bonobo_image_x_pdf_SOURCES = $(common_sources) GOutputDev.cc bonobo-image-x-pdf.cc +bonobo_image_x_pdf_SOURCES = $(common_sources) BonoboFile.h BonoboFile.cc GOutputDev.cc bonobo-image-x-pdf.cc + + +bonobo_image_x_pdf_CFLAGS = -DBONOBO_IO bonobo_image_x_pdf_LDADD = ../goo/libgoo.a $(GTK_LIBS) $(GNOME_LIBDIR) -lbonobo $(GNOMEGNORBA_LIBS) $(INTLLIBS) @@ -227,7 +230,7 @@ xpdf_LDFLAGS = bonobo_image_x_pdf_OBJECTS = Array.o Catalog.o Dict.o Error.o \ FontEncoding.o FontFile.o Gfx.o GfxFont.o GfxState.o Lexer.o Link.o \ Object.o OutputDev.o Page.o Params.o Parser.o PDFDoc.o Stream.o \ -TextOutputDev.o XRef.o GOutputDev.o bonobo-image-x-pdf.o +TextOutputDev.o XRef.o BonoboFile.o GOutputDev.o bonobo-image-x-pdf.o bonobo_image_x_pdf_DEPENDENCIES = ../goo/libgoo.a bonobo_image_x_pdf_LDFLAGS = CXXFLAGS = @CXXFLAGS@ @@ -249,11 +252,11 @@ DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) TAR = gtar GZIP_ENV = --best -DEP_FILES = .deps/Array.P .deps/Catalog.P .deps/Dict.P .deps/Error.P \ -.deps/FontEncoding.P .deps/FontFile.P .deps/GOutputDev.P .deps/Gfx.P \ -.deps/GfxFont.P .deps/GfxState.P .deps/ImageOutputDev.P \ -.deps/LTKOutputDev.P .deps/Lexer.P .deps/Link.P .deps/Object.P \ -.deps/OutputDev.P .deps/PBMOutputDev.P .deps/PDFDoc.P \ +DEP_FILES = .deps/Array.P .deps/BonoboFile.P .deps/Catalog.P \ +.deps/Dict.P .deps/Error.P .deps/FontEncoding.P .deps/FontFile.P \ +.deps/GOutputDev.P .deps/Gfx.P .deps/GfxFont.P .deps/GfxState.P \ +.deps/ImageOutputDev.P .deps/LTKOutputDev.P .deps/Lexer.P .deps/Link.P \ +.deps/Object.P .deps/OutputDev.P .deps/PBMOutputDev.P .deps/PDFDoc.P \ .deps/PSOutputDev.P .deps/Page.P .deps/Params.P .deps/Parser.P \ .deps/Stream.P .deps/TextOutputDev.P .deps/XOutputDev.P .deps/XRef.P \ .deps/bonobo-image-x-pdf.P .deps/gpdf.P .deps/pdfimages.P \ diff --git a/pdf/xpdf/Object.h b/pdf/xpdf/Object.h index 395096fb..305d28a3 100644 --- a/pdf/xpdf/Object.h +++ b/pdf/xpdf/Object.h @@ -18,6 +18,7 @@ #include "gtypes.h" #include "gmem.h" #include "GString.h" +#include "BaseFile.h" class Array; class Dict; @@ -177,7 +178,7 @@ public: char *streamGetLine(char *buf, int size); int streamGetPos(); void streamSetPos(int pos); - FILE *streamGetFile(); + BaseFile streamGetFile(); Dict *streamGetDict(); // Output. @@ -290,7 +291,7 @@ inline int Object::streamGetPos() inline void Object::streamSetPos(int pos) { stream->setPos(pos); } -inline FILE *Object::streamGetFile() +inline BaseFile Object::streamGetFile() { return stream->getFile(); } inline Dict *Object::streamGetDict() diff --git a/pdf/xpdf/PDFDoc.cc b/pdf/xpdf/PDFDoc.cc index 1537c6a3..599ceb10 100644 --- a/pdf/xpdf/PDFDoc.cc +++ b/pdf/xpdf/PDFDoc.cc @@ -29,11 +29,10 @@ // PDFDoc //------------------------------------------------------------------------ -PDFDoc::PDFDoc(GString *fileName1) { +PDFDoc::PDFDoc(BaseFile file1, GString *fileName1) { FileStream *str; Object catObj; Object obj; - GString *fileName2; // setup ok = gFalse; @@ -42,33 +41,14 @@ PDFDoc::PDFDoc(GString *fileName1) { file = NULL; links = NULL; - // try to open file fileName = fileName1; - fileName2 = NULL; -#ifdef VMS - if (!(file = fopen(fileName->getCString(), "rb", "ctx=stm"))) { - error(-1, "Couldn't open file '%s'", fileName->getCString()); + file = file1; + if (!file) return; - } -#else - if (!(file = fopen(fileName->getCString(), "rb"))) { - fileName2 = fileName->copy(); - fileName2->lowerCase(); - if (!(file = fopen(fileName2->getCString(), "rb"))) { - fileName2->upperCase(); - if (!(file = fopen(fileName2->getCString(), "rb"))) { - error(-1, "Couldn't open file '%s'", fileName->getCString()); - delete fileName2; - return; - } - } - delete fileName2; - } -#endif // create stream obj.initNull(); - str = new FileStream(file, 0, -1, &obj); + str = new FileStream(file, 0, -1, &obj); // check header str->checkHeader(); @@ -100,7 +80,7 @@ PDFDoc::~PDFDoc() { if (xref) delete xref; if (file) - fclose(file); + bfclose(file); if (fileName) delete fileName; if (links) @@ -153,8 +133,8 @@ GBool PDFDoc::saveAs(GString *name) { error(-1, "Couldn't open file '%s'", name->getCString()); return gFalse; } - rewind(file); - while ((n = fread(buf, 1, sizeof(buf), file)) > 0) + brewind(file); + while ((n = bfread(buf, 1, sizeof(buf), file)) > 0) fwrite(buf, 1, n, f); fclose(f); return gTrue; diff --git a/pdf/xpdf/PDFDoc.h b/pdf/xpdf/PDFDoc.h index 5e28962e..c5a24703 100644 --- a/pdf/xpdf/PDFDoc.h +++ b/pdf/xpdf/PDFDoc.h @@ -15,6 +15,7 @@ #include #include "Link.h" +#include "BaseFile.h" class GString; class XRef; @@ -31,7 +32,7 @@ class LinkDest; class PDFDoc { public: - PDFDoc(GString *fileName1); + PDFDoc(BaseFile file, GString *fileName1); ~PDFDoc(); // Was PDF document successfully opened? @@ -96,7 +97,7 @@ private: void getLinks(int page); GString *fileName; - FILE *file; + BaseFile file; XRef *xref; Catalog *catalog; Links *links; diff --git a/pdf/xpdf/Stream.cc b/pdf/xpdf/Stream.cc index 667d07c8..6e52d791 100644 --- a/pdf/xpdf/Stream.cc +++ b/pdf/xpdf/Stream.cc @@ -511,7 +511,7 @@ GBool StreamPredictor::getNextLine() { // FileStream //------------------------------------------------------------------------ -FileStream::FileStream(FILE *f1, int start1, int length1, Object *dict1) { +FileStream::FileStream(BaseFile f1, int start1, int length1, Object *dict1) { f = f1; start = start1; length = length1; @@ -523,13 +523,13 @@ FileStream::FileStream(FILE *f1, int start1, int length1, Object *dict1) { FileStream::~FileStream() { if (savePos >= 0) - fseek(f, savePos, SEEK_SET); + bfseek(f, savePos, SEEK_SET); dict.free(); } void FileStream::reset() { - savePos = (int)ftell(f); - fseek(f, start, SEEK_SET); + savePos = (int)bftell(f); + bfseek(f, start, SEEK_SET); bufPtr = bufEnd = buf; bufPos = start; } @@ -545,7 +545,7 @@ GBool FileStream::fillBuf() { n = start + length - bufPos; else n = 256; - n = fread(buf, 1, n, f); + n = bfread(buf, 1, n, f); bufEnd = buf + n; if (bufPtr >= bufEnd) return gFalse; @@ -556,15 +556,15 @@ void FileStream::setPos(int pos1) { long size; if (pos1 >= 0) { - fseek(f, pos1, SEEK_SET); + bfseek(f, pos1, SEEK_SET); bufPos = pos1; } else { - fseek(f, 0, SEEK_END); - size = ftell(f); + bfseek(f, 0, SEEK_END); + size = bftell(f); if (pos1 < -size) pos1 = (int)(-size); - fseek(f, pos1, SEEK_END); - bufPos = (int)ftell(f); + bfseek(f, pos1, SEEK_END); + bufPos = (int)bftell(f); } bufPtr = bufEnd = buf; } diff --git a/pdf/xpdf/Stream.h b/pdf/xpdf/Stream.h index 3eb8160b..14e68eaa 100644 --- a/pdf/xpdf/Stream.h +++ b/pdf/xpdf/Stream.h @@ -16,6 +16,7 @@ #include #include "gtypes.h" #include "Object.h" +#include "BaseFile.h" //------------------------------------------------------------------------ @@ -83,7 +84,7 @@ public: virtual Stream *getBaseStream() = 0; // Get the base file of this stream. - virtual FILE *getFile() = 0; + virtual BaseFile getFile() = 0; // Get the dictionary associated with this stream. virtual Dict *getDict() = 0; @@ -177,7 +178,7 @@ private: class FileStream: public Stream { public: - FileStream(FILE *f1, int start1, int length1, Object *dict1); + FileStream(BaseFile f1, int start1, int length1, Object *dict1); virtual ~FileStream(); virtual StreamKind getKind() { return strFile; } virtual void reset(); @@ -189,7 +190,7 @@ public: virtual void setPos(int pos1); virtual GBool isBinary(GBool last = gTrue) { return last; } virtual Stream *getBaseStream() { return this; } - virtual FILE *getFile() { return f; } + virtual BaseFile getFile() { return f; } virtual Dict *getDict() { return dict.getDict(); } // Check for a PDF header on this stream. Skip past some garbage @@ -203,7 +204,7 @@ private: GBool fillBuf(); - FILE *f; + BaseFile f; int start; int length; char buf[256]; @@ -230,7 +231,7 @@ public: virtual int getPos() { return str->getPos(); } virtual GBool isBinary(GBool last = gTrue) { return last; } virtual Stream *getBaseStream() { return this; } - virtual FILE *getFile() { return str->getFile(); } + virtual BaseFile getFile() { return str->getFile(); } virtual Dict *getDict() { return dict.getDict(); } private: @@ -257,7 +258,7 @@ public: virtual GString *getPSFilter(char *indent); virtual GBool isBinary(GBool last = gTrue); virtual Stream *getBaseStream() { return str->getBaseStream(); } - virtual FILE *getFile() { return str->getFile(); } + virtual BaseFile getFile() { return str->getFile(); } virtual Dict *getDict() { return str->getDict(); } private: @@ -285,7 +286,7 @@ public: virtual GString *getPSFilter(char *indent); virtual GBool isBinary(GBool last = gTrue); virtual Stream *getBaseStream() { return str->getBaseStream(); } - virtual FILE *getFile() { return str->getFile(); } + virtual BaseFile getFile() { return str->getFile(); } virtual Dict *getDict() { return str->getDict(); } private: @@ -316,7 +317,7 @@ public: virtual GString *getPSFilter(char *indent); virtual GBool isBinary(GBool last = gTrue); virtual Stream *getBaseStream() { return str->getBaseStream(); } - virtual FILE *getFile() { return str->getFile(); } + virtual BaseFile getFile() { return str->getFile(); } virtual Dict *getDict() { return str->getDict(); } private: @@ -358,7 +359,7 @@ public: virtual GString *getPSFilter(char *indent); virtual GBool isBinary(GBool last = gTrue); virtual Stream *getBaseStream() { return str->getBaseStream(); } - virtual FILE *getFile() { return str->getFile(); } + virtual BaseFile getFile() { return str->getFile(); } virtual Dict *getDict() { return str->getDict(); } private: @@ -394,7 +395,7 @@ public: virtual GString *getPSFilter(char *indent); virtual GBool isBinary(GBool last = gTrue); virtual Stream *getBaseStream() { return str->getBaseStream(); } - virtual FILE *getFile() { return str->getFile(); } + virtual BaseFile getFile() { return str->getFile(); } virtual Dict *getDict() { return str->getDict(); } private: @@ -461,7 +462,7 @@ public: virtual GString *getPSFilter(char *indent); virtual GBool isBinary(GBool last = gTrue); virtual Stream *getBaseStream() { return str->getBaseStream(); } - virtual FILE *getFile() { return str->getFile(); } + virtual BaseFile getFile() { return str->getFile(); } virtual Dict *getDict() { return str->getDict(); } Stream *getRawStream() { return str; } @@ -552,7 +553,7 @@ public: virtual GString *getPSFilter(char *indent); virtual GBool isBinary(GBool last = gTrue); virtual Stream *getBaseStream() { return str->getBaseStream(); } - virtual FILE *getFile() { return str->getFile(); } + virtual BaseFile getFile() { return str->getFile(); } virtual Dict *getDict() { return str->getDict(); } private: @@ -606,7 +607,7 @@ public: virtual GString *getPSFilter(char *indent) { return NULL; } virtual GBool isBinary(GBool last = gTrue) { return gFalse; } virtual Stream *getBaseStream() { return str->getBaseStream(); } - virtual FILE *getFile() { return str->getFile(); } + virtual BaseFile getFile() { return str->getFile(); } virtual Dict *getDict() { return str->getDict(); } private: @@ -631,7 +632,7 @@ public: virtual GString *getPSFilter(char *indent) { return NULL; } virtual GBool isBinary(GBool last = gTrue) { return gFalse; } virtual Stream *getBaseStream() { return str->getBaseStream(); } - virtual FILE *getFile() { return str->getFile(); } + virtual BaseFile getFile() { return str->getFile(); } virtual Dict *getDict() { return str->getDict(); } virtual GBool isEncoder() { return gTrue; } @@ -661,7 +662,7 @@ public: virtual GString *getPSFilter(char *indent) { return NULL; } virtual GBool isBinary(GBool last = gTrue) { return gFalse; } virtual Stream *getBaseStream() { return str->getBaseStream(); } - virtual FILE *getFile() { return str->getFile(); } + virtual BaseFile getFile() { return str->getFile(); } virtual Dict *getDict() { return str->getDict(); } virtual GBool isEncoder() { return gTrue; } @@ -696,7 +697,7 @@ public: virtual GString *getPSFilter(char *indent) { return NULL; } virtual GBool isBinary(GBool last = gTrue) { return gFalse; } virtual Stream *getBaseStream() { return str->getBaseStream(); } - virtual FILE *getFile() { return str->getFile(); } + virtual BaseFile getFile() { return str->getFile(); } virtual Dict *getDict() { return str->getDict(); } virtual GBool isEncoder() { return gTrue; } diff --git a/pdf/xpdf/XRef.h b/pdf/xpdf/XRef.h index b843ea28..e8874c7e 100644 --- a/pdf/xpdf/XRef.h +++ b/pdf/xpdf/XRef.h @@ -16,6 +16,7 @@ #include #include "gtypes.h" #include "Object.h" +#include "BaseFile.h" class Dict; class FileStream; @@ -60,7 +61,7 @@ public: private: - FILE *file; // input file + BaseFile file; // input file int start; // offset in file (to allow for garbage // at beginning of file) XRefEntry *entries; // xref entries diff --git a/pdf/xpdf/bonobo-image-x-pdf.cc b/pdf/xpdf/bonobo-image-x-pdf.cc index be263eb5..c69dbeeb 100644 --- a/pdf/xpdf/bonobo-image-x-pdf.cc +++ b/pdf/xpdf/bonobo-image-x-pdf.cc @@ -49,7 +49,8 @@ CORBA_ORB orb; typedef struct { GnomeEmbeddable *bonobo_object; - PDFDoc *pdf; + PDFDoc *pdf; + GNOME_Stream stream; /* To free it later */ GList *views; } bonobo_object_data_t; @@ -169,7 +170,6 @@ static int load_image_from_stream (GnomePersistStream *ps, GNOME_Stream stream, void *data) { bonobo_object_data_t *bonobo_object_data = (bonobo_object_data_t *)data; - CORBA_Environment ev; CORBA_long length; GNOME_Stream_iobuf *buffer; guint lp; @@ -177,7 +177,17 @@ load_image_from_stream (GnomePersistStream *ps, GNOME_Stream stream, void *data) FILE *hack; char *name; - buffer = GNOME_Stream_iobuf__alloc (); + if (bonobo_object_data->pdf || + bonobo_object_data->stream) { + g_warning ("Won't overwrite pre-existing stream: you wierdo"); + return 0; + } + + /* We need this for later */ + CORBA_Object_duplicate (stream, &ev); + g_return_val_if_fail (ev._major == CORBA_NO_EXCEPTION, 0); + +/* buffer = GNOME_Stream_iobuf__alloc (); length = GNOME_Stream_length (stream, &ev); name = tempnam (NULL, "xpdf-hack"); @@ -200,9 +210,12 @@ load_image_from_stream (GnomePersistStream *ps, GNOME_Stream stream, void *data) fclose (hack); - CORBA_free (buffer); + CORBA_free (buffer);*/ - bonobo_object_data->pdf = new PDFDoc (new GString (name)); + printf ("Loading PDF from persiststream\n"); + bonobo_object_data->stream = stream; + bonobo_object_data->pdf = new PDFDoc (stream, new GString ("Bonobo.pdf")); + printf ("Done load\n"); if (!(bonobo_object_data->pdf->isOk())) { g_warning ("Duff pdf data\n"); delete bonobo_object_data->pdf; diff --git a/pdf/xpdf/gpdf.cc b/pdf/xpdf/gpdf.cc index 171b2169..b57e75a4 100644 --- a/pdf/xpdf/gpdf.cc +++ b/pdf/xpdf/gpdf.cc @@ -155,7 +155,9 @@ static PDFDoc * getPDF (GString *fname) { PDFDoc *pdf; - pdf = new PDFDoc(fname); + BaseFile *file; + + pdf = new PDFDoc(bxpdfopen(fname), fname); if (!pdf->isOk()) { delete pdf; return NULL; diff --git a/pdf/xpdf/pdfimages.cc b/pdf/xpdf/pdfimages.cc index 1dd59f0b..9d7a4847 100644 --- a/pdf/xpdf/pdfimages.cc +++ b/pdf/xpdf/pdfimages.cc @@ -74,7 +74,7 @@ int main(int argc, char *argv[]) { // open PDF fihe xref = NULL; - doc = new PDFDoc(fileName); + doc = new PDFDoc(bxpdfopen(fileName), fileName); if (!doc->isOk()) { goto err1; } diff --git a/pdf/xpdf/pdfinfo.cc b/pdf/xpdf/pdfinfo.cc index 2c183c83..78664aa2 100644 --- a/pdf/xpdf/pdfinfo.cc +++ b/pdf/xpdf/pdfinfo.cc @@ -61,7 +61,7 @@ int main(int argc, char *argv[]) { // open PDF file xref = NULL; - doc = new PDFDoc(fileName); + doc = new PDFDoc(bxpdfopen(fileName), fileName); if (!doc->isOk()) exit(1); diff --git a/pdf/xpdf/pdftopbm.cc b/pdf/xpdf/pdftopbm.cc index 6cfe8305..51adb491 100644 --- a/pdf/xpdf/pdftopbm.cc +++ b/pdf/xpdf/pdftopbm.cc @@ -74,7 +74,7 @@ int main(int argc, char *argv[]) { // open PDF file xref = NULL; - doc = new PDFDoc(fileName); + doc = new PDFDoc(bxpdfopen(fileName), fileName); if (!doc->isOk()) exit(1); diff --git a/pdf/xpdf/pdftops.cc b/pdf/xpdf/pdftops.cc index d6fd6534..d79681e4 100644 --- a/pdf/xpdf/pdftops.cc +++ b/pdf/xpdf/pdftops.cc @@ -87,7 +87,7 @@ int main(int argc, char *argv[]) { // open PDF file xref = NULL; - doc = new PDFDoc(fileName); + doc = new PDFDoc(bxpdfopen(fileName), fileName); if (!doc->isOk()) { goto err1; } diff --git a/pdf/xpdf/pdftotext.cc b/pdf/xpdf/pdftotext.cc index 189d4898..f0b2b3a8 100644 --- a/pdf/xpdf/pdftotext.cc +++ b/pdf/xpdf/pdftotext.cc @@ -84,7 +84,7 @@ int main(int argc, char *argv[]) { // open PDF file xref = NULL; - doc = new PDFDoc(fileName); + doc = new PDFDoc(bxpdfopen(fileName), fileName); if (!doc->isOk()) { goto err1; } diff --git a/pdf/xpdf/xpdf.cc b/pdf/xpdf/xpdf.cc index 4e5a2a8c..60cb629d 100644 --- a/pdf/xpdf/xpdf.cc +++ b/pdf/xpdf/xpdf.cc @@ -679,7 +679,7 @@ static GBool loadFile(GString *fileName) { win->setBusyCursor(gTrue); // open PDF file - newDoc = new PDFDoc(fileName); + newDoc = new PDFDoc(bxpdfopen(fileName), fileName); if (!newDoc->isOk()) { delete newDoc; if (win) -- 2.43.5