Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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 Go to next message
omari is currently offline  omari
Messages: 264
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 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
omari wrote on Wed, 04 April 2018 13:58
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"


..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

Previous Topic: DST issue in Time()
Next Topic: [BUG #1855, + PATCH] FormatIntAlpha oes not always give the right results.
Goto Forum:
  


Current Time: Fri Mar 29 14:40:23 CET 2024

Total time taken to generate the page: 0.01762 seconds