Portability

- Fixed compiler warnings on Fedora/Ubuntu.
- Fixed bug found by compiler warnings.  Woohoo!
This commit is contained in:
Paul Beckingham 2009-06-15 10:00:06 -04:00
parent 98316f7ab1
commit 91da9440c5

View file

@ -34,7 +34,7 @@
#include "Duration.h" #include "Duration.h"
#include "Att.h" #include "Att.h"
static char* internalNames[] = static const char* internalNames[] =
{ {
"entry", "entry",
"start", "start",
@ -44,7 +44,7 @@ static char* internalNames[] =
// "limit", // "limit",
}; };
static char* modifiableNames[] = static const char* modifiableNames[] =
{ {
"project", "project",
"priority", "priority",
@ -55,7 +55,7 @@ static char* modifiableNames[] =
"until", "until",
}; };
static char* modifierNames[] = static const char* modifierNames[] =
{ {
"before", "before",
"after", "after",
@ -452,23 +452,31 @@ bool Att::match (const Att& other) const
// is = equal. Nop. // is = equal. Nop.
else if (mMod == "is") // TODO i18n else if (mMod == "is") // TODO i18n
{
if (mValue != other.mValue) if (mValue != other.mValue)
return false; return false;
}
// isnt = not equal. // isnt = not equal.
else if (mMod == "isnt") // TODO i18n else if (mMod == "isnt") // TODO i18n
{
if (mValue == other.mValue) if (mValue == other.mValue)
return false; return false;
}
// any = any value, but not empty value. // any = any value, but not empty value.
else if (mMod == "any") // TODO i18n else if (mMod == "any") // TODO i18n
{
if (other.mValue == "") if (other.mValue == "")
return false; return false;
}
// none = must have empty value. // none = must have empty value.
else if (mMod == "none") // TODO i18n else if (mMod == "none") // TODO i18n
{
if (other.mValue != "") if (other.mValue != "")
return false; return false;
}
// startswith = first characters must match. // startswith = first characters must match.
else if (mMod == "startswith") // TODO i18n else if (mMod == "startswith") // TODO i18n
@ -494,13 +502,17 @@ bool Att::match (const Att& other) const
// has = contains as a substring. // has = contains as a substring.
else if (mMod == "has" || mMod == "contains") // TODO i18n else if (mMod == "has" || mMod == "contains") // TODO i18n
{
if (other.mValue.find (mValue) == std::string::npos) if (other.mValue.find (mValue) == std::string::npos)
return false; return false;
}
// hasnt = does not contain as a substring. // hasnt = does not contain as a substring.
else if (mMod == "hasnt") // TODO i18n else if (mMod == "hasnt") // TODO i18n
{
if (other.mValue.find (mValue) != std::string::npos) if (other.mValue.find (mValue) != std::string::npos)
return false; return false;
}
// before = under = below = < // before = under = below = <
else if (mMod == "before" || mMod == "under" || mMod == "below") else if (mMod == "before" || mMod == "under" || mMod == "below")