summaryrefslogtreecommitdiff
path: root/sal/osl/unx/file_path_helper.cxx
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/osl/unx/file_path_helper.cxx
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/osl/unx/file_path_helper.cxx')
-rw-r--r--sal/osl/unx/file_path_helper.cxx8
1 files changed, 4 insertions, 4 deletions
diff --git a/sal/osl/unx/file_path_helper.cxx b/sal/osl/unx/file_path_helper.cxx
index 23486c596a4d..8a4a46453b65 100644
--- a/sal/osl/unx/file_path_helper.cxx
+++ b/sal/osl/unx/file_path_helper.cxx
@@ -44,7 +44,7 @@ void SAL_CALL osl_systemPathRemoveSeparator(rtl_uString* pustrPath)
{
// maybe there are more than one separator at end
// so we run in a loop
- while ((pustrPath->length > 1) && (FPH_CHAR_PATH_SEPARATOR == pustrPath->buffer[pustrPath->length - 1]))
+ while ((pustrPath->length > 1) && (pustrPath->buffer[pustrPath->length - 1] == FPH_CHAR_PATH_SEPARATOR))
{
pustrPath->length--;
pustrPath->buffer[pustrPath->length] = (sal_Unicode)'\0';
@@ -81,7 +81,7 @@ void SAL_CALL osl_systemPathEnsureSeparator(rtl_uString** ppustrPath)
bool SAL_CALL osl_systemPathIsRelativePath(const rtl_uString* pustrPath)
{
OSL_PRECOND(nullptr != pustrPath, "osl_systemPathIsRelativePath: Invalid parameter");
- return ((nullptr == pustrPath) || (0 == pustrPath->length) || (pustrPath->buffer[0] != FPH_CHAR_PATH_SEPARATOR));
+ return ((nullptr == pustrPath) || (pustrPath->length == 0) || (pustrPath->buffer[0] != FPH_CHAR_PATH_SEPARATOR));
}
void SAL_CALL osl_systemPathMakeAbsolutePath(
@@ -114,7 +114,7 @@ void SAL_CALL osl_systemPathGetFileNameOrLastDirectoryPart(
rtl::OUString last_part;
- if (path.getLength() > 1 || (1 == path.getLength() && *path.getStr() != FPH_CHAR_PATH_SEPARATOR))
+ if (path.getLength() > 1 || (path.getLength() == 1 && *path.getStr() != FPH_CHAR_PATH_SEPARATOR))
{
sal_Int32 idx_ps = path.lastIndexOf(FPH_CHAR_PATH_SEPARATOR);
idx_ps++; // always right to increment by one even if idx_ps == -1!
@@ -127,7 +127,7 @@ bool SAL_CALL osl_systemPathIsHiddenFileOrDirectoryEntry(
const rtl_uString* pustrPath)
{
OSL_PRECOND(nullptr != pustrPath, "osl_systemPathIsHiddenFileOrDirectoryEntry: Invalid parameter");
- if ((nullptr == pustrPath) || (0 == pustrPath->length))
+ if ((nullptr == pustrPath) || (pustrPath->length == 0))
return false;
rtl::OUString fdp;