From 979c8c56b7d52fe9a5d4b1fbfdab0adaba04c470 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Sun, 25 Jun 2017 18:20:04 +0200 Subject: loplugin:oncevar in oox..sax Change-Id: I0fee8bcddaeea48335e3be05761d2ad2c45020e2 Reviewed-on: https://gerrit.libreoffice.org/39238 Tested-by: Jenkins Reviewed-by: Noel Grandin --- sal/osl/all/filepath.cxx | 3 +-- sal/osl/unx/file_misc.cxx | 4 +--- sal/osl/unx/pipe.cxx | 3 +-- sal/textenc/convertisciidevangari.cxx | 2 +- sal/textenc/convertsinglebytetobmpunicode.cxx | 3 +-- 5 files changed, 5 insertions(+), 10 deletions(-) (limited to 'sal') diff --git a/sal/osl/all/filepath.cxx b/sal/osl/all/filepath.cxx index c6d12caf11f5..1b2bcace133f 100644 --- a/sal/osl/all/filepath.cxx +++ b/sal/osl/all/filepath.cxx @@ -27,7 +27,6 @@ static sal_uInt32 SAL_CALL osl_defCalcTextWidth( rtl_uString *ustrText ) oslFileError SAL_CALL osl_abbreviateSystemPath( rtl_uString *ustrSystemPath, rtl_uString **pustrCompacted, sal_uInt32 uMaxWidth, oslCalcTextWidthFunc pfnCalcWidth ) { - oslFileError error = osl_File_E_None; rtl_uString *ustrPath = nullptr; rtl_uString *ustrFile = nullptr; sal_uInt32 uPathWidth, uFileWidth; @@ -108,7 +107,7 @@ oslFileError SAL_CALL osl_abbreviateSystemPath( rtl_uString *ustrSystemPath, rtl if ( ustrFile ) rtl_uString_release( ustrFile ); - return error; + return osl_File_E_None; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sal/osl/unx/file_misc.cxx b/sal/osl/unx/file_misc.cxx index 52fd6b780bb0..816a4f729405 100644 --- a/sal/osl/unx/file_misc.cxx +++ b/sal/osl/unx/file_misc.cxx @@ -497,9 +497,7 @@ static int create_dir_with_callback( oslDirectoryCreationCallbackFunc aDirectoryCreationCallbackFunc, void* pData) { - int mode = S_IRWXU | S_IRWXG | S_IRWXO; - - if (osl::mkdir(directory_path, mode) == 0) + if (osl::mkdir(directory_path, S_IRWXU | S_IRWXG | S_IRWXO) == 0) { if (aDirectoryCreationCallbackFunc) { diff --git a/sal/osl/unx/pipe.cxx b/sal/osl/unx/pipe.cxx index ead32377303f..40c93e0c7add 100644 --- a/sal/osl/unx/pipe.cxx +++ b/sal/osl/unx/pipe.cxx @@ -368,9 +368,8 @@ void SAL_CALL osl_closePipe(oslPipe pPipe) addr.sun_family = AF_UNIX; strncpy(addr.sun_path, pPipe->m_Name, sizeof(addr.sun_path) - 1); - size_t len = sizeof(addr); - nRet = connect(fd, reinterpret_cast< sockaddr* >(&addr), len); + nRet = connect(fd, reinterpret_cast< sockaddr* >(&addr), sizeof(addr)); if (nRet < 0) SAL_WARN("sal.osl.pipe", "connect() failed: " << strerror(errno)); diff --git a/sal/textenc/convertisciidevangari.cxx b/sal/textenc/convertisciidevangari.cxx index 2e7f09e5e48e..ed87c5819586 100644 --- a/sal/textenc/convertisciidevangari.cxx +++ b/sal/textenc/convertisciidevangari.cxx @@ -234,7 +234,7 @@ sal_Size UnicodeToIsciiDevanagari::convert(sal_Unicode const* pSrcBuf, sal_Size char* pDestBuf, sal_Size nDestBytes, sal_uInt32 nFlags, sal_uInt32 * pInfo, sal_Size* pSrcCvtChars) { - size_t entries = SAL_N_ELEMENTS(unicodeToISCIIEncoding); + size_t const entries = SAL_N_ELEMENTS(unicodeToISCIIEncoding); BmpUnicodeToSingleByteRange const * ranges = unicodeToISCIIEncoding; sal_Unicode cHighSurrogate = m_cHighSurrogate; diff --git a/sal/textenc/convertsinglebytetobmpunicode.cxx b/sal/textenc/convertsinglebytetobmpunicode.cxx index 9bb994d2a9c8..5890a9dc8220 100644 --- a/sal/textenc/convertsinglebytetobmpunicode.cxx +++ b/sal/textenc/convertsinglebytetobmpunicode.cxx @@ -42,7 +42,6 @@ sal_Size rtl_textenc_convertSingleByteToBmpUnicode( sal_Unicode * destBufPtr = destBuf; sal_Unicode * destBufEnd = destBuf + destChars; for (; converted < srcBytes; ++converted) { - bool undefined = true; sal_Char b = *srcBuf++; sal_Unicode c = map[static_cast< sal_uInt8 >(b)]; if (c == 0xFFFF) { @@ -55,7 +54,7 @@ sal_Size rtl_textenc_convertSingleByteToBmpUnicode( continue; bad_input: switch (sal::detail::textenc::handleBadInputTextToUnicodeConversion( - undefined, false, b, flags, &destBufPtr, destBufEnd, + true/*undefined*/, false, b, flags, &destBufPtr, destBufEnd, &infoFlags)) { case sal::detail::textenc::BAD_INPUT_STOP: -- cgit