summaryrefslogtreecommitdiff
path: root/sdext/source/pdfimport
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2018-09-15 19:13:19 +0200
committerStephan Bergmann <sbergman@redhat.com>2018-09-17 09:05:38 +0200
commit206b5b2661be37efdff3c6aedb6f248c4636be79 (patch)
treeaf385e5b4725dcfea23988d9113cced8e9ccaf3c /sdext/source/pdfimport
parenta85d3ba1c0de313b60324b9ecfa488bb99d69d06 (diff)
New loplugin:external
...warning about (for now only) functions and variables with external linkage that likely don't need it. The problems with moving entities into unnamed namespacs and breaking ADL (as alluded to in comments in compilerplugins/clang/external.cxx) are illustrated by the fact that while struct S1 { int f() { return 0; } }; int f(S1 s) { return s.f(); } namespace N { struct S2: S1 { int f() { return 1; } }; int f(S2 s) { return s.f(); } } int main() { return f(N::S2()); } returns 1, both moving just the struct S2 into an nunnamed namespace, struct S1 { int f() { return 0; } }; int f(S1 s) { return s.f(); } namespace N { namespace { struct S2: S1 { int f() { return 1; } }; } int f(S2 s) { return s.f(); } } int main() { return f(N::S2()); } as well as moving just the function f overload into an unnamed namespace, struct S1 { int f() { return 0; } }; int f(S1 s) { return s.f(); } namespace N { struct S2: S1 { int f() { return 1; } }; namespace { int f(S2 s) { return s.f(); } } } int main() { return f(N::S2()); } would each change the program to return 0 instead. Change-Id: I4d09f7ac5e8f9bcd6e6bde4712608444b642265c Reviewed-on: https://gerrit.libreoffice.org/60539 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'sdext/source/pdfimport')
-rw-r--r--sdext/source/pdfimport/test/pdfunzip.cxx14
-rw-r--r--sdext/source/pdfimport/tree/drawtreevisiting.cxx6
-rw-r--r--sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx28
3 files changed, 24 insertions, 24 deletions
diff --git a/sdext/source/pdfimport/test/pdfunzip.cxx b/sdext/source/pdfimport/test/pdfunzip.cxx
index 2ccbffb5dcb3..3e5a452dee13 100644
--- a/sdext/source/pdfimport/test/pdfunzip.cxx
+++ b/sdext/source/pdfimport/test/pdfunzip.cxx
@@ -31,7 +31,7 @@
using namespace pdfparse;
-void printHelp( const char* pExe )
+static void printHelp( const char* pExe )
{
fprintf( stdout,
"USAGE: %s [-h,--help]\n"
@@ -212,7 +212,7 @@ unsigned int FileEmitContext::readOrigBytes( unsigned int nOrigOffset, unsigned
typedef int(*PDFFileHdl)(const char*, const char*, PDFFile*);
-int handleFile( const char* pInFile, const char* pOutFile, const char* pPassword, PDFFileHdl pHdl )
+static int handleFile( const char* pInFile, const char* pOutFile, const char* pPassword, PDFFileHdl pHdl )
{
PDFReader aParser;
@@ -236,7 +236,7 @@ int handleFile( const char* pInFile, const char* pOutFile, const char* pPassword
return nRet;
}
-int write_unzipFile( const char* pInFile, const char* pOutFile, PDFFile* pPDFFile )
+static int write_unzipFile( const char* pInFile, const char* pOutFile, PDFFile* pPDFFile )
{
FileEmitContext aContext( pOutFile, pInFile, pPDFFile );
aContext.m_bDecrypt = pPDFFile->isEncrypted();
@@ -244,7 +244,7 @@ int write_unzipFile( const char* pInFile, const char* pOutFile, PDFFile* pPDFFil
return 0;
}
-int write_addStreamArray( const char* pOutFile, PDFArray* pStreams, PDFFile* pPDFFile, const char* pInFile )
+static int write_addStreamArray( const char* pOutFile, PDFArray* pStreams, PDFFile* pPDFFile, const char* pInFile )
{
int nRet = 0;
unsigned int nArrayElements = pStreams->m_aSubElements.size();
@@ -285,7 +285,7 @@ int write_addStreamArray( const char* pOutFile, PDFArray* pStreams, PDFFile* pPD
return nRet;
}
-int write_addStreams( const char* pInFile, const char* pOutFile, PDFFile* pPDFFile )
+static int write_addStreams( const char* pInFile, const char* pOutFile, PDFFile* pPDFFile )
{
// find all trailers
int nRet = 0;
@@ -309,7 +309,7 @@ int write_addStreams( const char* pInFile, const char* pOutFile, PDFFile* pPDFFi
return nRet;
}
-int write_fonts( const char* i_pInFile, const char* i_pOutFile, PDFFile* i_pPDFFile )
+static int write_fonts( const char* i_pInFile, const char* i_pOutFile, PDFFile* i_pPDFFile )
{
int nRet = 0;
unsigned int nElements = i_pPDFFile->m_aSubElements.size();
@@ -395,7 +395,7 @@ int write_fonts( const char* i_pInFile, const char* i_pOutFile, PDFFile* i_pPDFF
static std::vector< std::pair< sal_Int32, sal_Int32 > > s_aEmitObjects;
-int write_objects( const char* i_pInFile, const char* i_pOutFile, PDFFile* i_pPDFFile )
+static int write_objects( const char* i_pInFile, const char* i_pOutFile, PDFFile* i_pPDFFile )
{
int nRet = 0;
unsigned int nElements = s_aEmitObjects.size();
diff --git a/sdext/source/pdfimport/tree/drawtreevisiting.cxx b/sdext/source/pdfimport/tree/drawtreevisiting.cxx
index b0d51c5cc2b8..d587ac97903e 100644
--- a/sdext/source/pdfimport/tree/drawtreevisiting.cxx
+++ b/sdext/source/pdfimport/tree/drawtreevisiting.cxx
@@ -648,7 +648,7 @@ void DrawXmlOptimizer::visit( PageElement& elem, const std::list< std::unique_pt
elem.applyToChildren(*this);
}
-bool isSpaces(TextElement* pTextElem)
+static bool isSpaces(TextElement* pTextElem)
{
for (sal_Int32 i = 0; i != pTextElem->Text.getLength(); ++i) {
if (pTextElem->Text[i] != ' ') {
@@ -658,7 +658,7 @@ bool isSpaces(TextElement* pTextElem)
return true;
}
-bool notTransformed(const GraphicsContext& GC)
+static bool notTransformed(const GraphicsContext& GC)
{
return
rtl::math::approxEqual(GC.Transformation.get(0,0), 100.00) &&
@@ -822,7 +822,7 @@ void DrawXmlFinalizer::visit( HyperlinkElement&, const std::list< std::unique_pt
{
}
-void SetFontsizeProperties(PropertyMap& props, double fontSize)
+static void SetFontsizeProperties(PropertyMap& props, double fontSize)
{
OUStringBuffer aBuf(32);
aBuf.append(fontSize * 72 / PDFI_OUTDEV_RESOLUTION);
diff --git a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
index 06e4faead383..942a5d60cc9f 100644
--- a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
+++ b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
@@ -67,7 +67,7 @@ namespace pdfi
{
/// cut off very small numbers & clamp value to zero
-inline double normalize( double val )
+static inline double normalize( double val )
{
return fabs(val) < 0.0000001 ? 0.0 : val;
}
@@ -118,12 +118,12 @@ std::vector<char> lcl_escapeLineFeeds(const char* const i_pStr)
/// for the initial std::vector capacity when copying stream from xpdf
#define WRITE_BUFFER_INITIAL_CAPACITY (1024*100)
-void initBuf(OutputBuffer& io_rBuffer)
+static void initBuf(OutputBuffer& io_rBuffer)
{
io_rBuffer.reserve(WRITE_BUFFER_INITIAL_CAPACITY);
}
-void writeBinaryBuffer( const OutputBuffer& rBuffer )
+static void writeBinaryBuffer( const OutputBuffer& rBuffer )
{
// ---sync point--- see SYNC STREAMS above
fflush(stdout);
@@ -138,7 +138,7 @@ void writeBinaryBuffer( const OutputBuffer& rBuffer )
fflush(g_binary_out);
}
-bool ExtractJpegData(Stream* str, OutputBuffer& outBuf)
+static bool ExtractJpegData(Stream* str, OutputBuffer& outBuf)
{
int bytesToMarker = 0;
int bytesToLen = -1;
@@ -204,7 +204,7 @@ bool ExtractJpegData(Stream* str, OutputBuffer& outBuf)
}
}
-void writeJpeg_( OutputBuffer& o_rOutputBuf, Stream* str )
+static void writeJpeg_( OutputBuffer& o_rOutputBuf, Stream* str )
{
// dump JPEG file as-is
#if POPPLER_CHECK_VERSION(0, 17, 3)
@@ -223,7 +223,7 @@ void writeJpeg_( OutputBuffer& o_rOutputBuf, Stream* str )
str->close();
}
-void writePbm_(OutputBuffer& o_rOutputBuf, Stream* str, int width, int height, bool bInvert )
+static void writePbm_(OutputBuffer& o_rOutputBuf, Stream* str, int width, int height, bool bInvert )
{
// write as PBM (char by char, to avoid stdlib lineend messing)
o_rOutputBuf.clear();
@@ -265,7 +265,7 @@ void writePbm_(OutputBuffer& o_rOutputBuf, Stream* str, int width, int height, b
str->close();
}
-void writePpm_( OutputBuffer& o_rOutputBuf,
+static void writePpm_( OutputBuffer& o_rOutputBuf,
Stream* str,
int width,
int height,
@@ -323,7 +323,7 @@ void writePpm_( OutputBuffer& o_rOutputBuf,
}
// call this only for 1 bit image streams !
-void writePng_( OutputBuffer& o_rOutputBuf,
+static void writePng_( OutputBuffer& o_rOutputBuf,
Stream* str,
int width,
int height,
@@ -340,7 +340,7 @@ void writePng_( OutputBuffer& o_rOutputBuf,
printf("\n");
}
-void writePng_( OutputBuffer& o_rOutputBuf,
+static void writePng_( OutputBuffer& o_rOutputBuf,
Stream* str,
int width, int height, GfxImageColorMap* colorMap,
Stream* maskStr,
@@ -355,7 +355,7 @@ void writePng_( OutputBuffer& o_rOutputBuf,
printf("\n");
}
-void writePng_( OutputBuffer& o_rOutputBuf,
+static void writePng_( OutputBuffer& o_rOutputBuf,
Stream* str,
int width, int height, GfxImageColorMap* colorMap,
Stream* maskStr,
@@ -371,7 +371,7 @@ void writePng_( OutputBuffer& o_rOutputBuf,
}
// stolen from ImageOutputDev.cc
-void writeMask_( OutputBuffer& o_rOutputBuf, Stream* str, int width, int height, bool bInvert )
+static void writeMask_( OutputBuffer& o_rOutputBuf, Stream* str, int width, int height, bool bInvert )
{
if( str->getKind() == strDCT )
writeJpeg_(o_rOutputBuf, str);
@@ -379,7 +379,7 @@ void writeMask_( OutputBuffer& o_rOutputBuf, Stream* str, int width, int height,
writePbm_(o_rOutputBuf, str, width, height, bInvert );
}
-void writeImage_( OutputBuffer& o_rOutputBuf,
+static void writeImage_( OutputBuffer& o_rOutputBuf,
Stream* str,
int width,
int height,
@@ -415,12 +415,12 @@ void writeImage_( OutputBuffer& o_rOutputBuf,
// forwarders
-inline void writeImageLF( OutputBuffer& o_rOutputBuf,
+static inline void writeImageLF( OutputBuffer& o_rOutputBuf,
Stream* str,
int width,
int height,
GfxImageColorMap* colorMap ) { writeImage_(o_rOutputBuf,str,width,height,colorMap); }
-inline void writeMaskLF( OutputBuffer& o_rOutputBuf,
+static inline void writeMaskLF( OutputBuffer& o_rOutputBuf,
Stream* str,
int width,
int height,