Home » U++ Library support » U++ Core » [BUG #1854] SegFault when calling CParser::NoSkipComments() before term initialisation
[BUG #1854] SegFault when calling CParser::NoSkipComments() before term initialisation [message #49692] |
Wed, 04 April 2018 13:58  |
omari
Messages: 276 Registered: March 2010
|
Experienced Member |
|
|
because the constructor CParser(const char*) call Spaces(); that consum any space and any comment in the start of the parsed String,
i decided to use CParser like this:
void TestCParser() {
String s = " some text ";
CParser p;
p.NoSkipComments();
p.Set(s);
}
investigation :
CParser& NoSkipComments() { return SkipComments(false); }
CParser& CParser::SkipComments(bool b)
{
skipcomments = b;
term = wspc;
Spaces0(); <---
return *this;
}
SkipComments is ambiguous,
if it is a setter, it must be a setter only,
if it is a procedure, it must not change the value of "skipcomments"
regards
omari.
|
|
|
Re: [BUG #1854] SegFault when calling CParser::NoSkipComments() before term initialisation [message #49719 is a reply to message #49692] |
Fri, 13 April 2018 10:50  |
 |
mirek
Messages: 14257 Registered: November 2005
|
Ultimate Member |
|
|
omari wrote on Wed, 04 April 2018 13:58because the constructor CParser(const char*) call Spaces(); that consum any space and any comment in the start of the parsed String,
i decided to use CParser like this:
void TestCParser() {
String s = " some text ";
CParser p;
p.NoSkipComments();
p.Set(s);
}
investigation :
CParser& NoSkipComments() { return SkipComments(false); }
CParser& CParser::SkipComments(bool b)
{
skipcomments = b;
term = wspc;
Spaces0(); <---
return *this;
}
SkipComments is ambiguous,
if it is a setter, it must be a setter only,
if it is a procedure, it must not change the value of "skipcomments"
..or we can just test 'term' in Spaces0... (in the trunk now)
Thanks for spotting this.
Mirek
[Updated on: Fri, 13 April 2018 10:51] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Sun May 11 15:26:45 CEST 2025
Total time taken to generate the page: 0.01171 seconds
|