Kaydet (Commit) 36a9091e authored tarafından Stephan Bergmann's avatar Stephan Bergmann

loplugin:useuniqueptr (clang-cl)

Change-Id: I08c2c3557b4cb1804446d5a65e8e0499b27a3329
üst 6d7b8977
......@@ -17,6 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <sal/config.h>
#include <memory>
#include <stdlib.h>
#include <time.h>
#ifndef _WIN32
......@@ -47,12 +51,11 @@ static OString impl_getHostname()
hostname by using the netbios name
*/
DWORD sz = MAX_COMPUTERNAME_LENGTH + 1;
char* szHost = new char[sz];
if (GetComputerName(szHost, &sz))
aHost = OString(szHost);
auto szHost = std::unique_ptr<char[]>(new char[sz]);
if (GetComputerName(szHost.get(), &sz))
aHost = OString(szHost.get());
else
aHost = OString("UNKNOWN");
delete[] szHost;
#else
/* Don't do dns lookup on Linux either */
sal_Char pHostName[1024];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment