Le jeudi 20 septembre 2007 21:34, Craig Ringer a écrit : > > Modified: podofo/trunk/tools/podofoimpose/pdftranslator.cpp > > =================================================================== > > --- podofo/trunk/tools/podofoimpose/pdftranslator.cpp 2007-09-19 > > 15:19:00 > > UTC (rev 649) +++ > > podofo/trunk/tools/podofoimpose/pdftranslator.cpp 2007-09-20 15:48:24 UTC > > (rev 650) @@ -85,10 +85,62 @@ > > > > void PdfTranslator::setSource ( const std::string & source ) > > { > > - inFilePath = source; > > - sourceDoc = new PdfMemDocument ( inFilePath.c_str() ); // must > > succeed or throw + ifstream in ( source.c_str(), ifstream::in ); > > + if (!in.good()) > > + throw runtime_error("setSource() failed to open input file"); > > + > > + char *magicBuffer = new char [5]; > > + in.read(magicBuffer, 5); > > + std::string magic( magicBuffer , 5 ); > > This is a memory leak, as magicBuffer is never freed. It's not a big > issue but should be fixed. Eliminating the dynamic memory allocation in > favour of a stack-based static buffer would be preferable - overrun is > not a risk since read() checks length limits.
Is there any static method or even global function in podofo's public API that check if a file is a PDF one ? -- Pierre Marchand ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Podofo-users mailing list Podofo-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/podofo-users