Skip to content
Snippets Groups Projects
Commit 9dcad461 authored by Marcel Loose's avatar Marcel Loose :sunglasses:
Browse files

BugID: 1029

Reimplemented moduleName() and keyName() using string::[r]find() methods. This
seems to solve the bug.
parent 368bfd1c
No related branches found
No related tags found
No related merge requests found
...@@ -842,14 +842,11 @@ uint32 seqNr(const string& aString) ...@@ -842,14 +842,11 @@ uint32 seqNr(const string& aString)
// //
string keyName(const string& fullKeyName) string keyName(const string& fullKeyName)
{ {
char* lastPoint = strrchr(fullKeyName.c_str(), '.'); string::size_type lastPoint = fullKeyName.rfind('.');
if (lastPoint == string::npos)
if (!lastPoint) { return fullKeyName;
return (fullKeyName); else
} return fullKeyName.substr(lastPoint+1);
return (fullKeyName.substr(lastPoint + 1 - fullKeyName.c_str()));
} }
...@@ -860,13 +857,11 @@ string keyName(const string& fullKeyName) ...@@ -860,13 +857,11 @@ string keyName(const string& fullKeyName)
// //
string moduleName(const string& fullKeyName) string moduleName(const string& fullKeyName)
{ {
char* lastPoint = strrchr(fullKeyName.c_str(), '.'); string::size_type lastPoint = fullKeyName.rfind('.');
if (lastPoint == string::npos)
if (!lastPoint) { return "";
return (""); else
} return fullKeyName.substr(0, lastPoint);
return (fullKeyName.substr(0, lastPoint - fullKeyName.c_str()));
} }
// //
...@@ -876,25 +871,21 @@ string moduleName(const string& fullKeyName) ...@@ -876,25 +871,21 @@ string moduleName(const string& fullKeyName)
// //
string keyPart (const string& parameterLine) string keyPart (const string& parameterLine)
{ {
char* firstEqual = strchr(parameterLine.c_str(), '='); string::size_type firstEqual = parameterLine.find('=');
if (firstEqual == string::npos)
if (!firstEqual) { return parameterLine;
return (parameterLine); else
} return parameterLine.substr(0, firstEqual);
return (parameterLine.substr(0, firstEqual - parameterLine.c_str()));
} }
// Returns the value of a parameterline // Returns the value of a parameterline
string valuePart (const string& parameterLine) string valuePart (const string& parameterLine)
{ {
char* firstEqual = strchr(parameterLine.c_str(), '='); string::size_type firstEqual = parameterLine.find('=');
if (firstEqual == string::npos)
if (!firstEqual) { return parameterLine;
return (""); else
} return parameterLine.substr(firstEqual+1);
return (parameterLine.substr(firstEqual + 1 - parameterLine.c_str()));
} }
// Returns the value of the index if the string contains an index otherwise // Returns the value of the index if the string contains an index otherwise
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment