Commit 5713d0da authored by Albert Astals Cid's avatar Albert Astals Cid

Enable readability-string-compare

parent 42efcb73
......@@ -40,7 +40,7 @@ build_clang_libcpp:
script:
- git clone --branch ${CI_COMMIT_REF_NAME} --depth 1 ${TEST_DATA_URL} test-data || git clone --depth 1 ${UPSTREAM_TEST_DATA_URL} test-data
- mkdir -p build && cd build
- CC=clang CXX=clang++ cmake -G Ninja -DCMAKE_CXX_FLAGS=-stdlib=libc++ -DTESTDATADIR=$PWD/../test-data -DCMAKE_CXX_CLANG_TIDY="clang-tidy;-header-filter=.;-checks=-*,performance-*,,bugprone-*,readability-inconsistent-declaration-parameter-name,-bugprone-narrowing-conversions,-bugprone-macro-parentheses,-bugprone-suspicious-string-compare,-bugprone-incorrect-roundings,-bugprone-undefined-memory-manipulation;-warnings-as-errors=*" ..
- CC=clang CXX=clang++ cmake -G Ninja -DCMAKE_CXX_FLAGS=-stdlib=libc++ -DTESTDATADIR=$PWD/../test-data -DCMAKE_CXX_CLANG_TIDY="clang-tidy;-header-filter=.;-checks=-*,performance-*,,bugprone-*,readability-inconsistent-declaration-parameter-name,readability-string-compare,-bugprone-narrowing-conversions,-bugprone-macro-parentheses,-bugprone-suspicious-string-compare,-bugprone-incorrect-roundings,-bugprone-undefined-memory-manipulation;-warnings-as-errors=*" ..
- ninja
- ctest --output-on-failure
......
......@@ -2870,18 +2870,18 @@ GfxDeviceNColorSpace::GfxDeviceNColorSpace(int nCompsA,
overprintMask = 0;
mapping = nullptr;
for (int i = 0; i < nComps; ++i) {
if (names[i].compare("None")) {
if (names[i] != "None") {
nonMarking = false;
}
if (!names[i].compare("Cyan")) {
if (names[i] == "Cyan") {
overprintMask |= 0x01;
} else if (!names[i].compare("Magenta")) {
} else if (names[i] == "Magenta") {
overprintMask |= 0x02;
} else if (!names[i].compare("Yellow")) {
} else if (names[i] == "Yellow") {
overprintMask |= 0x04;
} else if (!names[i].compare("Black")) {
} else if (names[i] == "Black") {
overprintMask |= 0x08;
} else if (!names[i].compare("All")) {
} else if (names[i] == "All") {
overprintMask = 0xffffffff;
} else {
overprintMask = 0x0f;
......@@ -3093,18 +3093,18 @@ void GfxDeviceNColorSpace::createMapping(std::vector<GfxSeparationColorSpace*> *
mapping = (int *)gmalloc(sizeof(int) * nComps);
unsigned int newOverprintMask = 0;
for (int i = 0; i < nComps; i++) {
if (!names[i].compare("None")) {
if (names[i] == "None") {
mapping[i] = -1;
} else if (!names[i].compare("Cyan")) {
} else if (names[i] == "Cyan") {
newOverprintMask |= 0x01;
mapping[i] = 0;
} else if (!names[i].compare("Magenta")) {
} else if (names[i] == "Magenta") {
newOverprintMask |= 0x02;
mapping[i] = 1;
} else if (!names[i].compare("Yellow")) {
} else if (names[i] == "Yellow") {
newOverprintMask |= 0x04;
mapping[i] = 2;
} else if (!names[i].compare("Black")) {
} else if (names[i] == "Black") {
newOverprintMask |= 0x08;
mapping[i] = 3;
} else {
......
......@@ -1742,13 +1742,13 @@ void SplashOutputDev::setOverprintMask(GfxColorSpace *colorSpace,
GfxDeviceNColorSpace *deviceNCS = (GfxDeviceNColorSpace *)colorSpace;
additive = mask == 0x0f && !deviceNCS->isNonMarking();
for (i = 0; i < deviceNCS->getNComps() && additive; i++) {
if (deviceNCS->getColorantName(i).compare("Cyan") == 0) {
if (deviceNCS->getColorantName(i) == "Cyan") {
additive = false;
} else if (deviceNCS->getColorantName(i).compare("Magenta") == 0) {
} else if (deviceNCS->getColorantName(i) == "Magenta") {
additive = false;
} else if (deviceNCS->getColorantName(i).compare("Yellow") == 0) {
} else if (deviceNCS->getColorantName(i) == "Yellow") {
additive = false;
} else if (deviceNCS->getColorantName(i).compare("Black") == 0) {
} else if (deviceNCS->getColorantName(i) == "Black") {
additive = false;
}
}
......
......@@ -1032,7 +1032,7 @@ std::string HtmlOutputDev::mapEncodingToHtml(const std::string &encoding)
{
for(int i = 0; HtmlEncodings[i][0] != nullptr; i++)
{
if( encoding.compare(HtmlEncodings[i][0]) == 0 )
if( encoding == HtmlEncodings[i][0] )
{
return HtmlEncodings[i][1];
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment