I have not Linux machine to compile it.
It looks like some includes are missing.
"struct stat" and "fstat" should be available in glibc too.

http://linux.die.net/man/2/stat
http://linux.die.net/man/2/fstat

could you try to add the following includes to "PdfInputStream.cpp" and
compile it?

#include <sys/types.h>
#include <sys/stat.h>

After a look in the include tree on my system "sys/types.h" is included by
"src/base/PdfCompilerCompat.h"

#if PODOFO_HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif

and "sys/stat.h" is included because "src/base/PdfCompilerCompat.h"
includes "wchar.h" which include "sys/stat.h"

Here is the inlcude tree

PdfInputStream.cpp
1>  Note: including file: ...\podofo-0.9.3\src\base\PdfInputStream.h
1>  Note: including file:  ...\podofo-0.9.3\src\base\PdfDefines.h
1>  Note: including file:   ...\podofo-0.9.3\src\base\PdfCompilerCompat.h
1>  Note: including file:    ...\podofo-0.9.3\podofo_config.h
1>  Note: including file:    C:\Program Files (x86)\Microsoft Visual
Studio 14.0\VC\include\cstddef
1>  Note: including file:     C:\Program Files (x86)\Microsoft Visual
Studio 14.0\VC\include\yvals.h
1>  Note: including file:      C:\Program Files (x86)\Microsoft Visual
Studio 14.0\VC\include\xkeycheck.h
1>  Note: including file:      C:\Program Files (x86)\Microsoft Visual
Studio 14.0\VC\include\crtdefs.h
1>  Note: including file:       C:\Program Files (x86)\Microsoft Visual
Studio 14.0\VC\include\vcruntime.h
1>  Note: including file:        C:\Program Files (x86)\Microsoft Visual
Studio 14.0\VC\include\sal.h
1>  Note: including file:         C:\Program Files (x86)\Microsoft Visual
Studio 14.0\VC\include\ConcurrencySal.h
1>  Note: including file:        C:\Program Files (x86)\Microsoft Visual
Studio 14.0\VC\include\vadefs.h
1>  Note: including file:       C:\Program Files (x86)\Windows
Kits\10\Include\10.0.10150.0\ucrt\corecrt.h
1>  Note: including file:        C:\Program Files (x86)\Microsoft Visual
Studio 14.0\VC\include\vcruntime.h
1>  Note: including file:      C:\Program Files (x86)\Microsoft Visual
Studio 14.0\VC\include\use_ansi.h
1>  Note: including file:     C:\Program Files (x86)\Windows
Kits\10\Include\10.0.10150.0\ucrt\stddef.h
1>  Note: including file:    C:\Program Files (x86)\Microsoft Visual
Studio 14.0\VC\include\stdint.h
1>  Note: including file:     C:\Program Files (x86)\Microsoft Visual
Studio 14.0\VC\include\vcruntime.h
1>  Note: including file:    C:\Program Files (x86)\Windows
Kits\8.1\Include\shared\BaseTsd.h
1>  Note: including file:    C:\Program Files (x86)\Windows
Kits\10\Include\10.0.10150.0\ucrt\sys/types.h
1>  Note: including file:    C:\Program Files (x86)\Windows
Kits\10\Include\10.0.10150.0\ucrt\ctype.h
1>  Note: including file:     C:\Program Files (x86)\Windows
Kits\10\Include\10.0.10150.0\ucrt\corecrt_wctype.h
1>  Note: including file:    C:\Program Files (x86)\Windows
Kits\10\Include\10.0.10150.0\ucrt\malloc.h
1>  Note: including file:     C:\Program Files (x86)\Windows
Kits\10\Include\10.0.10150.0\ucrt\corecrt_malloc.h
1>  Note: including file:   C:\Program Files (x86)\Windows
Kits\10\Include\10.0.10150.0\ucrt\wchar.h
1>  Note: including file:    C:\Program Files (x86)\Windows
Kits\10\Include\10.0.10150.0\ucrt\corecrt_memcpy_s.h
1>  Note: including file:     C:\Program Files (x86)\Windows
Kits\10\Include\10.0.10150.0\ucrt\errno.h
1>  Note: including file:     C:\Program Files (x86)\Microsoft Visual
Studio 14.0\VC\include\vcruntime_string.h
1>  Note: including file:      C:\Program Files (x86)\Microsoft Visual
Studio 14.0\VC\include\vcruntime.h
1>  Note: including file:    C:\Program Files (x86)\Windows
Kits\10\Include\10.0.10150.0\ucrt\corecrt_wconio.h
1>  Note: including file:     C:\Program Files (x86)\Windows
Kits\10\Include\10.0.10150.0\ucrt\corecrt_stdio_config.h
1>  Note: including file:    C:\Program Files (x86)\Windows
Kits\10\Include\10.0.10150.0\ucrt\corecrt_wdirect.h
1>  Note: including file:    C:\Program Files (x86)\Windows
Kits\10\Include\10.0.10150.0\ucrt\corecrt_wio.h
1>  Note: including file:     C:\Program Files (x86)\Windows
Kits\10\Include\10.0.10150.0\ucrt\corecrt_share.h
1>  Note: including file:    C:\Program Files (x86)\Windows
Kits\10\Include\10.0.10150.0\ucrt\corecrt_wprocess.h
1>  Note: including file:    C:\Program Files (x86)\Windows
Kits\10\Include\10.0.10150.0\ucrt\corecrt_wstdio.h
1>  Note: including file:    C:\Program Files (x86)\Windows
Kits\10\Include\10.0.10150.0\ucrt\corecrt_wstdlib.h
1>  Note: including file:    C:\Program Files (x86)\Windows
Kits\10\Include\10.0.10150.0\ucrt\corecrt_wstring.h
1>  Note: including file:    C:\Program Files (x86)\Windows
Kits\10\Include\10.0.10150.0\ucrt\corecrt_wtime.h
1>  Note: including file:    C:\Program Files (x86)\Windows
Kits\10\Include\10.0.10150.0\ucrt\sys/stat.h
..... //and many more



