Use IsEmpty() or .empty() to check if a container is empty. NFC.
Most found by clang-tidy.
This commit is contained in:
parent
61c0167ad7
commit
c0904e2ba8
@ -312,7 +312,7 @@ static bool RunCommand(const std::vector<std::string> args) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(inputFiles.size() == 0) {
|
if(inputFiles.empty()) {
|
||||||
fprintf(stderr, "At least one input file must be specified.\n");
|
fprintf(stderr, "At least one input file must be specified.\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1292,7 +1292,8 @@ public:
|
|||||||
|
|
||||||
void FilterChanged() {
|
void FilterChanged() {
|
||||||
std::string extension = GetExtension();
|
std::string extension = GetExtension();
|
||||||
if(extension == "") return;
|
if(extension.empty())
|
||||||
|
return;
|
||||||
|
|
||||||
Platform::Path path = GetFilename();
|
Platform::Path path = GetFilename();
|
||||||
SetCurrentName(path.WithExtension(extension).FileName());
|
SetCurrentName(path.WithExtension(extension).FileName());
|
||||||
|
@ -203,7 +203,7 @@ static void FindPrefix(const std::string &raw, size_t *pos) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if(raw.size() >= 1 && raw[0] == '/') {
|
if(!raw.empty() && raw[0] == '/') {
|
||||||
*pos = 1;
|
*pos = 1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -681,7 +681,8 @@ void SPolygon::MakeEdgesInto(SEdgeList *el) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Vector SPolygon::ComputeNormal() const {
|
Vector SPolygon::ComputeNormal() const {
|
||||||
if(l.n < 1) return Vector::From(0, 0, 0);
|
if(l.IsEmpty())
|
||||||
|
return Vector::From(0, 0, 0);
|
||||||
return (l[0]).ComputeNormal();
|
return (l[0]).ComputeNormal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -395,7 +395,7 @@ GLuint Generate(const std::vector<double> &pattern) {
|
|||||||
int dashI = 0;
|
int dashI = 0;
|
||||||
double dashT = 0.0;
|
double dashT = 0.0;
|
||||||
for(int i = 0; i < size; i++) {
|
for(int i = 0; i < size; i++) {
|
||||||
if(pattern.size() == 0) {
|
if(pattern.empty()) {
|
||||||
textureData[i] = EncodeLengthAsFloat(0.0);
|
textureData[i] = EncodeLengthAsFloat(0.0);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1147,7 +1147,7 @@ PluralExpr::Token PluralExpr::Lex() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
PluralExpr::Token PluralExpr::PopToken() {
|
PluralExpr::Token PluralExpr::PopToken() {
|
||||||
ssassert(stack.size() > 0, "Expected a non-empty stack");
|
ssassert(!stack.empty(), "Expected a non-empty stack");
|
||||||
Token t = stack.back();
|
Token t = stack.back();
|
||||||
stack.pop_back();
|
stack.pop_back();
|
||||||
return t;
|
return t;
|
||||||
@ -1406,7 +1406,7 @@ void GettextParser::Parse() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(key.ident == "") {
|
if(key.ident.empty()) {
|
||||||
ssassert(msgstrs.size() == 1,
|
ssassert(msgstrs.size() == 1,
|
||||||
"Expected exactly one header msgstr");
|
"Expected exactly one header msgstr");
|
||||||
ParseHeader(msgstrs[0]);
|
ParseHeader(msgstrs[0]);
|
||||||
|
@ -476,7 +476,7 @@ void SBezierLoop::MakePwlInto(SContour *sc, double chordTol) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool SBezierLoop::IsClosed() const {
|
bool SBezierLoop::IsClosed() const {
|
||||||
if(l.n < 1) return false;
|
if(l.IsEmpty()) return false;
|
||||||
Vector s = l.First()->Start(),
|
Vector s = l.First()->Start(),
|
||||||
f = l.Last()->Finish();
|
f = l.Last()->Finish();
|
||||||
return s.Equals(f);
|
return s.Equals(f);
|
||||||
@ -497,7 +497,7 @@ SBezierLoopSet SBezierLoopSet::From(SBezierList *sbl, SPolygon *poly,
|
|||||||
SBezierLoopSet ret = {};
|
SBezierLoopSet ret = {};
|
||||||
|
|
||||||
*allClosed = true;
|
*allClosed = true;
|
||||||
while(sbl->l.n > 0) {
|
while(!sbl->l.IsEmpty()) {
|
||||||
bool thisClosed;
|
bool thisClosed;
|
||||||
SBezierLoop loop;
|
SBezierLoop loop;
|
||||||
loop = SBezierLoop::FromCurves(sbl, &thisClosed, errorAt);
|
loop = SBezierLoop::FromCurves(sbl, &thisClosed, errorAt);
|
||||||
|
@ -175,7 +175,7 @@ bool GraphicsWindow::ToolbarDrawOrHitTest(int mx, int my, UiCanvas *canvas,
|
|||||||
|
|
||||||
bool leftpos = true;
|
bool leftpos = true;
|
||||||
for(ToolIcon &icon : Toolbar) {
|
for(ToolIcon &icon : Toolbar) {
|
||||||
if(icon.name == "") { // spacer
|
if(icon.name.empty()) { // spacer
|
||||||
if(!leftpos) {
|
if(!leftpos) {
|
||||||
leftpos = true;
|
leftpos = true;
|
||||||
y -= 32;
|
y -= 32;
|
||||||
|
Loading…
Reference in New Issue
Block a user