summaryrefslogtreecommitdiff
path: root/sal/rtl
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2016-12-01 13:02:55 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2016-12-06 05:38:14 +0000
commit2e293a731c1559c9869dfcb32491bc600fc18e4e (patch)
treedc43bd0d4ce9b55c3f4a6ae99abd830b395fcd9e /sal/rtl
parentcc719ad619f1897d05581e38a2703add6f6a1050 (diff)
new loplugin/rewriter comparisonwithconstant
As per sberg' suggestion Limit it to == and !=, because some people like the flow of inequalities like: "0 < a && a < 42" The changes to sal/ were made using the rewriter. The rewriter still has one bug, in pipe.cxx, it managed to pick up some random piece of macro. No idea why. Change-Id: I01305f9c5396a4b6c7421d6e92f1b4b529388e82 Reviewed-on: https://gerrit.libreoffice.org/30962 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sal/rtl')
-rw-r--r--sal/rtl/bootstrap.cxx22
-rw-r--r--sal/rtl/cmdargs.cxx10
2 files changed, 16 insertions, 16 deletions
diff --git a/sal/rtl/bootstrap.cxx b/sal/rtl/bootstrap.cxx
index 7977f32eb4b4..324ca2374d8d 100644
--- a/sal/rtl/bootstrap.cxx
+++ b/sal/rtl/bootstrap.cxx
@@ -163,11 +163,11 @@ static bool getFromCommandLineArgs(
{
rtl_uString *pArg = nullptr;
osl_getCommandArg( i, &pArg );
- if( ('-' == pArg->buffer[0] || '/' == pArg->buffer[0] ) &&
- 'e' == pArg->buffer[1] &&
- 'n' == pArg->buffer[2] &&
- 'v' == pArg->buffer[3] &&
- ':' == pArg->buffer[4] )
+ if( (pArg->buffer[0] == '-' || pArg->buffer[0] == '/' ) &&
+ pArg->buffer[1] == 'e' &&
+ pArg->buffer[2] == 'n' &&
+ pArg->buffer[3] == 'v' &&
+ pArg->buffer[4] == ':' )
{
sal_Int32 nIndex = rtl_ustr_indexOfChar( pArg->buffer, '=' );
if( nIndex >= 0 )
@@ -338,8 +338,8 @@ Bootstrap_Impl::Bootstrap_Impl( OUString const & rIniName )
// normalize path
FileStatus status( osl_FileStatus_Mask_FileURL );
DirectoryItem dirItem;
- if (DirectoryItem::E_None == DirectoryItem::get( base_ini, dirItem ) &&
- DirectoryItem::E_None == dirItem.getFileStatus( status ))
+ if (DirectoryItem::get( base_ini, dirItem ) == DirectoryItem::E_None &&
+ dirItem.getFileStatus( status ) == DirectoryItem::E_None)
{
base_ini = status.getFileURL();
if (! rIniName.equals( base_ini ))
@@ -351,11 +351,11 @@ Bootstrap_Impl::Bootstrap_Impl( OUString const & rIniName )
SAL_INFO("sal.rtl", "Bootstrap_Impl(): sFile=" << _iniName);
oslFileHandle handle;
if (!_iniName.isEmpty() &&
- osl_File_E_None == osl_openFile(_iniName.pData, &handle, osl_File_OpenFlag_Read))
+ osl_openFile(_iniName.pData, &handle, osl_File_OpenFlag_Read) == osl_File_E_None)
{
rtl::ByteSequence seq;
- while (osl_File_E_None == osl_readLine(handle , reinterpret_cast<sal_Sequence **>(&seq)))
+ while (osl_readLine(handle , reinterpret_cast<sal_Sequence **>(&seq)) == osl_File_E_None)
{
OString line( reinterpret_cast<const char *>(seq.getConstArray()), seq.getLength() );
sal_Int32 nIndex = line.indexOf('=');
@@ -622,8 +622,8 @@ rtlBootstrapHandle SAL_CALL rtl_bootstrap_args_open (
// normalize path
FileStatus status( osl_FileStatus_Mask_FileURL );
DirectoryItem dirItem;
- if (DirectoryItem::E_None != DirectoryItem::get( iniName, dirItem ) ||
- DirectoryItem::E_None != dirItem.getFileStatus( status ))
+ if (DirectoryItem::get( iniName, dirItem ) != DirectoryItem::E_None ||
+ dirItem.getFileStatus( status ) != DirectoryItem::E_None)
{
return nullptr;
}
diff --git a/sal/rtl/cmdargs.cxx b/sal/rtl/cmdargs.cxx
index ee4bead37c10..bb70e4a65120 100644
--- a/sal/rtl/cmdargs.cxx
+++ b/sal/rtl/cmdargs.cxx
@@ -57,11 +57,11 @@ void init()
{
rtl_uString * pArg = nullptr;
osl_getCommandArg (i, &pArg);
- if (('-' == pArg->buffer[0] || '/' == pArg->buffer[0]) &&
- 'e' == pArg->buffer[1] &&
- 'n' == pArg->buffer[2] &&
- 'v' == pArg->buffer[3] &&
- ':' == pArg->buffer[4] &&
+ if ((pArg->buffer[0] == '-' || pArg->buffer[0] == '/') &&
+ pArg->buffer[1] == 'e' &&
+ pArg->buffer[2] == 'n' &&
+ pArg->buffer[3] == 'v' &&
+ pArg->buffer[4] == ':' &&
rtl_ustr_indexOfChar (&(pArg->buffer[5]), '=') >= 0 )
{
// ignore.