summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2019-10-15 01:57:12 +0300
committerStephan Bergmann <sbergman@redhat.com>2019-10-17 09:53:42 +0200
commitd51db77c8d87f210785a8a8c6dd875f7bacddb3c (patch)
treefd1ab208d49e85371fc9bb321539ce137bdaf719 /sal
parentc8eaadb5d70f42723517bb028f363e37726be256 (diff)
Remove some memset calls
Replace them with default initialization or calloc Change-Id: I747f53c2ced2d0473fd5a5ede4f8520a0633dcc1 Reviewed-on: https://gerrit.libreoffice.org/80805 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'sal')
-rw-r--r--sal/osl/w32/file.cxx4
-rw-r--r--sal/osl/w32/file_dirvol.cxx3
-rw-r--r--sal/osl/w32/pipe.cxx9
-rw-r--r--sal/osl/w32/procimpl.cxx4
-rw-r--r--sal/osl/w32/profile.cxx4
5 files changed, 7 insertions, 17 deletions
diff --git a/sal/osl/w32/file.cxx b/sal/osl/w32/file.cxx
index 7fda6107adeb..1c219f8f00af 100644
--- a/sal/osl/w32/file.cxx
+++ b/sal/osl/w32/file.cxx
@@ -156,9 +156,7 @@ FileHandle_Impl::FileHandle_Impl(HANDLE hFile)
m_buffer (nullptr)
{
::InitializeCriticalSection (&m_mutex);
- m_buffer = static_cast<sal_uInt8 *>(malloc(m_bufsiz));
- if (m_buffer)
- memset (m_buffer, 0, m_bufsiz);
+ m_buffer = static_cast<sal_uInt8 *>(calloc(m_bufsiz, 1));
}
FileHandle_Impl::~FileHandle_Impl()
diff --git a/sal/osl/w32/file_dirvol.cxx b/sal/osl/w32/file_dirvol.cxx
index 96a2a473e731..c8ccd4001126 100644
--- a/sal/osl/w32/file_dirvol.cxx
+++ b/sal/osl/w32/file_dirvol.cxx
@@ -862,11 +862,10 @@ static oslFileError osl_getNextFileItem(
if ( !pDirImpl )
return osl_File_E_INVAL;
- pItemImpl = static_cast<DirectoryItem_Impl*>(malloc(sizeof(DirectoryItem_Impl)));
+ pItemImpl = static_cast<DirectoryItem_Impl*>(calloc(1, sizeof(DirectoryItem_Impl)));
if ( !pItemImpl )
return osl_File_E_NOMEM;
- memset( pItemImpl, 0, sizeof(DirectoryItem_Impl) );
fFound = EnumDirectory( pDirImpl->hDirectory, &pItemImpl->FindData );
if ( fFound )
diff --git a/sal/osl/w32/pipe.cxx b/sal/osl/w32/pipe.cxx
index f02a8951f3cb..7c3471888527 100644
--- a/sal/osl/w32/pipe.cxx
+++ b/sal/osl/w32/pipe.cxx
@@ -292,7 +292,7 @@ oslPipe SAL_CALL osl_acceptPipe(oslPipe pPipe)
{
oslPipe pAcceptedPipe = nullptr;
- OVERLAPPED os;
+ OVERLAPPED os = {};
DWORD nBytesTransfered;
rtl_uString* path = nullptr;
@@ -304,7 +304,6 @@ oslPipe SAL_CALL osl_acceptPipe(oslPipe pPipe)
SAL_WARN_IF(pPipe->m_File == INVALID_HANDLE_VALUE, "sal.osl.pipe", "osl_acceptPipe: invalid handle");
- memset(&os, 0, sizeof(OVERLAPPED));
os.hEvent = pPipe->m_AcceptEvent;
ResetEvent(pPipe->m_AcceptEvent);
@@ -372,11 +371,10 @@ sal_Int32 SAL_CALL osl_receivePipe(oslPipe pPipe,
sal_Int32 BytesToRead)
{
DWORD nBytes;
- OVERLAPPED os;
+ OVERLAPPED os = {};
assert(pPipe);
- memset(&os, 0, sizeof(OVERLAPPED));
os.hEvent = pPipe->m_ReadEvent;
ResetEvent(pPipe->m_ReadEvent);
@@ -410,11 +408,10 @@ sal_Int32 SAL_CALL osl_sendPipe(oslPipe pPipe,
sal_Int32 BytesToSend)
{
DWORD nBytes;
- OVERLAPPED os;
+ OVERLAPPED os = {};
assert(pPipe);
- memset(&os, 0, sizeof(OVERLAPPED));
os.hEvent = pPipe->m_WriteEvent;
ResetEvent(pPipe->m_WriteEvent);
diff --git a/sal/osl/w32/procimpl.cxx b/sal/osl/w32/procimpl.cxx
index d01b060e31c4..fa490a7c29bf 100644
--- a/sal/osl/w32/procimpl.cxx
+++ b/sal/osl/w32/procimpl.cxx
@@ -468,9 +468,7 @@ oslProcessError SAL_CALL osl_executeProcess_WithRedirectedIO(
if ((Options & osl_Process_DETACHED) && !(flags & CREATE_NEW_CONSOLE))
flags |= DETACHED_PROCESS;
- STARTUPINFOW startup_info;
- memset(&startup_info, 0, sizeof(startup_info));
-
+ STARTUPINFOW startup_info = {};
startup_info.cb = sizeof(startup_info);
startup_info.dwFlags = STARTF_USESHOWWINDOW;
startup_info.lpDesktop = const_cast<LPWSTR>(L"");
diff --git a/sal/osl/w32/profile.cxx b/sal/osl/w32/profile.cxx
index 90db6d437a16..55b7ea0d7c06 100644
--- a/sal/osl/w32/profile.cxx
+++ b/sal/osl/w32/profile.cxx
@@ -1036,13 +1036,11 @@ static osl_TStamp getFileStamp(osl_TFile* pFile)
static bool lockFile(const osl_TFile* pFile, osl_TLockMode eMode)
{
bool status = false;
- OVERLAPPED Overlapped;
+ OVERLAPPED Overlapped = {};
if (pFile->m_Handle == INVALID_HANDLE_VALUE)
return false;
- memset(&Overlapped, 0, sizeof(Overlapped));
-
switch (eMode)
{
case un_lock: