Also there is this additional warning when building with clang with -O3:

In function ‘char* strncpy(char*, const char*, size_t)’,
    inlined from ‘PoDoFo::PdfDate::PdfDate(const PoDoFo::PdfString&)’ at
podofo/base/PdfDate.cpp:67:12:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:34: warning:
‘char* __builtin_strncpy(char*, const char*, long unsigned int)’ output may
be truncated copying 26 bytes from a string of length 31
[-Wstringop-truncation]

On Tue, May 26, 2020 at 5:06 PM Michal Sudolsky <sudols...@gmail.com> wrote:

> Hi,
>
>         Hi,
>> being it it, I'd expect a lot more format-specific warnings, not only
>> this one. It's only my opinion, no proof available. I just tried with
>> clang 10.0.0 on Linux and it doesn't claim this warning. It claims some
>> other, which gcc (10.1.1) does not claim about here.
>>
>>
> On which version of linux did you try?
>
> What is interesting if I force it to use these defines:
>
> #  define PDF_FORMAT_INT64 "lld"
> #  define PDF_FORMAT_UINT64 "llu"
> #  define PDF_SIZE_FORMAT "zu"
>
> Then there is no -Wformat warning on osx. But there are -Wformat warnings
> on linux (one with llOffset and one with llGeneration):
>
> podofo/base/PdfParser.cpp:908:54: warning: format ‘%lld’ expects argument
> of type ‘long long int*’, but argument 3 has type ‘PoDoFo::pdf_int64*’ {aka
> ‘long int*’} [-Wformat=]
>   908 |             int read = sscanf( m_buffer.GetBuffer(), "%10"
> PDF_FORMAT_INT64 " %5" PDF_FORMAT_INT64 " %c%c%c",
>   909 |                               &llOffset, &llGeneration, &cUsed,
> &empty1, &empty2 );
>
> Are there any problems using macro like "SCNd64" from cinttypes?
>
> Why is PdfXRefStreamParserObject deprecated when it is so essential?
>
>
>
>> > podofo/base/PdfDate.cpp:205:50: warning: ‘%s’ directive output may be
>> > truncated writing up to 5 bytes into a region of size between 1 and
>> > 26 [-Wformat-truncation=]
>> >   205 |     snprintf( m_szDate, PDF_DATE_BUFFER_SIZE, "%s%s'00'",
>> > szDate, szZone );
>>
>> This one is not claimed by clang here.
>>
>> I use the same warning flags for both compilers.
>>
>
> On ubuntu 20.04 it is and on gcc. Also now I see also that warning about
> lua (without enabled lua):
>
> podofo/src/podofo/base/PdfDate.cpp:204:50: warning: ‘%s’ directive output
> may be truncated writing up to 5 bytes into a region of size between 1 and
> 26 [-Wformat-truncation=]
>   204 |     snprintf( m_szDate, PDF_DATE_BUFFER_SIZE, "%s%s'00'", szDate,
> szZone );
>
> podofo/src/podofo/base/PdfMemStream.cpp:57:18: warning:
> implicitly-declared ‘PoDoFo::PdfMemStream&
> PoDoFo::PdfMemStream::operator=(const PoDoFo::PdfMemStream&)’ is deprecated
> [-Wdeprecated-copy]
>    57 |     operator=(rhs);
>
> podofo/src/podofo/base/PdfString.cpp:787:58: warning: unused parameter
> ‘eConversion’ [-Wunused-parameter]
>   787 |                                     EPdfStringConversion
> eConversion )
>
> podofo/src/podofo/base/PdfString.cpp:825:58: warning: unused parameter
> ‘eConversion’ [-Wunused-parameter]
>   825 |                                     EPdfStringConversion
> eConversion  )
>
> podofo/src/podofo/base/PdfTokenizer.cpp:440:75: warning: type qualifiers
> ignored on cast result type [-Wignored-qualifiers]
>   440 |             else if( !(isdigit( static_cast<const unsigned
> char>(*pszStart) ) || *pszStart == '-' || *pszStart == '+' ) )
>
> podofo/src/podofo/base/PdfTokenizer.cpp:512:73: warning: type qualifiers
> ignored on cast result type [-Wignored-qualifiers]
>   512 |                                          static_cast<const
> pdf_uint16>(l) );
>
> podofo/src/podofo/doc/PdfField.cpp:107:26: warning: implicitly-declared
> ‘constexpr PoDoFo::PdfField& PoDoFo::PdfField::operator=(const
> PoDoFo::PdfField&)’ is deprecated [-Wdeprecated-copy]
>   107 |     this->operator=( rhs );
>
> podofo/tools/podofocolor/podofocolor.cpp:50:89: warning: unused parameter
> ‘lua’ [-Wunused-parameter]
>    50 | static IConverter* ConverterForName( const std::string &
> converter, const std::string & lua )
>
> These when I used clang (still on linux):
>
> podofo/src/podofo/base/PdfParser.cpp:946:5: warning:
> 'PdfXRefStreamParserObject' is deprecated [-Wdeprecated-declarations]
>     PdfXRefStreamParserObject xrefObject( m_vecObjects, m_device,
> m_buffer, &m_offsets );
>
> podofo/test/VariantTest/VariantTest.cpp:131:39: warning: illegal character
> encoding in string literal [-Winvalid-source-encoding]
>     TEST_SAFE_OP( Test( "(Hallo \\(sch<F6>ne\\) Welt!)",
> ePdfDataType_String ) );
>
> podofo/test/ObjectParserTest/ObjectParserTest.cpp:322:61: warning: illegal
> character encoding in string literal [-Winvalid-source-encoding]
> const char* pszSimpleObjectString2 = "5 0 obj\n(Hallo \\(sch<F6>ne\\)
> Welt!)\nendobj\n";
>
> podofo/test/ObjectParserTest/ObjectParserTest.cpp:448:77: warning: illegal
> character encoding in string literal [-Winvalid-source-encoding]
>     TRY_TEST(TestObject_String( pszSimpleObjectString2, 5, 0, "(Hallo
> \\(sch<F6>ne\\) Welt!)" );)
>
>
>
> Configuring it with cmake on osx is little harder. I need to manualy set
> FREETYPE_INCLUDE_DIR then:
>
> -- Performing Test PODOFO_HAVE_OPENSSL_1_1
> -- Performing Test PODOFO_HAVE_OPENSSL_1_1 - Failed
>
> Due to this it will not compile:
>
> src/podofo/base/PdfEncrypt.cpp:143:24: error: field has incomplete type
> 'EVP_CIPHER_CTX' (aka 'evp_cipher_ctx_st')
>         EVP_CIPHER_CTX aes;
>
> until I manually enable openssl 1.1 in podofo_config.h:
>
> #define PODOFO_HAVE_OPENSSL_1_1
>
> Then there is this error (due to latest commit):
>
> src/podofo/base/PdfString.cpp:136:9: error: unknown type name 'constexpr'
>         constexpr bool wchar_t_is_two_bytes = sizeof(wchar_t) == 2;
>
> I need to enable c++11. And there are many warnings -Wformat in tools and
> tests. Including similar warnings as on linux with clang.
>
>
>
>>         Bye,
>>         zyx
>>
>> P.S.: by the way, would you mind to reply to list instead to all when
>> replying (at least to my) messages here, please? I do not need to
>> receive private copy of the message when I get it through the list. I
>> also reply to the list, not to individuals, unless they explicitly ask
>> for it (like one time senders, whom might not be subscribed to the
>> list). Receiving messages through the list makes it easier to reply to
>> the list, in contrast to edit recipients in "private" mails when
>> replying.
>>
>>
> You are probably not using gmail. I have two options here "Reply" which
> would reply only to you and "Reply to all" which puts you as receiver and
> mailing list as CC. So then I must edit recipients if I want to reply only
> to list ;)
>
>
>
>>
>>
>> _______________________________________________
>> 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