Hi, Your change makes perfectly sense. I commited it to SVN.
Cheers,
Dominik
Am Donnerstag 16 September 2010 schrieb Naomaru Itoi:
> Thank you, Dominik.
>
> The problem turned out to be a very special use case. It is probably
> specific to us. But the fix is legitimate, I think.
>
> The problem sequence was:
> - PoDoFo opens a file which has just been created with 0 byte of data.
> - PdfParser::IsPdfFile() returns an error because there is no data to be
> read - PdfParser::ParseFile() throws an exception
> - It does not clean up the handle to the file
> - It leaks handle
> - The next process that tries to open this file fails
>
> The only fix needed was in PdfParser.cpp, line 190,
>
> Change this:
>
> if( !IsPdfFile() )
> {
> PODOFO_RAISE_ERROR( ePdfError_NoPdfFile );
> }
>
> try {
> ReadDocumentStructure();
> ReadObjects();
> }
>
> To this:
>
> try {
> if( !IsPdfFile() )
> {
> PODOFO_RAISE_ERROR( ePdfError_NoPdfFile );
> }
> ReadDocumentStructure();
> ReadObjects();
> }
>
> If you think this change makes sense and would submit it to SVN, I would
> appreciate it.
>
> Thank you very much,
>
> -----Original Message-----
> From: [email protected] [mailto:[email protected]]
> Sent: Wednesday, September 15, 2010 12:35 AM
> To: [email protected]
> Cc: Naomaru Itoi
> Subject: Re: [Podofo-users] change from ifstream to fopen(), fread()?
>
> Hi,
>
> svn blame and svn log show that this change came from a patch for 64bit
> support in PoDoFo:
>
> _svn log -r 1005 PdfInputDevice.cpp
> ------------------------------------------------------------------------
> r1005 | domseichter | 2009-04-03 20:36:41 +0200 (Fri, 03 Apr 2009) | 15
> lines
>
> Commited a large patch contributed by Ian Currington, which makes PoDoFo
> 64bit safe. He was able to edit a 5GB PDF file in one test.
>
> Citing from his email:
> Today, after several months of development, we are able to contribute a new
> set of changes to PoDoFo.
>
> These are specifically about 64-bit porting. As you can imagine, the
> changes are widespread, with data type changes. To enable you do perform
> difference analysis, the changes are against SVN 990. The changes
> dramatically reduce cast and data type warnings on MS Visual Studio C++
> x64. The changes have been tested internally here on 4 or 5 machines,
> including Linux 32-bit, Linux 64-bit, and Vista 64, Visual Studio 2008
> x64.
>
>
> I don't think that is the cause. I bet we would have other reports, if this
> would cause general failures on Windows 7.
>
> What kind of error do you get? Can you prepare a small testcase that shows
> an exception along with a test file?
>
> Cheers,
> Dominik
>
> Am Mittwoch 15 September 2010 schrieb Naomaru Itoi:
> > Hi,
> >
> > Thank you very much for your great work, as always.
> >
> > I am getting an error from PdfParser.IsPdfFile() on Windows 7, with
> > PoDoFo 0.8.1. It seems to happen with any PDF files.
> >
> > I am invoking PoDoFo from a service. When I run the same thing from
> > an application exe, it works fine. The same code, invoking from a
> > service, used to work with PoDoFo 0.7.0.
> >
> > I noticed that, in PdfInputDevice.cpp, the code changed from using
> > ifstream to read a PDF file, to using fopen() and fread(), on Windows.
> >
> > May I know why this change was made, please? Have you seen / do you
> > suspect any problems with this code change?
> >
> > I haven't looked into this problem deeply, yet. It's entirely
> > possible that the code change has nothing to do with the bug. I just
> > would like to understand the thinking behind the change.
> >
> > Thank you,
> >
> >
> > - --------------------------------------------------------------------
> > STATEMENT OF CONFIDENTIALITY
> >
> > The information contained in this electronic message and any
> > attachments to this message are intended for the exclusive use of the
> > addressee(s) and may contain confidential or privileged information.
> > No representation is made on its accuracy or completeness of the
> > information contained in this electronic message. Certain assumptions
> > may have been made in the preparation of this material as at this
> > date, and are subject to change without notice. If you are not the
> > intended recipient, you are hereby notified that any dissemination,
> > distribution or copying of this e-mail and any attachment(s) is
> > strictly prohibited. Please reply to the sender at NextLabs Inc and
> > destroy all copies of this message and any attachments from your system.
> >
> > ======================================================================
> >
> > ----------------------------------------------------------------------
> > -----
> > --- Start uncovering the many advantages of virtual appliances and
> > start using them to simplify application deployment and accelerate
> > your shift to cloud computing.
> > http://p.sf.net/sfu/novell-sfdev2dev
> > _______________________________________________
> > Podofo-users mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/podofo-users
>
> --
> **********************************************************************
> Dominik Seichter - [email protected]
> KRename - http://www.krename.net - Powerful batch renamer for KDE
> KBarcode - http://www.kbarcode.net - Barcode and label printing PoDoFo -
> http://podofo.sf.net - PDF generation and parsing library SchafKopf -
> http://schafkopf.berlios.de - Schafkopf, a card game, for KDE Alan -
> http://alan.sf.net - A Turing Machine in Java
> **********************************************************************
>
> - --------------------------------------------------------------------
> STATEMENT OF CONFIDENTIALITY
>
> The information contained in this electronic message and any attachments to
> this message are intended for the exclusive use of the addressee(s) and
> may contain confidential or privileged information. No representation is
> made on its accuracy or completeness of the information contained in this
> electronic message. Certain assumptions may have been made in the
> preparation of this material as at this date, and are subject to change
> without notice. If you are not the intended recipient, you are hereby
> notified that any dissemination, distribution or copying of this e-mail
> and any attachment(s) is strictly prohibited. Please reply to the sender
> at NextLabs Inc and destroy all copies of this message and any attachments
> from your system.
> ======================================================================
>
> ---------------------------------------------------------------------------
> --- Start uncovering the many advantages of virtual appliances
> and start using them to simplify application deployment and
> accelerate your shift to cloud computing.
> http://p.sf.net/sfu/novell-sfdev2dev
> _______________________________________________
> Podofo-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/podofo-users
>
--
**********************************************************************
Dominik Seichter - [email protected]
KRename - http://www.krename.net - Powerful batch renamer for KDE
KBarcode - http://www.kbarcode.net - Barcode and label printing
PoDoFo - http://podofo.sf.net - PDF generation and parsing library
SchafKopf - http://schafkopf.berlios.de - Schafkopf, a card game, for KDE
Alan - http://alan.sf.net - A Turing Machine in Java
**********************************************************************
signature.asc
Description: This is a digitally signed message part.
------------------------------------------------------------------------------ Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing. http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________ Podofo-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/podofo-users