PS: I have no Idea why IBM Notes breaks threading of the Message.



Julian Rehborn
Junior Software Engineer
________________________________________
GBS PAVONE Groupware GmbH
Im Dörener Feld 3
33100 Paderborn
Germany
Phone: +49 52 51 31 02-0
Fax: +49 52 51 31 02-99
www.pavone.de
________________________________________


Profitieren Sie von Best Practice Erfahrungen:

Grundlagen der iQ.Suite für IBM Notes/Domino am 19.01.2016 in Karlsruhe

Exklusiv für Volksbanken: So holen Sie das Maximum aus Ihrer iQ.Suite raus
am 18.02.2016 in Karlsruhe


--
GBS PAVONE Groupware GmbH Disclaimer
automatically added by GBS Email Management Solutions

Sitz der Gesellschaft:
GBS PAVONE Groupware GmbH
Hospitalstr. 6
99817 Eisenach
Germany

Webseite: http://www.pavone.de, E-Mail: i...@pavone.de

Registereintragung: Amtsgericht Jena HRB 508241
Umsatzsteuer-Identifikations-Nummer gemäß Paragraph 27a UstG: DE 185612304
Geschäftsführer: Jörg Ott






From:   zyx <z...@litepdf.cz>
To:     podofo-users@lists.sourceforge.net
Date:   08.12.2015 18:01
Subject:        Re: [Podofo-users] Set CreationDate and ModDate during
file embedding



On Tue, 2015-12-01 at 10:35 +0100, julian.rehb...@de.gbs.com 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 &params, 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 &params, 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                                 i...@litepdf.cz



------------------------------------------------------------------------------
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
Podofo-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/podofo-users

------------------------------------------------------------------------------
_______________________________________________
Podofo-users mailing list
Podofo-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/podofo-users

Reply via email to