Replace NULL by nullptr in all C++ files
authorStephan Beyer <s-beyer@gmx.net>
Thu, 4 Jun 2020 22:51:32 +0000 (00:51 +0200)
committerKevin Ottens <ervin@ipsquad.net>
Mon, 8 Jun 2020 18:07:50 +0000 (20:07 +0200)
We keep NULL in the pure C files in src/csync/std and test/csync.

We also replace Doxygen documentation referring to "NULL" to
"\c nullptr" (formatted as code).

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
36 files changed:
shell_integration/windows/OCContextMenu/OCContextMenu.cpp
shell_integration/windows/OCContextMenu/OCContextMenuFactory.cpp
shell_integration/windows/OCContextMenu/OCContextMenuRegHandler.cpp
shell_integration/windows/OCContextMenu/RegDelnode.h
shell_integration/windows/OCContextMenu/dllmain.cpp
shell_integration/windows/OCOverlays/DllMain.cpp
shell_integration/windows/OCOverlays/OCOverlay.cpp
shell_integration/windows/OCOverlays/OCOverlayFactory.cpp
shell_integration/windows/OCOverlays/OCOverlayRegistrationHandler.cpp
shell_integration/windows/OCUtil/CommunicationSocket.cpp
shell_integration/windows/OCUtil/RegistryUtil.cpp
shell_integration/windows/OCUtil/RemotePathChecker.cpp
src/3rdparty/qtlockedfile/qtlockedfile_win.cpp
src/common/filesystembase.cpp
src/common/filesystembase.h
src/common/utility.cpp
src/common/utility_mac.cpp
src/common/utility_win.cpp
src/csync/csync.h
src/csync/csync_reconcile.cpp
src/csync/csync_update.cpp
src/csync/std/c_utf8.cpp
src/csync/std/c_utf8.h
src/csync/vio/csync_vio_local_win.cpp
src/gui/cloudproviders/cloudproviderwrapper.cpp
src/gui/folderman.h
src/gui/folderwatcher_mac.cpp
src/gui/folderwatcher_win.cpp
test/csync/csync_tests/check_csync_exclude.cpp
test/csync/csync_tests/check_csync_misc.cpp
test/csync/csync_tests/check_csync_update.cpp
test/csync/csync_tests/check_csync_util.cpp
test/csync/encoding_tests/check_encoding.cpp
test/csync/vio_tests/check_vio.cpp
test/csync/vio_tests/check_vio_ext.cpp
test/testnextcloudpropagator.cpp

index 9e9052211e52cd4d08cbcf62c4b475cedfd21419..a5cab4ff1c1ce09b3e22eae4f5bb2dc04d03871b 100644 (file)
@@ -81,14 +81,14 @@ IFACEMETHODIMP OCContextMenu::Initialize(
         return E_INVALIDARG;
     }
 
