Added a few more performance tweaks.

This commit is contained in:
Andreas Huggel 2008-09-27 03:11:05 +00:00
parent bd1e9d239f
commit 4eda07a335
3 changed files with 7 additions and 8 deletions

View File

@ -638,7 +638,7 @@ namespace Exiv2 {
std::string::size_type pos1 = key_.find('.');
if (pos1 == std::string::npos) throw Error(6, key_);
std::string familyName = key_.substr(0, pos1);
if (familyName != std::string(familyName_)) {
if (0 != strcmp(familyName.c_str(), familyName_)) {
throw Error(6, key_);
}
std::string::size_type pos0 = pos1 + 1;

View File

@ -54,7 +54,7 @@ namespace {
//! Comparison operator for key
bool operator==(const std::string& key) const
{
return std::string(key_) == key;
return 0 == strcmp(key_, key.c_str());
}
const char* key_; //!< XMP key
@ -809,7 +809,7 @@ namespace Exiv2 {
if (!pl) return 0;
const XmpPropertyInfo* pi = 0;
for (int i = 0; pl[i].name_ != 0; ++i) {
if (std::string(pl[i].name_) == key.tagName()) {
if (0 == strcmp(pl[i].name_, key.tagName().c_str()) {
pi = pl + i;
break;
}
@ -970,7 +970,7 @@ namespace Exiv2 {
std::string::size_type pos1 = key.find('.');
if (pos1 == std::string::npos) throw Error(6, key);
std::string familyName = key.substr(0, pos1);
if (familyName != std::string(familyName_)) {
if (0 != strcmp(familyName.c_str(), familyName_)) {
throw Error(6, key);
}
std::string::size_type pos0 = pos1 + 1;

View File

@ -80,7 +80,7 @@ namespace Exiv2 {
{
const char* i = item.i_.c_str();
if (i == 0) return false;
return (strlen(i) == strlen(item_) && 0 == strcmp(i, item_));
return 0 == strcmp(i, item_);
}
// Important: IFD item must be unique!
@ -1625,8 +1625,7 @@ namespace Exiv2 {
const char* tn = tagName.c_str();
if (tn == 0) return 0;
for (int idx = 0; ti[idx].tag_ != 0xffff; ++idx) {
if ( strlen(ti[idx].name_) == strlen(tn)
&& strcmp(ti[idx].name_, tn) == 0) {
if (0 == strcmp(ti[idx].name_, tn)) {
return &ti[idx];
}
}
@ -1874,7 +1873,7 @@ namespace Exiv2 {
std::string::size_type pos1 = key_.find('.');
if (pos1 == std::string::npos) throw Error(6, key_);
std::string familyName = key_.substr(0, pos1);
if (familyName != std::string(familyName_)) {
if (0 != strcmp(familyName.c_str(), familyName_)) {
throw Error(6, key_);
}
std::string::size_type pos0 = pos1 + 1;