[Libreoffice-commits] core.git: shell/source
Stephan Bergmann
sbergman at redhat.com
Mon Jul 17 15:24:49 UTC 2017
shell/source/win32/spsupp/COMOpenDocuments.cxx | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
New commits:
commit 143b3a2f3c431b7277321471d5366e7e1e97a772
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Mon Jul 17 17:24:05 2017 +0200
loplugin:useuniqueptr: shell (clang-cl)
Change-Id: Icf6cd85f9e4792ad09dd1a97a8802da13da942c2
diff --git a/shell/source/win32/spsupp/COMOpenDocuments.cxx b/shell/source/win32/spsupp/COMOpenDocuments.cxx
index ece3ba82f2ad..c1efe033409c 100644
--- a/shell/source/win32/spsupp/COMOpenDocuments.cxx
+++ b/shell/source/win32/spsupp/COMOpenDocuments.cxx
@@ -10,6 +10,7 @@
#include <sal/config.h>
#include <cstring>
+#include <vector>
#include "COMOpenDocuments.hpp"
#include "spsuppServ.hpp"
@@ -62,13 +63,12 @@ HRESULT LOStart(const wchar_t* sModeArg, const wchar_t* sFilePath, bool bDoSecur
0, nullptr);
size_t nBufSize = wcslen(sMsgBuf) + 100;
- wchar_t* sDisplayBuf = new wchar_t[nBufSize];
- swprintf(sDisplayBuf, nBufSize, L"Could not start LibreOffice. Error is 0x%08X:\n\n%s", dwError, sMsgBuf);
+ std::vector<wchar_t> sDisplayBuf(nBufSize);
+ swprintf(sDisplayBuf.data(), nBufSize, L"Could not start LibreOffice. Error is 0x%08X:\n\n%s", dwError, sMsgBuf);
LocalFree(sMsgBuf);
// Report the error to user and return error
- MessageBoxW(nullptr, sDisplayBuf, nullptr, MB_ICONERROR);
- delete[](sDisplayBuf);
+ MessageBoxW(nullptr, sDisplayBuf.data(), nullptr, MB_ICONERROR);
return HRESULT_FROM_WIN32(dwError);
}
CloseHandle(pi.hProcess);
More information about the Libreoffice-commits
mailing list