-    FORMATETC fe = { CF_HDROP, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
+    FORMATETC fe = { CF_HDROP, nullptr, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
     STGMEDIUM stm;
 
     if (SUCCEEDED(pDataObj->GetData(&fe, &stm))) {
         // Get an HDROP handle.
         HDROP hDrop = static_cast<HDROP>(GlobalLock(stm.hGlobal));
         if (hDrop) {
-            UINT nFiles = DragQueryFile(hDrop, 0xFFFFFFFF, NULL, 0);
+            UINT nFiles = DragQueryFile(hDrop, 0xFFFFFFFF, nullptr, 0);
             for (UINT i = 0; i < nFiles; ++i) {
                 // Get the path of the file.
                 wchar_t buffer[MAX_PATH];
index 006a0091a32487faed790b8b9f62067379753927..13eb904a9b2c47b460aa087246f2732f7f186dfa 100644 (file)
@@ -65,7 +65,7 @@ IFACEMETHODIMP OCContextMenuFactory::CreateInstance(IUnknown *pUnkOuter, REFIID
     HRESULT hr = CLASS_E_NOAGGREGATION;
 
     // pUnkOuter is used for aggregation. We do not support it in the sample.
-    if (pUnkOuter == NULL) {
+    if (pUnkOuter == nullptr) {
         hr = E_OUTOFMEMORY;
 
         // Create the COM component.
@@ -88,4 +88,4 @@ IFACEMETHODIMP OCContextMenuFactory::LockServer(BOOL fLock)
         InterlockedDecrement(&g_cDllRef);
     }
     return S_OK;
-}
\ No newline at end of file
+}
index 1bbfc66054b237fa7d2e77d4c2c8d14fbf3c560c..6c04734da13124cb697a4084870cbe406b9492a9 100644 (file)
@@ -24,16 +24,16 @@ namespace {
 HRESULT SetHKCRRegistryKeyAndValue(PCWSTR pszSubKey, PCWSTR pszValueName, PCWSTR pszData)
 {
     HRESULT hr;
-    HKEY hKey = NULL;
+    HKEY hKey = nullptr;
 
     // Creates the specified registry key. If the key already exists, the 
     // function opens it. 
     hr = HRESULT_FROM_WIN32(RegCreateKeyEx(HKEY_CLASSES_ROOT, pszSubKey, 0,
-        NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hKey, NULL));
+        nullptr, REG_OPTION_NON_VOLATILE, KEY_WRITE, nullptr, &hKey, nullptr));
 
     if (SUCCEEDED(hr))
     {
-        if (pszData != NULL)
+        if (pszData != nullptr)
         {
             // Set the specified value of the key.
             DWORD cbData = lstrlen(pszData) * sizeof(*pszData);
@@ -50,7 +50,7 @@ HRESULT SetHKCRRegistryKeyAndValue(PCWSTR pszSubKey, PCWSTR pszValueName, PCWSTR
 HRESULT GetHKCRRegistryKeyAndValue(PCWSTR pszSubKey, PCWSTR pszValueName, PWSTR pszData, DWORD cbData)
 {
     HRESULT hr;
-    HKEY hKey = NULL;
+    HKEY hKey = nullptr;
 
     // Try to open the specified registry key. 
     hr = HRESULT_FROM_WIN32(RegOpenKeyEx(HKEY_CLASSES_ROOT, pszSubKey, 0,
@@ -59,8 +59,8 @@ HRESULT GetHKCRRegistryKeyAndValue(PCWSTR pszSubKey, PCWSTR pszValueName, PWSTR
     if (SUCCEEDED(hr))
     {
         // Get the data for the specified value name.
-        hr = HRESULT_FROM_WIN32(RegQueryValueEx(hKey, pszValueName, NULL,
-            NULL, reinterpret_cast<LPBYTE>(pszData), &cbData));
+        hr = HRESULT_FROM_WIN32(RegQueryValueEx(hKey, pszValueName, nullptr,
+            nullptr, reinterpret_cast<LPBYTE>(pszData), &cbData));
 
         RegCloseKey(hKey);
     }
@@ -72,7 +72,7 @@ HRESULT GetHKCRRegistryKeyAndValue(PCWSTR pszSubKey, PCWSTR pszValueName, PWSTR
 
 HRESULT OCContextMenuRegHandler::RegisterInprocServer(PCWSTR pszModule, const CLSID& clsid, PCWSTR pszFriendlyName, PCWSTR pszThreadModel)
 {
-    if (pszModule == NULL || pszThreadModel == NULL)
+    if (pszModule == nullptr || pszThreadModel == nullptr)
     {
         return E_INVALIDARG;
     }
@@ -88,7 +88,7 @@ HRESULT OCContextMenuRegHandler::RegisterInprocServer(PCWSTR pszModule, const CL
     hr = StringCchPrintf(szSubkey, ARRAYSIZE(szSubkey), L"CLSID\\%s", szCLSID);
     if (SUCCEEDED(hr))
     {
-        hr = SetHKCRRegistryKeyAndValue(szSubkey, NULL, pszFriendlyName);
+        hr = SetHKCRRegistryKeyAndValue(szSubkey, nullptr, pszFriendlyName);
 
         // Create the HKCR\CLSID\{<CLSID>}\InprocServer32 key.
         if (SUCCEEDED(hr))
@@ -99,7 +99,7 @@ HRESULT OCContextMenuRegHandler::RegisterInprocServer(PCWSTR pszModule, const CL
             {
                 // Set the default value of the InprocServer32 key to the 
                 // path of the COM module.
-                hr = SetHKCRRegistryKeyAndValue(szSubkey, NULL, pszModule);
+                hr = SetHKCRRegistryKeyAndValue(szSubkey, nullptr, pszModule);
                 if (SUCCEEDED(hr))
                 {
                     // Set the threading model of the component.
@@ -136,7 +136,7 @@ HRESULT OCContextMenuRegHandler::UnregisterInprocServer(const CLSID& clsid)
 HRESULT OCContextMenuRegHandler::RegisterShellExtContextMenuHandler(
     PCWSTR pszFileType, const CLSID& clsid, PCWSTR pszFriendlyName)
 {
-    if (pszFileType == NULL)
+    if (pszFileType == nullptr)
     {
         return E_INVALIDARG;
     }
@@ -154,7 +154,7 @@ HRESULT OCContextMenuRegHandler::RegisterShellExtContextMenuHandler(
     if (*pszFileType == L'.')
     {
         wchar_t szDefaultVal[260];
-        hr = GetHKCRRegistryKeyAndValue(pszFileType, NULL, szDefaultVal,
+        hr = GetHKCRRegistryKeyAndValue(pszFileType, nullptr, szDefaultVal,
             sizeof(szDefaultVal));
 
         // If the key exists and its default value is not empty, use the 
@@ -171,7 +171,7 @@ HRESULT OCContextMenuRegHandler::RegisterShellExtContextMenuHandler(
     if (SUCCEEDED(hr))
     {
         // Set the default value of the key.
-        hr = SetHKCRRegistryKeyAndValue(szSubkey, NULL, szCLSID);
+        hr = SetHKCRRegistryKeyAndValue(szSubkey, nullptr, szCLSID);
     }
 
     return hr;
@@ -180,7 +180,7 @@ HRESULT OCContextMenuRegHandler::RegisterShellExtContextMenuHandler(
 HRESULT OCContextMenuRegHandler::UnregisterShellExtContextMenuHandler(
     PCWSTR pszFileType, PCWSTR pszFriendlyName)
 {
-    if (pszFileType == NULL)
+    if (pszFileType == nullptr)
     {
         return E_INVALIDARG;
     }
@@ -195,7 +195,7 @@ HRESULT OCContextMenuRegHandler::UnregisterShellExtContextMenuHandler(
     if (*pszFileType == L'.')
     {
         wchar_t szDefaultVal[260];
-        hr = GetHKCRRegistryKeyAndValue(pszFileType, NULL, szDefaultVal,
+        hr = GetHKCRRegistryKeyAndValue(pszFileType, nullptr, szDefaultVal,
             sizeof(szDefaultVal));
 
         // If the key exists and its default value is not empty, use the 
@@ -215,4 +215,4 @@ HRESULT OCContextMenuRegHandler::UnregisterShellExtContextMenuHandler(
     }
 
     return hr;
-}
\ No newline at end of file
+}
index 633745b6294bc43229d39eebfc887f0897ea802c..f79d1dcca47df68b5468bb8d06bf32c123fc3c27 100644 (file)
@@ -58,8 +58,8 @@ HRESULT RegDelnodeRecurse(HKEY hKeyRoot, LPTSTR lpSubKey)
        // Enumerate the keys
 
        dwSize = MAX_PATH;
-       lResult = RegEnumKeyEx(hKey, 0, szName, &dwSize, NULL,
-               NULL, NULL, &ftWrite);
+       lResult = RegEnumKeyEx(hKey, 0, szName, &dwSize, nullptr,
+               nullptr, nullptr, &ftWrite);
 
        if (lResult == ERROR_SUCCESS)
        {
@@ -73,8 +73,8 @@ HRESULT RegDelnodeRecurse(HKEY hKeyRoot, LPTSTR lpSubKey)
 
                        dwSize = MAX_PATH;
 
-                       lResult = RegEnumKeyEx(hKey, 0, szName, &dwSize, NULL,
-                               NULL, NULL, &ftWrite);
+                       lResult = RegEnumKeyEx(hKey, 0, szName, &dwSize, nullptr,
+                               nullptr, nullptr, &ftWrite);
 
                } while (lResult == ERROR_SUCCESS);
        }
index 088dea7670c507a977386421ec33097da4ea30e7..8cd31fea40b14a9b588ac7f4cf2ba666234a2749 100644 (file)
@@ -22,7 +22,7 @@
 // {841A0AAD-AA11-4B50-84D9-7F8E727D77D7}
 static const GUID CLSID_FileContextMenuExt = { 0x841a0aad, 0xaa11, 0x4b50, { 0x84, 0xd9, 0x7f, 0x8e, 0x72, 0x7d, 0x77, 0xd7 } };
 
-HINSTANCE   g_hInst = NULL;
+HINSTANCE   g_hInst = nullptr;
 long        g_cDllRef = 0;
 
 BOOL APIENTRY DllMain(HMODULE hModule, DWORD dwReason, LPVOID lpReserved)
@@ -105,4 +105,4 @@ STDAPI DllUnregisterServer(void)
        }
 
        return hr;
-}
\ No newline at end of file
+}
index 02166f59129431f4648a4a65d490568d46c9b612..00195b6e51e852b13fa4c89a5d7c49a837b95a3f 100644 (file)
@@ -17,7 +17,7 @@
 #include "OCOverlayRegistrationHandler.h"
 #include "OCOverlayFactory.h"
 
-HINSTANCE instanceHandle = NULL;
+HINSTANCE instanceHandle = nullptr;
 
 long dllReferenceCount = 0;
 
index dd03a8664df5db37017093d802210a2f4a8778c2..f7ff64f5b3d1762f18a75c12093ff93977215d70 100644 (file)
@@ -82,7 +82,7 @@ IFACEMETHODIMP OCOverlay::QueryInterface(REFIID riid, void **ppv)
     else
     {
         hr = E_NOINTERFACE;
-        *ppv = NULL;
+        *ppv = nullptr;
     }
 
     if (*ppv)
index 1a317dae144e885780860dcbd165f27d84fb2e3e..34b22f5396f81b8a98859040fa71c26bfceac086 100644 (file)
@@ -43,7 +43,7 @@ IFACEMETHODIMP OCOverlayFactory::QueryInterface(REFIID riid, void **ppv)
     else
     {
         hResult = E_NOINTERFACE;
-        *ppv = NULL;
+        *ppv = nullptr;
     }
 
     return hResult;
@@ -70,7 +70,7 @@ IFACEMETHODIMP OCOverlayFactory::CreateInstance(
 {
     HRESULT hResult = CLASS_E_NOAGGREGATION;
 
-    if (pUnkOuter != NULL) { return hResult; }
+    if (pUnkOuter != nullptr) { return hResult; }
 
     hResult = E_OUTOFMEMORY;
     OCOverlay *lrOverlay = new (std::nothrow) OCOverlay(_state);
@@ -90,4 +90,4 @@ IFACEMETHODIMP OCOverlayFactory::LockServer(BOOL fLock)
         InterlockedDecrement(&dllReferenceCount);
     }
     return S_OK;
-}
\ No newline at end of file
+}
index 0ef83b84c5f3170cff4bb3bbf7086e883aea57d9..b10d646719130046e3b2ed794da74916d1f9e5fd 100644 (file)
@@ -24,9 +24,9 @@ using namespace std;
 HRESULT OCOverlayRegistrationHandler::MakeRegistryEntries(const CLSID& clsid, PCWSTR friendlyName)
 {
     HRESULT hResult;
-    HKEY shellOverlayKey = NULL;
+    HKEY shellOverlayKey = nullptr;
     // the key may not exist yet
-    hResult = HRESULT_FROM_WIN32(RegCreateKeyEx(HKEY_LOCAL_MACHINE, REGISTRY_OVERLAY_KEY, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &shellOverlayKey, NULL));
+    hResult = HRESULT_FROM_WIN32(RegCreateKeyEx(HKEY_LOCAL_MACHINE, REGISTRY_OVERLAY_KEY, 0, nullptr, REG_OPTION_NON_VOLATILE, KEY_WRITE, nullptr, &shellOverlayKey, nullptr));
     if (!SUCCEEDED(hResult)) {
         hResult = RegCreateKey(HKEY_LOCAL_MACHINE, REGISTRY_OVERLAY_KEY, &shellOverlayKey);
         if(!SUCCEEDED(hResult)) {
@@ -34,8 +34,8 @@ HRESULT OCOverlayRegistrationHandler::MakeRegistryEntries(const CLSID& clsid, PC
         }
     }
 
-    HKEY syncExOverlayKey = NULL;
-    hResult = HRESULT_FROM_WIN32(RegCreateKeyEx(shellOverlayKey, friendlyName, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &syncExOverlayKey, NULL));
+    HKEY syncExOverlayKey = nullptr;
+    hResult = HRESULT_FROM_WIN32(RegCreateKeyEx(shellOverlayKey, friendlyName, 0, nullptr, REG_OPTION_NON_VOLATILE, KEY_WRITE, nullptr, &syncExOverlayKey, nullptr));
 
     if (!SUCCEEDED(hResult)) {
         return hResult;
@@ -44,7 +44,7 @@ HRESULT OCOverlayRegistrationHandler::MakeRegistryEntries(const CLSID& clsid, PC
     wchar_t stringCLSID[MAX_PATH];
     StringFromGUID2(clsid, stringCLSID, ARRAYSIZE(stringCLSID));
     LPCTSTR value = stringCLSID;
-    hResult = RegSetValueEx(syncExOverlayKey, NULL, 0, REG_SZ, (LPBYTE)value, (DWORD)((wcslen(value)+1) * sizeof(TCHAR)));
+    hResult = RegSetValueEx(syncExOverlayKey, nullptr, 0, REG_SZ, (LPBYTE)value, (DWORD)((wcslen(value)+1) * sizeof(TCHAR)));
     if (!SUCCEEDED(hResult)) {
         return hResult;
     }
@@ -55,14 +55,14 @@ HRESULT OCOverlayRegistrationHandler::MakeRegistryEntries(const CLSID& clsid, PC
 HRESULT OCOverlayRegistrationHandler::RemoveRegistryEntries(PCWSTR friendlyName)
 {
     HRESULT hResult;
-    HKEY shellOverlayKey = NULL;
+    HKEY shellOverlayKey = nullptr;
     hResult = HRESULT_FROM_WIN32(RegOpenKeyEx(HKEY_LOCAL_MACHINE, REGISTRY_OVERLAY_KEY, 0, KEY_WRITE, &shellOverlayKey));
 
     if (!SUCCEEDED(hResult)) {
         return hResult;
     }
 
-    HKEY syncExOverlayKey = NULL;
+    HKEY syncExOverlayKey = nullptr;
     hResult = HRESULT_FROM_WIN32(RegDeleteKey(shellOverlayKey, friendlyName));
     if (!SUCCEEDED(hResult)) {
         return hResult;
@@ -73,35 +73,35 @@ HRESULT OCOverlayRegistrationHandler::RemoveRegistryEntries(PCWSTR friendlyName)
 
 HRESULT OCOverlayRegistrationHandler::RegisterCOMObject(PCWSTR modulePath, PCWSTR friendlyName, const CLSID& clsid)
 {
-    if (modulePath == NULL) {
+    if (modulePath == nullptr) {
         return E_FAIL;
     }
 
     wchar_t stringCLSID[MAX_PATH];
     StringFromGUID2(clsid, stringCLSID, ARRAYSIZE(stringCLSID));
     HRESULT hResult;
-    HKEY hKey = NULL;
+    HKEY hKey = nullptr;
 
     hResult = HRESULT_FROM_WIN32(RegOpenKeyEx(HKEY_CLASSES_ROOT, REGISTRY_CLSID, 0, KEY_WRITE, &hKey));
     if (!SUCCEEDED(hResult)) {
         return hResult;
     }
 
-    HKEY clsidKey = NULL;
-    hResult = HRESULT_FROM_WIN32(RegCreateKeyEx(hKey, stringCLSID, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &clsidKey, NULL));
+    HKEY clsidKey = nullptr;
+    hResult = HRESULT_FROM_WIN32(RegCreateKeyEx(hKey, stringCLSID, 0, nullptr, REG_OPTION_NON_VOLATILE, KEY_WRITE, nullptr, &clsidKey, nullptr));
     if(!SUCCEEDED(hResult)) {
         return hResult;
     }
 
-    hResult = HRESULT_FROM_WIN32(RegSetValue(clsidKey, NULL, REG_SZ, friendlyName, (DWORD) wcslen(friendlyName)));
+    hResult = HRESULT_FROM_WIN32(RegSetValue(clsidKey, nullptr, REG_SZ, friendlyName, (DWORD) wcslen(friendlyName)));
 
-    HKEY inprocessKey = NULL;
-    hResult = HRESULT_FROM_WIN32(RegCreateKeyEx(clsidKey, REGISTRY_IN_PROCESS, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &inprocessKey, NULL));
+    HKEY inprocessKey = nullptr;
+    hResult = HRESULT_FROM_WIN32(RegCreateKeyEx(clsidKey, REGISTRY_IN_PROCESS, 0, nullptr, REG_OPTION_NON_VOLATILE, KEY_WRITE, nullptr, &inprocessKey, nullptr));
     if(!SUCCEEDED(hResult)) {
         return hResult;
     }
 
-    hResult = HRESULT_FROM_WIN32(RegSetValue(inprocessKey, NULL, REG_SZ, modulePath, (DWORD) wcslen(modulePath)));
+    hResult = HRESULT_FROM_WIN32(RegSetValue(inprocessKey, nullptr, REG_SZ, modulePath, (DWORD) wcslen(modulePath)));
 
     if(!SUCCEEDED(hResult)) {
         return hResult;
@@ -126,13 +126,13 @@ HRESULT OCOverlayRegistrationHandler::UnregisterCOMObject(const CLSID& clsid)
 
     StringFromGUID2(clsid, stringCLSID, ARRAYSIZE(stringCLSID));
     HRESULT hResult;
-    HKEY hKey = NULL;
+    HKEY hKey = nullptr;
     hResult = HRESULT_FROM_WIN32(RegOpenKeyEx(HKEY_CLASSES_ROOT, REGISTRY_CLSID, 0, DELETE, &hKey));
     if (!SUCCEEDED(hResult)) {
         return hResult;
     }
 
-    HKEY clsidKey = NULL;
+    HKEY clsidKey = nullptr;
     hResult = HRESULT_FROM_WIN32(RegOpenKeyEx(hKey, stringCLSID, 0, DELETE, &clsidKey));
     if(!SUCCEEDED(hResult)) {
         return hResult;
@@ -149,4 +149,4 @@ HRESULT OCOverlayRegistrationHandler::UnregisterCOMObject(const CLSID& clsid)
     }
 
     return S_OK;
-}
\ No newline at end of file
+}
index b7dd64c32cd4a82ce29abf300979bbe64b51929a..f24b30ba60bd4cd5803d1c3c5debc37dd52f721b 100644 (file)
@@ -73,7 +73,7 @@ bool CommunicationSocket::Close()
 
 bool CommunicationSocket::Connect(const std::wstring &pipename)
 {
-    _pipe = CreateFile(pipename.data(), GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
+    _pipe = CreateFile(pipename.data(), GENERIC_READ | GENERIC_WRITE, 0, nullptr, OPEN_EXISTING, 0, nullptr);
 
     if (_pipe == INVALID_HANDLE_VALUE) {
         return false;
@@ -87,7 +87,7 @@ bool CommunicationSocket::SendMsg(const wchar_t* message) const
     auto utf8_msg = StringUtil::toUtf8(message);
 
     DWORD numBytesWritten = 0;
-    auto result = WriteFile( _pipe, utf8_msg.c_str(), DWORD(utf8_msg.size()), &numBytesWritten, NULL);
+    auto result = WriteFile( _pipe, utf8_msg.c_str(), DWORD(utf8_msg.size()), &numBytesWritten, nullptr);
 
     if (result) {
         return true;
@@ -123,7 +123,7 @@ bool CommunicationSocket::ReadLine(wstring* response)
         DWORD numBytesRead = 0;
         DWORD totalBytesAvailable = 0;
 
-        if (!PeekNamedPipe(_pipe, NULL, 0, 0, &totalBytesAvailable, 0)) {
+        if (!PeekNamedPipe(_pipe, nullptr, 0, 0, &totalBytesAvailable, 0)) {
             Close();
             return false;
         }
@@ -131,7 +131,7 @@ bool CommunicationSocket::ReadLine(wstring* response)
             return false;
         }
 
-        if (!ReadFile(_pipe, resp_utf8.data(), DWORD(resp_utf8.size()), &numBytesRead, NULL)) {
+        if (!ReadFile(_pipe, resp_utf8.data(), DWORD(resp_utf8.size()), &numBytesRead, nullptr)) {
             Close();
             return false;
         }
index 5542ac4d694b4d58c5a4b4a0d81287527129d65e..fc8b125dc350797e0f8910dc01d7f21f78430815 100644 (file)
@@ -38,9 +38,9 @@ bool RegistryUtil::ReadRegistry(const wchar_t* key, const wchar_t* name, wstring
 {
     HRESULT hResult;
 
-    HKEY rootKey = NULL;
+    HKEY rootKey = nullptr;
 
-    hResult = HRESULT_FROM_WIN32(RegOpenKeyEx(HKEY_CURRENT_USER, (LPCWSTR)key, NULL, KEY_READ, &rootKey));
+    hResult = HRESULT_FROM_WIN32(RegOpenKeyEx(HKEY_CURRENT_USER, (LPCWSTR)key, nullptr, KEY_READ, &rootKey));
 
     if(!SUCCEEDED(hResult))
     {
@@ -49,8 +49,8 @@ bool RegistryUtil::ReadRegistry(const wchar_t* key, const wchar_t* name, wstring
 
     wchar_t value[SIZE];
     DWORD value_length = SIZE;
-    
-    hResult = RegQueryValueEx(rootKey, (LPCWSTR)name, NULL, NULL, (LPBYTE)value, &value_length );
+
+    hResult = RegQueryValueEx(rootKey, (LPCWSTR)name, nullptr, nullptr, (LPBYTE)value, &value_length );
 
     if(!SUCCEEDED(hResult))
     {
index 37caee18240bf4ef62295cd19cc0b3c62a94abe5..99b46d3bacfea2cdd3f5174c09ab4eae0ba6303c 100644 (file)
@@ -83,7 +83,7 @@ void RemotePathChecker::workerThreadLoop()
                 // We don't keep track of all files and can't know which file is currently visible
                 // to the user, but at least reload the root dir so that any shortcut to the root
                 // is updated without the user needing to refresh.
-                SHChangeNotify(SHCNE_UPDATEDIR, SHCNF_PATH | SHCNF_FLUSHNOWAIT, responsePath.data(), NULL);
+                SHChangeNotify(SHCNE_UPDATEDIR, SHCNF_PATH | SHCNF_FLUSHNOWAIT, responsePath.data(), nullptr);
             } else if (StringUtil::begins_with(response, wstring(L"UNREGISTER_PATH:"))) {
                 wstring responsePath = response.substr(16); // length of UNREGISTER_PATH:
 
@@ -107,7 +107,7 @@ void RemotePathChecker::workerThreadLoop()
                     }
                 }
                 for (auto& path : removedPaths)
-                    SHChangeNotify(SHCNE_UPDATEITEM, SHCNF_PATH | SHCNF_FLUSHNOWAIT, path.data(), NULL);
+                    SHChangeNotify(SHCNE_UPDATEITEM, SHCNF_PATH | SHCNF_FLUSHNOWAIT, path.data(), nullptr);
             } else if (StringUtil::begins_with(response, wstring(L"STATUS:")) ||
                     StringUtil::begins_with(response, wstring(L"BROADCAST:"))) {
 
@@ -135,7 +135,7 @@ void RemotePathChecker::workerThreadLoop()
                     it->second = state;
                 }
                 if (updateView) {
-                    SHChangeNotify(SHCNE_UPDATEITEM, SHCNF_PATH | SHCNF_FLUSHNOWAIT, responsePath.data(), NULL);
+                    SHChangeNotify(SHCNE_UPDATEITEM, SHCNF_PATH | SHCNF_FLUSHNOWAIT, responsePath.data(), nullptr);
                 }
             }
         }
@@ -151,7 +151,7 @@ void RemotePathChecker::workerThreadLoop()
             lock.unlock();
             // Let explorer know about each invalidated cache entry that needs to get its icon removed.
             for (auto it = cache.begin(); it != cache.end(); ++it) {
-                SHChangeNotify(SHCNE_UPDATEITEM, SHCNF_PATH | SHCNF_FLUSHNOWAIT, it->first.data(), NULL);
+                SHChangeNotify(SHCNE_UPDATEITEM, SHCNF_PATH | SHCNF_FLUSHNOWAIT, it->first.data(), nullptr);
             }
         }
 
@@ -168,7 +168,7 @@ RemotePathChecker::RemotePathChecker()
     : _stop(false)
     , _watchedDirectories(make_shared<const vector<wstring>>())
     , _connected(false)
-    , _newQueries(CreateEvent(NULL, FALSE, FALSE, NULL))
+    , _newQueries(CreateEvent(nullptr, FALSE, FALSE, nullptr))
     , _thread([this]{ this->workerThreadLoop(); })
 {
 }
index ae6286fce6c9768fa88d5097a086c8075304a1ad..d7d855bbf9b51df8141c9c8414f4fb90428484f8 100644 (file)
@@ -94,7 +94,7 @@ bool QtLockedFile::lock(LockMode mode, bool block)
             QString mut_name = QString::fromLatin1(MUTEX_PREFIX)
                                + fi.absoluteFilePath().toLower();
 
-            m_mutex_hnd = CreateMutexW(NULL, FALSE, (TCHAR*)mut_name.utf16());
+            m_mutex_hnd = CreateMutexW(nullptr, FALSE, (TCHAR*)mut_name.utf16());
 
             if (m_mutex_hnd == 0) {
                 qWarning("QtLockedFile::lock(): CreateMutex: %s",
@@ -118,7 +118,7 @@ bool QtLockedFile::lock(LockMode mode, bool block)
         if (res == WAIT_TIMEOUT) {
             if (i) {
                 // A failed nonblocking rw locking. Undo changes to semaphore.
-                if (ReleaseSemaphore(m_semaphore_hnd, i, NULL) == 0) {
+                if (ReleaseSemaphore(m_semaphore_hnd, i, nullptr) == 0) {
                     qWarning("QtLockedFile::unlock(): ReleaseSemaphore: %s",
                              errorCodeToString(GetLastError()).toLatin1().constData());
                     // Fall through
index 9a7401cda5b803c6dc8e00df94b0dbf064ae41e2..464c2edc69bd9bbfb61f65e84f38d9b7773a5a29 100644 (file)
@@ -147,8 +147,8 @@ bool FileSystem::rename(const QString &originFileName,
         if (!success) {
             wchar_t *string = 0;
             FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
-                NULL, ::GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
-                (LPWSTR)&string, 0, NULL);
+                nullptr, ::GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+                (LPWSTR)&string, 0, nullptr);
 
             error = QString::fromWCharArray(string);
             LocalFree((HLOCAL)string);
@@ -216,8 +216,8 @@ bool FileSystem::uncheckedRenameReplace(const QString &originFileName,
     if (!ok) {
         wchar_t *string = 0;
         FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
-            NULL, ::GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
-            (LPWSTR)&string, 0, NULL);
+            nullptr, ::GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+            (LPWSTR)&string, 0, nullptr);
 
         *errorString = QString::fromWCharArray(string);
         qCWarning(lcFileSystem) << "Renaming temp file to final failed: " << *errorString;
@@ -248,7 +248,7 @@ bool FileSystem::openAndSeekFileSharedRead(QFile *file, QString *errorOrNull, qi
     DWORD creationDisp = OPEN_EXISTING;
 
     // Create the file handle.
-    SECURITY_ATTRIBUTES securityAtts = { sizeof(SECURITY_ATTRIBUTES), NULL, FALSE };
+    SECURITY_ATTRIBUTES securityAtts = { sizeof(SECURITY_ATTRIBUTES), nullptr, FALSE };
     QString fName = longWinPath(file->fileName());
 
     HANDLE fileHandle = CreateFileW(
@@ -258,7 +258,7 @@ bool FileSystem::openAndSeekFileSharedRead(QFile *file, QString *errorOrNull, qi
         &securityAtts,
         creationDisp,
         FILE_ATTRIBUTE_NORMAL,
-        NULL);
+        nullptr);
 
     // Bail out on error.
     if (fileHandle == INVALID_HANDLE_VALUE) {
@@ -352,8 +352,8 @@ QString FileSystem::fileSystemForPath(const QString &path)
 
     if (!GetVolumeInformationW(
             reinterpret_cast<LPCWSTR>(drive.utf16()),
-            NULL, 0,
-            NULL, NULL, NULL,
+            nullptr, 0,
+            nullptr, nullptr, nullptr,
             fileSystemBuffer, fileSystemBufferSize)) {
         return QString();
     }
@@ -516,9 +516,9 @@ bool FileSystem::isFileLocked(const QString &fileName)
             wuri,
             GENERIC_READ | GENERIC_WRITE,
             FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
-            NULL, OPEN_EXISTING,
+            nullptr, OPEN_EXISTING,
             FILE_ATTRIBUTE_NORMAL | FILE_FLAG_BACKUP_SEMANTICS,
-            NULL);
+            nullptr);
 
         if (win_h == INVALID_HANDLE_VALUE) {
             /* could not be opened, so locked? */
@@ -543,7 +543,7 @@ bool FileSystem::isJunction(const QString &filename)
 {
 #ifdef Q_OS_WIN
     WIN32_FIND_DATA findData;
-    HANDLE hFind = FindFirstFileEx((const wchar_t *)filename.utf16(), FindExInfoBasic, &findData, FindExSearchNameMatch, NULL, 0);
+    HANDLE hFind = FindFirstFileEx((const wchar_t *)filename.utf16(), FindExInfoBasic, &findData, FindExSearchNameMatch, nullptr, 0);
     if (hFind != INVALID_HANDLE_VALUE) {
         FindClose(hFind);
         return false;
index d889930b620cf9e311d86771f1caac2a4c70a4cc..c5bed655884d847e9d8aa37a7d9604f8cffec25e 100644 (file)
@@ -91,7 +91,7 @@ namespace FileSystem {
      */
     bool OCSYNC_EXPORT rename(const QString &originFileName,
         const QString &destinationFileName,
-        QString *errorString = NULL);
+        QString *errorString = nullptr);
 
     /**
      * Rename the file \a originFileName to \a destinationFileName, and
index 49503231207dd4a1f62807eba68cb4bb425b698f..28f507696e3538ced2ddbb1ee2d9e951acc4ddf0 100644 (file)
@@ -215,7 +215,7 @@ qint64 Utility::freeDiskSpace(const QString &path)
 #elif defined(Q_OS_WIN)
     ULARGE_INTEGER freeBytes;
     freeBytes.QuadPart = 0L;
-    if (GetDiskFreeSpaceEx(reinterpret_cast<const wchar_t *>(path.utf16()), &freeBytes, NULL, NULL)) {
+    if (GetDiskFreeSpaceEx(reinterpret_cast<const wchar_t *>(path.utf16()), &freeBytes, nullptr, nullptr)) {
         return freeBytes.QuadPart;
     }
 #endif
index 4d09db99bf33a12f070f9bdad76fbdf0d4112848..befef0cbce0a675e70766b00dfb8af57ec37f93a 100644 (file)
@@ -56,9 +56,9 @@ bool hasLaunchOnStartup_private(const QString &)
         CFStringRef appUrlRefString = CFURLGetString(urlRef); // no need for release
         for (int i = 0; i < CFArrayGetCount(itemsArray); i++) {
             LSSharedFileListItemRef item = (LSSharedFileListItemRef)CFArrayGetValueAtIndex(itemsArray, i);
-            CFURLRef itemUrlRef = NULL;
+            CFURLRef itemUrlRef = nullptr;
 
-            if (LSSharedFileListItemResolve(item, 0, &itemUrlRef, NULL) == noErr && itemUrlRef) {
+            if (LSSharedFileListItemResolve(item, 0, &itemUrlRef, nullptr) == noErr && itemUrlRef) {
                 CFStringRef itemUrlString = CFURLGetString(itemUrlRef);
                 if (CFStringCompare(itemUrlString, appUrlRefString, 0) == kCFCompareEqualTo) {
                     returnValue = true;
@@ -98,9 +98,9 @@ void setLaunchOnStartup_private(const QString &appName, const QString &guiName,
         CFStringRef appUrlRefString = CFURLGetString(urlRef);
         for (int i = 0; i < CFArrayGetCount(itemsArray); i++) {
             LSSharedFileListItemRef item = (LSSharedFileListItemRef)CFArrayGetValueAtIndex(itemsArray, i);
-            CFURLRef itemUrlRef = NULL;
+            CFURLRef itemUrlRef = nullptr;
 
-            if (LSSharedFileListItemResolve(item, 0, &itemUrlRef, NULL) == noErr && itemUrlRef) {
+            if (LSSharedFileListItemResolve(item, 0, &itemUrlRef, nullptr) == noErr && itemUrlRef) {
                 CFStringRef itemUrlString = CFURLGetString(itemUrlRef);
                 if (CFStringCompare(itemUrlString, appUrlRefString, 0) == kCFCompareEqualTo) {
                     LSSharedFileListItemRemove(loginItems, item); // remove it!
@@ -120,11 +120,11 @@ static bool hasDarkSystray_private()
 {
     bool returnValue = false;
     CFStringRef interfaceStyleKey = CFSTR("AppleInterfaceStyle");
-    CFStringRef interfaceStyle = NULL;
+    CFStringRef interfaceStyle = nullptr;
     CFStringRef darkInterfaceStyle = CFSTR("Dark");
     interfaceStyle = (CFStringRef)CFPreferencesCopyAppValue(interfaceStyleKey,
         kCFPreferencesCurrentApplication);
-    if (interfaceStyle != NULL) {
+    if (interfaceStyle != nullptr) {
         returnValue = (kCFCompareEqualTo == CFStringCompare(interfaceStyle, darkInterfaceStyle, 0));
         CFRelease(interfaceStyle);
     }
index 3a8c16fffff8c7fcdbe6b902cdd95bfcc18b2913..f8157a68aeb97af6648d1b2edbc321bc93a9a69a 100644 (file)
@@ -57,7 +57,7 @@ static void setupFavLink_private(const QString &folder)
     /* Use new WINAPI functions */
     PWSTR path;
 
-    if (SHGetKnownFolderPath(FOLDERID_Links, 0, NULL, &path) == S_OK) {
+    if (SHGetKnownFolderPath(FOLDERID_Links, 0, nullptr, &path) == S_OK) {
         QString links = QDir::fromNativeSeparators(QString::fromWCharArray(path));
         linkName = QDir(links).filePath(folderDir.dirName() + QLatin1String(".lnk"));
         CoTaskMemFree(path);
index 408693205af0f6732e816993f90f1b21db34b692..f23e9d21c1d71714ff37c136edd6f2a35c88b778 100644 (file)
@@ -235,7 +235,7 @@ int OCSYNC_EXPORT csync_reconcile(CSYNC *ctx);
  *
  * @param ctx           The csync context.
  *
- * @return              The userdata saved in the context, NULL if an error
+ * @return              The userdata saved in the context, \c nullptr if an error
  *                      occurred.
  */
 void *csync_get_userdata(CSYNC *ctx);
@@ -257,7 +257,7 @@ int OCSYNC_EXPORT csync_set_userdata(CSYNC *ctx, void *userdata);
  *
  * @param ctx           The csync context.
  *
- * @return              The authentication callback set or NULL if an error
+ * @return              The authentication callback set or \c nullptr if an error
  *                      occurred.
  */
 csync_auth_callback OCSYNC_EXPORT csync_get_auth_callback(CSYNC *ctx);
index 371db2328fd8fb992003247bf4a446227be01ae1..8b947c65197ba5957fc97934dc0eb79dc1b72275 100644 (file)
@@ -37,7 +37,7 @@ Q_LOGGING_CATEGORY(lcReconcile, "nextcloud.sync.csync.reconciler", QtInfoMsg)
 #include "inttypes.h"
 
 /* Check if a file is ignored because one parent is ignored.
- * return the node of the ignored directoy if it's the case, or NULL if it is not ignored */
+ * return the node of the ignored directoy if it's the case, or \c nullptr if it is not ignored */
 static csync_file_stat_t *_csync_check_ignored(csync_s::FileMap *tree, const ByteArrayRef &path)
 {
     /* compute the size of the parent directory */
index f7320d9bd01258d2516174a574332e11107a9f9b..7ddd203f36dd0b9882f6775027f8d3b11eed6c75 100644 (file)
@@ -63,8 +63,8 @@ static bool _csync_sameextension(const char *p1, const char *p2) {
 
     /* If the found extension contains a '/', it is because the . was in the folder name
      *            => no extensions */
-    if (e1 && strchr(e1, '/')) e1 = NULL;
-    if (e2 && strchr(e2, '/')) e2 = NULL;
+    if (e1 && strchr(e1, '/')) e1 = nullptr;
+    if (e2 && strchr(e2, '/')) e2 = nullptr;
 
     /* If none have extension, it is the same extension */
     if (!e1 && !e2)
index fe3b8ca20dceea7174b7a02b4ab949ac24764c8d..4fb2c9273320b74fb3bc78c829d1aa2a8b484be6 100644 (file)
@@ -53,10 +53,10 @@ QByteArray c_utf8_from_locale(const mbchar_t *wstr)
   size_t len;
   len = wcslen(wstr);
   /* Call once to get the required size. */
-  size_needed = WideCharToMultiByte(CP_UTF8, 0, wstr, OCC::Utility::convertSizeToInt(len), NULL, 0, NULL, NULL);
+  size_needed = WideCharToMultiByte(CP_UTF8, 0, wstr, OCC::Utility::convertSizeToInt(len), nullptr, 0, nullptr, nullptr);
   if (size_needed > 0) {
     dst.resize(size_needed);
-    WideCharToMultiByte(CP_UTF8, 0, wstr, OCC::Utility::convertSizeToInt(len), dst.data(), size_needed, NULL, NULL);
+    WideCharToMultiByte(CP_UTF8, 0, wstr, OCC::Utility::convertSizeToInt(len), dst.data(), size_needed, nullptr, nullptr);
   }
   return dst;
 #else
@@ -91,12 +91,12 @@ mbchar_t* c_utf8_string_to_locale(const char *str)
         return nullptr;
     }
 #ifdef _WIN32
-    mbchar_t *dst = NULL;
+    mbchar_t *dst = nullptr;
     size_t len;
     int size_needed;
 
     len = strlen(str);
-    size_needed = MultiByteToWideChar(CP_UTF8, 0, str, OCC::Utility::convertSizeToInt(len), NULL, 0);
+    size_needed = MultiByteToWideChar(CP_UTF8, 0, str, OCC::Utility::convertSizeToInt(len), nullptr, 0);
     if (size_needed > 0) {
         int size_char = (size_needed + 1) * sizeof(mbchar_t);
         dst = (mbchar_t*)c_malloc(size_char);
index 6fbb8afe9b398d9bd775d5ae23e56b5388f911de..2bbe1d4bd7a3eea5eb4eaf26e28dc7e868c70527 100644 (file)
@@ -83,7 +83,7 @@ extern "C" {
  *
  * @param  str     The utf8 string to convert.
  *
- * @return The malloced converted multibyte string or NULL on error.
+ * @return The malloced converted multibyte string or \c nullptr on error.
  *
  * @see c_free_locale_string()
  * @see c_utf8_from_locale()
index 9955c230ee2fdd5af8633635bec2a69d6f05d0d0..920cbf1fe84d6b4cd33fc9fd0757d0dace178928 100644 (file)
@@ -53,15 +53,15 @@ typedef struct dhandle_s {
 static int _csync_vio_local_stat_mb(const mbchar_t *uri, csync_file_stat_t *buf);
 
 csync_vio_handle_t *csync_vio_local_opendir(const char *name) {
-  dhandle_t *handle = NULL;
-  mbchar_t *dirname = NULL;
+  dhandle_t *handle = nullptr;
+  mbchar_t *dirname = nullptr;
 
   handle = (dhandle_t*)c_malloc(sizeof(dhandle_t));
 
   // the file wildcard has to be attached
   size_t len_name = strlen(name);
   if( len_name ) {
-      char *h = NULL;
+      char *h = nullptr;
 
       // alloc an enough large buffer to take the name + '/*' + the closing zero.
       h = (char*)c_malloc(len_name+3);
@@ -85,7 +85,7 @@ csync_vio_handle_t *csync_vio_local_opendir(const char *name) {
           errno = EACCES;
       }
       SAFE_FREE(handle);
-      return NULL;
+      return nullptr;
   }
 
   handle->firstFind = 1; // Set a flag that there first fileinfo is available.
@@ -97,10 +97,10 @@ csync_vio_handle_t *csync_vio_local_opendir(const char *name) {
 }
 
 int csync_vio_local_closedir(csync_vio_handle_t *dhandle) {
-  dhandle_t *handle = NULL;
+  dhandle_t *handle = nullptr;
   int rc = -1;
 
-  if (dhandle == NULL) {
+  if (dhandle == nullptr) {
     errno = EBADF;
     return -1;
   }
@@ -141,7 +141,7 @@ static time_t FileTimeToUnixTime(FILETIME *filetime, DWORD *remainder)
 
 std::unique_ptr<csync_file_stat_t> csync_vio_local_readdir(csync_vio_handle_t *dhandle) {
 
-  dhandle_t *handle = NULL;
+  dhandle_t *handle = nullptr;
   std::unique_ptr<csync_file_stat_t> file_stat;
   DWORD rem;
 
@@ -234,9 +234,9 @@ static int _csync_vio_local_stat_mb(const mbchar_t *wuri, csync_file_stat_t *buf
     ULARGE_INTEGER FileIndex;
 
     h = CreateFileW( wuri, 0, FILE_SHARE_WRITE | FILE_SHARE_READ | FILE_SHARE_DELETE,
-                     NULL, OPEN_EXISTING,
+                     nullptr, OPEN_EXISTING,
                      FILE_ATTRIBUTE_NORMAL | FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT,
-                     NULL );
+                     nullptr );
     if( h == INVALID_HANDLE_VALUE ) {
         qCCritical(lcCSyncVIOLocal, "CreateFileW failed on %ls", wuri);
         errno = GetLastError();
index 3b520721a32a042c56ebc33ec56bf8e5d94e95dc..0d2f2530fa8506d49fd277abe5b7c7d5ff35685d 100644 (file)
@@ -286,7 +286,7 @@ activate_action_open (GSimpleAction *action, GVariant *parameter, gpointer user_
     }
 
     if(g_str_equal(name, "showfile")) {
-        const gchar *path = g_variant_get_string (parameter, NULL);
+        const gchar *path = g_variant_get_string(parameter, nullptr);
         g_print("showfile => %s\n", path);
         showInFileManager(QString(path));
     }
index d4d311becdf312696ebba1262f9f3cf84ecb3b25..8d81ace0d29a2880996a2c8236f366a0195f39d3 100644 (file)
@@ -87,7 +87,7 @@ public:
       */
     QStringList findFileInLocalFolders(const QString &relPath, const AccountPtr acc);
 
-    /** Returns the folder by alias or NULL if no folder with the alias exists. */
+    /** Returns the folder by alias or \c nullptr if no folder with the alias exists. */
     Folder *folder(const QString &);
 
     /**
index a28277fea9eb98f7fe58164bfe32c63e44d6178e..3fa10f7b1c1d0791480c66bb89adfd62a2b53096 100644 (file)
@@ -86,13 +86,13 @@ void FolderWatcherPrivate::startWatching()
     qCDebug(lcFolderWatcher) << "FolderWatcherPrivate::startWatching()" << _folder;
     CFStringRef folderCF = CFStringCreateWithCharacters(0, reinterpret_cast<const UniChar *>(_folder.unicode()),
         _folder.length());
-    CFArrayRef pathsToWatch = CFStringCreateArrayBySeparatingStrings(NULL, folderCF, CFSTR(":"));
+    CFArrayRef pathsToWatch = CFStringCreateArrayBySeparatingStrings(nullptr, folderCF, CFSTR(":"));
 
-    FSEventStreamContext ctx = { 0, this, NULL, NULL, NULL };
+    FSEventStreamContext ctx = { 0, this, nullptr, nullptr, nullptr };
 
     // TODO: Add kFSEventStreamCreateFlagFileEvents ?
 
-    _stream = FSEventStreamCreate(NULL,
+    _stream = FSEventStreamCreate(nullptr,
         &callback,
         &ctx,
         pathsToWatch,
index 4adc6cd6cbfa1d355153af3d8adb62ca2dfdfb89..4907b5adfb1c20c5a3108f54dcf887ddb127bdc5 100644 (file)
@@ -37,10 +37,10 @@ void WatcherThread::watchChanges(size_t fileNotifyBufferSize,
         (wchar_t *)longPath.utf16(),
         FILE_LIST_DIRECTORY,
         FILE_SHARE_WRITE | FILE_SHARE_READ | FILE_SHARE_DELETE,
-        NULL,
+        nullptr,
         OPEN_EXISTING,
         FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OVERLAPPED,
-        NULL);
+        nullptr);
 
     if (_directory == INVALID_HANDLE_VALUE) {
         DWORD errorCode = GetLastError();
@@ -72,7 +72,7 @@ void WatcherThread::watchChanges(size_t fileNotifyBufferSize,
                 FILE_NOTIFY_CHANGE_FILE_NAME | FILE_NOTIFY_CHANGE_DIR_NAME | FILE_NOTIFY_CHANGE_LAST_WRITE,
                 &dwBytesReturned,
                 &overlapped,
-                NULL)) {
+                nullptr)) {
             DWORD errorCode = GetLastError();
             if (errorCode == ERROR_NOTIFY_ENUM_DIR) {
                 qCDebug(lcFolderWatcher) << "The buffer for changes overflowed! Triggering a generic change and resizing";
@@ -156,14 +156,14 @@ void WatcherThread::closeHandle()
 {
     if (_directory) {
         CloseHandle(_directory);
-        _directory = NULL;
+        _directory = nullptr;
     }
 }
 
 void WatcherThread::run()
 {
-    _resultEvent = CreateEvent(NULL, true, false, NULL);
-    _stopEvent = CreateEvent(NULL, true, false, NULL);
+    _resultEvent = CreateEvent(nullptr, true, false, nullptr);
+    _stopEvent = CreateEvent(nullptr, true, false, nullptr);
 
     // If this buffer fills up before we've extracted its data we will lose
     // change information. Therefore start big.
index 8425877b1eacf70ce62989f4ede0a45fbe8fa501..85efea3686cd25184478fb4102b2d3ad3b680509 100644 (file)
@@ -86,7 +86,7 @@ static int teardown(void **state) {
     rc = system("rm -rf /tmp/check_csync2");
     assert_int_equal(rc, 0);
 
-    *state = NULL;
+    *state = nullptr;
 
     return 0;
 }
@@ -717,5 +717,5 @@ int torture_run_tests(void)
         cmocka_unit_test(T::check_csync_exclude_expand_escapes),
     };
 
-    return cmocka_run_group_tests(tests, NULL, NULL);
+    return cmocka_run_group_tests(tests, nullptr, nullptr);
 }
index 4d07d43359c242a4969c7b3c4beeb7a77d6d94eb..fc7fea67e26c5e41c46fb11b0073507dccec7daf 100644 (file)
@@ -50,6 +50,6 @@ int torture_run_tests(void)
         cmocka_unit_test(check_csync_normalize_etag),
     };
 
-    return cmocka_run_group_tests(tests, NULL, NULL);
+    return cmocka_run_group_tests(tests, nullptr, nullptr);
 }
 
index 11acf896a582e5cc689b2537bd67e325578eb496..a896905a2b7e0a5e5b61f0d65735483d70b8a2e0 100644 (file)
@@ -50,7 +50,7 @@ static void statedb_create_metadata_table(sqlite3 *db)
                           "contentChecksumTypeId INTEGER,"
                           "PRIMARY KEY(phash));";
 
-        rc = sqlite3_exec(db, sql, NULL, NULL, NULL);
+        rc = sqlite3_exec(db, sql, nullptr, nullptr, nullptr);
         //const char *msg = sqlite3_errmsg(db);
         assert_int_equal( rc, SQLITE_OK );
 
@@ -58,7 +58,7 @@ static void statedb_create_metadata_table(sqlite3 *db)
                         "id INTEGER PRIMARY KEY,"
                         "name TEXT UNIQUE"
                         ");";
-        rc = sqlite3_exec(db, sql, NULL, NULL, NULL);
+        rc = sqlite3_exec(db, sql, nullptr, nullptr, nullptr);
         assert_int_equal( rc, SQLITE_OK );
     }
 }
@@ -83,7 +83,7 @@ static void statedb_insert_metadata(sqlite3 *db)
                                      "4711");
 
         char *errmsg = nullptr;
-        rc = sqlite3_exec(db, stmt, NULL, NULL, &errmsg);
+        rc = sqlite3_exec(db, stmt, nullptr, nullptr, &errmsg);
         sqlite3_free(stmt);
         assert_int_equal( rc, SQLITE_OK );
     }
@@ -129,8 +129,8 @@ static int setup_ftw(void **state)
     assert_int_equal(rc, 0);
     csync = new CSYNC("/tmp", new OCC::SyncJournalDb(TESTDB));
 
-    sqlite3 *db = NULL;
-    rc = sqlite3_open_v2(TESTDB, &db, SQLITE_OPEN_CREATE | SQLITE_OPEN_READWRITE, NULL);
+    sqlite3 *db = nullptr;
+    rc = sqlite3_open_v2(TESTDB, &db, SQLITE_OPEN_CREATE | SQLITE_OPEN_READWRITE, nullptr);
     assert_int_equal(rc, SQLITE_OK);
     statedb_create_metadata_table(db);
     rc = sqlite3_close(db);
@@ -153,8 +153,8 @@ static int teardown(void **state)
     delete csync;
     delete statedb;
 
-    *state = NULL;
-    
+    *state = nullptr;
+
     return 0;
 }
 
@@ -366,5 +366,5 @@ int torture_run_tests(void)
         cmocka_unit_test_setup_teardown(check_csync_ftw_failing_fn, setup_ftw, teardown_rm),
     };
 
-    return cmocka_run_group_tests(tests, NULL, NULL);
+    return cmocka_run_group_tests(tests, nullptr, nullptr);
 }
index 11fae6c09f8fdc04a1422b840278744830454c60..53be6b56799ee8c0dd888d58c29191880848b5be 100644 (file)
@@ -48,6 +48,6 @@ int torture_run_tests(void)
         cmocka_unit_test(check_csync_memstat),
     };
 
-    return cmocka_run_group_tests(tests, NULL, NULL);
+    return cmocka_run_group_tests(tests, nullptr, nullptr);
 }
 
index 372005e93da61ac906f856dcc3bd8c8c3cc7d4e7..a28e9cc226910b2697483efddbfff1d7e5a1d480 100644 (file)
@@ -31,7 +31,7 @@
 
 static void check_iconv_to_native_normalization(void **state)
 {
-    mbchar_t *out = NULL;
+    mbchar_t *out = nullptr;
     const char *in= "\x48\xc3\xa4"; // UTF8
 #ifdef __APPLE__
     const char *exp_out = "\x48\x61\xcc\x88"; // UTF-8-MAC
@@ -94,7 +94,7 @@ static void check_to_multibyte(void **state)
     int rc = -1;
 
     mbchar_t *mb_string = c_utf8_path_to_locale( TESTSTRING );
-    mbchar_t *mb_null   = c_utf8_path_to_locale( NULL );
+    mbchar_t *mb_null   = c_utf8_path_to_locale( nullptr );
 
     (void) state;
 
@@ -103,7 +103,7 @@ static void check_to_multibyte(void **state)
 #else
     assert_string_equal(mb_string, TESTSTRING);
 #endif
-    assert_true( mb_null == NULL );
+    assert_true( mb_null == nullptr );
     assert_int_equal(rc, -1);
 
     c_free_locale_string(mb_string);
@@ -178,6 +178,6 @@ int torture_run_tests(void)
 
     };
 
-    return cmocka_run_group_tests(tests, NULL, NULL);
+    return cmocka_run_group_tests(tests, nullptr, nullptr);
 }
 
index 79e28ab1c2366b5e371ce220d354780f944953c5..7d429f0a245a2414fd8c136eff18b5560ddf58f5 100644 (file)
@@ -88,7 +88,7 @@ static int teardown(void **state) {
     rc = system("rm -rf /tmp/csync_test/");
     assert_int_equal(rc, 0);
 
-    *state = NULL;
+    *state = nullptr;
     return 0;
 }
 
@@ -135,7 +135,7 @@ static void check_csync_vio_closedir_null(void **state)
     CSYNC *csync = (CSYNC*)*state;
     int rc = 0;
 
-    rc = csync_vio_closedir(csync, NULL);
+    rc = csync_vio_closedir(csync, nullptr);
     assert_int_equal(rc, -1);
 }
 
@@ -147,5 +147,5 @@ int torture_run_tests(void)
         cmocka_unit_test(check_csync_vio_closedir_null),
     };
 
-    return cmocka_run_group_tests(tests, NULL, NULL);
+    return cmocka_run_group_tests(tests, nullptr, nullptr);
 }
index e73c424249396aca4ed039887191163f16ed473f..afcb0c87ff642b807f97d79ced6386955f04f9d0 100644 (file)
@@ -95,7 +95,7 @@ static int setup_testenv(void **state) {
 
     /* --- initialize csync */
     statevar *mystate = (statevar*)malloc( sizeof(statevar) );
-    mystate->result = NULL;
+    mystate->result = nullptr;
 
     mystate->csync = new CSYNC("/tmp/check_csync1", new OCC::SyncJournalDb(""));
 
@@ -134,7 +134,7 @@ static int teardown(void **state) {
     rc = wipe_testdir();
     assert_int_equal(rc, 0);
 
-    *state = NULL;
+    *state = nullptr;
     return 0;
 }
 
@@ -277,7 +277,7 @@ static void create_file( const char *path, const char *name, const char *content
   assert_int_equal( 0, hFile==INVALID_HANDLE_VALUE );
 
   int len = strlen(content);
-  mbchar_t *dst = NULL;
+  mbchar_t *dst = nullptr;
 
   dst = c_utf8_string_to_locale(content);
   WriteFile(hFile, dst, len * sizeof(mbchar_t), &dwWritten, 0);
@@ -462,5 +462,5 @@ int torture_run_tests(void)
         cmocka_unit_test_setup_teardown(check_readdir_bigunicode, setup_testenv, teardown),
     };
 
-    return cmocka_run_group_tests(tests, NULL, NULL);
+    return cmocka_run_group_tests(tests, nullptr, nullptr);
 }
index dc2e476adb13c4f45581728bab7ac0a35db3bdd2..443d3a430330d3ac706a3a72f2883c60a34c77d3 100644 (file)
@@ -22,7 +22,7 @@ class TestNextcloudPropagator : public QObject
 private slots:
     void testUpdateErrorFromSession()
     {
-//        NextcloudPropagator propagator( NULL, QLatin1String("test1"), QLatin1String("test2"), new ProgressDatabase);
+        //OwncloudPropagator propagator(nullptr, QLatin1String("test1"), QLatin1String("test2"), new ProgressDatabase);
         QVERIFY( true );
     }