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 » Developing U++ » U++ Developers corner » Pop3 class and reference examples for U++
Re: Pop3 class and reference examples for U++ [message #42610 is a reply to message #42605] Wed, 26 March 2014 12:37 Go to previous messageGo to previous message
Oblivion is currently offline  Oblivion
Messages: 1093
Registered: August 2007
Senior Contributor
Hello Mirek,

Ah.. I didn't encounter any actual errors but yes, looking more closely, you are right that was my fault, sorry. And thanks for correcting it. Smile

Other than that, after furter examining the code, I shall report an error in the Pop3::GetListItems() method:
Current code omits the last line of the list. So I corrected it.


bool Pop3::GetListItems(ValueMap& list, dword type1, dword type2)
{
	StringStream s(data);
        for(;;) {
		String line = s.GetLine();
		if(s.IsError())
			return false;
		if(s.IsEof())                                // << ---- Omits last line of the list. EOF checking should be moved to top.
			break;
		Vector<String> s = Split(line, ' ');
		if(s.GetCount() < 2)
			return false;
		list.Add(Scan(type1, s[0]), Scan(type2, s[1]));
	}
	return true;
}


Corrected version:

bool Pop3::GetListItems(ValueMap& list, dword type1, dword type2)
{
	StringStream s(data);
	while(!s.IsEof()) {
		String line = s.GetLine();
		if(s.IsError())
			return false;
		Vector<String> s = Split(line, ' ');
		if(s.GetCount() < 2)
			return false;
		list.Add(Scan(type1, s[0]), Scan(type2, s[1]));
	}
	return true;
}


Other than that, everything seems fine.


P.S. Thanks a lot for the SplitTo() function, it is and will be very helpful. Too bad those handy utility functions got undocumented.
When I have time I'll examine and document them.

Regards.


[Updated on: Wed, 26 March 2014 18:29]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Value size ?
Next Topic: Skylark: Should escape character '$' be replaced to avoid name clash with Jquery?
Goto Forum:
  


Current Time: Mon Apr 29 07:33:38 CEST 2024

Total time taken to generate the page: 0.02431 seconds