[Issue#] N/A
[Problem] .filename9.jpg or .filename#.jpg matched incorrectly.
[Cause] matcher not stopping if not detected . before 9 or hash.
[Solution] Ensured matcher stops after character before 9.suffix or #.suffix.
Note, the filename ".9.jpg" still matches - is this desired?
[Verification] Build Repo
Change-Id: I32cc2e8db4d35e5237c614a0617ddf8dff198518
Signed-off-by: David Steele <david.steele@partner.samsung.com>
{
bool match = false;
- std::string::const_iterator iter = filename.end();
+ std::string::const_reverse_iterator iter = filename.rbegin();
iter--;
enum { SUFFIX, HASH, HASH_DOT, DONE } state = SUFFIX;
- while(iter >= filename.begin() && state != DONE)
+ while(iter < filename.rend() && state != DONE)
{
switch(state)
{
{
if(*iter == '.')
{
- state = DONE;
match = true;
}
+ state = DONE; // Stop testing characters
}
break;
case DONE:
}
break;
}
- iter--;
+ iter++;
}
return match;
}