diff --git a/src/platform/entrycli.cpp b/src/platform/entrycli.cpp index 6859712a..b6e1cc01 100644 --- a/src/platform/entrycli.cpp +++ b/src/platform/entrycli.cpp @@ -312,7 +312,7 @@ static bool RunCommand(const std::vector args) { return false; } - if(inputFiles.size() == 0) { + if(inputFiles.empty()) { fprintf(stderr, "At least one input file must be specified.\n"); return false; } diff --git a/src/platform/guigtk.cpp b/src/platform/guigtk.cpp index d9a3b9f7..2569b5fe 100644 --- a/src/platform/guigtk.cpp +++ b/src/platform/guigtk.cpp @@ -1292,7 +1292,8 @@ public: void FilterChanged() { std::string extension = GetExtension(); - if(extension == "") return; + if(extension.empty()) + return; Platform::Path path = GetFilename(); SetCurrentName(path.WithExtension(extension).FileName()); diff --git a/src/platform/platform.cpp b/src/platform/platform.cpp index ab08828d..33b65793 100644 --- a/src/platform/platform.cpp +++ b/src/platform/platform.cpp @@ -203,7 +203,7 @@ static void FindPrefix(const std::string &raw, size_t *pos) { } } #else - if(raw.size() >= 1 && raw[0] == '/') { + if(!raw.empty() && raw[0] == '/') { *pos = 1; } #endif diff --git a/src/polygon.cpp b/src/polygon.cpp index 715e2b1c..e28bc424 100644 --- a/src/polygon.cpp +++ b/src/polygon.cpp @@ -681,7 +681,8 @@ void SPolygon::MakeEdgesInto(SEdgeList *el) 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(); } diff --git a/src/render/gl3shader.cpp b/src/render/gl3shader.cpp index cf25cbeb..8ad45c7a 100644 --- a/src/render/gl3shader.cpp +++ b/src/render/gl3shader.cpp @@ -395,7 +395,7 @@ GLuint Generate(const std::vector &pattern) { int dashI = 0; double dashT = 0.0; for(int i = 0; i < size; i++) { - if(pattern.size() == 0) { + if(pattern.empty()) { textureData[i] = EncodeLengthAsFloat(0.0); continue; } diff --git a/src/resource.cpp b/src/resource.cpp index 2722cf82..569d95e7 100644 --- a/src/resource.cpp +++ b/src/resource.cpp @@ -1147,7 +1147,7 @@ PluralExpr::Token PluralExpr::Lex() { } 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(); stack.pop_back(); return t; @@ -1406,7 +1406,7 @@ void GettextParser::Parse() { } } - if(key.ident == "") { + if(key.ident.empty()) { ssassert(msgstrs.size() == 1, "Expected exactly one header msgstr"); ParseHeader(msgstrs[0]); diff --git a/src/srf/curve.cpp b/src/srf/curve.cpp index e896e5bb..9bdcca28 100644 --- a/src/srf/curve.cpp +++ b/src/srf/curve.cpp @@ -476,7 +476,7 @@ void SBezierLoop::MakePwlInto(SContour *sc, double chordTol) const { } bool SBezierLoop::IsClosed() const { - if(l.n < 1) return false; + if(l.IsEmpty()) return false; Vector s = l.First()->Start(), f = l.Last()->Finish(); return s.Equals(f); @@ -497,7 +497,7 @@ SBezierLoopSet SBezierLoopSet::From(SBezierList *sbl, SPolygon *poly, SBezierLoopSet ret = {}; *allClosed = true; - while(sbl->l.n > 0) { + while(!sbl->l.IsEmpty()) { bool thisClosed; SBezierLoop loop; loop = SBezierLoop::FromCurves(sbl, &thisClosed, errorAt); diff --git a/src/toolbar.cpp b/src/toolbar.cpp index 8e489648..b1718204 100644 --- a/src/toolbar.cpp +++ b/src/toolbar.cpp @@ -175,7 +175,7 @@ bool GraphicsWindow::ToolbarDrawOrHitTest(int mx, int my, UiCanvas *canvas, bool leftpos = true; for(ToolIcon &icon : Toolbar) { - if(icon.name == "") { // spacer + if(icon.name.empty()) { // spacer if(!leftpos) { leftpos = true; y -= 32;