summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2016-02-17 13:14:50 +0200
committerNoel Grandin <noel@peralex.com>2016-02-23 08:08:56 +0200
commitc45d3badc96481db093560b94d8bf51ead6bd17c (patch)
tree4bb6c9220678a12b327e46ca2acd01e77fc8e2c4 /sal
parent003d0ccf902d2449320dd24119564565a384f365 (diff)
new loplugin: commaoperator
Change-Id: I03f24e61f696b7619855e3c7010aa0d874e5a4ff
Diffstat (limited to 'sal')
-rw-r--r--sal/osl/unx/file.cxx57
-rw-r--r--sal/osl/unx/file_misc.cxx3
-rw-r--r--sal/rtl/alloc_arena.cxx9
-rw-r--r--sal/rtl/alloc_cache.cxx27
-rw-r--r--sal/rtl/alloc_global.cxx3
-rw-r--r--sal/rtl/alloc_impl.hxx50
-rw-r--r--sal/rtl/cipher.cxx9
7 files changed, 115 insertions, 43 deletions
diff --git a/sal/osl/unx/file.cxx b/sal/osl/unx/file.cxx
index 0824011fdcc2..3f44a1019065 100644
--- a/sal/osl/unx/file.cxx
+++ b/sal/osl/unx/file.cxx
@@ -202,14 +202,18 @@ FileHandle_Impl::Allocator::Allocator()
}
FileHandle_Impl::Allocator::~Allocator()
{
- rtl_cache_destroy (m_cache), m_cache = nullptr;
+ rtl_cache_destroy (m_cache);
+ m_cache = nullptr;
}
void FileHandle_Impl::Allocator::allocate (sal_uInt8 ** ppBuffer, size_t * pnSize)
{
OSL_PRECOND((nullptr != ppBuffer) && (nullptr != pnSize), "FileHandle_Impl::Allocator::allocate(): contract violation");
if ((nullptr != ppBuffer) && (nullptr != pnSize))
- *ppBuffer = static_cast< sal_uInt8* >(rtl_cache_alloc(m_cache)), *pnSize = m_bufsiz;
+ {
+ *ppBuffer = static_cast< sal_uInt8* >(rtl_cache_alloc(m_cache));
+ *pnSize = m_bufsiz;
+ }
}
void FileHandle_Impl::Allocator::deallocate (sal_uInt8 * pBuffer)
{
@@ -253,8 +257,12 @@ FileHandle_Impl::FileHandle_Impl (int fd, enum Kind kind, char const * path)
FileHandle_Impl::~FileHandle_Impl()
{
if (m_kind == KIND_FD)
- Allocator::get().deallocate (m_buffer), m_buffer = nullptr;
- rtl_string_release (m_strFilePath), m_strFilePath = nullptr;
+ {
+ Allocator::get().deallocate (m_buffer);
+ m_buffer = nullptr;
+ }
+ rtl_string_release (m_strFilePath);
+ m_strFilePath = nullptr;
(void) pthread_mutex_destroy(&m_mutex); // ignoring EBUSY ...
}
@@ -441,7 +449,8 @@ oslFileError FileHandle_Impl::readFileAt (
oslFileError result = syncFile();
if (result != osl_File_E_None)
return result;
- m_bufptr = -1, m_buflen = 0;
+ m_bufptr = -1;
+ m_buflen = 0;
if (nBytesRequested >= m_bufsiz)
{
@@ -460,7 +469,8 @@ oslFileError FileHandle_Impl::readFileAt (
result = readAt (bufptr, m_buffer, m_bufsiz, &uDone);
if (result != osl_File_E_None)
return result;
- m_bufptr = bufptr, m_buflen = uDone;
+ m_bufptr = bufptr;
+ m_buflen = uDone;
}
if (bufpos >= m_buflen)
{
@@ -472,7 +482,9 @@ oslFileError FileHandle_Impl::readFileAt (
SAL_INFO("sal.file", "FileHandle_Impl::readFileAt(" << m_fd << ", " << nOffset << ", " << bytes << ")");
memcpy (&(buffer[*pBytesRead]), &(m_buffer[bufpos]), bytes);
- nBytesRequested -= bytes, *pBytesRead += bytes, nOffset += bytes;
+ nBytesRequested -= bytes;
+ *pBytesRead += bytes;
+ nOffset += bytes;
}
return osl_File_E_None;
}
@@ -511,7 +523,8 @@ oslFileError FileHandle_Impl::writeFileAt (
oslFileError result = syncFile();
if (result != osl_File_E_None)
return result;
- m_bufptr = -1, m_buflen = 0;
+ m_bufptr = -1;
+ m_buflen = 0;
if (nBytesToWrite >= m_bufsiz)
{
@@ -532,14 +545,17 @@ oslFileError FileHandle_Impl::writeFileAt (
result = readAt (bufptr, m_buffer, m_bufsiz, &uDone);
if (result != osl_File_E_None)
return result;
- m_bufptr = bufptr, m_buflen = uDone;
+ m_bufptr = bufptr;
+ m_buflen = uDone;
}
size_t const bytes = std::min (m_bufsiz - bufpos, nBytesToWrite);
SAL_INFO("sal.file", "FileHandle_Impl::writeFileAt(" << m_fd << ", " << nOffset << ", " << bytes << ")");
memcpy (&(m_buffer[bufpos]), &(buffer[*pBytesWritten]), bytes);
- nBytesToWrite -= bytes, *pBytesWritten += bytes, nOffset += bytes;
+ nBytesToWrite -= bytes;
+ *pBytesWritten += bytes;
+ nOffset += bytes;
m_buflen = std::max(m_buflen, bufpos + bytes);
m_state |= STATE_MODIFIED;
@@ -569,7 +585,8 @@ oslFileError FileHandle_Impl::readLineAt (
if (result != osl_File_E_None)
return result;
- m_bufptr = bufptr, m_buflen = uDone;
+ m_bufptr = bufptr;
+ m_buflen = uDone;
}
static int const LINE_STATE_BEGIN = 0;
@@ -591,7 +608,8 @@ oslFileError FileHandle_Impl::readLineAt (
ppSequence, &dstpos, &(m_buffer[bufpos]), curpos - bufpos);
if (result != osl_File_E_None)
return result;
- *pBytesRead += curpos - bufpos, nOffset += curpos - bufpos;
+ *pBytesRead += curpos - bufpos;
+ nOffset += curpos - bufpos;
}
bufptr = nOffset / m_bufsiz * m_bufsiz;
@@ -602,10 +620,12 @@ oslFileError FileHandle_Impl::readLineAt (
result = readAt (bufptr, m_buffer, m_bufsiz, &uDone);
if (result != osl_File_E_None)
return result;
- m_bufptr = bufptr, m_buflen = uDone;
+ m_bufptr = bufptr;
+ m_buflen = uDone;
}
- bufpos = nOffset - m_bufptr, curpos = bufpos;
+ bufpos = nOffset - m_bufptr;
+ curpos = bufpos;
if (bufpos >= m_buflen)
break;
}
@@ -648,7 +668,8 @@ oslFileError FileHandle_Impl::readLineAt (
ppSequence, &dstpos, &(m_buffer[bufpos]), curpos - bufpos - 1);
if (result != osl_File_E_None)
return result;
- *pBytesRead += curpos - bufpos, nOffset += curpos - bufpos;
+ *pBytesRead += curpos - bufpos;
+ nOffset += curpos - bufpos;
}
break;
}
@@ -684,7 +705,8 @@ oslFileError FileHandle_Impl::writeSequence_Impl (
if (*ppSequence != nullptr && nBytes != 0)
{
/* fill sequence */
- memcpy(&((*ppSequence)->elements[*pnOffset]), pBuffer, nBytes), *pnOffset += nBytes;
+ memcpy(&((*ppSequence)->elements[*pnOffset]), pBuffer, nBytes);
+ *pnOffset += nBytes;
}
return (*ppSequence != nullptr) ? osl_File_E_None : osl_File_E_NOMEM;
}
@@ -1479,7 +1501,8 @@ SAL_CALL osl_setFileSize( oslFileHandle Handle, sal_uInt64 uSize )
oslFileError result = pImpl->syncFile();
if (result != osl_File_E_None)
return result;
- pImpl->m_bufptr = -1, pImpl->m_buflen = 0;
+ pImpl->m_bufptr = -1;
+ pImpl->m_buflen = 0;
return pImpl->setSize (uSize);
}
diff --git a/sal/osl/unx/file_misc.cxx b/sal/osl/unx/file_misc.cxx
index c78e7753e0be..7f3356ec4f40 100644
--- a/sal/osl/unx/file_misc.cxx
+++ b/sal/osl/unx/file_misc.cxx
@@ -334,7 +334,8 @@ oslFileError SAL_CALL osl_getNextDirectoryItem(oslDirectory Directory, oslDirect
DirectoryItem_Impl * pImpl = static_cast< DirectoryItem_Impl* >(*pItem);
if (nullptr != pImpl)
{
- pImpl->release(), pImpl = nullptr;
+ pImpl->release();
+ pImpl = nullptr;
}
#ifdef _DIRENT_HAVE_D_TYPE
pImpl = new DirectoryItem_Impl(ustrFilePath, pEntry->d_type);
diff --git a/sal/rtl/alloc_arena.cxx b/sal/rtl/alloc_arena.cxx
index 3e6adbe481ab..6a7f7405b852 100644
--- a/sal/rtl/alloc_arena.cxx
+++ b/sal/rtl/alloc_arena.cxx
@@ -365,7 +365,8 @@ rtl_arena_hash_remove (
{
if (segment->m_addr == addr)
{
- *segpp = segment->m_fnext, segment->m_fnext = segment->m_fprev = segment;
+ *segpp = segment->m_fnext;
+ segment->m_fnext = segment->m_fprev = segment;
break;
}
@@ -785,7 +786,8 @@ rtl_arena_deactivate (
while ((segment = arena->m_hash_table[i]) != nullptr)
{
/* pop from hash table */
- arena->m_hash_table[i] = segment->m_fnext, segment->m_fnext = segment->m_fprev = segment;
+ arena->m_hash_table[i] = segment->m_fnext;
+ segment->m_fnext = segment->m_fprev = segment;
/* coalesce w/ adjacent free segment(s) */
rtl_arena_segment_coalesce (arena, segment);
@@ -1034,7 +1036,8 @@ SAL_CALL rtl_arena_free (
rtl_arena_segment_coalesce (arena, segment);
/* determine (new) next and prev segment */
- next = segment->m_snext, prev = segment->m_sprev;
+ next = segment->m_snext;
+ prev = segment->m_sprev;
/* entire span free when prev is a span, and next is either a span or a list head */
if (((prev->m_type == RTL_ARENA_SEGMENT_TYPE_SPAN)) &&
diff --git a/sal/rtl/alloc_cache.cxx b/sal/rtl/alloc_cache.cxx
index ebe1b171355a..1241f4260109 100644
--- a/sal/rtl/alloc_cache.cxx
+++ b/sal/rtl/alloc_cache.cxx
@@ -189,7 +189,8 @@ rtl_cache_hash_remove (
{
if (bufctl->m_addr == addr)
{
- *ppHead = bufctl->m_next, bufctl->m_next = nullptr;
+ *ppHead = bufctl->m_next;
+ bufctl->m_next = nullptr;
break;
}
@@ -322,7 +323,8 @@ rtl_cache_slab_destroy (
rtl_cache_bufctl_type * bufctl = slab->m_sp;
/* pop from freelist */
- slab->m_sp = bufctl->m_next, bufctl->m_next = nullptr;
+ slab->m_sp = bufctl->m_next;
+ bufctl->m_next = nullptr;
/* return bufctl struct to bufctl cache */
rtl_cache_free (gp_cache_bufctl_cache, bufctl);
@@ -914,7 +916,8 @@ rtl_cache_deactivate (
rtl_cache_magazine_type * mag;
/* prevent recursion */
- mag_cache = cache->m_magazine_cache, cache->m_magazine_cache = nullptr;
+ mag_cache = cache->m_magazine_cache;
+ cache->m_magazine_cache = nullptr;
/* cleanup cpu layer */
if ((mag = cache->m_cpu_curr) != nullptr)
@@ -978,7 +981,8 @@ rtl_cache_deactivate (
while ((bufctl = cache->m_hash_table[i]) != nullptr)
{
/* pop from hash table */
- cache->m_hash_table[i] = bufctl->m_next, bufctl->m_next = nullptr;
+ cache->m_hash_table[i] = bufctl->m_next;
+ bufctl->m_next = nullptr;
/* return to bufctl cache */
rtl_cache_free (gp_cache_bufctl_cache, bufctl);
@@ -1137,7 +1141,8 @@ SAL_CALL rtl_cache_alloc (
if (!((cache->m_constructor)(obj, cache->m_userarg)))
{
/* construction failure */
- rtl_freeMemory(obj), obj = nullptr;
+ rtl_freeMemory(obj);
+ obj = nullptr;
}
}
return obj;
@@ -1194,7 +1199,8 @@ SAL_CALL rtl_cache_alloc (
if (!((cache->m_constructor)(obj, cache->m_userarg)))
{
/* construction failure */
- rtl_cache_slab_free (cache, obj), obj = nullptr;
+ rtl_cache_slab_free (cache, obj);
+ obj = nullptr;
}
}
return (obj);
@@ -1643,19 +1649,22 @@ rtl_cache_fini()
if (gp_cache_bufctl_cache != nullptr)
{
- cache = gp_cache_bufctl_cache, gp_cache_bufctl_cache = nullptr;
+ cache = gp_cache_bufctl_cache;
+ gp_cache_bufctl_cache = nullptr;
rtl_cache_deactivate (cache);
rtl_cache_destructor (cache);
}
if (gp_cache_slab_cache != nullptr)
{
- cache = gp_cache_slab_cache, gp_cache_slab_cache = nullptr;
+ cache = gp_cache_slab_cache;
+ gp_cache_slab_cache = nullptr;
rtl_cache_deactivate (cache);
rtl_cache_destructor (cache);
}
if (gp_cache_magazine_cache != nullptr)
{
- cache = gp_cache_magazine_cache, gp_cache_magazine_cache = nullptr;
+ cache = gp_cache_magazine_cache;
+ gp_cache_magazine_cache = nullptr;
rtl_cache_deactivate (cache);
rtl_cache_destructor (cache);
}
diff --git a/sal/rtl/alloc_global.cxx b/sal/rtl/alloc_global.cxx
index 6dd24f186af7..1e344f38b3a3 100644
--- a/sal/rtl/alloc_global.cxx
+++ b/sal/rtl/alloc_global.cxx
@@ -173,7 +173,8 @@ void * SAL_CALL rtl_reallocateMemory_CUSTOM (void * p, sal_Size n) SAL_THROW_EXT
}
else if (p != nullptr)
{
- rtl_freeMemory (p), p = nullptr;
+ rtl_freeMemory (p);
+ p = nullptr;
}
return p;
}
diff --git a/sal/rtl/alloc_impl.hxx b/sal/rtl/alloc_impl.hxx
index 61c0e88100e5..3666996cb8ac 100644
--- a/sal/rtl/alloc_impl.hxx
+++ b/sal/rtl/alloc_impl.hxx
@@ -74,16 +74,31 @@ highbit(sal_Size n)
return 0;
#if SAL_TYPES_SIZEOFLONG == 8
if (n & 0xffffffff00000000ul)
- k |= 32, n >>= 32;
+ {
+ k |= 32;
+ n >>= 32;
+ }
#endif
if (n & 0xffff0000)
- k |= 16, n >>= 16;
+ {
+ k |= 16;
+ n >>= 16;
+ }
if (n & 0xff00)
- k |= 8, n >>= 8;
+ {
+ k |= 8;
+ n >>= 8;
+ }
if (n & 0xf0)
- k |= 4, n >>= 4;
+ {
+ k |= 4;
+ n >>= 4;
+ }
if (n & 0x0c)
- k |= 2, n >>= 2;
+ {
+ k |= 2;
+ n >>= 2;
+ }
if (n & 0x02)
k++;
@@ -102,16 +117,31 @@ lowbit(sal_Size n)
return 0;
#if SAL_TYPES_SIZEOFLONG == 8
if (!(n & 0xffffffff))
- k |= 32, n >>= 32;
+ {
+ k |= 32;
+ n >>= 32;
+ }
#endif
if (!(n & 0xffff))
- k |= 16, n >>= 16;
+ {
+ k |= 16;
+ n >>= 16;
+ }
if (!(n & 0xff))
- k |= 8, n >>= 8;
+ {
+ k |= 8;
+ n >>= 8;
+ }
if (!(n & 0xf))
- k |= 4, n >>= 4;
+ {
+ k |= 4;
+ n >>= 4;
+ }
if (!(n & 0x3))
- k |= 2, n >>= 2;
+ {
+ k |= 2;
+ n >>= 2;
+ }
if (!(n & 0x1))
k++;
return k;
diff --git a/sal/rtl/cipher.cxx b/sal/rtl/cipher.cxx
index 0bcaa49f5038..4660e6a868c0 100644
--- a/sal/rtl/cipher.cxx
+++ b/sal/rtl/cipher.cxx
@@ -1175,7 +1175,10 @@ static rtlCipherError rtl_cipherARCFOUR_init_Impl (
for (x = 0, y = 0; x < CIPHER_CBLOCK_ARCFOUR; x++)
{
y = (y + S[x] + K[x]) % CIPHER_CBLOCK_ARCFOUR;
- t = S[x], S[x] = S[y], S[y] = t; /* swap S[x] and S[y] */
+ /* swap S[x] and S[y] */
+ t = S[x];
+ S[x] = S[y];
+ S[y] = t;
}
/* Initialize counters X and Y. */
@@ -1217,7 +1220,9 @@ static rtlCipherError rtl_cipherARCFOUR_update_Impl (
ctx->m_Y = y;
/* Swap S[x] and S[y]. */
- t = S[x], S[x] = S[y], S[y] = t;
+ t = S[x];
+ S[x] = S[y];
+ S[y] = t;
/* Evaluate next key byte S[t]. */
t = (S[x] + S[y]) % CIPHER_CBLOCK_ARCFOUR;