1
0
Fork 0

Merge pull request #169 from narspt/patch-2

fix wiresx search, avoid listing same reflector multiple times
ycs232-kbc
Jonathan Naylor 5 years ago committed by GitHub
commit 37fcf6068b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -313,17 +313,15 @@ std::vector<CYSFReflector*>& CYSFReflectors::search(const std::string& name)
reflector.erase(std::find_if(reflector.rbegin(), reflector.rend(), std::not1(std::ptr_fun<int, int>(std::isspace))).base(), reflector.end()); reflector.erase(std::find_if(reflector.rbegin(), reflector.rend(), std::not1(std::ptr_fun<int, int>(std::isspace))).base(), reflector.end());
std::transform(reflector.begin(), reflector.end(), reflector.begin(), ::toupper); std::transform(reflector.begin(), reflector.end(), reflector.begin(), ::toupper);
// Origional match function - only matches start of string. // Original match function - only matches start of string.
// if (trimmed == reflector.substr(0U, len)) // if (trimmed == reflector.substr(0U, len))
// m_search.push_back(*it); // m_search.push_back(*it);
// New match function searches the whole string // New match function searches the whole string
unsigned int refSrcPos; for (unsigned int refSrcPos = 0U; refSrcPos < reflector.length(); refSrcPos++) {
for (refSrcPos=0;refSrcPos<reflector.length(); refSrcPos++) if (reflector.substr(refSrcPos, trimmed.length()) == trimmed) {
{
if (reflector.substr(refSrcPos,trimmed.length()) == trimmed)
{
m_search.push_back(*it); m_search.push_back(*it);
break;
} }
} }
} }

Loading…
Cancel
Save