archrelease: copy trunk to testing-x86_64
[arch-packages.git] / libreoffice-still / trunk / poppler-22.04.0.patch
blob9a044903827dc9d6e6a9dd937ac57207ad60773d
1 # Patch from FreeBSD (https://cgit.freebsd.org/ports/commit/?id=d9b5ef800dbd)
3 --- sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx.orig 2022-04-26 16:11:01 UTC
4 +++ sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
5 @@ -474,11 +474,17 @@ int PDFOutDev::parseFont( long long nNewId, GfxFont* g
7 // TODO(P3): Unfortunately, need to read stream twice, since
8 // we must write byte count to stdout before
9 +#if !POPPLER_CHECK_VERSION(22, 3, 0)
10 char* pBuf = gfxFont->readEmbFontFile( m_pDoc->getXRef(), &nSize );
11 +#else
12 + std::optional<std::vector<unsigned char>> pBuf = gfxFont->readEmbFontFile( m_pDoc->getXRef() );
13 +#endif
14 if( pBuf )
16 aNewFont.isEmbedded = true;
17 +#if !POPPLER_CHECK_VERSION(22, 3, 0)
18 gfree(pBuf);
19 +#endif
23 @@ -492,21 +498,32 @@ void PDFOutDev::writeFontFile( GfxFont* gfxFont ) cons
24 return;
26 int nSize = 0;
27 - char* pBuf = gfxFont->readEmbFontFile( m_pDoc->getXRef(), &nSize );
28 +#if !POPPLER_CHECK_VERSION(22, 3, 0)
29 + char* pBuf = gfxFont->readEmbFontFile( m_pDoc->getXRef(), &nSize );
30 +#else
31 + std::optional<std::vector<unsigned char>> pBuf = gfxFont->readEmbFontFile( m_pDoc->getXRef() );
32 +#endif
33 if( !pBuf )
34 return;
36 // ---sync point--- see SYNC STREAMS above
37 fflush(stdout);
39 +#if !POPPLER_CHECK_VERSION(22, 3, 0)
40 if( fwrite(pBuf, sizeof(char), nSize, g_binary_out) != static_cast<size_t>(nSize) )
41 +#else
42 + if( fwrite(reinterpret_cast<char*>(pBuf.value().data()), sizeof(char), nSize, g_binary_out) != static_cast<size_t>(nSize) )
43 +#endif
45 - gfree(pBuf);
46 +#if !POPPLER_CHECK_VERSION(22, 3, 0)
47 + gfree(pBuf);
48 +#endif
49 exit(1); // error
51 // ---sync point--- see SYNC STREAMS above
52 fflush(g_binary_out);
53 - gfree(pBuf);
54 +#if !POPPLER_CHECK_VERSION(22, 3, 0)
55 + gfree(pBuf);
56 +#endif
59 #if POPPLER_CHECK_VERSION(0, 83, 0)
60 @@ -759,7 +776,11 @@ void PDFOutDev::updateFont(GfxState *state)
62 assert(state);
64 +#if !POPPLER_CHECK_VERSION(22, 3, 0)
65 GfxFont *gfxFont = state->getFont();
66 +#else
67 + GfxFont *gfxFont = state->getFont().get();
68 +#endif
69 if( !gfxFont )
70 return;