[Libreoffice-commits] core.git: desktop/source
Lubos Lunak
l.lunak at suse.cz
Wed Feb 20 05:33:27 PST 2013
On Tuesday 19 of February 2013, Julien Nabet wrote:
> desktop/source/app/officeipcthread.cxx | 8 +-------
> 1 file changed, 1 insertion(+), 7 deletions(-)
>
> New commits:
> commit 7d9a7020eb5777f5baaa8beb6af5db9a8796c7c9
> Author: Julien Nabet <serval2412 at yahoo.fr>
> Date: Tue Feb 19 21:35:19 2013 +0100
>
> Good way to initialize array of char char var[NB]={0}
>
> See http://stackoverflow.com/questions/1920430/c-array-initialization
>
> Change-Id: Ibbbe249684dc34f8aa44868c99cc1344a2928ade
>
> diff --git a/desktop/source/app/officeipcthread.cxx
> b/desktop/source/app/officeipcthread.cxx index 8db7946..445ccb4 100644
> --- a/desktop/source/app/officeipcthread.cxx
> +++ b/desktop/source/app/officeipcthread.cxx
> @@ -497,23 +497,17 @@ OfficeIPCThread::Status
> OfficeIPCThread::EnableOfficeIPCThread() else if( pThread->maPipe.create(
> aPipeIdent.getStr(), osl_Pipe_OPEN, rSecurity )) // Creation not
> successfull, now we try to connect {
> osl::StreamPipe aStreamPipe(pThread->maPipe.getHandle());
> - char pReceiveBuffer[sc_nCSASeqLength + 1];
> + char pReceiveBuffer[sc_nCSASeqLength + 1] = {0};
> int nResult = 0;
> int nBytes = 0;
> int nBufSz = sc_nCSASeqLength + 1;
> // read byte per byte
> - pReceiveBuffer[0] = 0;
> while ((nResult=aStreamPipe.recv( pReceiveBuffer+nBytes,
> nBufSz-nBytes))>0) { nBytes += nResult;
> if (pReceiveBuffer[nBytes-1]=='\0') {
> break;
> }
> }
> - /* make sure the buffer is \0 terminated */
> - if (nBytes > 0)
> - {
> - pReceiveBuffer[nBytes-1] = 0;
> - }
Did you really mean to remove this part?
--
Lubos Lunak
l.lunak at suse.cz
More information about the LibreOffice
mailing list