Hi all, attached to this e-mail is the second part of the API changes, the part which I fear to be more controversial, but I also included a good bit of documentation typo fixes. Please apply this together with the first part (I generated it with svn diff after reverting the first part, so an offset on applying is normal). In the build test there were no new warnings, however please note that I did these test (also of the first part) with libpng disabled (by having PODOFO_HAVE_PNG_LIB set to FALSE in the top-level CMakeLists.txt) because it is missing png_init_io() for me. I hope this is acceptable to you.
Could you please apply/commit these changes before Christmas, or is the time too short for that? If so, I'm sorry, no problem. I wish you a merry Christmas (if you celebrate it or are Christian). Best regards, mabri ----- Original Message ----- From: Matthew Brincke <mabr...@ymail.com> To: "podofo-users@lists.sourceforge.net" <podofo-users@lists.sourceforge.net> Sent: 1:32 Tuesday, 22 December 2015 Subject: Public API method names typo fixes & clarifications Hi all, this is the surprise I promised to you: because of health reasons I didn't get to it earlier (I'm sorry). In addition to the typo fixes and clarifications, e.g. about methods being getters (isn't that also in the PoDoFo CodingStyle?) I also fixed typos and some formatting in attribute names and code using them. I didn't adhere to the 80 chars/line limit everywhere because zyx pronounced that unnecessary. I build-tested it for static- and shared- library (both incl. programs) build both for native GNU/Linux and as cross-build to Win32 (via MinGW-w64), it was all OK (no new warnings). I hope to have submitted the patch attached to this e-mail early enough for it being committed making the revision directly after the current one, i.e. Julian Rehborn's change (even as modified by zyx) shall count for the future only, right? Please, as long as there is no other change to commit, await the second part of this my change submission, which will include more controversial changes (although none to method bodies except for typo fixes/formatting as in this). Please commit the second part (only on acceptance, of course) together with this one, this is an exception to what's usual for me. When you'll have another person's change to commit, please commit the patch attached here (my first part) first (without waiting for the second one). The next revision number (after current) is important to me. Best regards, mabri
Index: src/base/PdfFilter.cpp =================================================================== --- src/base/PdfFilter.cpp (revision 1699) +++ src/base/PdfFilter.cpp (working copy) @@ -234,7 +234,7 @@ const_cast<PdfFilter*>(this)->EncodeBlock( pInBuffer, lInLen ); const_cast<PdfFilter*>(this)->EndEncode(); - *ppOutBuffer = stream.TakeBuffer(); + *ppOutBuffer = stream.GiveBuffer(); *plOutLen = stream.GetLength(); } @@ -252,7 +252,7 @@ const_cast<PdfFilter*>(this)->DecodeBlock( pInBuffer, lInLen ); const_cast<PdfFilter*>(this)->EndDecode(); - *ppOutBuffer = stream.TakeBuffer(); + *ppOutBuffer = stream.GiveBuffer(); *plOutLen = stream.GetLength(); } Index: src/base/PdfOutputStream.h =================================================================== --- src/base/PdfOutputStream.h (revision 1699) +++ src/base/PdfOutputStream.h (working copy) @@ -165,11 +165,11 @@ * * The internal buffer is now owned by the caller * and will not be deleted by PdfMemoryOutputStream. - * Further calls to write are not allowed. + * Further calls to Write() are not allowed. * - * The caller has to free the returned malloc'ed buffer! + * The caller has to free() the returned malloc()'ed buffer! */ - inline char* TakeBuffer(); + inline char* GiveBuffer(); private: char* m_pBuffer; @@ -191,7 +191,7 @@ // ----------------------------------------------------- // // ----------------------------------------------------- -inline char* PdfMemoryOutputStream::TakeBuffer() +inline char* PdfMemoryOutputStream::GiveBuffer() { char* pBuffer = m_pBuffer; m_pBuffer = NULL; Index: src/base/PdfParser.h =================================================================== --- src/base/PdfParser.h (revision 1699) +++ src/base/PdfParser.h (working copy) @@ -87,7 +87,7 @@ * \param pVecObjects vector to write the parsed PdfObjects to * \param pszFilename filename of the file which is going to be parsed * \param bLoadOnDemand If true all objects will be read from the file at - * the time they are accesed first. + * the time they are accessed first. * If false all objects will be read immediately. * This is faster if you do not need the complete PDF * file in memory. @@ -94,7 +94,7 @@ * * This might throw a PdfError( ePdfError_InvalidPassword ) exception * if a password is required to read this PDF. - * Call SetPassword with the correct password in this case. + * Call SetPassword() with the correct password in this case. * * \see SetPassword */ @@ -101,7 +101,7 @@ PdfParser( PdfVecObjects* pVecObjects, const char* pszFilename, bool bLoadOnDemand = true ); #ifdef _WIN32 -#if defined(_MSC_VER) && _MSC_VER <= 1200 // nicht für Visualstudio 6 +#if defined(_MSC_VER) && _MSC_VER <= 1200 // not for Visual Studio 6 #else /** Create a new PdfParser object and open a PDF file and parse * it into memory. @@ -109,7 +109,7 @@ * \param pVecObjects vector to write the parsed PdfObjects to * \param pszFilename filename of the file which is going to be parsed * \param bLoadOnDemand If true all objects will be read from the file at - * the time they are accesed first. + * the time they are accessed first. * If false all objects will be read immediately. * This is faster if you do not need the complete PDF * file in memory. @@ -116,10 +116,10 @@ * * This might throw a PdfError( ePdfError_InvalidPassword ) exception * if a password is required to read this PDF. - * Call SetPassword with the correct password in this case. + * Call SetPassword() with the correct password in this case. * * This is an overloaded member function to allow working - * with unicode characters. On Unix systes you can also path + * with unicode characters. On Unix systems you can also pass * UTF-8 to the const char* overload. * * \see SetPassword @@ -135,7 +135,7 @@ * \param pBuffer buffer containing a PDF file in memory * \param lLen length of the buffer containing the PDF file * \param bLoadOnDemand If true all objects will be read from the file at - * the time they are accesed first. + * the time they are accessed first. * If false all objects will be read immediately. * This is faster if you do not need the complete PDF * file in memory. @@ -142,7 +142,7 @@ * * This might throw a PdfError( ePdfError_InvalidPassword ) exception * if a password is required to read this PDF. - * Call SetPassword with the correct password in this case. + * Call SetPassword() with the correct password in this case. * * \see SetPassword */ @@ -154,7 +154,7 @@ * \param pVecObjects vector to write the parsed PdfObjects to * \param rDevice read from this PdfRefCountedInputDevice * \param bLoadOnDemand If true all objects will be read from the file at - * the time they are accesed first. + * the time they are accessed first. * If false all objects will be read immediately. * This is faster if you do not need the complete PDF * file in memory. @@ -161,7 +161,7 @@ * * This might throw a PdfError( ePdfError_InvalidPassword ) exception * if a password is required to read this PDF. - * Call SetPassword with the correct password in this case. + * Call SetPassword() with the correct password in this case. * * \see SetPassword */ @@ -176,7 +176,7 @@ * * \param pszFilename filename of the file which is going to be parsed * \param bLoadOnDemand If true all objects will be read from the file at - * the time they are accesed first. + * the time they are accessed first. * If false all objects will be read immediately. * This is faster if you do not need the complete PDF * file in memory. @@ -184,7 +184,7 @@ * * This might throw a PdfError( ePdfError_InvalidPassword ) exception * if a password is required to read this PDF. - * Call SetPassword with the correct password in this case. + * Call SetPassword() with the correct password in this case. * * \see SetPassword */ @@ -219,7 +219,7 @@ * \param pBuffer buffer containing a PDF file in memory * \param lLen length of the buffer containing the PDF file * \param bLoadOnDemand If true all objects will be read from the file at - * the time they are accesed first. + * the time they are accessed first. * If false all objects will be read immediately. * This is faster if you do not need the complete PDF * file in memory. @@ -227,7 +227,7 @@ * * This might throw a PdfError( ePdfError_InvalidPassword ) exception * if a password is required to read this PDF. - * Call SetPassword with the correct password in this case. + * Call SetPassword() with the correct password in this case. * * \see SetPassword */ @@ -237,7 +237,7 @@ * * \param rDevice the input device to read from * \param bLoadOnDemand If true all objects will be read from the file at - * the time they are accesed first. + * the time they are accessed first. * If false all objects will be read immediately. * This is faster if you do not need the complete PDF * file in memory. @@ -245,7 +245,7 @@ * * This might throw a PdfError( ePdfError_InvalidPassword ) exception * if a password is required to read this PDF. - * Call SetPassword with the correct password in this case. + * Call SetPassword() with the correct password in this case. * * \see SetPassword */ @@ -314,15 +314,15 @@ const PdfEncrypt* GetEncrypt() const { return m_pEncrypt; } /** - * Takes the encryption object fro mthe parser. The internal handle will be set + * Gives the encryption object from the parser. The internal handle will be set * to NULL and the ownership of the object is given to the caller. * * Only call this if you need access to the encryption object * before deleting the parser. * - * \returns the parsers encryption object or NULL if the read PDF file was not encrypted + * \returns the parser's encryption object, or NULL if the read PDF file was not encrypted. */ - inline PdfEncrypt* TakeEncrypt(); + inline PdfEncrypt* GiveEncrypt(); /** If you try to open an encrypted PDF file, which requires @@ -354,7 +354,7 @@ * Strict parsing is by default disabled. * * If you enable strict parsing, PoDoFo will fail - * on a few more common PDF failures. Please not + * on a few more common PDF failures. Please note * that PoDoFo's parser is by default very strict * already and does not recover from e.g. wrong XREF * tables. @@ -530,10 +530,10 @@ void ReadNextTrailer(); - /** Checks for the existence of the %%EOF marker at the end of the file + /** Checks for the existence of the %%EOF marker at the end of the file. * When strict mode is off it will also attempt to setup the parser to ignore - * any garbage after the last %%EOF marker - * Simply raises an error if there is a problem with the marker + * any garbage after the last %%EOF marker. + * Simply raises an error if there is a problem with the marker. * */ void CheckEOFMarker(); @@ -555,8 +555,8 @@ const PdfString & GetDocumentId(); /** Determines the correct version of the PDF - * from the document catalog (if available). - * as, PDF > 1.4 allows updating the version. + * from the document catalog (if available), + * as PDF > 1.4 allows updating the version. * * If no catalog dictionary is present or no /Version * key is available, the version from the file header will @@ -639,7 +639,7 @@ // ----------------------------------------------------- // // ----------------------------------------------------- -PdfEncrypt* PdfParser::TakeEncrypt() +PdfEncrypt* PdfParser::GiveEncrypt() { PdfEncrypt* pEncrypt = m_pEncrypt; m_pEncrypt = NULL; Index: src/base/PdfStream.cpp =================================================================== --- src/base/PdfStream.cpp (revision 1699) +++ src/base/PdfStream.cpp (working copy) @@ -106,7 +106,7 @@ } *lLen = stream.GetLength(); - *ppBuffer = stream.TakeBuffer(); + *ppBuffer = stream.GiveBuffer(); } const PdfStream & PdfStream::operator=( const PdfStream & rhs ) Index: src/doc/PdfMemDocument.cpp =================================================================== --- src/doc/PdfMemDocument.cpp (revision 1699) +++ src/doc/PdfMemDocument.cpp (working copy) @@ -166,10 +166,10 @@ if( pParser->GetEncrypted() ) { - // All PdfParserObjects have a pointer to the PdfEncrypt obkect - // So we have to take ownership of it. + // All PdfParser instances have a pointer to a PdfEncrypt object. + // So we have to take ownership of it (command the parser to give it). delete m_pEncrypt; - m_pEncrypt = pParser->TakeEncrypt(); + m_pEncrypt = pParser->GiveEncrypt(); } this->SetCatalog ( pCatalog ); Index: test/FilterTest/FilterTest.cpp =================================================================== --- test/FilterTest/FilterTest.cpp (revision 1699) +++ test/FilterTest/FilterTest.cpp (working copy) @@ -120,7 +120,7 @@ printf("\t-> Test succeeded!\n"); } -void test_filter_queque( const char* pBuffer, long lLen ) +void test_filter_queue( const char* pBuffer, long lLen ) { char* pEncoded; pdf_long lEncoded; @@ -147,7 +147,7 @@ delete pEncode; lEncoded = stream.GetLength(); - pEncoded = stream.TakeBuffer(); + pEncoded = stream.GiveBuffer(); PdfMemoryOutputStream stream2; PdfOutputStream* pDecode = PdfFilterFactory::CreateDecodeStream( filters, &stream2 ); @@ -158,7 +158,7 @@ delete pDecode; lDecoded = stream2.GetLength(); - pDecoded = stream2.TakeBuffer(); + pDecoded = stream2.GiveBuffer(); printf("\t-> Original Data Length: %li\n", lLen ); printf("\t-> Encoded Data Length: %li\n", lEncoded ); @@ -284,8 +284,8 @@ } - test_filter_queque( pTestBuffer1, lTestLength1 ); - test_filter_queque( pTestBuffer2, lTestLength2 ); + test_filter_queue( pTestBuffer1, lTestLength1 ); + test_filter_queue( pTestBuffer2, lTestLength2 ); test_stream( pTestBuffer1, lTestLength1 ); test_stream( pTestBuffer2, lTestLength2 ); Index: tools/podofoimpose/pdftranslator.cpp =================================================================== --- tools/podofoimpose/pdftranslator.cpp (revision 1699) +++ tools/podofoimpose/pdftranslator.cpp (working copy) @@ -300,7 +300,7 @@ outMemStream.Close(); - PdfMemoryInputStream inStream ( outMemStream.TakeBuffer(),outMemStream.GetLength() ); + PdfMemoryInputStream inStream ( outMemStream.GiveBuffer(), outMemStream.GetLength() ); xobj->GetContents()->GetStream()->Set ( &inStream ); resources[i+1] = getInheritedResources ( page );
------------------------------------------------------------------------------
_______________________________________________ Podofo-users mailing list Podofo-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/podofo-users