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 » LocalProcess trivia bug in Write() function causing incorrect error strings
LocalProcess trivia bug in Write() function causing incorrect error strings [message #44191] Tue, 20 January 2015 23:00 Go to next message
hans is currently offline  hans
Messages: 44
Registered: March 2006
Location: Germany
Member
Line 518 ff:
		for(int wn = 0; ret && wn < s.GetLength(); wn += n) {
			ret = WriteFile(hInputWrite, ~s + wn, s.GetLength(), &n, NULL);
			String ho = wreso;
			String he = wrese;
			wreso = wrese = Null;
			Read2(wreso, wrese);
			wreso = ho + wreso;
			wrese = ho + wrese;
		}

obviously last line should be wrese = he + wrese;

Same on line 538.

And I even don't understand why it was coded this way, it seems dangerous to give member variables (wreso, wrese) as parameters to the member function.
But perhaps there is a good reason for Razz

[Updated on: Tue, 20 January 2015 23:02]

Report message to a moderator

Re: LocalProcess trivia bug in Write() function causing incorrect error strings [message #44192 is a reply to message #44191] Tue, 20 January 2015 23:48 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
hans wrote on Tue, 20 January 2015 23:00
Line 518 ff:
		for(int wn = 0; ret && wn < s.GetLength(); wn += n) {
			ret = WriteFile(hInputWrite, ~s + wn, s.GetLength(), &n, NULL);
			String ho = wreso;
			String he = wrese;
			wreso = wrese = Null;
			Read2(wreso, wrese);
			wreso = ho + wreso;
			wrese = ho + wrese;
		}

obviously last line should be wrese = he + wrese;

Same on line 538.


Yes, thanks a lot.

Quote:

And I even don't understand why it was coded this way, it seems dangerous to give member variables (wreso, wrese) as parameters to the member function.
But perhaps there is a good reason for Razz


I agree that it is not the nicest piece of code, somehow I wanted to avoid adding another method. Those variables are there to fetch any output from the child process that can appear during pushing input to it, to avoid deadlock (because pipe can overflow and child process block on write to pipe, not reading the data we are attempting to send there). wrese/wreso are the used in client code call to Read2 (thus I we need to clean them before the call to Read2).
Previous Topic: Ideographic Character Handling
Next Topic: Using standard C++ in U++ application
Goto Forum:
  


Current Time: Thu Mar 28 13:05:27 CET 2024

Total time taken to generate the page: 0.00887 seconds