On 02/20/2013 04:25 PM, julien2412 wrote:
Lubos Lunak wrote
Lubos Lunak wrote
  Sorry, I did not realize that = { 0 } actually clears the rest of the
array.
And I do not quite understand why clearing an entire array is supposed to
be
a good way to initialize it when just setting the last one to 0 is enough.
...
Why "pReceiveBuffer[nBytes-1] = 0;" would need to stay?

  If I'm reading the code correctly, "nBytes-1" is not the position after
the
read data, but the last read item. Which should mean that the repeated
recv()
may rewrite all the 0's from the initialization. That rather begs the
question why it changes the last read item instead of terminating it, so
the
code may have been already broken to begin with.

I thought it could be interesting to put together declaration and
initialization so we're sure we won't have some side effects (I thought it
could be more clean too).
To be honest, I thought too it was a very straightforward patch, so i pushed
it on master instead of having submitted for gerrit review. Obviously, I was
wrong.

For the second part of your message, I really don't know.

Again, don't hesitate to tell me if I must revert this commit.

FYI: Without having seen this mail thread, I did see the couple of recent commits to desktop/source/app/officeipcthread.cxx last night, saw that they still don't address all problems with the sending side not including NUL bytes at places where the receiving side expects them, worked on a clean-up of that code, but didn't come around yet to push it. Will happen shortly.

Stephan
_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to