ソースを参照

Replace NULL by nullptr in all C++ files

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>
Stephan Beyer 5 年 前
コミット
ea16804751
36 ファイル変更137 行追加137 行削除
  1. 2 2
      shell_integration/windows/OCContextMenu/OCContextMenu.cpp
  2. 2 2
      shell_integration/windows/OCContextMenu/OCContextMenuFactory.cpp
  3. 15 15
      shell_integration/windows/OCContextMenu/OCContextMenuRegHandler.cpp
  4. 4 4
      shell_integration/windows/OCContextMenu/RegDelnode.h
  5. 2 2
      shell_integration/windows/OCContextMenu/dllmain.cpp
  6. 1 1
      shell_integration/windows/OCOverlays/DllMain.cpp
  7. 1 1
      shell_integration/windows/OCOverlays/OCOverlay.cpp
  8. 3 3
      shell_integration/windows/OCOverlays/OCOverlayFactory.cpp
  9. 18 18
      shell_integration/windows/OCOverlays/OCOverlayRegistrationHandler.cpp
  10. 4 4
      shell_integration/windows/OCUtil/CommunicationSocket.cpp
  11. 4 4
      shell_integration/windows/OCUtil/RegistryUtil.cpp
  12. 5 5
      shell_integration/windows/OCUtil/RemotePathChecker.cpp
  13. 2 2
      src/3rdparty/qtlockedfile/qtlockedfile_win.cpp
  14. 11 11
      src/common/filesystembase.cpp
  15. 1 1
      src/common/filesystembase.h
  16. 1 1
      src/common/utility.cpp
  17. 6 6
      src/common/utility_mac.cpp
  18. 1 1
      src/common/utility_win.cpp
  19. 2 2
      src/csync/csync.h
  20. 1 1
      src/csync/csync_reconcile.cpp
  21. 2 2
      src/csync/csync_update.cpp
  22. 4 4
      src/csync/std/c_utf8.cpp
  23. 1 1
      src/csync/std/c_utf8.h
  24. 9 9
      src/csync/vio/csync_vio_local_win.cpp
  25. 1 1
      src/gui/cloudproviders/cloudproviderwrapper.cpp
  26. 1 1
      src/gui/folderman.h
  27. 3 3
      src/gui/folderwatcher_mac.cpp
  28. 6 6
      src/gui/folderwatcher_win.cpp
  29. 2 2
      test/csync/csync_tests/check_csync_exclude.cpp
  30. 1 1
      test/csync/csync_tests/check_csync_misc.cpp
  31. 8 8
      test/csync/csync_tests/check_csync_update.cpp
  32. 1 1
      test/csync/csync_tests/check_csync_util.cpp
  33. 4 4
      test/csync/encoding_tests/check_encoding.cpp
  34. 3 3
      test/csync/vio_tests/check_vio.cpp
  35. 4 4
      test/csync/vio_tests/check_vio_ext.cpp
  36. 1 1
      test/testnextcloudpropagator.cpp

+ 2 - 2
shell_integration/windows/OCContextMenu/OCContextMenu.cpp

@@ -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];

+ 2 - 2
shell_integration/windows/OCContextMenu/OCContextMenuFactory.cpp

@@ -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;
-}
+}

+ 15 - 15
shell_integration/windows/OCContextMenu/OCContextMenuRegHandler.cpp

@@ -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;
-}
+}

+ 4 - 4
shell_integration/windows/OCContextMenu/RegDelnode.h

@@ -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);
 	}

+ 2 - 2
shell_integration/windows/OCContextMenu/dllmain.cpp

@@ -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;
-}
+}

+ 1 - 1
shell_integration/windows/OCOverlays/DllMain.cpp

@@ -17,7 +17,7 @@
 #include "OCOverlayRegistrationHandler.h"
 #include "OCOverlayFactory.h"
 
-HINSTANCE instanceHandle = NULL;
+HINSTANCE instanceHandle = nullptr;
 
 long dllReferenceCount = 0;
 

+ 1 - 1
shell_integration/windows/OCOverlays/OCOverlay.cpp

@@ -82,7 +82,7 @@ IFACEMETHODIMP OCOverlay::QueryInterface(REFIID riid, void **ppv)
     else
     {
         hr = E_NOINTERFACE;
-        *ppv = NULL;
+        *ppv = nullptr;
     }
 
     if (*ppv)

+ 3 - 3
shell_integration/windows/OCOverlays/OCOverlayFactory.cpp

@@ -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;
-}
+}

+ 18 - 18
shell_integration/windows/OCOverlays/OCOverlayRegistrationHandler.cpp

@@ -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;
-}
+}

+ 4 - 4
shell_integration/windows/OCUtil/CommunicationSocket.cpp

@@ -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;
         }

+ 4 - 4
shell_integration/windows/OCUtil/RegistryUtil.cpp

@@ -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))
     {

+ 5 - 5
shell_integration/windows/OCUtil/RemotePathChecker.cpp

@@ -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(); })
 {
 }

+ 2 - 2
src/3rdparty/qtlockedfile/qtlockedfile_win.cpp

@@ -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

+ 11 - 11
src/common/filesystembase.cpp

@@ -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;

+ 1 - 1
src/common/filesystembase.h

@@ -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

+ 1 - 1
src/common/utility.cpp

@@ -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

+ 6 - 6
src/common/utility_mac.cpp

@@ -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);
     }

+ 1 - 1
src/common/utility_win.cpp

@@ -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);

+ 2 - 2
src/csync/csync.h

@@ -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);

+ 1 - 1
src/csync/csync_reconcile.cpp

@@ -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 */

+ 2 - 2
src/csync/csync_update.cpp

@@ -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)

+ 4 - 4
src/csync/std/c_utf8.cpp

@@ -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);

+ 1 - 1
src/csync/std/c_utf8.h

@@ -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()

+ 9 - 9
src/csync/vio/csync_vio_local_win.cpp

@@ -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();

+ 1 - 1
src/gui/cloudproviders/cloudproviderwrapper.cpp

@@ -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));
     }

+ 1 - 1
src/gui/folderman.h

@@ -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 &);
 
     /**

+ 3 - 3
src/gui/folderwatcher_mac.cpp

@@ -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,

+ 6 - 6
src/gui/folderwatcher_win.cpp

@@ -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.

+ 2 - 2
test/csync/csync_tests/check_csync_exclude.cpp

@@ -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);
 }

+ 1 - 1
test/csync/csync_tests/check_csync_misc.cpp

@@ -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);
 }
 

+ 8 - 8
test/csync/csync_tests/check_csync_update.cpp

@@ -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);
 }

+ 1 - 1
test/csync/csync_tests/check_csync_util.cpp

@@ -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);
 }
 

+ 4 - 4
test/csync/encoding_tests/check_encoding.cpp

@@ -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);
 }
 

+ 3 - 3
test/csync/vio_tests/check_vio.cpp

@@ -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);
 }

+ 4 - 4
test/csync/vio_tests/check_vio_ext.cpp

@@ -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);
 }

+ 1 - 1
test/testnextcloudpropagator.cpp

@@ -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 );
     }