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 » BlockStream::_Get does not buffer data (current svn version)
BlockStream::_Get does not buffer data (current svn version) [message #15442] Wed, 23 April 2008 22:23 Go to previous message
hans is currently offline  hans
Messages: 44
Registered: March 2006
Location: Germany
Member
In the function

dword BlockStream::_Get(void *data, dword size)

the call to SyncPage resets the read buffer, so the normal Get() functions of Stream are not benefit from buffering.
	if(pg0 == pg1) {
		SyncPage(); // <--- here
		memcpy(data, buffer + pos0 - pos, size);
		ptr = buffer + pos1 - pos;
	}

I have commented out SyncPage() and this seems to fix it but I do not completely understand the code, so this may have introduce new bugs Rolling Eyes

App to reproduce (run it and see how often BlockStream::_Get() is called)

file: console.cpp
CONSOLE_APP_MAIN
{
	Cout() << "Hello wonderful U++ world\n";
	FileIn f;
	f.Open("console.cpp");
	for (;;) {
		byte b;
		if (f.Get(&b, 1) != 1) break;
		Cout() << b;
	}

}
//add many comment lines to get big filesize
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////

 
Read Message
Read Message
Read Message
Read Message
Previous Topic: GetHWND() always returns NULL?
Next Topic: Convenient work with options/properties
Goto Forum:
  


Current Time: Thu May 09 15:10:25 CEST 2024

Total time taken to generate the page: 0.01236 seconds