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  |
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
[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  |
 |
mirek
Messages: 14255 Registered: November 2005
|
Ultimate Member |
|
|
hans wrote on Tue, 20 January 2015 23:00Line 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 
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).
|
|
|
Goto Forum:
Current Time: Tue Apr 29 05:41:43 CEST 2025
Total time taken to generate the page: 0.04096 seconds
|