diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-02-23 21:36:23 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-02-27 09:45:55 +0000 |
commit | 06dda2b7aef3693b4481fa6254fe3afd294f3363 (patch) | |
tree | 251424fde5145570fbb9776d45c34552343f92da /desktop | |
parent | c35e81202cc709f3061e8b189af94e6858418940 (diff) |
make desktop Bytestring free
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/source/app/officeipcthread.cxx | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/desktop/source/app/officeipcthread.cxx b/desktop/source/app/officeipcthread.cxx index 38babd8cecf9..5943978e24c1 100644 --- a/desktop/source/app/officeipcthread.cxx +++ b/desktop/source/app/officeipcthread.cxx @@ -556,19 +556,21 @@ OfficeIPCThread::Status OfficeIPCThread::EnableOfficeIPCThread() aStreamPipe.write(aArguments.getStr(), aArguments.getLength()); aStreamPipe.write("\0", 1); - ByteString aToken(sc_aConfirmationSequence); - char *aReceiveBuffer = new char[aToken.Len()+1]; - int n = aStreamPipe.read( aReceiveBuffer, aToken.Len() ); - aReceiveBuffer[n]='\0'; + rtl::OString aToken(sc_aConfirmationSequence); + char *pReceiveBuffer = new char[aToken.getLength()+1]; + sal_Int32 n = aStreamPipe.read(pReceiveBuffer, aToken.getLength()); + pReceiveBuffer[n]='\0'; - if (aToken.CompareTo(aReceiveBuffer)!= COMPARE_EQUAL) { + bool bIsConfirmationSequence = aToken.equals(pReceiveBuffer); + delete[] pReceiveBuffer; + + if (!bIsConfirmationSequence) + { // something went wrong - delete[] aReceiveBuffer; return IPC_STATUS_BOOTSTRAP_ERROR; - } else { - delete[] aReceiveBuffer; - return IPC_STATUS_2ND_OFFICE; } + + return IPC_STATUS_2ND_OFFICE; } return IPC_STATUS_OK; @@ -685,19 +687,19 @@ void OfficeIPCThread::execute() } // don't close pipe ... - ByteString aArguments = aBuf.makeStringAndClear(); + rtl::OString aArguments = aBuf.makeStringAndClear(); // Is this a lookup message from another application? if so, ignore - if ( aArguments.Len() == 0 ) + if (aArguments.isEmpty()) continue; // is this a termination message ? if so, terminate - if(( aArguments.CompareTo( sc_aTerminationSequence, sc_nTSeqLength ) == COMPARE_EQUAL ) || - mbDowning ) return; + if (aArguments.equalsL(sc_aTerminationSequence, sc_nTSeqLength) || mbDowning) + return; std::auto_ptr< CommandLineArgs > aCmdLineArgs; try { - Parser p( aArguments ); + Parser p(aArguments); aCmdLineArgs.reset( new CommandLineArgs( p ) ); } catch ( const CommandLineArgs::Supplier::Exception & ) @@ -867,8 +869,8 @@ void OfficeIPCThread::execute() delete pRequest; pRequest = NULL; } - if (( aArguments.CompareTo( sc_aShowSequence, sc_nShSeqLength ) == COMPARE_EQUAL ) || - aCmdLineArgs->IsEmpty() ) + if (aArguments.equalsL(sc_aShowSequence, sc_nShSeqLength) || + aCmdLineArgs->IsEmpty()) { // no document was sent, just bring Office to front ApplicationEvent* pAppEvent = |