On Tue, 2015-12-01 at 10:35 +0100, [email protected] wrote:
> Here is the patch file with your recommended changed.
Hi,
thanks for the patch. I do not know why you resent it multiple times, I
do not see any changes in it. I also prefer (and require) patches as
attachments, not as text/plain body.
The patch looks fine, except it doesn't build here with an error:
---------------------------------------------------------------------
[ 5%] Building CXX object
src/CMakeFiles/podofo_static.dir/base/PdfInputStream.cpp.o
/data/develop/dila/podofo/trunk/src/base/PdfInputStream.cpp: In member
function ‘PoDoFo::PdfDate PoDoFo::PdfFileInputStream::GetModifiedDate()’:
/data/develop/dila/podofo/trunk/src/base/PdfInputStream.cpp:105:17: error:
aggregate ‘PoDoFo::PdfFileInputStream::GetModifiedDate()::stat file_stat’ has
incomplete type and cannot be defined
struct stat file_stat;
^
/data/develop/dila/podofo/trunk/src/base/PdfInputStream.cpp:107:25: error:
‘fstat’ was not declared in this scope
fstat(fp, &file_stat);
^
/data/develop/dila/podofo/trunk/src/base/PdfInputStream.cpp: In member
function ‘PoDoFo::PdfDate PoDoFo::PdfFileInputStream::GetCreationDate()’:
/data/develop/dila/podofo/trunk/src/base/PdfInputStream.cpp:114:17: error:
aggregate ‘PoDoFo::PdfFileInputStream::GetCreationDate()::stat file_stat’ has
incomplete type and cannot be defined
struct stat file_stat;
^
/data/develop/dila/podofo/trunk/src/base/PdfInputStream.cpp:116:25: error:
‘fstat’ was not declared in this scope
fstat(fp, &file_stat);
^
src/CMakeFiles/podofo_static.dir/build.make:470: recipe for target
'src/CMakeFiles/podofo_static.dir/base/PdfInputStream.cpp.o' failed
make[2]: *** [src/CMakeFiles/podofo_static.dir/base/PdfInputStream.cpp.o]
Error 1
CMakeFiles/Makefile2:117: recipe for target
'src/CMakeFiles/podofo_static.dir/all' failed
make[1]: *** [src/CMakeFiles/podofo_static.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2
---------------------------------------------------------------------
The change should be cross-platform, or conditionally compiled.
I compile on a Linux machine here. Apart of this build failure, I've
couple cosmetic queries on the patch itself, see below (pity your patch
doesn't use -up argument for diff).
> Index: src/base/PdfInputStream.cpp
> ===================================================================
> --- src/base/PdfInputStream.cpp (revision 1697)
> +++ src/base/PdfInputStream.cpp (working copy)
> @@ -35,6 +35,7 @@
>
> #include "PdfInputDevice.h"
> #include "PdfDefinesPrivate.h"
> +#include "PdfDate.h"
>
> #include <stdio.h>
> #include <string.h>
> @@ -98,6 +99,24 @@
> return lLen;
> }
>
> +PdfDate PdfFileInputStream::GetModifiedDate()
> +{
> +
coding style: extra empty line above
> + struct stat file_stat;
> + int fp = fileno(m_hFile);
> + fstat(fp, &file_stat);
> + return PdfDate(file_stat.st_mtime);
> +}
> +
> +
coding style: extra empty line above
> +PdfDate PdfFileInputStream::GetCreationDate()
> +{
> + struct stat file_stat;
> + int fp = fileno(m_hFile);
> + fstat(fp, &file_stat);
> + return PdfDate(file_stat.st_ctime);
> +}
> +
> FILE*
> PdfFileInputStream::GetHandle()
> {
> Index: src/base/PdfInputStream.h
> ===================================================================
> --- src/base/PdfInputStream.h (revision 1697)
> +++ src/base/PdfInputStream.h (working copy)
> @@ -35,6 +35,7 @@
> #define _PDF_INPUT_STREAM_H_
>
> #include "PdfDefines.h"
> +#include "PdfDate.h"
>
> namespace PoDoFo {
>
> @@ -103,6 +104,16 @@
> */
> pdf_long GetFileLength();
>
> + /** Get the modified date of the file.
> + * \return the file modified date
> + */
> + PdfDate GetModifiedDate();
> +
> + /** Get the creation date of the file.
> + * \return the file creation date
> + */
> + PdfDate GetCreationDate();
> +
> /** Get the internal FILE handle.
> * \return the internal FILE handle
> */
> Index: src/doc/PdfFileSpec.cpp
> ===================================================================
> --- src/doc/PdfFileSpec.cpp (revision 1697)
> +++ src/doc/PdfFileSpec.cpp (working copy)
> @@ -39,6 +39,7 @@
> #include "base/PdfInputStream.h"
> #include "base/PdfObject.h"
> #include "base/PdfStream.h"
> +#include "base/PdfDate.h"
>
> #include <sstream>
>
> @@ -182,7 +183,7 @@
> // Add additional information about the embedded file to the
> stream
> PdfDictionary params;
> params.AddKey( "Size",
> static_cast<pdf_int64>(stream.GetFileLength()) );
> - // TODO: CreationDate and ModDate
> + AddDateParams(params, stream.GetCreationDate(),
> stream.GetModifiedDate());
> pStream->GetDictionary().AddKey("Params", params );
> }
>
> @@ -291,7 +292,7 @@
> // Add additional information about the embedded file to the
> stream
> PdfDictionary params;
> params.AddKey( "Size",
> static_cast<pdf_int64>(stream.GetFileLength()) );
> - // TODO: CreationDate and ModDate
> + AddDateParams(params, stream.GetCreationDate(),
> stream.GetModifiedDate());
> pStream->GetDictionary().AddKey("Params", params );
> }
>
> @@ -320,7 +321,7 @@
> return lastFrom;
> }
>
> -void PdfFileSpec::EmbeddFileFromMem( PdfObject* pStream, const
> unsigned char* data, ptrdiff_t size ) const
> +void PdfFileSpec::EmbeddFileFromMem( PdfObject* pStream, const
> unsigned char* data, ptrdiff_t size, const PdfDate* creation_date,
> const PdfDate* mod_date ) const
> {
> PdfMemoryInputStream memstream(reinterpret_cast<const
> char*>(data),size);
> pStream->GetStream()->Set( &memstream );
> @@ -328,6 +329,17 @@
> // Add additional information about the embedded file to the
> stream
> PdfDictionary params;
> params.AddKey( "Size", static_cast<pdf_int64>(size) );
> + PdfDate creation_date_internal;
> + PdfDate mod_date_internal;
> + if (creation_date != NULL)
> + {
> + creation_date_internal = *creation_date;
> + }
> + if (mod_date != NULL)
> + {
> + mod_date_internal = *mod_date;
> + }
> + AddDateParams( params, creation_date_internal, mod_date_internal
> );
> pStream->GetDictionary().AddKey("Params", params );
> }
>
> @@ -346,5 +358,15 @@
> PODOFO_RAISE_ERROR( ePdfError_InvalidDataType );
> }
>
> +void PdfFileSpec::AddDateParams(PdfDictionary ¶ms, const PdfDate
> &creation_date, const PdfDate &mod_date) const
> +{
> + PdfString mod_date_string;
> + mod_date.ToString(mod_date_string);
> + params.AddKey("ModDate", mod_date_string);
> + PdfString creation_date_string;
> + creation_date.ToString(creation_date_string);
> + params.AddKey("CreationDate", creation_date_string);
> +}
>
> +
coding style: extra empty line above
> };
> Index: src/doc/PdfFileSpec.h
> ===================================================================
> --- src/doc/PdfFileSpec.h (revision 1697)
> +++ src/doc/PdfFileSpec.h (working copy)
> @@ -38,6 +38,8 @@
>
> #include "podofo/base/PdfString.h"
>
> +#include "base/PdfDate.h"
See how PdfString is included here. why not do it the same (and not add
the empty gap between PdfString.h and PdfDate.h)?
> +
> #include "PdfElement.h"
>
> namespace PoDoFo {
> @@ -125,8 +127,15 @@
> /* Petr P. Petrov 17 September 2009*/
> /** Embeds the file from memory
> */
> - void EmbeddFileFromMem( PdfObject* pStream, const unsigned char*
> data, ptrdiff_t size ) const;
> + void EmbeddFileFromMem( PdfObject* pStream, const unsigned char*
> data, ptrdiff_t size, const PdfDate* creation_date = NULL, const
> PdfDate* mod_date = NULL ) const;
>
> + /** Add creation date and modified date params to the given
> dictonary.
> + * \param params add the dates to this dictionary
> + * \param creation_date the creation date that will be added
> + * \param mod_date the modified date that will be added
> + */
> + void AddDateParams( PdfDictionary ¶ms, const PdfDate
> &creation_date, const PdfDate &mod_date ) const;
> +
> };
>
> };
Thanks and bye,
zyx
P.S.: by the way, do you have any idea why your mailer breaks threading
of the messages?
--
http://www.litePDF.cz [email protected]
------------------------------------------------------------------------------
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140
_______________________________________________
Podofo-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/podofo-users