summaryrefslogtreecommitdiff
path: root/sd
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 /sd
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 'sd')
-rw-r--r--sd/source/ui/remotecontrol/BluetoothServer.cxx6
-rw-r--r--sd/source/ui/remotecontrol/DiscoveryService.cxx6
2 files changed, 4 insertions, 8 deletions
diff --git a/sd/source/ui/remotecontrol/BluetoothServer.cxx b/sd/source/ui/remotecontrol/BluetoothServer.cxx
index 4f684df3bd4c..12f94aee3c95 100644
--- a/sd/source/ui/remotecontrol/BluetoothServer.cxx
+++ b/sd/source/ui/remotecontrol/BluetoothServer.cxx
@@ -1329,8 +1329,7 @@ void SAL_CALL BluetoothServer::run()
int aNameSize = sizeof(aName);
getsockname( aSocket, reinterpret_cast<SOCKADDR*>(&aName), &aNameSize ); // Retrieve the local address and port
- CSADDR_INFO aAddrInfo;
- memset( &aAddrInfo, 0, sizeof(aAddrInfo) );
+ CSADDR_INFO aAddrInfo = {};
aAddrInfo.LocalAddr.lpSockaddr = reinterpret_cast<SOCKADDR*>(&aName);
aAddrInfo.LocalAddr.iSockaddrLength = sizeof( SOCKADDR_BTH );
aAddrInfo.iSocketType = SOCK_STREAM;
@@ -1345,8 +1344,7 @@ void SAL_CALL BluetoothServer::run()
// ULONGLONG aData4 = 0x800000805F9B34FB;
// memcpy( uuid.Data4, &aData4, sizeof(uuid.Data4) );
- WSAQUERYSETW aRecord;
- memset( &aRecord, 0, sizeof(aRecord));
+ WSAQUERYSETW aRecord = {};
aRecord.dwSize = sizeof(aRecord);
aRecord.lpszServiceInstanceName = const_cast<wchar_t *>(
L"LibreOffice Impress Remote Control");
diff --git a/sd/source/ui/remotecontrol/DiscoveryService.cxx b/sd/source/ui/remotecontrol/DiscoveryService.cxx
index 275e23556737..90f88a6c5374 100644
--- a/sd/source/ui/remotecontrol/DiscoveryService.cxx
+++ b/sd/source/ui/remotecontrol/DiscoveryService.cxx
@@ -104,8 +104,7 @@ void DiscoveryService::setupSockets()
return; // would be better to throw, but unsure if caller handles that
}
- sockaddr_in aAddr;
- memset(&aAddr, 0, sizeof(aAddr));
+ sockaddr_in aAddr = {};
aAddr.sin_family = AF_INET;
aAddr.sin_addr.s_addr = htonl(INADDR_ANY);
aAddr.sin_port = htons( PORT_DISCOVERY );
@@ -155,10 +154,9 @@ void SAL_CALL DiscoveryService::run()
setupSockets();
// Kept for backward compatibility
- char aBuffer[BUFFER_SIZE];
while ( true )
{
- memset( aBuffer, 0, sizeof(char) * BUFFER_SIZE );
+ char aBuffer[BUFFER_SIZE] = {};
sockaddr_in aAddr;
socklen_t aLen = sizeof( aAddr );
if(recvfrom( mSocket, aBuffer, BUFFER_SIZE, 0, reinterpret_cast<sockaddr*>(&aAddr), &aLen ) > 0)