summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-04-06 10:47:24 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-04-12 10:11:34 +0200
commit992a33313046f4a4d322db9464c474e7429a019a (patch)
tree494143e3070af872027ecaca840516d3101a881c /sal
parent77c1431ee88ab04a9ff48b849acedee6d455bafb (diff)
clang-tidy: readability-else-after-return
run it against sal,cppu,cppuhelper I had to run this multiple times to catch all the cases in each module, and it requires some hand-tweaking of the resulting output - clang-tidy is not very good about cleaning up trailing spaces, and aligning things nicely. Change-Id: I00336345f5f036e12422b98d66526509380c497a Reviewed-on: https://gerrit.libreoffice.org/36194 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sal')
-rw-r--r--sal/osl/unx/conditn.cxx2
-rw-r--r--sal/osl/unx/file.cxx166
-rw-r--r--sal/osl/unx/file_misc.cxx23
-rw-r--r--sal/osl/unx/file_url.cxx36
-rw-r--r--sal/osl/unx/memory.cxx12
-rw-r--r--sal/osl/unx/module.cxx41
-rw-r--r--sal/osl/unx/pipe.cxx62
-rw-r--r--sal/osl/unx/profile.cxx20
-rw-r--r--sal/osl/unx/random.cxx5
-rw-r--r--sal/osl/unx/security.cxx9
-rw-r--r--sal/osl/unx/socket.cxx53
-rw-r--r--sal/rtl/bootstrap.cxx14
-rw-r--r--sal/rtl/digest.cxx15
-rw-r--r--sal/rtl/math.cxx45
-rw-r--r--sal/rtl/uri.cxx19
-rw-r--r--sal/rtl/ustring.cxx2
-rw-r--r--sal/textenc/converter.cxx3
-rw-r--r--sal/textenc/convertgb18030.cxx2
-rw-r--r--sal/textenc/convertisciidevangari.cxx4
-rw-r--r--sal/textenc/convertsimple.cxx15
-rw-r--r--sal/textenc/convertsinglebytetobmpunicode.cxx3
-rw-r--r--sal/textenc/handleundefinedunicodetotextchar.cxx14
-rw-r--r--sal/textenc/tcvtmb.cxx77
-rw-r--r--sal/textenc/tcvtutf7.cxx4
-rw-r--r--sal/textenc/tencinfo.cxx11
-rw-r--r--sal/textenc/textcvt.cxx16
26 files changed, 297 insertions, 376 deletions
diff --git a/sal/osl/unx/conditn.cxx b/sal/osl/unx/conditn.cxx
index ba86f937018f..56eadde87a17 100644
--- a/sal/osl/unx/conditn.cxx
+++ b/sal/osl/unx/conditn.cxx
@@ -209,7 +209,7 @@ oslConditionResult SAL_CALL osl_waitCondition(oslCondition Condition, const Time
return Result;
}
- else if ( ret != EINTR )
+ if ( ret != EINTR )
{
Result = osl_cond_result_error;
nRet = pthread_mutex_unlock(&pCond->m_Lock);
diff --git a/sal/osl/unx/file.cxx b/sal/osl/unx/file.cxx
index 416533a64de1..933780f87d8f 100644
--- a/sal/osl/unx/file.cxx
+++ b/sal/osl/unx/file.cxx
@@ -431,64 +431,62 @@ oslFileError FileHandle_Impl::readFileAt (
*pBytesRead = nBytes;
return osl_File_E_None;
}
- else if (m_kind == KIND_MEM || nullptr == m_buffer)
+ if (m_kind == KIND_MEM || nullptr == m_buffer)
{
// not buffered
return readAt (nOffset, pBuffer, nBytesRequested, pBytesRead);
}
- else
+
+ sal_uInt8 * buffer = static_cast<sal_uInt8*>(pBuffer);
+ for (*pBytesRead = 0; nBytesRequested > 0; )
{
- sal_uInt8 * buffer = static_cast<sal_uInt8*>(pBuffer);
- for (*pBytesRead = 0; nBytesRequested > 0; )
- {
- off_t const bufptr = (nOffset / m_bufsiz) * m_bufsiz;
- size_t const bufpos = (nOffset % m_bufsiz);
+ off_t const bufptr = (nOffset / m_bufsiz) * m_bufsiz;
+ size_t const bufpos = (nOffset % m_bufsiz);
- if (bufptr != m_bufptr)
+ if (bufptr != m_bufptr)
+ {
+ // flush current buffer
+ oslFileError result = syncFile();
+ if (result != osl_File_E_None)
+ return result;
+ m_bufptr = -1;
+ m_buflen = 0;
+
+ if (nBytesRequested >= m_bufsiz)
{
- // flush current buffer
- oslFileError result = syncFile();
- if (result != osl_File_E_None)
- return result;
- m_bufptr = -1;
- m_buflen = 0;
-
- if (nBytesRequested >= m_bufsiz)
- {
- // buffer too small, read through from file
- sal_uInt64 uDone = 0;
- result = readAt (nOffset, &(buffer[*pBytesRead]), nBytesRequested, &uDone);
- if (result != osl_File_E_None)
- return result;
-
- *pBytesRead += uDone;
- return osl_File_E_None;
- }
-
- // update buffer (pointer)
+ // buffer too small, read through from file
sal_uInt64 uDone = 0;
- result = readAt (bufptr, m_buffer, m_bufsiz, &uDone);
+ result = readAt (nOffset, &(buffer[*pBytesRead]), nBytesRequested, &uDone);
if (result != osl_File_E_None)
return result;
- m_bufptr = bufptr;
- m_buflen = uDone;
- }
- if (bufpos >= m_buflen)
- {
- // end of file
+
+ *pBytesRead += uDone;
return osl_File_E_None;
}
- size_t const bytes = std::min (m_buflen - bufpos, nBytesRequested);
- SAL_INFO("sal.file", "FileHandle_Impl::readFileAt(" << m_fd << ", " << nOffset << ", " << bytes << ")");
-
- memcpy (&(buffer[*pBytesRead]), &(m_buffer[bufpos]), bytes);
- nBytesRequested -= bytes;
- *pBytesRead += bytes;
- nOffset += bytes;
+ // update buffer (pointer)
+ sal_uInt64 uDone = 0;
+ result = readAt (bufptr, m_buffer, m_bufsiz, &uDone);
+ if (result != osl_File_E_None)
+ return result;
+ m_bufptr = bufptr;
+ m_buflen = uDone;
}
- return osl_File_E_None;
+ if (bufpos >= m_buflen)
+ {
+ // end of file
+ return osl_File_E_None;
+ }
+
+ size_t const bytes = std::min (m_buflen - bufpos, nBytesRequested);
+ SAL_INFO("sal.file", "FileHandle_Impl::readFileAt(" << m_fd << ", " << nOffset << ", " << bytes << ")");
+
+ memcpy (&(buffer[*pBytesRead]), &(m_buffer[bufpos]), bytes);
+ nBytesRequested -= bytes;
+ *pBytesRead += bytes;
+ nOffset += bytes;
}
+ return osl_File_E_None;
}
oslFileError FileHandle_Impl::writeFileAt (
@@ -506,63 +504,61 @@ oslFileError FileHandle_Impl::writeFileAt (
*pBytesWritten = nBytes;
return osl_File_E_None;
}
- else if (nullptr == m_buffer)
+ if (nullptr == m_buffer)
{
// not buffered
return writeAt (nOffset, pBuffer, nBytesToWrite, pBytesWritten);
}
- else
+
+ sal_uInt8 const * buffer = static_cast<sal_uInt8 const *>(pBuffer);
+ for (*pBytesWritten = 0; nBytesToWrite > 0; )
{
- sal_uInt8 const * buffer = static_cast<sal_uInt8 const *>(pBuffer);
- for (*pBytesWritten = 0; nBytesToWrite > 0; )
+ off_t const bufptr = (nOffset / m_bufsiz) * m_bufsiz;
+ size_t const bufpos = (nOffset % m_bufsiz);
+ if (bufptr != m_bufptr)
{
- off_t const bufptr = (nOffset / m_bufsiz) * m_bufsiz;
- size_t const bufpos = (nOffset % m_bufsiz);
- if (bufptr != m_bufptr)
+ // flush current buffer
+ oslFileError result = syncFile();
+ if (result != osl_File_E_None)
+ return result;
+ m_bufptr = -1;
+ m_buflen = 0;
+
+ if (nBytesToWrite >= m_bufsiz)
{
- // flush current buffer
- oslFileError result = syncFile();
- if (result != osl_File_E_None)
- return result;
- m_bufptr = -1;
- m_buflen = 0;
-
- if (nBytesToWrite >= m_bufsiz)
- {
- // buffer to small, write through to file
- sal_uInt64 uDone = 0;
- result = writeAt (nOffset, &(buffer[*pBytesWritten]), nBytesToWrite, &uDone);
- if (result != osl_File_E_None)
- return result;
- if (uDone != nBytesToWrite)
- return osl_File_E_IO;
-
- *pBytesWritten += uDone;
- return osl_File_E_None;
- }
-
- // update buffer (pointer)
+ // buffer to small, write through to file
sal_uInt64 uDone = 0;
- result = readAt (bufptr, m_buffer, m_bufsiz, &uDone);
+ result = writeAt (nOffset, &(buffer[*pBytesWritten]), nBytesToWrite, &uDone);
if (result != osl_File_E_None)
return result;
- m_bufptr = bufptr;
- m_buflen = uDone;
+ if (uDone != nBytesToWrite)
+ return osl_File_E_IO;
+
+ *pBytesWritten += uDone;
+ return osl_File_E_None;
}
- size_t const bytes = std::min (m_bufsiz - bufpos, nBytesToWrite);
- SAL_INFO("sal.file", "FileHandle_Impl::writeFileAt(" << m_fd << ", " << nOffset << ", " << bytes << ")");
+ // update buffer (pointer)
+ sal_uInt64 uDone = 0;
+ result = readAt (bufptr, m_buffer, m_bufsiz, &uDone);
+ if (result != osl_File_E_None)
+ return result;
+ m_bufptr = bufptr;
+ m_buflen = uDone;
+ }
- memcpy (&(m_buffer[bufpos]), &(buffer[*pBytesWritten]), bytes);
- nBytesToWrite -= bytes;
- *pBytesWritten += bytes;
- nOffset += bytes;
+ size_t const bytes = std::min (m_bufsiz - bufpos, nBytesToWrite);
+ SAL_INFO("sal.file", "FileHandle_Impl::writeFileAt(" << m_fd << ", " << nOffset << ", " << bytes << ")");
- m_buflen = std::max(m_buflen, bufpos + bytes);
- m_state |= STATE_MODIFIED;
- }
- return osl_File_E_None;
+ memcpy (&(m_buffer[bufpos]), &(buffer[*pBytesWritten]), bytes);
+ nBytesToWrite -= bytes;
+ *pBytesWritten += bytes;
+ nOffset += bytes;
+
+ m_buflen = std::max(m_buflen, bufpos + bytes);
+ m_state |= STATE_MODIFIED;
}
+ return osl_File_E_None;
}
oslFileError FileHandle_Impl::readLineAt (
diff --git a/sal/osl/unx/file_misc.cxx b/sal/osl/unx/file_misc.cxx
index ec599a3416b6..a651ed5cd342 100644
--- a/sal/osl/unx/file_misc.cxx
+++ b/sal/osl/unx/file_misc.cxx
@@ -207,11 +207,8 @@ oslFileError SAL_CALL osl_openDirectory(rtl_uString* ustrDirectoryURL, oslDirect
*pDirectory = static_cast<oslDirectory>(pDirImpl);
return osl_File_E_None;
}
- else
- {
- errno = ENOMEM;
- closedir( pdir );
- }
+ errno = ENOMEM;
+ closedir( pdir );
}
else
{
@@ -274,8 +271,7 @@ static struct dirent* osl_readdir_impl_(DIR* pdir, bool bFilterLocalAndParentDir
if (bFilterLocalAndParentDir &&
((strcmp(pdirent->d_name, ".") == 0) || (strcmp(pdirent->d_name, "..") == 0)))
continue;
- else
- break;
+ break;
}
return pdirent;
@@ -493,8 +489,7 @@ static int path_make_parent(sal_Unicode* path)
*(path + i) = 0;
return i;
}
- else
- return 0;
+ return 0;
}
static int create_dir_with_callback(
@@ -775,10 +770,8 @@ static oslFileError osl_psz_copyFile( const sal_Char* pszPath, const sal_Char* p
{
return osl_File_E_ISDIR;
}
- else
- {
- /* mfe: file does not exists or is no dir */
- }
+
+ /* mfe: file does not exists or is no dir */
tErr = oslDoCopy(pszPath,pszDestPath,nMode,nSourceSize,DestFileExists);
@@ -924,8 +917,8 @@ static int oslDoCopyLink(const sal_Char* pszSourceFileName, const sal_Char* pszD
nRet=errno;
return nRet;
}
- else
- pszLinkContent[ nRet ] = 0;
+
+ pszLinkContent[ nRet ] = 0;
nRet = symlink(pszLinkContent,pszDestFileName);
diff --git a/sal/osl/unx/file_url.cxx b/sal/osl/unx/file_url.cxx
index ddf2be4d8098..69ba4349b968 100644
--- a/sal/osl/unx/file_url.cxx
+++ b/sal/osl/unx/file_url.cxx
@@ -126,7 +126,7 @@ oslFileError getSystemPathFromFileUrl(
}
i = j + 1;
break;
- } else if (!rtl::isAsciiAlphanumeric(c) && c != '+' && c != '-'
+ } if (!rtl::isAsciiAlphanumeric(c) && c != '+' && c != '-'
&& c != '.')
{
break;
@@ -202,10 +202,9 @@ oslFileError getSystemPathFromFileUrl(
return osl_File_E_INVAL;
}
return getSystemPathFromFileUrl(home, path, false);
- } else {
- // FIXME: replace ~user with user's home directory
- return osl_File_E_INVAL;
}
+ // FIXME: replace ~user with user's home directory
+ return osl_File_E_INVAL;
}
return osl_File_E_None;
}
@@ -500,12 +499,12 @@ namespace
punresolved++;
continue;
}
- else if (*(punresolved + 1) == '/')
+ if (*(punresolved + 1) == '/')
{
punresolved += 2;
continue;
}
- else if ((*(punresolved + 1) == '.') && (*(punresolved + 2) == '\0' || (*(punresolved + 2) == '/')))
+ if ((*(punresolved + 1) == '.') && (*(punresolved + 2) == '\0' || (*(punresolved + 2) == '/')))
{
_rmlastpathtoken(path_resolved_so_far);
@@ -518,22 +517,21 @@ namespace
continue;
}
- else // a file or directory name may start with '.'
- {
- if ((presolvedsf = ustrtoend(path_resolved_so_far)) > sentinel)
- return oslTranslateFileError(OSL_FET_ERROR, ENAMETOOLONG);
+ // a file or directory name may start with '.'
- ustrchrcat(*punresolved++, path_resolved_so_far);
+ if ((presolvedsf = ustrtoend(path_resolved_so_far)) > sentinel)
+ return oslTranslateFileError(OSL_FET_ERROR, ENAMETOOLONG);
- if (*punresolved == '\0' && !realpath_failed)
- {
- ferr = _osl_resolvepath(
- path_resolved_so_far,
- &realpath_failed);
+ ustrchrcat(*punresolved++, path_resolved_so_far);
- if (ferr != osl_File_E_None)
- return ferr;
- }
+ if (*punresolved == '\0' && !realpath_failed)
+ {
+ ferr = _osl_resolvepath(
+ path_resolved_so_far,
+ &realpath_failed);
+
+ if (ferr != osl_File_E_None)
+ return ferr;
}
}
else if (*punresolved == '/')
diff --git a/sal/osl/unx/memory.cxx b/sal/osl/unx/memory.cxx
index db376ecaf722..745a7f14c3f2 100644
--- a/sal/osl/unx/memory.cxx
+++ b/sal/osl/unx/memory.cxx
@@ -20,16 +20,14 @@ void* osl_aligned_alloc( sal_Size align, sal_Size size )
{
return nullptr;
}
- else
- {
+
#if defined __ANDROID__
- return memalign(align, size);
+ return memalign(align, size);
#else
- void* ptr;
- int err = posix_memalign(&ptr, align, size);
- return err ? nullptr : ptr;
+ void* ptr;
+ int err = posix_memalign(&ptr, align, size);
+ return err ? nullptr : ptr;
#endif
- }
}
void osl_aligned_free( void* p )
diff --git a/sal/osl/unx/module.cxx b/sal/osl/unx/module.cxx
index d99abc32fd04..207b0379a924 100644
--- a/sal/osl/unx/module.cxx
+++ b/sal/osl/unx/module.cxx
@@ -172,28 +172,27 @@ oslModule osl_loadModuleRelativeAscii(
assert(relativePath && "illegal argument");
if (relativePath[0] == '/') {
return osl_loadModuleAscii(relativePath, mode);
- } else {
- rtl_String * path = nullptr;
- rtl_String * suffix = nullptr;
- oslModule module;
- if (!getModulePathFromAddress(
- reinterpret_cast< void * >(baseModule), &path))
- {
- return nullptr;
- }
- rtl_string_newFromStr_WithLength(
- &path, path->buffer,
- (rtl_str_lastIndexOfChar_WithLength(path->buffer, path->length, '/')
- + 1));
- /* cut off everything after the last slash; should the original path
- contain no slash, the resulting path is the empty string */
- rtl_string_newFromStr(&suffix, relativePath);
- rtl_string_newConcat(&path, path, suffix);
- rtl_string_release(suffix);
- module = osl_loadModuleAscii(path->buffer, mode);
- rtl_string_release(path);
- return module;
}
+ rtl_String * path = nullptr;
+ rtl_String * suffix = nullptr;
+ oslModule module;
+ if (!getModulePathFromAddress(
+ reinterpret_cast< void * >(baseModule), &path))
+ {
+ return nullptr;
+ }
+ rtl_string_newFromStr_WithLength(
+ &path, path->buffer,
+ (rtl_str_lastIndexOfChar_WithLength(path->buffer, path->length, '/')
+ + 1));
+ /* cut off everything after the last slash; should the original path
+ contain no slash, the resulting path is the empty string */
+ rtl_string_newFromStr(&suffix, relativePath);
+ rtl_string_newConcat(&path, path, suffix);
+ rtl_string_release(suffix);
+ module = osl_loadModuleAscii(path->buffer, mode);
+ rtl_string_release(path);
+ return module;
}
#endif // !DISABLE_DYNLOADING
diff --git a/sal/osl/unx/pipe.cxx b/sal/osl/unx/pipe.cxx
index c47d92b429c5..18a3dac02174 100644
--- a/sal/osl/unx/pipe.cxx
+++ b/sal/osl/unx/pipe.cxx
@@ -300,22 +300,20 @@ oslPipe SAL_CALL osl_psz_createPipe(const sal_Char *pszPipeName, oslPipeOptions
return pPipe;
}
- else
- { /* osl_pipe_OPEN */
- if ( access(name, F_OK) != -1 )
- {
- if ( connect( pPipe->m_Socket, reinterpret_cast<sockaddr *>(&addr), len) >= 0 )
- {
- return pPipe;
- }
- SAL_WARN("sal.osl.pipe", "connect() failed: " << strerror(errno));
+ /* osl_pipe_OPEN */
+ if ( access(name, F_OK) != -1 )
+ {
+ if ( connect( pPipe->m_Socket, reinterpret_cast<sockaddr *>(&addr), len) >= 0 )
+ {
+ return pPipe;
}
-
- close (pPipe->m_Socket);
- destroyPipeImpl(pPipe);
- return nullptr;
+ SAL_WARN("sal.osl.pipe", "connect() failed: " << strerror(errno));
}
+
+ close (pPipe->m_Socket);
+ destroyPipeImpl(pPipe);
+ return nullptr;
}
void SAL_CALL osl_acquirePipe( oslPipe pPipe )
@@ -444,32 +442,30 @@ oslPipe SAL_CALL osl_acceptPipe(oslPipe pPipe)
return nullptr;
}
#endif /* CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT */
- else
- {
- /* alloc memory */
- pAcceptedPipe = createPipeImpl();
- OSL_ASSERT(pAcceptedPipe);
- if(pAcceptedPipe==nullptr)
- {
- close(s);
- return nullptr;
- }
+ /* alloc memory */
+ pAcceptedPipe = createPipeImpl();
+
+ OSL_ASSERT(pAcceptedPipe);
+ if(pAcceptedPipe==nullptr)
+ {
+ close(s);
+ return nullptr;
+ }
- /* set close-on-exec flag */
- int flags;
- if (!((flags = fcntl(s, F_GETFD, 0)) < 0))
+ /* set close-on-exec flag */
+ int flags;
+ if (!((flags = fcntl(s, F_GETFD, 0)) < 0))
+ {
+ flags |= FD_CLOEXEC;
+ if (fcntl(s, F_SETFD, flags) < 0)
{
- flags |= FD_CLOEXEC;
- if (fcntl(s, F_SETFD, flags) < 0)
- {
- SAL_WARN("sal.osl.pipe", "fcntl() failed: " << strerror(errno));
- }
+ SAL_WARN("sal.osl.pipe", "fcntl() failed: " << strerror(errno));
}
-
- pAcceptedPipe->m_Socket = s;
}
+ pAcceptedPipe->m_Socket = s;
+
return pAcceptedPipe;
}
diff --git a/sal/osl/unx/profile.cxx b/sal/osl/unx/profile.cxx
index 17bf399bde8e..a979c7b8e71b 100644
--- a/sal/osl/unx/profile.cxx
+++ b/sal/osl/unx/profile.cxx
@@ -1842,20 +1842,18 @@ static bool releaseProfile(osl_TProfileImpl* pProfile)
{
return osl_closeProfile(static_cast<oslProfile>(pProfile));
}
- else
+
+ if (! (pProfile->m_Flags & (osl_Profile_READLOCK | osl_Profile_WRITELOCK | osl_Profile_FLUSHWRITE )))
{
- if (! (pProfile->m_Flags & (osl_Profile_READLOCK | osl_Profile_WRITELOCK | osl_Profile_FLUSHWRITE )))
+ if (pProfile->m_Flags & FLG_MODIFIED)
{
- if (pProfile->m_Flags & FLG_MODIFIED)
- {
- bool bRet = storeProfile(pProfile, false);
- SAL_WARN_IF(!bRet, "sal.osl", "storeProfile(pProfile, false) ==> false");
- (void)bRet;
- }
-
- closeFileImpl(pProfile->m_pFile,pProfile->m_Flags);
- pProfile->m_pFile = nullptr;
+ bool bRet = storeProfile(pProfile, false);
+ SAL_WARN_IF(!bRet, "sal.osl", "storeProfile(pProfile, false) ==> false");
+ (void)bRet;
}
+
+ closeFileImpl(pProfile->m_pFile,pProfile->m_Flags);
+ pProfile->m_pFile = nullptr;
}
return true;
diff --git a/sal/osl/unx/random.cxx b/sal/osl/unx/random.cxx
index f9c97755b233..6f7d4a8adfb8 100644
--- a/sal/osl/unx/random.cxx
+++ b/sal/osl/unx/random.cxx
@@ -40,10 +40,7 @@ int osl_get_system_random_data(char* buffer, size_t desired_len)
close(fd);
return true;
}
- else
- {
- return false;
- }
+ return false;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/osl/unx/security.cxx b/sal/osl/unx/security.cxx
index 701f6e775499..f14107c1ba23 100644
--- a/sal/osl/unx/security.cxx
+++ b/sal/osl/unx/security.cxx
@@ -65,12 +65,11 @@ static bool sysconf_SC_GETPW_R_SIZE_MAX(std::size_t * value) {
FreeBSD versions support sysconf(_SC_GETPW_R_SIZE_MAX) in a broken
way and always set EINVAL, so be resilient here: */
return false;
- } else {
- SAL_WARN_IF( m < 0 || (unsigned long) m >= std::numeric_limits<std::size_t>::max(), "sal.osl",
- "m < 0 || (unsigned long) m >= std::numeric_limits<std::size_t>::max()");
- *value = (std::size_t) m;
- return true;
}
+ SAL_WARN_IF( m < 0 || (unsigned long) m >= std::numeric_limits<std::size_t>::max(), "sal.osl",
+ "m < 0 || (unsigned long) m >= std::numeric_limits<std::size_t>::max()");
+ *value = (std::size_t) m;
+ return true;
#else
/* some platforms like Mac OS X 1.3 do not define _SC_GETPW_R_SIZE_MAX: */
return false;
diff --git a/sal/osl/unx/socket.cxx b/sal/osl/unx/socket.cxx
index 0771ccfc3f0e..dd4055bab54d 100644
--- a/sal/osl/unx/socket.cxx
+++ b/sal/osl/unx/socket.cxx
@@ -959,8 +959,7 @@ oslHostAddr SAL_CALL osl_copyHostAddr (const oslHostAddr pAddr)
if (pAddr)
return osl_psz_createHostAddr (pAddr->pHostName, pAddr->pSockAddr);
- else
- return nullptr;
+ return nullptr;
}
void SAL_CALL osl_getHostnameOfHostAddr (
@@ -980,8 +979,7 @@ const sal_Char* SAL_CALL osl_psz_getHostnameOfHostAddr (const oslHostAddr pAddr)
{
if (pAddr)
return pAddr->pHostName;
- else
- return nullptr;
+ return nullptr;
}
oslSocketAddr SAL_CALL osl_getSocketAddrOfHostAddr (const oslHostAddr pAddr)
@@ -990,8 +988,7 @@ oslSocketAddr SAL_CALL osl_getSocketAddrOfHostAddr (const oslHostAddr pAddr)
if (pAddr)
return pAddr->pSockAddr;
- else
- return nullptr;
+ return nullptr;
}
void SAL_CALL osl_destroyHostAddr (oslHostAddr pAddr)
@@ -1182,8 +1179,7 @@ oslAddrFamily SAL_CALL osl_getFamilyOfSocketAddr(oslSocketAddr pAddr)
if (pAddr)
return FAMILY_FROM_NATIVE(pAddr->m_sockaddr.sa_family);
- else
- return osl_Socket_FamilyInvalid;
+ return osl_Socket_FamilyInvalid;
}
sal_Int32 SAL_CALL osl_getInetPortOfSocketAddr(oslSocketAddr pAddr)
@@ -1554,12 +1550,12 @@ oslSocketResult SAL_CALL osl_connectSocketTo(oslSocket pSocket,
&(pAddr->m_sockaddr),
sizeof(struct sockaddr)) != OSL_SOCKET_ERROR)
return osl_Socket_Ok;
- else
- if (errno == EWOULDBLOCK || errno == EINPROGRESS)
- {
- pSocket->m_nLastError=EINPROGRESS;
- return osl_Socket_InProgress;
- }
+
+ if (errno == EWOULDBLOCK || errno == EINPROGRESS)
+ {
+ pSocket->m_nLastError=EINPROGRESS;
+ return osl_Socket_InProgress;
+ }
pSocket->m_nLastError=errno;
int nErrno = errno;
@@ -1581,18 +1577,16 @@ oslSocketResult SAL_CALL osl_connectSocketTo(oslSocket pSocket,
return osl_Socket_Ok;
}
- else
+
+ /* really an error or just delayed? */
+ if (errno != EINPROGRESS)
{
- /* really an error or just delayed? */
- if (errno != EINPROGRESS)
- {
- pSocket->m_nLastError=errno;
- int nErrno = errno;
- SAL_WARN( "sal.osl", "connection failed: (" << nErrno << ") " << strerror(nErrno) );
+ pSocket->m_nLastError=errno;
+ int nErrno = errno;
+ SAL_WARN( "sal.osl", "connection failed: (" << nErrno << ") " << strerror(nErrno) );
- osl_enableNonBlockingMode(pSocket, false);
- return osl_Socket_Error;
- }
+ osl_enableNonBlockingMode(pSocket, false);
+ return osl_Socket_Error;
}
/* prepare select set for socket */
@@ -1645,11 +1639,8 @@ oslSocketResult SAL_CALL osl_connectSocketTo(oslSocket pSocket,
/* already destroyed */
return osl_Socket_Interrupted;
}
- else
- {
- pSocket->m_nLastError=errno;
- Result= osl_Socket_Error;
- }
+ pSocket->m_nLastError=errno;
+ Result= osl_Socket_Error;
}
else /* timeout */
{
@@ -2244,8 +2235,8 @@ sal_Bool SAL_CALL osl_isNonBlockingMode(oslSocket pSocket)
if (flags == -1 || !(flags & O_NONBLOCK))
return false;
- else
- return true;
+
+ return true;
}
oslSocketType SAL_CALL osl_getSocketType(oslSocket pSocket)
diff --git a/sal/rtl/bootstrap.cxx b/sal/rtl/bootstrap.cxx
index 6455c35b2aaa..4a5fabfb6836 100644
--- a/sal/rtl/bootstrap.cxx
+++ b/sal/rtl/bootstrap.cxx
@@ -76,10 +76,9 @@ bool resolvePathnameUrl(rtl::OUString * url) {
osl::FileBase::E_None))
{
return true;
- } else {
- *url = rtl::OUString();
- return false;
}
+ *url = rtl::OUString();
+ return false;
}
enum LookupMode {
@@ -537,9 +536,8 @@ bool Bootstrap_Impl::getDirectValue(
if (find(_nameValueList, key, &v)) {
expandValue(value, v, mode, this, key, requestStack);
return true;
- } else {
- return false;
}
+ return false;
}
bool Bootstrap_Impl::getAmbienceValue(
@@ -557,9 +555,8 @@ bool Bootstrap_Impl::getAmbienceValue(
{
expandValue(value, v, mode, nullptr, key, requestStack);
return true;
- } else {
- return false;
}
+ return false;
}
void Bootstrap_Impl::expandValue(
@@ -838,7 +835,8 @@ sal_Unicode read(rtl::OUString const & text, sal_Int32 * pos, bool * escaped) {
*escaped = true;
return static_cast< sal_Unicode >(
(n1 << 12) | (n2 << 8) | (n3 << 4) | n4);
- } else if (*pos < text.getLength()) {
+ }
+ if (*pos < text.getLength()) {
*escaped = true;
return text[(*pos)++];
}
diff --git a/sal/rtl/digest.cxx b/sal/rtl/digest.cxx
index 51cef8198037..068db56b81e8 100644
--- a/sal/rtl/digest.cxx
+++ b/sal/rtl/digest.cxx
@@ -135,8 +135,7 @@ rtlDigestAlgorithm SAL_CALL rtl_digest_queryAlgorithm (rtlDigest Digest)
Digest_Impl *pImpl = static_cast<Digest_Impl *>(Digest);
if (pImpl)
return pImpl->m_algorithm;
- else
- return rtl_Digest_AlgorithmInvalid;
+ return rtl_Digest_AlgorithmInvalid;
}
/*
@@ -148,8 +147,7 @@ sal_uInt32 SAL_CALL rtl_digest_queryLength (rtlDigest Digest)
Digest_Impl *pImpl = static_cast<Digest_Impl *>(Digest);
if (pImpl)
return pImpl->m_length;
- else
- return 0;
+ return 0;
}
/*
@@ -164,8 +162,7 @@ rtlDigestError SAL_CALL rtl_digest_init (
{
if (pImpl->m_init)
return pImpl->m_init (Digest, pData, nDatLen);
- else
- return rtl_Digest_E_None;
+ return rtl_Digest_E_None;
}
return rtl_Digest_E_Argument;
}
@@ -180,8 +177,7 @@ rtlDigestError SAL_CALL rtl_digest_update (
Digest_Impl *pImpl = static_cast<Digest_Impl *>(Digest);
if (pImpl && pImpl->m_update)
return pImpl->m_update (Digest, pData, nDatLen);
- else
- return rtl_Digest_E_Argument;
+ return rtl_Digest_E_Argument;
}
/*
@@ -194,8 +190,7 @@ rtlDigestError SAL_CALL rtl_digest_get (
Digest_Impl *pImpl = static_cast<Digest_Impl *>(Digest);
if (pImpl && pImpl->m_get)
return pImpl->m_get (Digest, pBuffer, nBufLen);
- else
- return rtl_Digest_E_Argument;
+ return rtl_Digest_E_Argument;
}
/*
diff --git a/sal/rtl/math.cxx b/sal/rtl/math.cxx
index 5dc94e0e0c1f..7eeeb85b4013 100644
--- a/sal/rtl/math.cxx
+++ b/sal/rtl/math.cxx
@@ -54,18 +54,16 @@ static double getN10Exp( int nExp )
// because -nExp = nExp
if ( -nExp <= n10Count && -nExp > 0 )
return n10s[1][-nExp-1];
- else
- return pow( 10.0, static_cast<double>( nExp ) );
+ return pow( 10.0, static_cast<double>( nExp ) );
}
- else if ( nExp > 0 )
+ if ( nExp > 0 )
{
if ( nExp <= n10Count )
return n10s[0][nExp-1];
- else
- return pow( 10.0, static_cast<double>( nExp ) );
+ return pow( 10.0, static_cast<double>( nExp ) );
}
- else // ( nExp == 0 )
- return 1.0;
+ // ( nExp == 0 )
+ return 1.0;
}
namespace {
@@ -1144,21 +1142,19 @@ double SAL_CALL rtl_math_asinh( double fX ) SAL_THROW_EXTERN_C()
{
if ( fX == 0.0 )
return 0.0;
- else
+
+ double fSign = 1.0;
+ if ( fX < 0.0 )
{
- double fSign = 1.0;
- if ( fX < 0.0 )
- {
- fX = - fX;
- fSign = -1.0;
- }
- if ( fX < 0.125 )
- return fSign * rtl_math_log1p( fX + fX*fX / (1.0 + sqrt( 1.0 + fX*fX)));
- else if ( fX < 1.25e7 )
- return fSign * log( fX + sqrt( 1.0 + fX*fX));
- else
- return fSign * log( 2.0*fX);
+ fX = - fX;
+ fSign = -1.0;
}
+ if ( fX < 0.125 )
+ return fSign * rtl_math_log1p( fX + fX*fX / (1.0 + sqrt( 1.0 + fX*fX)));
+ if ( fX < 1.25e7 )
+ return fSign * log( fX + sqrt( 1.0 + fX*fX));
+
+ return fSign * log( 2.0*fX);
}
/** improved accuracy of acosh for x large and for x near 1
@@ -1173,14 +1169,13 @@ double SAL_CALL rtl_math_acosh( double fX ) SAL_THROW_EXTERN_C()
::rtl::math::setNan( &fResult );
return fResult;
}
- else if ( fX == 1.0 )
+ if ( fX == 1.0 )
return 0.0;
- else if ( fX < 1.1 )
+ if ( fX < 1.1 )
return rtl_math_log1p( fZ + sqrt( fZ*fZ + 2.0*fZ));
- else if ( fX < 1.25e7 )
+ if ( fX < 1.25e7 )
return log( fX + sqrt( fX*fX - 1.0));
- else
- return log( 2.0*fX);
+ return log( 2.0*fX);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/rtl/uri.cxx b/sal/rtl/uri.cxx
index b00dfb99f472..91653f6cdabe 100644
--- a/sal/rtl/uri.cxx
+++ b/sal/rtl/uri.cxx
@@ -176,7 +176,7 @@ sal_uInt32 readUcs4(sal_Unicode const ** pBegin, sal_Unicode const * pEnd,
return nDstSize == 1
? aDst[0] : rtl::combineSurrogates(aDst[0], aDst[1]);
}
- else if (nInfo == RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOSMALL
+ if (nInfo == RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOSMALL
&& pEnd - p >= 3 && p[0] == cEscapePrefix
&& (nWeight1 = getHexWeight(p[1])) >= 0
&& (nWeight2 = getHexWeight(p[2])) >= 0)
@@ -202,13 +202,11 @@ sal_uInt32 readUcs4(sal_Unicode const ** pBegin, sal_Unicode const * pEnd,
}
return nChar;
}
- else
- {
- *pType = EscapeNo;
- return rtl::isHighSurrogate(nChar) && *pBegin < pEnd
- && rtl::isLowSurrogate(**pBegin) ?
- rtl::combineSurrogates(nChar, *(*pBegin)++) : nChar;
- }
+
+ *pType = EscapeNo;
+ return rtl::isHighSurrogate(nChar) && *pBegin < pEnd
+ && rtl::isLowSurrogate(**pBegin) ?
+ rtl::combineSurrogates(nChar, *(*pBegin)++) : nChar;
}
void writeUcs4(rtl_uString ** pBuffer, sal_Int32 * pCapacity, sal_uInt32 nUtf32)
@@ -305,9 +303,8 @@ bool writeEscapeChar(rtl_uString ** pBuffer, sal_Int32 * pCapacity,
} else {
if (bStrict) {
return false;
- } else {
- writeUcs4(pBuffer, pCapacity, nUtf32);
}
+ writeUcs4(pBuffer, pCapacity, nUtf32);
}
}
return true;
@@ -359,7 +356,7 @@ void parseUriRef(rtl_uString const * pUriRef, Components * pComponents)
pPos = p;
break;
}
- else if (!rtl::isAsciiAlphanumeric(*p) && *p != '+' && *p != '-'
+ if (!rtl::isAsciiAlphanumeric(*p) && *p != '+' && *p != '-'
&& *p != '.')
{
break;
diff --git a/sal/rtl/ustring.cxx b/sal/rtl/ustring.cxx
index 3d157270ef3c..85ac84a97538 100644
--- a/sal/rtl/ustring.cxx
+++ b/sal/rtl/ustring.cxx
@@ -1017,7 +1017,7 @@ void SAL_CALL rtl_uString_internConvert( rtl_uString ** newStr,
rtl_ustring_intern_internal( newStr, pScratch, CANNOT_RETURN );
return;
}
- else if ( (ulen = rtl_canGuessUOutputLength(len, eTextEncoding)) != 0 )
+ if ( (ulen = rtl_canGuessUOutputLength(len, eTextEncoding)) != 0 )
{
rtl_uString *pScratch;
rtl_TextToUnicodeConverter hConverter;
diff --git a/sal/textenc/converter.cxx b/sal/textenc/converter.cxx
index bbf172d977ad..109469fffdb5 100644
--- a/sal/textenc/converter.cxx
+++ b/sal/textenc/converter.cxx
@@ -150,8 +150,7 @@ sal::detail::textenc::handleBadInputUnicodeToTextConversion(
*pPrefixWritten = true;
return BAD_INPUT_CONTINUE;
}
- else
- return BAD_INPUT_NO_OUTPUT;
+ return BAD_INPUT_NO_OUTPUT;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/textenc/convertgb18030.cxx b/sal/textenc/convertgb18030.cxx
index ee52a98f99c5..dec9d4880a49 100644
--- a/sal/textenc/convertgb18030.cxx
+++ b/sal/textenc/convertgb18030.cxx
@@ -363,7 +363,7 @@ sal_Size ImplConvertUnicodeToGb18030(void const * pData,
goto no_output;
break;
}
- else if (nChar <= pRange->m_nLastUnicode)
+ if (nChar <= pRange->m_nLastUnicode)
{
if (pDestBufEnd - pDestBufPtr >= 4)
{
diff --git a/sal/textenc/convertisciidevangari.cxx b/sal/textenc/convertisciidevangari.cxx
index 8a025ef4b4bd..2e7f09e5e48e 100644
--- a/sal/textenc/convertisciidevangari.cxx
+++ b/sal/textenc/convertisciidevangari.cxx
@@ -194,7 +194,7 @@ sal_Size IsciiDevanagariToUnicode::convert(
continue;
if (eAction == BAD_INPUT_STOP)
break;
- else if (eAction == BAD_INPUT_NO_OUTPUT)
+ if (eAction == BAD_INPUT_NO_OUTPUT)
{
nInfo |= RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOSMALL;
break;
@@ -358,7 +358,7 @@ sal_Size UnicodeToIsciiDevanagari::convert(sal_Unicode const* pSrcBuf, sal_Size
{
break;
}
- else if (c <= sal::static_int_cast< sal_uInt32 >(
+ if (c <= sal::static_int_cast< sal_uInt32 >(
ranges[i].unicode + ranges[i].range))
{
if (pDestBufEnd - pDestBufPtr < 1)
diff --git a/sal/textenc/convertsimple.cxx b/sal/textenc/convertsimple.cxx
index 6e08b5fe5505..99689f6d3d32 100644
--- a/sal/textenc/convertsimple.cxx
+++ b/sal/textenc/convertsimple.cxx
@@ -497,11 +497,8 @@ int ImplConvertUnicodeCharToChar(
dest[0] = static_cast< char >(pCharExData->mnChar);
if ( pCharExData->mnChar2 == 0 )
return 1;
- else
- {
- dest[1] = static_cast< char >(pCharExData->mnChar2);
- return 2;
- }
+ dest[1] = static_cast< char >(pCharExData->mnChar2);
+ return 2;
}
}
}
@@ -546,13 +543,12 @@ sal_Size sal::detail::textenc::convertCharToUnicode(
*pInfo |= RTL_TEXTTOUNICODE_INFO_ERROR;
break;
}
- else if ( (nFlags & RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_MASK) == RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_IGNORE )
+ if ( (nFlags & RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_MASK) == RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_IGNORE )
{
pSrcBuf++;
continue;
}
- else
- cConv = ImplGetUndefinedUnicodeChar(c, nFlags);
+ cConv = ImplGetUndefinedUnicodeChar(c, nFlags);
}
}
@@ -642,8 +638,7 @@ sal_Size sal::detail::textenc::convertUnicodeToChar(
&pSrcBuf, pEndSrcBuf, &pDestBuf, pEndDestBuf,
nFlags, pInfo))
continue;
- else
- break;
+ break;
}
}
}
diff --git a/sal/textenc/convertsinglebytetobmpunicode.cxx b/sal/textenc/convertsinglebytetobmpunicode.cxx
index 2cfbb83728ba..9bb994d2a9c8 100644
--- a/sal/textenc/convertsinglebytetobmpunicode.cxx
+++ b/sal/textenc/convertsinglebytetobmpunicode.cxx
@@ -126,7 +126,8 @@ sal_Size rtl_textenc_convertBmpUnicodeToSingleByte(
for (std::size_t i = 0; i < entries; ++i) {
if (c < ranges[i].unicode) {
break;
- } else if (c <= sal::static_int_cast< sal_uInt32 >(
+ }
+ if (c <= sal::static_int_cast< sal_uInt32 >(
ranges[i].unicode + ranges[i].range))
{
if (destBufEnd - destBufPtr < 1) {
diff --git a/sal/textenc/handleundefinedunicodetotextchar.cxx b/sal/textenc/handleundefinedunicodetotextchar.cxx
index 164369fb3218..2f6640b0ad51 100644
--- a/sal/textenc/handleundefinedunicodetotextchar.cxx
+++ b/sal/textenc/handleundefinedunicodetotextchar.cxx
@@ -125,12 +125,12 @@ bool sal::detail::textenc::handleUndefinedUnicodeToTextChar(
*pInfo |= RTL_UNICODETOTEXT_INFO_ERROR;
return false;
}
- else if ( (nFlags & RTL_UNICODETOTEXT_FLAGS_INVALID_MASK) == RTL_UNICODETOTEXT_FLAGS_INVALID_IGNORE )
+ if ( (nFlags & RTL_UNICODETOTEXT_FLAGS_INVALID_MASK) == RTL_UNICODETOTEXT_FLAGS_INVALID_IGNORE )
{
(*ppSrcBuf)++;
return true;
}
- else if (ImplGetInvalidAsciiMultiByte(nFlags,
+ if (ImplGetInvalidAsciiMultiByte(nFlags,
*ppDestBuf,
pEndDestBuf - *ppDestBuf))
{
@@ -138,12 +138,8 @@ bool sal::detail::textenc::handleUndefinedUnicodeToTextChar(
++*ppDestBuf;
return true;
}
- else
- {
- *pInfo |= RTL_UNICODETOTEXT_INFO_ERROR
- | RTL_UNICODETOTEXT_INFO_DESTBUFFERTOSMALL;
- return false;
- }
+ *pInfo |= RTL_UNICODETOTEXT_INFO_ERROR | RTL_UNICODETOTEXT_INFO_DESTBUFFERTOSMALL;
+ return false;
}
}
@@ -153,7 +149,7 @@ bool sal::detail::textenc::handleUndefinedUnicodeToTextChar(
*pInfo |= RTL_UNICODETOTEXT_INFO_ERROR;
return false;
}
- else if ( (nFlags & RTL_UNICODETOTEXT_FLAGS_UNDEFINED_MASK) == RTL_UNICODETOTEXT_FLAGS_UNDEFINED_IGNORE )
+ if ( (nFlags & RTL_UNICODETOTEXT_FLAGS_UNDEFINED_MASK) == RTL_UNICODETOTEXT_FLAGS_UNDEFINED_IGNORE )
(*ppSrcBuf)++;
else if (ImplGetUndefinedAsciiMultiByte(nFlags,
*ppDestBuf,
diff --git a/sal/textenc/tcvtmb.cxx b/sal/textenc/tcvtmb.cxx
index d36f5b8a4d17..a41611a84669 100644
--- a/sal/textenc/tcvtmb.cxx
+++ b/sal/textenc/tcvtmb.cxx
@@ -72,13 +72,12 @@ sal_Size ImplDBCSToUnicode( const void* pData, SAL_UNUSED_PARAMETER void*,
*pInfo |= RTL_TEXTTOUNICODE_INFO_ERROR;
break;
}
- else if ( (nFlags & RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_MASK) == RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_IGNORE )
+ if ( (nFlags & RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_MASK) == RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_IGNORE )
{
pSrcBuf++;
continue;
}
- else
- cConv = ImplGetUndefinedUnicodeChar(cLead, nFlags);
+ cConv = ImplGetUndefinedUnicodeChar(cLead, nFlags);
}
}
else
@@ -120,33 +119,27 @@ sal_Size ImplDBCSToUnicode( const void* pData, SAL_UNUSED_PARAMETER void*,
(cTrail-pEUDCTab->mnTrail1Start);
break;
}
- else
+ sal_uInt16 nTrailCount = pEUDCTab->mnTrail1End-pEUDCTab->mnTrail1Start+1;
+ if ( (pEUDCTab->mnTrailCount >= 2) &&
+ (cTrail >= pEUDCTab->mnTrail2Start) &&
+ (cTrail <= pEUDCTab->mnTrail2End) )
+ {
+ cConv = pEUDCTab->mnUniStart+
+ ((cLead-pEUDCTab->mnLeadStart)*pEUDCTab->mnTrailRangeCount)+
+ nTrailCount+
+ (cTrail-pEUDCTab->mnTrail2Start);
+ break;
+ }
+ nTrailCount = pEUDCTab->mnTrail2End-pEUDCTab->mnTrail2Start+1;
+ if ( (pEUDCTab->mnTrailCount >= 3) &&
+ (cTrail >= pEUDCTab->mnTrail3Start) &&
+ (cTrail <= pEUDCTab->mnTrail3End) )
{
- sal_uInt16 nTrailCount = pEUDCTab->mnTrail1End-pEUDCTab->mnTrail1Start+1;
- if ( (pEUDCTab->mnTrailCount >= 2) &&
- (cTrail >= pEUDCTab->mnTrail2Start) &&
- (cTrail <= pEUDCTab->mnTrail2End) )
- {
- cConv = pEUDCTab->mnUniStart+
- ((cLead-pEUDCTab->mnLeadStart)*pEUDCTab->mnTrailRangeCount)+
- nTrailCount+
- (cTrail-pEUDCTab->mnTrail2Start);
- break;
- }
- else
- {
- nTrailCount = pEUDCTab->mnTrail2End-pEUDCTab->mnTrail2Start+1;
- if ( (pEUDCTab->mnTrailCount >= 3) &&
- (cTrail >= pEUDCTab->mnTrail3Start) &&
- (cTrail <= pEUDCTab->mnTrail3End) )
- {
- cConv = pEUDCTab->mnUniStart+
- ((cLead-pEUDCTab->mnLeadStart)*pEUDCTab->mnTrailRangeCount)+
- nTrailCount+
- (cTrail-pEUDCTab->mnTrail3Start);
- break;
- }
- }
+ cConv = pEUDCTab->mnUniStart+
+ ((cLead-pEUDCTab->mnLeadStart)*pEUDCTab->mnTrailRangeCount)+
+ nTrailCount+
+ (cTrail-pEUDCTab->mnTrail3Start);
+ break;
}
}
@@ -172,13 +165,12 @@ sal_Size ImplDBCSToUnicode( const void* pData, SAL_UNUSED_PARAMETER void*,
*pInfo |= RTL_TEXTTOUNICODE_INFO_ERROR;
break;
}
- else if ( (nFlags & RTL_TEXTTOUNICODE_FLAGS_INVALID_MASK) == RTL_TEXTTOUNICODE_FLAGS_INVALID_IGNORE )
+ if ( (nFlags & RTL_TEXTTOUNICODE_FLAGS_INVALID_MASK) == RTL_TEXTTOUNICODE_FLAGS_INVALID_IGNORE )
{
pSrcBuf++;
continue;
}
- else
- cConv = RTL_TEXTENC_UNICODE_REPLACEMENT_CHARACTER;
+ cConv = RTL_TEXTENC_UNICODE_REPLACEMENT_CHARACTER;
}
}
}
@@ -191,13 +183,12 @@ sal_Size ImplDBCSToUnicode( const void* pData, SAL_UNUSED_PARAMETER void*,
*pInfo |= RTL_TEXTTOUNICODE_INFO_ERROR;
break;
}
- else if ( (nFlags & RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_MASK) == RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_IGNORE )
+ if ( (nFlags & RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_MASK) == RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_IGNORE )
{
pSrcBuf++;
continue;
}
- else
- cConv = RTL_TEXTENC_UNICODE_REPLACEMENT_CHARACTER;
+ cConv = RTL_TEXTENC_UNICODE_REPLACEMENT_CHARACTER;
}
}
@@ -334,8 +325,7 @@ sal_Size ImplUnicodeToDBCS( const void* pData, SAL_UNUSED_PARAMETER void*,
&pSrcBuf, pEndSrcBuf, &pDestBuf, pEndDestBuf, nFlags,
pInfo))
continue;
- else
- break;
+ break;
}
/* SingleByte */
@@ -495,13 +485,12 @@ sal_Size ImplEUCJPToUnicode( const void* pData,
*pInfo |= RTL_TEXTTOUNICODE_INFO_ERROR;
break;
}
- else if ( (nFlags & RTL_TEXTTOUNICODE_FLAGS_INVALID_MASK) == RTL_TEXTTOUNICODE_FLAGS_INVALID_IGNORE )
+ if ( (nFlags & RTL_TEXTTOUNICODE_FLAGS_INVALID_MASK) == RTL_TEXTTOUNICODE_FLAGS_INVALID_IGNORE )
{
pSrcBuf++;
continue;
}
- else
- cConv = RTL_TEXTENC_UNICODE_REPLACEMENT_CHARACTER;
+ cConv = RTL_TEXTENC_UNICODE_REPLACEMENT_CHARACTER;
}
else
{
@@ -511,13 +500,12 @@ sal_Size ImplEUCJPToUnicode( const void* pData,
*pInfo |= RTL_TEXTTOUNICODE_INFO_ERROR;
break;
}
- else if ( (nFlags & RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_MASK) == RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_IGNORE )
+ if ( (nFlags & RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_MASK) == RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_IGNORE )
{
pSrcBuf++;
continue;
}
- else
- cConv = RTL_TEXTENC_UNICODE_REPLACEMENT_CHARACTER;
+ cConv = RTL_TEXTENC_UNICODE_REPLACEMENT_CHARACTER;
}
}
}
@@ -616,8 +604,7 @@ sal_Size ImplUnicodeToEUCJP( const void* pData,
&pSrcBuf, pEndSrcBuf, &pDestBuf, pEndDestBuf,
nFlags, pInfo))
continue;
- else
- break;
+ break;
}
}
}
diff --git a/sal/textenc/tcvtutf7.cxx b/sal/textenc/tcvtutf7.cxx
index 367007417968..f9cae77633da 100644
--- a/sal/textenc/tcvtutf7.cxx
+++ b/sal/textenc/tcvtutf7.cxx
@@ -306,7 +306,7 @@ sal_Size ImplUTF7ToUnicode( SAL_UNUSED_PARAMETER const void*, void* pContext,
*pInfo |= RTL_TEXTTOUNICODE_INFO_ERROR;
break;
}
- else if ( (nFlags & RTL_TEXTTOUNICODE_FLAGS_INVALID_MASK) != RTL_TEXTTOUNICODE_FLAGS_INVALID_IGNORE )
+ if ( (nFlags & RTL_TEXTTOUNICODE_FLAGS_INVALID_MASK) != RTL_TEXTTOUNICODE_FLAGS_INVALID_IGNORE )
{
if ( pDestBuf >= pEndDestBuf )
{
@@ -347,7 +347,7 @@ sal_Size ImplUTF7ToUnicode( SAL_UNUSED_PARAMETER const void*, void* pContext,
*pInfo |= RTL_TEXTTOUNICODE_INFO_ERROR;
break;
}
- else if ( (nFlags & RTL_TEXTTOUNICODE_FLAGS_INVALID_MASK) != RTL_TEXTTOUNICODE_FLAGS_INVALID_IGNORE )
+ if ( (nFlags & RTL_TEXTTOUNICODE_FLAGS_INVALID_MASK) != RTL_TEXTTOUNICODE_FLAGS_INVALID_IGNORE )
{
if ( pDestBuf >= pEndDestBuf )
{
diff --git a/sal/textenc/tencinfo.cxx b/sal/textenc/tencinfo.cxx
index b0312bb4f7fc..a220d71a4330 100644
--- a/sal/textenc/tencinfo.cxx
+++ b/sal/textenc/tencinfo.cxx
@@ -783,8 +783,7 @@ sal_uInt8 SAL_CALL rtl_getBestWindowsCharsetFromTextEncoding( rtl_TextEncoding e
const ImplTextEncodingData* pData = Impl_getTextEncodingData( eTextEncoding );
if ( pData )
return pData->mnBestWindowsCharset;
- else
- return 1;
+ return 1;
}
/* ----------------------------------------------------------------------- */
@@ -794,10 +793,9 @@ const char* SAL_CALL rtl_getBestUnixCharsetFromTextEncoding( rtl_TextEncoding eT
const ImplTextEncodingData* pData = Impl_getTextEncodingData( eTextEncoding );
if ( pData )
return pData->mpBestUnixCharset;
- else if( eTextEncoding == RTL_TEXTENCODING_UNICODE )
+ if( eTextEncoding == RTL_TEXTENCODING_UNICODE )
return "iso10646-1";
- else
- return nullptr;
+ return nullptr;
}
/* ----------------------------------------------------------------------- */
@@ -815,8 +813,7 @@ const char* SAL_CALL rtl_getBestMimeCharsetFromTextEncoding( rtl_TextEncoding eT
const ImplTextEncodingData* pData = Impl_getTextEncodingData( eTextEncoding );
if ( pData )
return pData->mpBestMimeCharset;
- else
- return nullptr;
+ return nullptr;
}
/* The following two functions are based on <http://www.sharmahd.com/tm/
diff --git a/sal/textenc/textcvt.cxx b/sal/textenc/textcvt.cxx
index 63f261225bf2..3bd377d2f80d 100644
--- a/sal/textenc/textcvt.cxx
+++ b/sal/textenc/textcvt.cxx
@@ -107,8 +107,7 @@ rtl_TextToUnicodeConverter SAL_CALL rtl_createTextToUnicodeConverter( rtl_TextEn
const ImplTextEncodingData* pData = Impl_getTextEncodingData( eTextEncoding );
if ( pData )
return static_cast<rtl_TextToUnicodeConverter>(const_cast<ImplTextConverter *>(&pData->maConverter));
- else
- return nullptr;
+ return nullptr;
}
/* ----------------------------------------------------------------------- */
@@ -124,10 +123,9 @@ rtl_TextToUnicodeContext SAL_CALL rtl_createTextToUnicodeContext( rtl_TextToUnic
const ImplTextConverter* pConverter = static_cast<const ImplTextConverter*>(hConverter);
if ( !pConverter )
return nullptr;
- else if ( pConverter->mpCreateTextToUnicodeContext )
+ if ( pConverter->mpCreateTextToUnicodeContext )
return pConverter->mpCreateTextToUnicodeContext();
- else
- return reinterpret_cast<rtl_TextToUnicodeContext>(1);
+ return reinterpret_cast<rtl_TextToUnicodeContext>(1);
}
/* ----------------------------------------------------------------------- */
@@ -185,8 +183,7 @@ rtl_UnicodeToTextConverter SAL_CALL rtl_createUnicodeToTextConverter( rtl_TextEn
const ImplTextEncodingData* pData = Impl_getTextEncodingData( eTextEncoding );
if ( pData )
return static_cast<rtl_TextToUnicodeConverter>(const_cast<ImplTextConverter *>(&pData->maConverter));
- else
- return nullptr;
+ return nullptr;
}
/* ----------------------------------------------------------------------- */
@@ -202,10 +199,9 @@ rtl_UnicodeToTextContext SAL_CALL rtl_createUnicodeToTextContext( rtl_UnicodeToT
const ImplTextConverter* pConverter = static_cast<const ImplTextConverter*>(hConverter);
if ( !pConverter )
return nullptr;
- else if ( pConverter->mpCreateUnicodeToTextContext )
+ if ( pConverter->mpCreateUnicodeToTextContext )
return pConverter->mpCreateUnicodeToTextContext();
- else
- return reinterpret_cast<rtl_UnicodeToTextContext>(1);
+ return reinterpret_cast<rtl_UnicodeToTextContext>(1);
}
/* ----------------------------------------------------------------------- */