I think the best solution is reverting then using pdf_unt8 to store the enum 
internally.

The only changes needed after reverting are

change
       EPdfDataType m_eDataType;
to
       pdf_int8 m_eDataType;

and in PdfVariant::GetDataType change

       return m_eDataType;
to
       return (EPdfDataType)m_eDataType;


I’ll do some testing them submit a patch.

Best Regards
Mark

Mark Rogers - mark.rog...@powermapper.com
PowerMapper Software Ltd - www.powermapper.com 
Registered in Scotland No 362274 Quartermile 2 Edinburgh EH3 9GL 
 


On 16/02/2017, 18:50, "zyx" <z...@litepdf.cz> wrote:

    On Sat, 2017-02-11 at 03:12 +0100, Sandro Mani wrote:
    > So rather than just removing -std=c++98 from the CMakeLists, the
    > code must be changed to ensure the size of the enum is always the
    > same regardless of the language standard one is using.
    
        Hi,
    I would ideally use something like the attached change, but it has also
    caveats. 
    
    It lets me compile the test example with any standard, even with c++98,
    while keeping the PoDoFo built with the default standard for the
    compiler, but as the enum is defined in a public header, then when I
    use lower-than c++11 (more precisely, when my compilation doesn't have
    required standard version, but PoDoFo had been built with new-enough
    C++ standard), the I get a warning from gcc:
    
       src/base/PdfCompilerCompat.h:202:29: warning: scoped enums only
       available with -std=c++11 or -std=gnu++11
         #define PODOFO_ENUM_UINT8 : uint8_t
    
    Thus it can make, theoretically, a trouble. I do not see any good
    solution for this, maybe only revert this change (r1810) all together
    and change PdfVariant to not hold
       EPdfDataType m_eDataType;
    but
       pdf_int8 m_eDataType;
    instead, which would require some other internal changes possibly. I
    would not change the public API otherwise, the functions would still
    use the enum.
    
    Opinions?
        Bye,
        zyx
    
    -- 
    http://www.litePDF.cz                                 i...@litepdf.cz

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Podofo-users mailing list
Podofo-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/podofo-users

Reply via email to