variable bouquets name compare

git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@803 e54a6e83-5905-42d5-8d5c-058d10e6a962
This commit is contained in:
satbaby
2010-09-27 18:32:25 +00:00
parent 764386ccc9
commit cc7c7f2bde

View File

@@ -530,7 +530,6 @@ void CBouquetManager::deleteBouquet(const CZapitBouquet* bouquet)
} }
} }
} }
// -- Find Bouquet-Name, if BQ exists (2002-04-02 rasc) // -- Find Bouquet-Name, if BQ exists (2002-04-02 rasc)
// -- Return: Bouqet-ID (found: 0..n) or -1 (Bouquet does not exist) // -- Return: Bouqet-ID (found: 0..n) or -1 (Bouquet does not exist)
int CBouquetManager::existsBouquet(char const * const name) int CBouquetManager::existsBouquet(char const * const name)
@@ -538,9 +537,38 @@ int CBouquetManager::existsBouquet(char const * const name)
unsigned int i; unsigned int i;
for (i = 0; i < Bouquets.size(); i++) { for (i = 0; i < Bouquets.size(); i++) {
//if (strncasecmp(Bouquets[i]->Name.c_str(), name,Bouquets[i]->Name.length())==0)
if (Bouquets[i]->Name == name) if (Bouquets[i]->Name == name)
return (int)i; return (int)i;
else if (strcasecmp(Bouquets[i]->Name.c_str(), name)==0){
int lower1 = 0, lower2 = 0;
int upper1 = 0 ,upper2 = 0;
std::string str2 = name;
size_t pos=0;
size_t pos2 = Bouquets[i]->Name.find("] ");
if(pos != std::string::npos){
pos += pos2;
}
while (Bouquets[i]->Name[pos]){
if(islower(Bouquets[i]->Name[pos])){
++lower1;
}
if(isupper(Bouquets[i]->Name[pos])){
++upper1;
}
if(islower(str2[pos])){
++lower2;
}
if(isupper(str2[pos])){
++upper2;
}
pos++;
}
if ( ( upper2 && (lower1 < lower2)) || (lower2==0 && upper1==0 && upper2==lower1) ){
Bouquets[i]->Name = str2;
}
return (int)i;
}
} }
return -1; return -1;
} }