From 275959c64eaf91c088f426ea451ab14fab31c098 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Sat, 5 Nov 2011 23:18:26 +0200 Subject: Use empty() instead of size() to check container emptiness. --- bitmap.c | 2 +- render.c | 2 +- xml/parser.c | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/bitmap.c b/bitmap.c index c43609f..e6e5606 100644 --- a/bitmap.c +++ b/bitmap.c @@ -164,7 +164,7 @@ bool cText2SkinBitmap::LoadNonXpm(const char *Filename, int height, int width, i int w, h; std::vector::iterator it; readImages(&images, Filename); - if (images.size() == 0) { + if (images.empty()) { esyslog("ERROR: text2skin: Couldn't load %s", Filename); return false; } diff --git a/render.c b/render.c index 2e17669..49e5fdc 100644 --- a/render.c +++ b/render.c @@ -174,7 +174,7 @@ void cText2SkinRender::Update(void) DrawObject(mDisplay->GetObject(i)); mDirty = 0; - while (mDirtyItems.size() > 0) + while (!mDirtyItems.empty()) mDirtyItems.pop_back(); Dbench(flush); diff --git a/xml/parser.c b/xml/parser.c index bbfd09b..8329fb6 100644 --- a/xml/parser.c +++ b/xml/parser.c @@ -87,7 +87,7 @@ static uint oindex = 0; bool xStartElem(const std::string &name, std::map &attrs) { //Dprintf("start element: %s\n", name.c_str()); - if (context.size() == 0) { + if (context.empty()) { if (name == "skin") { ATTRIB_MAN_FUNC ("version", skin->mVersion.Parse); ATTRIB_MAN_STRING("name", skin->mTitle); @@ -128,7 +128,7 @@ bool xStartElem(const std::string &name, std::map &attr else { object = new cxObject(display); if (object->ParseType(name)) { - if (parents.size() > 0) + if (!parents.empty()) object->mRefresh = parents.back()->mRefresh; else object->mRefresh = display->mRefreshDefault; @@ -246,7 +246,7 @@ bool xEndElem(const std::string &name) { display = NULL; oindex = 0; } - else if (object != NULL || parents.size() > 0) { + else if (object != NULL || !parents.empty()) { if (object == NULL) { Dprintf("rotating parent to object\n"); object = parents[parents.size() - 1]; @@ -282,7 +282,7 @@ bool xEndElem(const std::string &name) { } object->mIndex = oindex++; - if (parents.size() > 0) { + if (!parents.empty()) { Dprintf("pushing to parent\n"); cxObject *parent = parents[parents.size() - 1]; if (parent->mObjects == NULL) -- cgit v1.2.3