cland-tidy: simplify booleans
Found with readability-simplify-boolean-expr Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
parent
9dc34ad39c
commit
d856ca7d82
@ -1059,7 +1059,7 @@ int Params::getopt(int argc, char* const Argv[]) {
|
||||
// We'll set them again, after reading the file
|
||||
Exiv2::XmpProperties::unregisterNs();
|
||||
}
|
||||
if (!directory_.empty() && !(action_ == Action::insert || action_ == Action::extract)) {
|
||||
if (!directory_.empty() && action_ != Action::insert && action_ != Action::extract) {
|
||||
std::cerr << progname() << ": " << _("-l option can only be used with extract or insert actions\n");
|
||||
rc = 1;
|
||||
}
|
||||
@ -1221,7 +1221,7 @@ int parsePreviewNumbers(Params::PreviewNumbers& previewNumbers, const std::strin
|
||||
}
|
||||
i = k;
|
||||
}
|
||||
if (!(k < optArg.size() && optArg[i] == ','))
|
||||
if (k >= optArg.size() || optArg[i] != ',')
|
||||
break;
|
||||
}
|
||||
auto ret = static_cast<int>(k - j);
|
||||
|
||||
@ -1152,7 +1152,7 @@ void Converter::cnvXmpGPSCoord(const char* from, const char* to) {
|
||||
min = static_cast<double>(static_cast<int>(min));
|
||||
}
|
||||
|
||||
if (in.bad() || !(ref == 'N' || ref == 'S' || ref == 'E' || ref == 'W') || sep1 != ',' || !in.eof()) {
|
||||
if (in.bad() || (ref != 'N' && ref != 'S' && ref != 'E' && ref != 'W') || sep1 != ',' || !in.eof()) {
|
||||
#ifndef SUPPRESS_WARNINGS
|
||||
EXV_WARNING << "Failed to convert " << from << " to " << to << "\n";
|
||||
#endif
|
||||
|
||||
@ -143,7 +143,7 @@ bool isCrwType(BasicIo& iIo, bool advance) {
|
||||
if (iIo.error() || iIo.eof()) {
|
||||
return false;
|
||||
}
|
||||
if (!(('I' == tmpBuf[0] && 'I' == tmpBuf[1]) || ('M' == tmpBuf[0] && 'M' == tmpBuf[1]))) {
|
||||
if (('I' != tmpBuf[0] || 'I' != tmpBuf[1]) && ('M' != tmpBuf[0] || 'M' != tmpBuf[1])) {
|
||||
result = false;
|
||||
}
|
||||
if (result && std::memcmp(tmpBuf + 6, Internal::CiffHeader::signature(), 8) != 0) {
|
||||
|
||||
@ -272,7 +272,7 @@ void readWriteEpsMetadata(BasicIo& io, std::string& xmpPacket, NativePreviewList
|
||||
EXV_DEBUG << "readWriteEpsMetadata: DOS EPS checksum is not FFFF\n";
|
||||
#endif
|
||||
}
|
||||
if (!((posWmf == 0 && sizeWmf == 0) || (posTiff == 0 && sizeTiff == 0))) {
|
||||
if ((posWmf != 0 || sizeWmf != 0) && (posTiff != 0 || sizeTiff != 0)) {
|
||||
#ifndef SUPPRESS_WARNINGS
|
||||
EXV_WARNING << "DOS EPS file has both WMF and TIFF section. Only one of those is allowed.\n";
|
||||
#endif
|
||||
@ -472,8 +472,8 @@ void readWriteEpsMetadata(BasicIo& io, std::string& xmpPacket, NativePreviewList
|
||||
significantLine = true;
|
||||
#endif
|
||||
// implicit comments
|
||||
if (line == "%%EOF" || line == "%begin_xml_code" ||
|
||||
!(line.size() >= 2 && line.front() == '%' && '\x21' <= line[1] && line[1] <= '\x7e')) {
|
||||
if (line == "%%EOF" || line == "%begin_xml_code" || line.size() < 2 || line.front() != '%' || '\x21' > line[1] ||
|
||||
line[1] > '\x7e') {
|
||||
if (posEndComments == posEndEps) {
|
||||
posEndComments = startPos;
|
||||
#ifdef DEBUG
|
||||
|
||||
@ -187,7 +187,7 @@ bool OlympusMnHeader::read(const byte* pData, size_t size, ByteOrder /*byteOrder
|
||||
return false;
|
||||
header_.alloc(sizeOfSignature());
|
||||
std::copy_n(pData, header_.size(), header_.data());
|
||||
return !(header_.size() < sizeOfSignature() || 0 != header_.cmpBytes(0, signature_, 6));
|
||||
return header_.size() >= sizeOfSignature() && 0 == header_.cmpBytes(0, signature_, 6);
|
||||
}
|
||||
|
||||
size_t OlympusMnHeader::write(IoWrapper& ioWrapper, ByteOrder /*byteOrder*/) const {
|
||||
@ -222,7 +222,7 @@ bool Olympus2MnHeader::read(const byte* pData, size_t size, ByteOrder /*byteOrde
|
||||
return false;
|
||||
header_.alloc(sizeOfSignature());
|
||||
std::copy_n(pData, header_.size(), header_.data());
|
||||
return !(header_.size() < sizeOfSignature() || 0 != header_.cmpBytes(0, signature_, 10));
|
||||
return header_.size() >= sizeOfSignature() && 0 == header_.cmpBytes(0, signature_, 10);
|
||||
}
|
||||
|
||||
size_t Olympus2MnHeader::write(IoWrapper& ioWrapper, ByteOrder /*byteOrder*/) const {
|
||||
@ -258,7 +258,7 @@ bool OMSystemMnHeader::read(const byte* pData, size_t size, ByteOrder /*byteOrde
|
||||
return false;
|
||||
header_.alloc(sizeOfSignature());
|
||||
std::copy_n(pData, header_.size(), header_.data());
|
||||
return !(header_.size() < sizeOfSignature() || 0 != header_.cmpBytes(0, signature_, sizeOfSignature() - 2));
|
||||
return header_.size() >= sizeOfSignature() && 0 == header_.cmpBytes(0, signature_, sizeOfSignature() - 2);
|
||||
}
|
||||
|
||||
size_t OMSystemMnHeader::write(IoWrapper& ioWrapper, ByteOrder /*byteOrder*/) const {
|
||||
@ -301,7 +301,7 @@ bool FujiMnHeader::read(const byte* pData, size_t size, ByteOrder /*byteOrder*/)
|
||||
// Read offset to the IFD relative to the start of the makernote
|
||||
// from the header. Note that we ignore the byteOrder argument
|
||||
start_ = header_.read_uint32(8, byteOrder_);
|
||||
return !(header_.size() < sizeOfSignature() || 0 != header_.cmpBytes(0, signature_, 8));
|
||||
return header_.size() >= sizeOfSignature() && 0 == header_.cmpBytes(0, signature_, 8);
|
||||
}
|
||||
|
||||
size_t FujiMnHeader::write(IoWrapper& ioWrapper, ByteOrder /*byteOrder*/) const {
|
||||
@ -460,7 +460,7 @@ bool PentaxDngMnHeader::read(const byte* pData, size_t size, ByteOrder /*byteOrd
|
||||
return false;
|
||||
header_.alloc(sizeOfSignature());
|
||||
std::copy_n(pData, header_.size(), header_.data());
|
||||
return !(header_.size() < sizeOfSignature() || 0 != header_.cmpBytes(0, signature_, 7));
|
||||
return header_.size() >= sizeOfSignature() && 0 == header_.cmpBytes(0, signature_, 7);
|
||||
}
|
||||
|
||||
size_t PentaxDngMnHeader::write(IoWrapper& ioWrapper, ByteOrder /*byteOrder*/) const {
|
||||
@ -491,7 +491,7 @@ bool PentaxMnHeader::read(const byte* pData, size_t size, ByteOrder /*byteOrder*
|
||||
return false;
|
||||
header_.alloc(sizeOfSignature());
|
||||
std::copy_n(pData, header_.size(), header_.data());
|
||||
return !(header_.size() < sizeOfSignature() || 0 != header_.cmpBytes(0, signature_, 3));
|
||||
return header_.size() >= sizeOfSignature() && 0 == header_.cmpBytes(0, signature_, 3);
|
||||
}
|
||||
|
||||
size_t PentaxMnHeader::write(IoWrapper& ioWrapper, ByteOrder /*byteOrder*/) const {
|
||||
|
||||
@ -1053,7 +1053,7 @@ const TagInfo* OlympusMakerNote::tagListRi() {
|
||||
|
||||
// Gradation
|
||||
std::ostream& OlympusMakerNote::print0x050f(std::ostream& os, const Value& value, const ExifData*) {
|
||||
if (!(value.count() == 3 || value.count() == 4) || value.typeId() != signedShort) {
|
||||
if ((value.count() != 3 && value.count() != 4) || value.typeId() != signedShort) {
|
||||
return os << value;
|
||||
}
|
||||
|
||||
|
||||
@ -355,7 +355,7 @@ PreviewId Loader::getNumLoaders() {
|
||||
}
|
||||
|
||||
LoaderNative::LoaderNative(PreviewId id, const Image& image, int parIdx) : Loader(id, image) {
|
||||
if (!(0 <= parIdx && static_cast<size_t>(parIdx) < image.nativePreviews().size()))
|
||||
if (0 > parIdx || static_cast<size_t>(parIdx) >= image.nativePreviews().size())
|
||||
return;
|
||||
nativePreview_ = image.nativePreviews()[parIdx];
|
||||
width_ = nativePreview_.width_;
|
||||
|
||||
@ -3034,7 +3034,7 @@ std::ostream& printXmpVersion(std::ostream& os, const Value& value, const ExifDa
|
||||
}
|
||||
|
||||
std::ostream& printXmpDate(std::ostream& os, const Value& value, const ExifData*) {
|
||||
if (!(value.size() == 19 || value.size() == 20) || value.typeId() != xmpText) {
|
||||
if ((value.size() != 19 && value.size() != 20) || value.typeId() != xmpText) {
|
||||
return os << value;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user