From caeeead5b90e7b3498178fa417e18fcc8c9b6cd3 Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Sat, 29 Jul 2023 21:22:19 +1200 Subject: [PATCH] Maintenance: replace most NULL with nullptr --- lib/hash.cc | 2 +- lib/sspwin32.cc | 94 +++++++++---------- src/DiskIO/AIO/AIODiskIOStrategy.cc | 4 +- src/DiskIO/AIO/aio_win32.cc | 2 +- src/DiskIO/DiskThreads/DiskThreadsDiskFile.cc | 4 +- src/DiskIO/DiskThreads/aiops_win32.cc | 56 +++++------ src/WinSvc.cc | 50 +++++----- src/acl/external/AD_group/ext_ad_group_acl.cc | 48 +++++----- .../external/LDAP_group/ext_ldap_group_acl.cc | 6 +- src/acl/external/LM_group/ext_lm_group_acl.cc | 40 ++++---- .../ext_edirectory_userip_acl.cc | 2 +- .../kerberos_ldap_group/support_krb5.cc | 4 +- .../kerberos_ldap_group/support_ldap.cc | 46 ++++----- .../kerberos_ldap_group/support_sasl.cc | 2 +- .../external/time_quota/ext_time_quota_acl.cc | 6 +- src/auth/basic/LDAP/basic_ldap_auth.cc | 6 +- src/auth/basic/PAM/basic_pam_auth.cc | 14 +-- src/auth/basic/SASL/basic_sasl_auth.cc | 6 +- src/auth/basic/SMB_LM/msntauth.cc | 4 +- src/auth/basic/SMB_LM/valid.cc | 4 +- src/auth/basic/SSPI/basic_sspi_auth.cc | 4 +- src/auth/basic/SSPI/valid.cc | 6 +- src/auth/digest/LDAP/ldap_backend.cc | 8 +- src/auth/digest/eDirectory/ldap_backend.cc | 8 +- .../negotiate/SSPI/negotiate_sspi_auth.cc | 10 +- .../kerberos/negotiate_kerberos_auth.cc | 4 +- src/auth/ntlm/SMB_LM/ntlm_smb_lm_auth.cc | 54 +++++------ src/auth/ntlm/SSPI/ntlm_sspi_auth.cc | 26 ++--- src/cache_cf.cc | 2 +- src/cf_gen.cc | 10 +- src/clientStream.cc | 4 +- src/client_side.cc | 4 +- src/client_side_request.cc | 2 +- src/comm/ConnOpener.cc | 2 +- src/comm/ModDevPoll.cc | 8 +- src/comm/ModKqueue.cc | 8 +- src/comm/ModSelectWin32.cc | 38 ++++---- src/debug/debug.cc | 2 +- src/dns_internal.cc | 44 ++++----- src/eui/Eui48.cc | 6 +- src/fs_io.cc | 2 +- src/http/url_rewriters/LFS/rredir.cc | 2 +- src/icmp/Icmp6.cc | 2 +- src/icmp/net_db.cc | 2 +- src/ipc/mem/Segment.cc | 2 +- src/ipc_win32.cc | 26 ++--- src/log/access_log.cc | 8 +- src/main.cc | 2 +- src/pconn.cc | 2 +- src/peer_digest.cc | 2 +- src/peer_proxy_negotiate_auth.cc | 10 +- src/redirect.cc | 2 +- .../cert_generators/file/certificate_db.cc | 2 +- src/ssl/bio.cc | 2 +- src/ssl/support.cc | 8 +- src/store_client.cc | 4 +- src/store_digest.cc | 2 +- src/test_cache_digest.cc | 18 ++-- src/tests/stub_wordlist.cc | 2 +- src/tests/testAuth.cc | 6 +- src/tools.cc | 2 +- src/unlinkd.cc | 2 +- src/win32.cc | 2 +- tools/cachemgr.cc | 2 +- tools/squidclient/Transport.cc | 2 +- tools/squidclient/squidclient.cc | 2 +- 66 files changed, 384 insertions(+), 384 deletions(-) diff --git a/lib/hash.cc b/lib/hash.cc index dfce188f68..b661f53b14 100644 --- a/lib/hash.cc +++ b/lib/hash.cc @@ -327,7 +327,7 @@ main(void) hash_table *hid; LOCAL_ARRAY(char, buf, BUFSIZ); LOCAL_ARRAY(char, todelete, BUFSIZ); - hash_link *walker = NULL; + hash_link *walker = nullptr; todelete[0] = '\0'; printf("init\n"); diff --git a/lib/sspwin32.cc b/lib/sspwin32.cc index d7f092fffa..1f9022299e 100644 --- a/lib/sspwin32.cc +++ b/lib/sspwin32.cc @@ -31,8 +31,8 @@ static char * SSP_Package_InUse; SECURITY_STATUS SecurityStatus = SEC_E_OK; static DWORD cbMaxToken = 0; -static uint8_t * pClientBuf = NULL; -static uint8_t * pServerBuf = NULL; +static uint8_t * pClientBuf = nullptr; +static uint8_t * pServerBuf = nullptr; static AUTH_SEQ NTLM_asServer = {0}; @@ -40,18 +40,18 @@ BOOL Use_Unicode = FALSE; BOOL NTLM_LocalCall = FALSE; /* Function pointers */ -ACCEPT_SECURITY_CONTEXT_FN _AcceptSecurityContext = NULL; -ACQUIRE_CREDENTIALS_HANDLE_FN _AcquireCredentialsHandle = NULL; -COMPLETE_AUTH_TOKEN_FN _CompleteAuthToken = NULL; -DELETE_SECURITY_CONTEXT_FN _DeleteSecurityContext = NULL; -FREE_CONTEXT_BUFFER_FN _FreeContextBuffer = NULL; -FREE_CREDENTIALS_HANDLE_FN _FreeCredentialsHandle = NULL; -INITIALIZE_SECURITY_CONTEXT_FN _InitializeSecurityContext = NULL; -QUERY_SECURITY_PACKAGE_INFO_FN _QuerySecurityPackageInfo = NULL; +ACCEPT_SECURITY_CONTEXT_FN _AcceptSecurityContext = nullptr; +ACQUIRE_CREDENTIALS_HANDLE_FN _AcquireCredentialsHandle = nullptr; +COMPLETE_AUTH_TOKEN_FN _CompleteAuthToken = nullptr; +DELETE_SECURITY_CONTEXT_FN _DeleteSecurityContext = nullptr; +FREE_CONTEXT_BUFFER_FN _FreeContextBuffer = nullptr; +FREE_CREDENTIALS_HANDLE_FN _FreeCredentialsHandle = nullptr; +INITIALIZE_SECURITY_CONTEXT_FN _InitializeSecurityContext = nullptr; +QUERY_SECURITY_PACKAGE_INFO_FN _QuerySecurityPackageInfo = nullptr; #ifdef UNICODE -QUERY_CONTEXT_ATTRIBUTES_FN_W _QueryContextAttributes = NULL; +QUERY_CONTEXT_ATTRIBUTES_FN_W _QueryContextAttributes = nullptr; #else -QUERY_CONTEXT_ATTRIBUTES_FN_A _QueryContextAttributes = NULL; +QUERY_CONTEXT_ATTRIBUTES_FN_A _QueryContextAttributes = nullptr; #endif void UnloadSecurityDll(void) @@ -68,24 +68,24 @@ void UnloadSecurityDll(void) xfree(pClientBuf); xfree(pServerBuf); - _AcceptSecurityContext = NULL; - _AcquireCredentialsHandle = NULL; - _CompleteAuthToken = NULL; - _DeleteSecurityContext = NULL; - _FreeContextBuffer = NULL; - _FreeCredentialsHandle = NULL; - _InitializeSecurityContext = NULL; - _QuerySecurityPackageInfo = NULL; - _QueryContextAttributes = NULL; - - hModule = NULL; + _AcceptSecurityContext = nullptr; + _AcquireCredentialsHandle = nullptr; + _CompleteAuthToken = nullptr; + _DeleteSecurityContext = nullptr; + _FreeContextBuffer = nullptr; + _FreeCredentialsHandle = nullptr; + _InitializeSecurityContext = nullptr; + _QuerySecurityPackageInfo = nullptr; + _QueryContextAttributes = nullptr; + + hModule = nullptr; } HMODULE LoadSecurityDll(int mode, const char * SSP_Package) { TCHAR lpszDLL[MAX_PATH]; OSVERSIONINFO VerInfo; - PSecPkgInfo pSPI = NULL; + PSecPkgInfo pSPI = nullptr; /* * Find out which security DLL to use, depending on @@ -93,7 +93,7 @@ HMODULE LoadSecurityDll(int mode, const char * SSP_Package) * We have to use security.dll on Windows NT 4.0. * All other operating systems, we have to use Secur32.dll */ - hModule = NULL; + hModule = nullptr; if ((mode != SSP_BASIC) && (mode != SSP_NTLM)) return hModule; NTLM_mode = mode; @@ -115,7 +115,7 @@ HMODULE LoadSecurityDll(int mode, const char * SSP_Package) GetProcAddress(hModule, "AcceptSecurityContext"); if (!_AcceptSecurityContext) { UnloadSecurityDll(); - hModule = NULL; + hModule = nullptr; return hModule; } #ifdef UNICODE @@ -127,35 +127,35 @@ HMODULE LoadSecurityDll(int mode, const char * SSP_Package) #endif if (!_AcquireCredentialsHandle) { UnloadSecurityDll(); - hModule = NULL; + hModule = nullptr; return hModule; } _CompleteAuthToken = (COMPLETE_AUTH_TOKEN_FN) GetProcAddress(hModule, "CompleteAuthToken"); if (!_CompleteAuthToken) { UnloadSecurityDll(); - hModule = NULL; + hModule = nullptr; return hModule; } _DeleteSecurityContext = (DELETE_SECURITY_CONTEXT_FN) GetProcAddress(hModule, "DeleteSecurityContext"); if (!_DeleteSecurityContext) { UnloadSecurityDll(); - hModule = NULL; + hModule = nullptr; return hModule; } _FreeContextBuffer = (FREE_CONTEXT_BUFFER_FN) GetProcAddress(hModule, "FreeContextBuffer"); if (!_FreeContextBuffer) { UnloadSecurityDll(); - hModule = NULL; + hModule = nullptr; return hModule; } _FreeCredentialsHandle = (FREE_CREDENTIALS_HANDLE_FN) GetProcAddress(hModule, "FreeCredentialsHandle"); if (!_FreeCredentialsHandle) { UnloadSecurityDll(); - hModule = NULL; + hModule = nullptr; return hModule; } #ifdef UNICODE @@ -167,7 +167,7 @@ HMODULE LoadSecurityDll(int mode, const char * SSP_Package) #endif if (!_InitializeSecurityContext) { UnloadSecurityDll(); - hModule = NULL; + hModule = nullptr; return hModule; } #ifdef UNICODE @@ -179,7 +179,7 @@ HMODULE LoadSecurityDll(int mode, const char * SSP_Package) #endif if (!_QuerySecurityPackageInfo) { UnloadSecurityDll(); - hModule = NULL; + hModule = nullptr; } #ifdef UNICODE @@ -191,7 +191,7 @@ HMODULE LoadSecurityDll(int mode, const char * SSP_Package) #endif if (!_QueryContextAttributes) { UnloadSecurityDll(); - hModule = NULL; + hModule = nullptr; } /* Get max token size */ @@ -228,8 +228,8 @@ BOOL GenClientContext(PAUTH_SEQ pAS, PSEC_WINNT_AUTH_IDENTITY pAuthIdentity, ULONG fContextAttr; if (!pAS->fInitialized) { - SecurityStatus = _AcquireCredentialsHandle(NULL, (SEC_CHAR*) _T(SSP_Package_InUse), - SECPKG_CRED_OUTBOUND, NULL, (NTLM_mode == SSP_NTLM) ? NULL : pAuthIdentity, NULL, NULL, + SecurityStatus = _AcquireCredentialsHandle(nullptr, (SEC_CHAR*) _T(SSP_Package_InUse), + SECPKG_CRED_OUTBOUND, nullptr, (NTLM_mode == SSP_NTLM) ? NULL : pAuthIdentity, nullptr, nullptr, &pAS->hcred, &tsExpiry); if (SecurityStatus < 0) return FALSE; @@ -254,7 +254,7 @@ BOOL GenClientContext(PAUTH_SEQ pAS, PSEC_WINNT_AUTH_IDENTITY pAuthIdentity, sbIn.pvBuffer = pIn; } SecurityStatus = _InitializeSecurityContext(&pAS->hcred, - pAS->fInitialized ? &pAS->hctxt : NULL, NULL, 0, 0, + pAS->fInitialized ? &pAS->hctxt : NULL, nullptr, 0, 0, SECURITY_NATIVE_DREP, pAS->fInitialized ? &sbdIn : NULL, 0, &pAS->hctxt, &sbdOut, &fContextAttr, &tsExpiry); if (SecurityStatus < 0) @@ -298,8 +298,8 @@ BOOL GenServerContext(PAUTH_SEQ pAS, PVOID pIn, DWORD cbIn, PVOID pOut, SecPkgContext_Names namebuffer; if (!pAS->fInitialized) { - SecurityStatus = _AcquireCredentialsHandle(NULL, (SEC_CHAR*) _T(SSP_Package_InUse), - SECPKG_CRED_INBOUND, NULL, NULL, NULL, NULL, &pAS->hcred, + SecurityStatus = _AcquireCredentialsHandle(nullptr, (SEC_CHAR*) _T(SSP_Package_InUse), + SECPKG_CRED_INBOUND, nullptr, nullptr, nullptr, nullptr, &pAS->hcred, &pAS->hcredLifeTime); #if SSP_DEBUG fprintf(stderr, "AcquireCredentialsHandle returned: %x\n", SecurityStatus); @@ -411,14 +411,14 @@ BOOL WINAPI SSP_LogonUser(PTSTR szUser, PTSTR szPassword, PTSTR szDomain) /* Prepare client message (negotiate) */ cbOut = cbMaxToken; - if (!GenClientContext(&asClient, &ai, NULL, 0, pClientBuf, &cbOut, &fDone)) + if (!GenClientContext(&asClient, &ai, nullptr, 0, pClientBuf, &cbOut, &fDone)) break; /* Prepare server message (challenge) */ cbIn = cbOut; cbOut = cbMaxToken; if (!GenServerContext(&asServer, pClientBuf, cbIn, pServerBuf, &cbOut, - &fDone, NULL)) + &fDone, nullptr)) break; /* Most likely failure: AcceptServerContext fails with SEC_E_LOGON_DENIED * in the case of bad szUser or szPassword. @@ -437,7 +437,7 @@ BOOL WINAPI SSP_LogonUser(PTSTR szUser, PTSTR szPassword, PTSTR szDomain) cbIn = cbOut; cbOut = cbMaxToken; if (!GenServerContext(&asServer, pClientBuf, cbIn, pServerBuf, &cbOut, - &fDone, NULL)) + &fDone, nullptr)) break; fResult = TRUE; } while (0); @@ -458,7 +458,7 @@ BOOL WINAPI SSP_LogonUser(PTSTR szUser, PTSTR szPassword, PTSTR szDomain) const char * WINAPI SSP_MakeChallenge(PVOID PNegotiateBuf, int NegotiateLen) { BOOL fDone = FALSE; - uint8_t * fResult = NULL; + uint8_t * fResult = nullptr; DWORD cbOut = 0; DWORD cbIn = 0; ntlm_challenge * challenge; @@ -481,7 +481,7 @@ const char * WINAPI SSP_MakeChallenge(PVOID PNegotiateBuf, int NegotiateLen) cbIn = NegotiateLen; cbOut = cbMaxToken; if (!GenServerContext(&NTLM_asServer, pClientBuf, cbIn, pServerBuf, &cbOut, - &fDone, NULL)) + &fDone, nullptr)) break; fResult = pServerBuf; } while (0); @@ -499,7 +499,7 @@ const char * WINAPI SSP_MakeChallenge(PVOID PNegotiateBuf, int NegotiateLen) encoded[dstLen] = '\0'; return encoded; } - return NULL; + return nullptr; } BOOL WINAPI SSP_ValidateNTLMCredentials(PVOID PAutenticateBuf, int AutenticateLen, char * credentials) @@ -565,7 +565,7 @@ const char * WINAPI SSP_MakeNegotiateBlob(PVOID PNegotiateBuf, int NegotiateLen, encoded[dstLen] = '\0'; return encoded; } - return NULL; + return nullptr; } const char * WINAPI SSP_ValidateNegotiateCredentials(PVOID PAutenticateBuf, int AutenticateLen, PBOOL fDone, int * Status, char * credentials) @@ -600,6 +600,6 @@ const char * WINAPI SSP_ValidateNegotiateCredentials(PVOID PAutenticateBuf, int encoded[dstLen] = '\0'; return encoded; } - return NULL; + return nullptr; } diff --git a/src/DiskIO/AIO/AIODiskIOStrategy.cc b/src/DiskIO/AIO/AIODiskIOStrategy.cc index 825096cf44..9e6c680155 100644 --- a/src/DiskIO/AIO/AIODiskIOStrategy.cc +++ b/src/DiskIO/AIO/AIODiskIOStrategy.cc @@ -134,8 +134,8 @@ AIODiskIOStrategy::callback() buf = aqe->aq_e_buf; type = aqe->aq_e_type; callback_valid = cbdataReferenceValidDone(aqe->aq_e_callback_data, &cbdata); - AIODiskFile * theFile = NULL; - void *theFileVoid = NULL; + AIODiskFile * theFile = nullptr; + void *theFileVoid = nullptr; void *theTmpFile = aqe->theFile; bool fileOk = cbdataReferenceValidDone(theTmpFile, &theFileVoid); diff --git a/src/DiskIO/AIO/aio_win32.cc b/src/DiskIO/AIO/aio_win32.cc index 227c669a67..d510eb3fc9 100644 --- a/src/DiskIO/AIO/aio_win32.cc +++ b/src/DiskIO/AIO/aio_win32.cc @@ -287,7 +287,7 @@ int aio_open(const char *path, int mode) if ((hndl = CreateFile(path, /* file name */ dwDesiredAccess, /* access mode */ 0, /* share mode */ - NULL, /* SD */ + nullptr, /* SD */ dwCreationDisposition, /* how to create */ FILE_FLAG_OVERLAPPED, /* file attributes */ NULL /* handle to template file */ diff --git a/src/DiskIO/DiskThreads/DiskThreadsDiskFile.cc b/src/DiskIO/DiskThreads/DiskThreadsDiskFile.cc index 802999f60d..adbe6aef1c 100644 --- a/src/DiskIO/DiskThreads/DiskThreadsDiskFile.cc +++ b/src/DiskIO/DiskThreads/DiskThreadsDiskFile.cc @@ -67,7 +67,7 @@ DiskThreadsDiskFile::open(int flags, mode_t mode, RefCount callback #else - openDone(fd, NULL, fd, 0); + openDone(fd, nullptr, fd, 0); #endif } @@ -116,7 +116,7 @@ DiskThreadsDiskFile::create(int flags, mode_t mode, RefCount callba #else - openDone (fd, NULL, fd, 0); + openDone (fd, nullptr, fd, 0); #endif } diff --git a/src/DiskIO/DiskThreads/aiops_win32.cc b/src/DiskIO/DiskThreads/aiops_win32.cc index 35d72c0191..85c36537de 100644 --- a/src/DiskIO/DiskThreads/aiops_win32.cc +++ b/src/DiskIO/DiskThreads/aiops_win32.cc @@ -93,7 +93,7 @@ static void *squidaio_do_opendir(squidaio_request_t *); static void squidaio_debug(squidaio_request_t *); static void squidaio_poll_queues(void); -static squidaio_thread_t *threads = NULL; +static squidaio_thread_t *threads = nullptr; static int squidaio_initialised = 0; #define AIO_LARGE_BUFS 16384 @@ -119,7 +119,7 @@ static struct { request_queue2 = { - NULL, &request_queue2.head + nullptr, &request_queue2.head }; static squidaio_request_queue_t done_queue; @@ -129,7 +129,7 @@ static struct { done_requests = { - NULL, &done_requests.head + nullptr, &done_requests.head }; static HANDLE main_thread; @@ -150,7 +150,7 @@ squidaio_get_pool(int size) return squidaio_large_bufs; } - return NULL; + return nullptr; } void * @@ -218,22 +218,22 @@ squidaio_init(void) } /* Initialize request queue */ - if ((request_queue.mutex = CreateMutex(NULL, /* no inheritance */ + if ((request_queue.mutex = CreateMutex(nullptr, /* no inheritance */ FALSE, /* start unowned (as per mutex_init) */ - NULL) /* no name */ + nullptr) /* no name */ ) == NULL) { fatal("Failed to create mutex"); } - if ((request_queue.cond = CreateEvent(NULL, /* no inheritance */ + if ((request_queue.cond = CreateEvent(nullptr, /* no inheritance */ FALSE, /* auto signal reset - which I think is pthreads like ? */ FALSE, /* start non signaled */ - NULL) /* no name */ + nullptr) /* no name */ ) == NULL) { fatal("Failed to create condition variable"); } - request_queue.head = NULL; + request_queue.head = nullptr; request_queue.tailp = &request_queue.head; @@ -243,22 +243,22 @@ squidaio_init(void) /* Initialize done queue */ - if ((done_queue.mutex = CreateMutex(NULL, /* no inheritance */ + if ((done_queue.mutex = CreateMutex(nullptr, /* no inheritance */ FALSE, /* start unowned (as per mutex_init) */ - NULL) /* no name */ + nullptr) /* no name */ ) == NULL) { fatal("Failed to create mutex"); } - if ((done_queue.cond = CreateEvent(NULL, /* no inheritance */ + if ((done_queue.cond = CreateEvent(nullptr, /* no inheritance */ TRUE, /* manually signaled - which I think is pthreads like ? */ FALSE, /* start non signaled */ - NULL) /* no name */ + nullptr) /* no name */ ) == NULL) { fatal("Failed to create condition variable"); } - done_queue.head = NULL; + done_queue.head = nullptr; done_queue.tailp = &done_queue.head; @@ -278,12 +278,12 @@ squidaio_init(void) for (i = 0; i < NUMTHREADS; ++i) { threadp = (squidaio_thread_t *)squidaio_thread_pool->alloc(); threadp->status = _THREAD_STARTING; - threadp->current_req = NULL; + threadp->current_req = nullptr; threadp->requests = 0; threadp->next = threads; threads = threadp; - if ((threadp->thread = CreateThread(NULL, /* no security attributes */ + if ((threadp->thread = CreateThread(nullptr, /* no security attributes */ 0, /* use default stack size */ squidaio_thread_loop, /* thread function */ threadp, /* argument to thread function */ @@ -392,8 +392,8 @@ squidaio_thread_loop(LPVOID lpParam) while (1) { DWORD rv; - threadp->current_req = request = NULL; - request = NULL; + threadp->current_req = request = nullptr; + request = nullptr; /* Get a request to process */ threadp->status = _THREAD_WAITING; @@ -451,7 +451,7 @@ squidaio_thread_loop(LPVOID lpParam) /* process the request */ threadp->status = _THREAD_BUSY; - request->next = NULL; + request->next = nullptr; threadp->current_req = request; @@ -540,7 +540,7 @@ squidaio_queue_request(squidaio_request_t * request) request_queue_len += 1; request->resultp->_data = request; /* Play some tricks with the request_queue2 queue */ - request->next = NULL; + request->next = nullptr; if (WaitForSingleObject(request_queue.mutex, 0) == WAIT_OBJECT_0) { if (request_queue2.head) { @@ -566,7 +566,7 @@ squidaio_queue_request(squidaio_request_t * request) if (request_queue2.head) { /* Clear queue of blocked requests */ - request_queue2.head = NULL; + request_queue2.head = nullptr; request_queue2.tailp = &request_queue2.head; } } else { @@ -699,8 +699,8 @@ squidaio_cancel(squidaio_result_t * resultp) if (request && request->resultp == resultp) { debugs(43, 9, "squidaio_cancel: " << request << " type=" << request->request_type << " result=" << request->resultp); request->cancelled = 1; - request->resultp = NULL; - resultp->_data = NULL; + request->resultp = nullptr; + resultp->_data = nullptr; resultp->result_type = _AIO_OP_NONE; return 0; } @@ -778,7 +778,7 @@ squidaio_do_read(squidaio_request_t * requestp) lseek(requestp->fd, requestp->offset, requestp->whence); if (!ReadFile((HANDLE)_get_osfhandle(requestp->fd), requestp->bufferp, - requestp->buflen, (LPDWORD)&requestp->ret, NULL)) { + requestp->buflen, (LPDWORD)&requestp->ret, nullptr)) { WIN32_maperror(GetLastError()); requestp->ret = -1; } @@ -820,7 +820,7 @@ static void squidaio_do_write(squidaio_request_t * requestp) { if (!WriteFile((HANDLE)_get_osfhandle(requestp->fd), requestp->bufferp, - requestp->buflen, (LPDWORD)&requestp->ret, NULL)) { + requestp->buflen, (LPDWORD)&requestp->ret, nullptr)) { WIN32_maperror(GetLastError()); requestp->ret = -1; } @@ -968,7 +968,7 @@ squidaio_poll_queues(void) } Sleep(0); - request_queue2.head = NULL; + request_queue2.head = nullptr; request_queue2.tailp = &request_queue2.head; } @@ -977,7 +977,7 @@ squidaio_poll_queues(void) (WaitForSingleObject(done_queue.mutex, 0)==WAIT_OBJECT_0)) { struct squidaio_request_t *requests = done_queue.head; - done_queue.head = NULL; + done_queue.head = nullptr; done_queue.tailp = &done_queue.head; if (!ReleaseMutex(done_queue.mutex)) { @@ -1016,7 +1016,7 @@ AIO_REPOLL: } if (!request) { - return NULL; + return nullptr; } debugs(43, 9, "squidaio_poll_done: " << request << " type=" << request->request_type << " result=" << request->resultp); diff --git a/src/WinSvc.cc b/src/WinSvc.cc index 670784a881..f9e6634c72 100644 --- a/src/WinSvc.cc +++ b/src/WinSvc.cc @@ -79,13 +79,13 @@ typedef BOOL (WINAPI * PFChangeServiceConfig2) (SC_HANDLE, DWORD, LPVOID); static SC_ACTION Squid_SCAction[] = { { SC_ACTION_RESTART, 60000 } }; static char Squid_ServiceDescriptionString[] = SOFTWARENAME " " VERSION " WWW Proxy Server"; static SERVICE_DESCRIPTION Squid_ServiceDescription = { Squid_ServiceDescriptionString }; -static SERVICE_FAILURE_ACTIONS Squid_ServiceFailureActions = { INFINITE, NULL, NULL, 1, Squid_SCAction }; +static SERVICE_FAILURE_ACTIONS Squid_ServiceFailureActions = { INFINITE, nullptr, nullptr, 1, Squid_SCAction }; static char REGKEY[256] = SOFTWARE "\\" VENDOR "\\" SOFTWARENAME "\\"; static char *keys[] = { SOFTWAREString, /* key[0] */ VENDORString, /* key[1] */ SOFTWARENAMEString, /* key[2] */ - NULL, /* key[3] */ + nullptr, /* key[3] */ NULL /* key[4] */ }; @@ -116,8 +116,8 @@ WIN32_create_key(void) unsigned long result; rv = RegCreateKeyEx(hKey, keys[index], /* subkey */ 0, /* reserved */ - NULL, /* class */ - REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hKeyNext, &result); + nullptr, /* class */ + REG_OPTION_NON_VOLATILE, KEY_WRITE, nullptr, &hKeyNext, &result); if (rv != ERROR_SUCCESS) { fprintf(stderr, "RegCreateKeyEx(%s),%d\n", keys[index], (int) rv); @@ -276,7 +276,7 @@ static void WIN32_build_argv(char *cmd) WIN32_argv[WIN32_argc++] = word; } - WIN32_argv[WIN32_argc] = NULL; + WIN32_argv[WIN32_argc] = nullptr; } #endif /* USE_WIN32_SERVICE */ @@ -426,7 +426,7 @@ WIN32_IpAddrChangeMonitor(LPVOID lpParam) NotifyAddrChange = (PFNotifyAddrChange) GetProcAddress(IPHLPAPIHandle, NOTIFYADDRCHANGE); while (1) { - Result = NotifyAddrChange(NULL, NULL); + Result = NotifyAddrChange(nullptr, nullptr); if (Result != NO_ERROR) { debugs(1, DBG_IMPORTANT, "ERROR: NotifyAddrChange error " << Result); return 1; @@ -444,7 +444,7 @@ WIN32_IpAddrChangeMonitorInit() DWORD threadID = 0, ThrdParam = 0; if ((WIN32_run_mode == _WIN_SQUID_RUN_MODE_SERVICE) && (Config.onoff.WIN32_IpAddrChangeMonitor)) { - NotifyAddrChange_thread = CreateThread(NULL, 0, WIN32_IpAddrChangeMonitor, + NotifyAddrChange_thread = CreateThread(nullptr, 0, WIN32_IpAddrChangeMonitor, &ThrdParam, 0, &threadID); if (NotifyAddrChange_thread == NULL) { status = GetLastError(); @@ -495,7 +495,7 @@ int WIN32_Subsystem_Init(int * argc, char *** argv) return 1; /* Set Process work dir to directory containing squid.exe */ - GetModuleFileName(NULL, path, 512); + GetModuleFileName(nullptr, path, 512); WIN32_module_name=xstrdup(path); @@ -511,11 +511,11 @@ int WIN32_Subsystem_Init(int * argc, char *** argv) DWORD Type = 0; DWORD Size = 0; LONG Result; - Result = RegQueryValueEx(hndKey, CONFIGFILE, NULL, &Type, NULL, &Size); + Result = RegQueryValueEx(hndKey, CONFIGFILE, nullptr, &Type, nullptr, &Size); if (Result == ERROR_SUCCESS && Size) { ConfigFile = static_cast(xmalloc(Size)); - RegQueryValueEx(hndKey, CONFIGFILE, NULL, &Type, (unsigned char *)ConfigFile, &Size); + RegQueryValueEx(hndKey, CONFIGFILE, nullptr, &Type, (unsigned char *)ConfigFile, &Size); } else ConfigFile = xstrdup(DEFAULT_CONFIG_FILE); @@ -523,11 +523,11 @@ int WIN32_Subsystem_Init(int * argc, char *** argv) Type = 0; - Result = RegQueryValueEx(hndKey, COMMANDLINE, NULL, &Type, NULL, &Size); + Result = RegQueryValueEx(hndKey, COMMANDLINE, nullptr, &Type, nullptr, &Size); if (Result == ERROR_SUCCESS && Size) { WIN32_Service_Command_Line = static_cast(xmalloc(Size)); - RegQueryValueEx(hndKey, COMMANDLINE, NULL, &Type, (unsigned char *)WIN32_Service_Command_Line, &Size); + RegQueryValueEx(hndKey, COMMANDLINE, nullptr, &Type, (unsigned char *)WIN32_Service_Command_Line, &Size); } else WIN32_Service_Command_Line = xstrdup(""); @@ -658,8 +658,8 @@ WIN32_RemoveService() keys[4] = const_cast(service); - schSCManager = OpenSCManager(NULL, /* machine (NULL == local) */ - NULL, /* database (NULL == default) */ + schSCManager = OpenSCManager(nullptr, /* machine (NULL == local) */ + nullptr, /* database (NULL == default) */ SC_MANAGER_ALL_ACCESS /* access required */ ); @@ -732,14 +732,14 @@ WIN32_InstallService() keys[4] = const_cast(service); - if ((lenpath = GetModuleFileName(NULL, ServicePath, 512)) == 0) { + if ((lenpath = GetModuleFileName(nullptr, ServicePath, 512)) == 0) { fprintf(stderr, "Can't get executable path\n"); exit(EXIT_FAILURE); } snprintf(szPath, sizeof(szPath), "%s %s:" SQUIDSBUFPH, ServicePath, _WIN_SQUID_SERVICE_OPTION, SQUIDSBUFPRINT(service_name)); - schSCManager = OpenSCManager(NULL, /* machine (NULL == local) */ - NULL, /* database (NULL == default) */ + schSCManager = OpenSCManager(nullptr, /* machine (NULL == local) */ + nullptr, /* database (NULL == default) */ SC_MANAGER_ALL_ACCESS /* access required */ ); @@ -755,11 +755,11 @@ WIN32_InstallService() SERVICE_AUTO_START, /* start type */ SERVICE_ERROR_NORMAL, /* error control type */ (const char *) szPath, /* service's binary */ - NULL, /* no load ordering group */ - NULL, /* no tag identifier */ + nullptr, /* no load ordering group */ + nullptr, /* no tag identifier */ "Tcpip\0AFD\0", /* dependencies */ - NULL, /* LocalSystem account */ - NULL); /* no password */ + nullptr, /* LocalSystem account */ + nullptr); /* no password */ if (schService) { if (WIN32_OS_version > _WIN_OS_WINNT) { @@ -806,8 +806,8 @@ WIN32_sendSignal(int WIN32_signal) if (service_name.isEmpty()) service_name = SBuf(APP_SHORTNAME); - schSCManager = OpenSCManager(NULL, /* machine (NULL == local) */ - NULL, /* database (NULL == default) */ + schSCManager = OpenSCManager(nullptr, /* machine (NULL == local) */ + nullptr, /* database (NULL == default) */ SC_MANAGER_ALL_ACCESS /* access required */ ); @@ -894,8 +894,8 @@ WIN32_sendSignal(int WIN32_signal) int WIN32_StartService(int argc, char **argv) { SERVICE_TABLE_ENTRY DispatchTable[] = { - {NULL, SquidWinSvcMain}, - {NULL, NULL} + {nullptr, SquidWinSvcMain}, + {nullptr, nullptr} }; char *c; char stderr_path[256]; diff --git a/src/acl/external/AD_group/ext_ad_group_acl.cc b/src/acl/external/AD_group/ext_ad_group_acl.cc index 5f8dacffca..3f53d68a57 100644 --- a/src/acl/external/AD_group/ext_ad_group_acl.cc +++ b/src/acl/external/AD_group/ext_ad_group_acl.cc @@ -102,11 +102,11 @@ char *program_name; pid_t mypid; char *machinedomain; int use_case_insensitive_compare = 0; -char *DefaultDomain = NULL; +char *DefaultDomain = nullptr; const char NTV_VALID_DOMAIN_SEPARATOR[] = "\\/"; int numberofgroups = 0; int WIN32_COM_initialized = 0; -char *WIN32_ErrorMessage = NULL; +char *WIN32_ErrorMessage = nullptr; wchar_t **User_Groups; int User_Groups_Count = 0; @@ -157,7 +157,7 @@ Get_primaryGroup(IADs * pUser) VARIANT var; unsigned User_primaryGroupID; char tmpSID[SECURITY_MAX_SID_SIZE * 2]; - wchar_t *wc = NULL, *result = NULL; + wchar_t *wc = nullptr, *result = nullptr; int wcsize; VariantInit(&var); @@ -177,8 +177,8 @@ Get_primaryGroup(IADs * pUser) hr = pUser->lpVtbl->Get(pUser, L"objectSid", &var); if (SUCCEEDED(hr)) { PSID pObjectSID; - LPBYTE pByte = NULL; - char *szSID = NULL; + LPBYTE pByte = nullptr; + char *szSID = nullptr; hr = GetLPBYTEtoOctetString(&var, &pByte); pObjectSID = (PSID) pByte; @@ -213,12 +213,12 @@ Get_WIN32_ErrorMessage(HRESULT hr) { FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, + nullptr, hr, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) & WIN32_ErrorMessage, 0, - NULL); + nullptr); return WIN32_ErrorMessage; } @@ -240,7 +240,7 @@ My_NameTranslate(wchar_t * name, int in_format, int out_format) WIN32_COM_initialized = 1; } hr = CoCreateInstance(&CLSID_NameTranslate, - NULL, + nullptr, CLSCTX_INPROC_SERVER, &IID_IADsNameTranslate, (void **) &pNto); @@ -260,13 +260,13 @@ My_NameTranslate(wchar_t * name, int in_format, int out_format) if (FAILED(hr)) { debug("My_NameTranslate: cannot set translate of %S, ERROR: %s\n", name, Get_WIN32_ErrorMessage(hr)); pNto->lpVtbl->Release(pNto); - return NULL; + return nullptr; } hr = pNto->lpVtbl->Get(pNto, out_format, &bstr); if (FAILED(hr)) { debug("My_NameTranslate: cannot get translate of %S, ERROR: %s\n", name, Get_WIN32_ErrorMessage(hr)); pNto->lpVtbl->Release(pNto); - return NULL; + return nullptr; } debug("My_NameTranslate: %S translated to %S\n", name, bstr); @@ -296,11 +296,11 @@ GetLDAPPath(wchar_t * Base_DN, int query_mode) char * GetDomainName(void) { - static char *DomainName = NULL; + static char *DomainName = nullptr; PDSROLE_PRIMARY_DOMAIN_INFO_BASIC pDSRoleInfo; DWORD netret; - if ((netret = DsRoleGetPrimaryDomainInformation(NULL, DsRolePrimaryDomainInfoBasic, (PBYTE *) & pDSRoleInfo) == ERROR_SUCCESS)) { + if ((netret = DsRoleGetPrimaryDomainInformation(nullptr, DsRolePrimaryDomainInfoBasic, (PBYTE *) & pDSRoleInfo) == ERROR_SUCCESS)) { /* * Check the machine role. */ @@ -317,7 +317,7 @@ GetDomainName(void) DomainName = (char *) xmalloc(len + 1); /* copy unicode buffer */ - WideCharToMultiByte(CP_ACP, 0, pDSRoleInfo->DomainNameFlat, -1, DomainName, len, NULL, NULL); + WideCharToMultiByte(CP_ACP, 0, pDSRoleInfo->DomainNameFlat, -1, DomainName, len, nullptr, nullptr); /* add null termination */ DomainName[len] = '\0'; @@ -350,7 +350,7 @@ add_User_Group(wchar_t * Group) if (User_Groups_Count == 0) { User_Groups = (wchar_t **) xmalloc(sizeof(wchar_t *)); - *User_Groups = NULL; + *User_Groups = nullptr; ++User_Groups_Count; } array = User_Groups; @@ -360,7 +360,7 @@ add_User_Group(wchar_t * Group) ++array; } User_Groups = (wchar_t **) xrealloc(User_Groups, sizeof(wchar_t *) * (User_Groups_Count + 1)); - User_Groups[User_Groups_Count] = NULL; + User_Groups[User_Groups_Count] = nullptr; User_Groups[User_Groups_Count - 1] = (wchar_t *) xmalloc((wcslen(Group) + 1) * sizeof(wchar_t)); wcscpy(User_Groups[User_Groups_Count - 1], Group); ++User_Groups_Count; @@ -480,7 +480,7 @@ Recursive_Memberof(IADs * pObj) static wchar_t ** build_groups_DN_array(const char **array, char *userdomain) { - wchar_t *wc = NULL; + wchar_t *wc = nullptr; int wcsize; int source_group_format; char Group[GNLEN + 1]; @@ -515,7 +515,7 @@ build_groups_DN_array(const char **array, char *userdomain) } ++entry; } - *entry = NULL; + *entry = nullptr; return wc_array; } @@ -537,7 +537,7 @@ Valid_Local_Groups(char *UserName, const char **Groups) NET_API_STATUS nStatus; DWORD i; DWORD dwTotalCount = 0; - LPBYTE pBufTmp = NULL; + LPBYTE pBufTmp = nullptr; if ((Domain_Separator = strchr(UserName, '/')) != NULL) *Domain_Separator = '\\'; @@ -557,7 +557,7 @@ Valid_Local_Groups(char *UserName, const char **Groups) * function should also return the names of the local * groups in which the user is indirectly a member. */ - nStatus = NetUserGetLocalGroups(NULL, + nStatus = NetUserGetLocalGroups(nullptr, wszUserName, dwLevel, dwFlags, @@ -605,7 +605,7 @@ Valid_Global_Groups(char *UserName, const char **Groups) WCHAR wszUser[DNLEN + UNLEN + 2]; /* Unicode user name */ char NTDomain[DNLEN + UNLEN + 2]; - char *domain_qualify = NULL; + char *domain_qualify = nullptr; char User[DNLEN + UNLEN + 2]; size_t j; @@ -785,8 +785,8 @@ main(int argc, char *argv[]) } mypid = getpid(); - setbuf(stdout, NULL); - setbuf(stderr, NULL); + setbuf(stdout, nullptr); + setbuf(stderr, nullptr); /* Check Command Line */ process_options(argc, argv); @@ -833,11 +833,11 @@ main(int argc, char *argv[]) continue; } username = strtok(buf, " "); - for (n = 0; (group = strtok(NULL, " ")) != NULL; ++n) { + for (n = 0; (group = strtok(nullptr, " ")) != NULL; ++n) { rfc1738_unescape(group); groups[n] = group; } - groups[n] = NULL; + groups[n] = nullptr; numberofgroups = n; if (NULL == username) { diff --git a/src/acl/external/LDAP_group/ext_ldap_group_acl.cc b/src/acl/external/LDAP_group/ext_ldap_group_acl.cc index e73f7169de..435a49c387 100644 --- a/src/acl/external/LDAP_group/ext_ldap_group_acl.cc +++ b/src/acl/external/LDAP_group/ext_ldap_group_acl.cc @@ -76,7 +76,7 @@ typedef WINLDAPAPI ULONG(LDAPAPI * PFldap_start_tls_s) (IN PLDAP, OUT PULONG, OU typedef WINLDAPAPI ULONG(LDAPAPI * PFldap_start_tls_s) (IN PLDAP, OUT PULONG, OUT LDAPMessage **, IN PLDAPControlA *, IN PLDAPControlA *); #endif /* LDAP_UNICODE */ PFldap_start_tls_s Win32_ldap_start_tls_s; -#define ldap_start_tls_s(l,s,c) Win32_ldap_start_tls_s(l,NULL,NULL,s,c) +#define ldap_start_tls_s(l,s,c) Win32_ldap_start_tls_s(l, nullptr, nullptr,s,c) #endif /* LDAP_VERSION3 */ #else @@ -107,7 +107,7 @@ static int persistent = 0; static int noreferrals = 0; static int aliasderef = LDAP_DEREF_NEVER; #if defined(NETSCAPE_SSL) -static char *sslpath = NULL; +static char *sslpath = nullptr; static int sslinit = 0; #endif static int connect_timeout = 0; @@ -523,7 +523,7 @@ recover: #endif #if NETSCAPE_SSL if (sslpath) { - if (!sslinit && (ldapssl_client_init(sslpath, NULL) != LDAP_SUCCESS)) { + if (!sslinit && (ldapssl_client_init(sslpath, nullptr) != LDAP_SUCCESS)) { fprintf(stderr, "FATAL: Unable to initialise SSL with cert path %s\n", sslpath); exit(EXIT_FAILURE); } else { diff --git a/src/acl/external/LM_group/ext_lm_group_acl.cc b/src/acl/external/LM_group/ext_lm_group_acl.cc index 8a35d527d6..8077f0b20f 100644 --- a/src/acl/external/LM_group/ext_lm_group_acl.cc +++ b/src/acl/external/LM_group/ext_lm_group_acl.cc @@ -102,7 +102,7 @@ const char *program_name; pid_t mypid; char *machinedomain; int use_case_insensitive_compare = 0; -char *DefaultDomain = NULL; +char *DefaultDomain = nullptr; const char NTV_VALID_DOMAIN_SEPARATOR[] = "\\/"; char * @@ -117,10 +117,10 @@ AllocStrFromLSAStr(LSA_UNICODE_STRING LsaStr) safe_free(target); target = (char *) xmalloc(len); if (target == NULL) - return NULL; + return nullptr; /* copy unicode buffer */ - WideCharToMultiByte(CP_ACP, 0, LsaStr.Buffer, LsaStr.Length, target, len, NULL, NULL); + WideCharToMultiByte(CP_ACP, 0, LsaStr.Buffer, LsaStr.Length, target, len, nullptr, nullptr); /* add null termination */ target[len - 1] = '\0'; @@ -136,7 +136,7 @@ GetDomainName(void) PPOLICY_PRIMARY_DOMAIN_INFO ppdiDomainInfo; PWKSTA_INFO_100 pwkiWorkstationInfo; DWORD netret; - char *DomainName = NULL; + char *DomainName = nullptr; /* * Always initialize the object attributes to all zeroes. @@ -150,7 +150,7 @@ GetDomainName(void) * The wki100_computername field contains a pointer to a UNICODE * string containing the local computer name. */ - netret = NetWkstaGetInfo(NULL, 100, (LPBYTE *) & pwkiWorkstationInfo); + netret = NetWkstaGetInfo(nullptr, 100, (LPBYTE *) & pwkiWorkstationInfo); if (netret == NERR_Success) { /* * We have the workstation name in: @@ -160,7 +160,7 @@ GetDomainName(void) * the LsaOpenPolicy function. */ status = LsaOpenPolicy( - NULL, + nullptr, &ObjectAttributes, GENERIC_READ | POLICY_VIEW_LOCAL_INFORMATION, &PolicyHandle @@ -199,7 +199,7 @@ GetDomainName(void) */ debug("Member of Domain %s\n", DomainName); } else { - DomainName = NULL; + DomainName = nullptr; } } } @@ -240,7 +240,7 @@ Valid_Local_Groups(char *UserName, const char **Groups) char *Domain_Separator; WCHAR wszUserName[UNLEN + 1]; // Unicode user name - LPLOCALGROUP_USERS_INFO_0 pBuf = NULL; + LPLOCALGROUP_USERS_INFO_0 pBuf = nullptr; LPLOCALGROUP_USERS_INFO_0 pTmpBuf; DWORD dwLevel = 0; DWORD dwFlags = LG_INCLUDE_INDIRECT; @@ -270,7 +270,7 @@ Valid_Local_Groups(char *UserName, const char **Groups) * groups in which the user is indirectly a member. */ nStatus = NetUserGetLocalGroups( - NULL, + nullptr, wszUserName, dwLevel, dwFlags, @@ -323,11 +323,11 @@ Valid_Global_Groups(char *UserName, const char **Groups) char User[UNLEN + 1]; size_t j; - LPWSTR LclDCptr = NULL; - LPWSTR UsrDCptr = NULL; - LPGROUP_USERS_INFO_0 pUsrBuf = NULL; + LPWSTR LclDCptr = nullptr; + LPWSTR UsrDCptr = nullptr; + LPGROUP_USERS_INFO_0 pUsrBuf = nullptr; LPGROUP_USERS_INFO_0 pTmpBuf; - LPSERVER_INFO_101 pSrvBuf = NULL; + LPSERVER_INFO_101 pSrvBuf = nullptr; DWORD dwLevel = 0; DWORD dwPrefMaxLen = -1; DWORD dwEntriesRead = 0; @@ -363,16 +363,16 @@ Valid_Global_Groups(char *UserName, const char **Groups) /* Call the NetServerGetInfo function for local computer, specifying level 101. */ dwLevel = 101; - nStatus = NetServerGetInfo(NULL, dwLevel, (LPBYTE *) & pSrvBuf); + nStatus = NetServerGetInfo(nullptr, dwLevel, (LPBYTE *) & pSrvBuf); if (nStatus == NERR_Success) { /* Check if we are running on a Domain Controller */ if ((pSrvBuf->sv101_type & SV_TYPE_DOMAIN_CTRL) || (pSrvBuf->sv101_type & SV_TYPE_DOMAIN_BAKCTRL)) { - LclDCptr = NULL; + LclDCptr = nullptr; debug("Running on a DC.\n"); } else - nStatus = (use_PDC_only ? NetGetDCName(NULL, wszLocalDomain, (LPBYTE *) & LclDCptr) : NetGetAnyDCName(NULL, wszLocalDomain, (LPBYTE *) & LclDCptr)); + nStatus = (use_PDC_only ? NetGetDCName(nullptr, wszLocalDomain, (LPBYTE *) & LclDCptr) : NetGetAnyDCName(nullptr, wszLocalDomain, (LPBYTE *) & LclDCptr)); } else { fprintf(stderr, "%s: ERROR: NetServerGetInfo() failed.'\n", program_name); if (pSrvBuf != NULL) @@ -525,8 +525,8 @@ main(int argc, char *argv[]) } mypid = getpid(); - setbuf(stdout, NULL); - setbuf(stderr, NULL); + setbuf(stdout, nullptr); + setbuf(stderr, nullptr); /* Check Command Line */ process_options(argc, argv); @@ -576,11 +576,11 @@ main(int argc, char *argv[]) continue; } username = strtok(buf, " "); - for (n = 0; (group = strtok(NULL, " ")) != NULL; ++n) { + for (n = 0; (group = strtok(nullptr, " ")) != NULL; ++n) { rfc1738_unescape(group); groups[n] = group; } - groups[n] = NULL; + groups[n] = nullptr; if (NULL == username) { SEND_BH(HLP_MSG("Invalid Request. No Username.")); diff --git a/src/acl/external/eDirectory_userip/ext_edirectory_userip_acl.cc b/src/acl/external/eDirectory_userip/ext_edirectory_userip_acl.cc index 3274609a53..bf124d24f9 100644 --- a/src/acl/external/eDirectory_userip/ext_edirectory_userip_acl.cc +++ b/src/acl/external/eDirectory_userip/ext_edirectory_userip_acl.cc @@ -1722,7 +1722,7 @@ MainSafe(int argc, char **argv) local_printfx("BH message=\"(SearchFilterLDAP: %s)\"\n", ErrLDAP(x)); } else { edui_ldap.err = -1; - debug("SearchFilterLDAP(-, NULL) -> Length: %u\n", x); + debug("SearchFilterLDAP(-, nullptr) -> Length: %u\n", x); x = SearchLDAP(&edui_ldap, edui_ldap.scope, edui_ldap.search_filter, (char **) &search_attrib); if (x != LDAP_ERR_SUCCESS) { debug("SearchLDAP() -> %s (LDAP: %s)\n", ErrLDAP(x), ldap_err2string(x)); diff --git a/src/acl/external/kerberos_ldap_group/support_krb5.cc b/src/acl/external/kerberos_ldap_group/support_krb5.cc index 31a95e1ac9..8083923afa 100644 --- a/src/acl/external/kerberos_ldap_group/support_krb5.cc +++ b/src/acl/external/kerberos_ldap_group/support_krb5.cc @@ -350,7 +350,7 @@ krb5_create_cache(char *domain, char *service_principal_name) creds->client = principal; code = krb5_parse_name(kparam.context, service, &creds->server); xfree(service); - code = krb5_get_in_tkt_with_keytab(kparam.context, 0, NULL, NULL, NULL, keytab, NULL, creds, 0); + code = krb5_get_in_tkt_with_keytab(kparam.context, 0, nullptr, nullptr, nullptr, keytab, nullptr, creds, 0); #endif if (code) { @@ -435,7 +435,7 @@ krb5_create_cache(char *domain, char *service_principal_name) creds->client = principal_list[i]; code = krb5_parse_name(kparam.context, service, &creds->server); xfree(service); - code = krb5_get_in_tkt_with_keytab(kparam.context, 0, NULL, NULL, NULL, keytab, NULL, creds, 0); + code = krb5_get_in_tkt_with_keytab(kparam.context, 0, nullptr, nullptr, nullptr, keytab, nullptr, creds, 0); #endif if (code) { k5_error("Error while initialising credentials from keytab", code); diff --git a/src/acl/external/kerberos_ldap_group/support_ldap.cc b/src/acl/external/kerberos_ldap_group/support_ldap.cc index 83229fecc8..88da943b09 100644 --- a/src/acl/external/kerberos_ldap_group/support_ldap.cc +++ b/src/acl/external/kerberos_ldap_group/support_ldap.cc @@ -117,8 +117,8 @@ ldap_simple_rebind(LDAP * ld, credp = credp; methodp = methodp; freeit = freeit; - return ldap_sasl_bind_s(ld, cp->dn, LDAP_SASL_SIMPLE, &cred, NULL, NULL, - NULL); + return ldap_sasl_bind_s(ld, cp->dn, LDAP_SASL_SIMPLE, &cred, nullptr, nullptr, + nullptr); } #elif HAVE_LDAP_REBIND_PROC #if HAVE_SASL_H || HAVE_SASL_SASL_H || HAVE_SASL_DARWIN @@ -145,8 +145,8 @@ ldap_simple_rebind(LDAP * ld, cred.bv_val = cp->pw; cred.bv_len = strlen(cp->pw); } - return ldap_sasl_bind_s(ld, cp->dn, LDAP_SASL_SIMPLE, &cred, NULL, NULL, - NULL); + return ldap_sasl_bind_s(ld, cp->dn, LDAP_SASL_SIMPLE, &cred, nullptr, nullptr, + nullptr); } #elif HAVE_LDAP_REBIND_FUNCTION @@ -185,8 +185,8 @@ ldap_simple_rebind(LDAP * ld, credp = credp; methodp = methodp; freeit = freeit; - return ldap_sasl_bind_s(ld, cp->dn, LDAP_SASL_SIMPLE, &cred, NULL, NULL, - NULL); + return ldap_sasl_bind_s(ld, cp->dn, LDAP_SASL_SIMPLE, &cred, nullptr, nullptr, + nullptr); } #else #error "No rebind functione defined" @@ -533,7 +533,7 @@ ldap_set_ssl_defaults(struct main_args *margs) #if HAVE_OPENLDAP int val; #elif HAVE_LDAPSSL_CLIENT_INIT - char *ssl_certdbpath = NULL; + char *ssl_certdbpath = nullptr; #endif #if HAVE_OPENLDAP @@ -616,8 +616,8 @@ ldap_set_ssl_defaults(struct main_args *margs) * Solaris SSL ldap calls require path to certificate database */ /* - * rc = ldapssl_client_init( ssl_certdbpath, NULL ); - * rc = ldapssl_advclientauth_init( ssl_certdbpath, NULL , 0 , NULL, NULL, 0, NULL, 2); + * rc = ldapssl_client_init( ssl_certdbpath, nullptr); + * rc = ldapssl_advclientauth_init( ssl_certdbpath, nullptr, 0 , nullptr, nullptr, 0, nullptr, 2); */ ssl_certdbpath = getenv("SSL_CERTDBPATH"); if (!ssl_certdbpath) { @@ -627,11 +627,11 @@ ldap_set_ssl_defaults(struct main_args *margs) "%s| %s: DEBUG: Set certificate database path for ldap server to %s. (Changeable through setting environment variable SSL_CERTDBPATH)\n", LogTime(), PROGRAM, ssl_certdbpath); if (!margs->rc_allow) { - rc = ldapssl_advclientauth_init(ssl_certdbpath, NULL, 0, NULL, NULL, 0, - NULL, 2); + rc = ldapssl_advclientauth_init(ssl_certdbpath, nullptr, 0, nullptr, nullptr, 0, + nullptr, 2); } else { - rc = ldapssl_advclientauth_init(ssl_certdbpath, NULL, 0, NULL, NULL, 0, - NULL, 0); + rc = ldapssl_advclientauth_init(ssl_certdbpath, nullptr, 0, nullptr, nullptr, 0, + nullptr, 0); debug((char *) "%s| %s: DEBUG: Disable server certificate check for ldap server.\n", LogTime(), PROGRAM); @@ -846,7 +846,7 @@ tool_ldap_open(struct main_args * margs, char *host, int port, char *ssl) LogTime(), PROGRAM, ldap_err2string(rc)); xfree(ldapuri); ldap_free_urldesc(url); - return NULL; + return nullptr; } #else #error "No URL parsing function" @@ -920,7 +920,7 @@ tool_ldap_open(struct main_args * margs, char *host, int port, char *ssl) LogTime(), PROGRAM, ldap_err2string(rc)); xfree(ldapuri); ldap_free_urldesc(url); - return NULL; + return nullptr; } #else #error "No URL parsing function" @@ -952,18 +952,18 @@ tool_ldap_open(struct main_args * margs, char *host, int port, char *ssl) error((char *) "%s| %s: ERROR: Error while setting SSL for ldap server: %s\n", LogTime(), PROGRAM, ldapssl_err2string(rc)); - ldap_unbind_ext(ld, NULL, NULL); - ld = NULL; - return NULL; + ldap_unbind_ext(ld, nullptr, nullptr); + ld = nullptr; + return nullptr; } rc = ldap_set_defaults(ld); if (rc != LDAP_SUCCESS) { error((char *) "%s| %s: ERROR: Error while setting default options for ldap server: %s\n", LogTime(), PROGRAM, ldap_err2string(rc)); - ldap_unbind_ext(ld, NULL, NULL); - ld = NULL; - return NULL; + ldap_unbind_ext(ld, nullptr, nullptr); + ld = nullptr; + return nullptr; } #else error((char *) "%s| %s: ERROR: SSL not supported by ldap library\n", @@ -1102,8 +1102,8 @@ get_memberof(struct main_args *margs, char *user, char *domain, char *group) break; } #else - ldap_unbind_ext(ld, NULL, NULL); - ld = NULL; + ldap_unbind_ext(ld, nullptr, nullptr); + ld = nullptr; error((char *) "%s| %s: ERROR: SASL not supported on system\n", LogTime(), PROGRAM); continue; diff --git a/src/acl/external/kerberos_ldap_group/support_sasl.cc b/src/acl/external/kerberos_ldap_group/support_sasl.cc index 03ee140184..6633c7c534 100644 --- a/src/acl/external/kerberos_ldap_group/support_sasl.cc +++ b/src/acl/external/kerberos_ldap_group/support_sasl.cc @@ -239,7 +239,7 @@ tool_sasl_bind(LDAP * ld, char *binddn, char *ssl) char *sasl_secprops; /* * char *sasl_secprops = (char *)"maxssf=56"; - * char *sasl_secprops = NULL; + * char *sasl_secprops = nullptr; */ struct berval passwd = {}; void *defaults; diff --git a/src/acl/external/time_quota/ext_time_quota_acl.cc b/src/acl/external/time_quota/ext_time_quota_acl.cc index be6da43096..38fc70a923 100644 --- a/src/acl/external/time_quota/ext_time_quota_acl.cc +++ b/src/acl/external/time_quota/ext_time_quota_acl.cc @@ -287,11 +287,11 @@ static void readConfig(const char *filename) if ((username = strtok(line, "\t ")) != NULL) { /* get the time budget */ - if ((budget = strtok(NULL, "/")) == NULL) { + if ((budget = strtok(nullptr, "/")) == NULL) { fprintf(stderr, "ERROR: missing 'budget' field on line %u of '%s'.\n", lineCount, filename); continue; } - if ((period = strtok(NULL, "/")) == NULL) { + if ((period = strtok(nullptr, "/")) == NULL) { fprintf(stderr, "ERROR: missing 'period' field on line %u of '%s'.\n", lineCount, filename); continue; } @@ -438,7 +438,7 @@ int main(int argc, char **argv) } log_info("Starting %s\n", __FILE__); - setbuf(stdout, NULL); + setbuf(stdout, nullptr); init_db(); diff --git a/src/auth/basic/LDAP/basic_ldap_auth.cc b/src/auth/basic/LDAP/basic_ldap_auth.cc index c3aa9aa54c..4d9a78574c 100644 --- a/src/auth/basic/LDAP/basic_ldap_auth.cc +++ b/src/auth/basic/LDAP/basic_ldap_auth.cc @@ -126,7 +126,7 @@ typedef WINLDAPAPI ULONG(LDAPAPI * PFldap_start_tls_s) (IN PLDAP, OUT PULONG, OU typedef WINLDAPAPI ULONG(LDAPAPI * PFldap_start_tls_s) (IN PLDAP, OUT PULONG, OUT LDAPMessage **, IN PLDAPControlA *, IN PLDAPControlA *); #endif /* LDAP_UNICODE */ PFldap_start_tls_s Win32_ldap_start_tls_s; -#define ldap_start_tls_s(l,s,c) Win32_ldap_start_tls_s(l,NULL,NULL,s,c) +#define ldap_start_tls_s(l,s,c) Win32_ldap_start_tls_s(l, nullptr, nullptr,s,c) #endif /* LDAP_VERSION3 */ #else @@ -155,7 +155,7 @@ static int bind_once = 0; static int noreferrals = 0; static int aliasderef = LDAP_DEREF_NEVER; #if defined(NETSCAPE_SSL) -static const char *sslpath = NULL; +static const char *sslpath = nullptr; static int sslinit = 0; #endif static int connect_timeout = 0; @@ -275,7 +275,7 @@ open_ldap_connection(const char *ldapServer, int port) #endif #if NETSCAPE_SSL if (sslpath) { - if (!sslinit && (ldapssl_client_init(sslpath, NULL) != LDAP_SUCCESS)) { + if (!sslinit && (ldapssl_client_init(sslpath, nullptr) != LDAP_SUCCESS)) { fprintf(stderr, "\nUnable to initialise SSL with cert path %s\n", sslpath); exit(EXIT_FAILURE); diff --git a/src/auth/basic/PAM/basic_pam_auth.cc b/src/auth/basic/PAM/basic_pam_auth.cc index becc413dfc..fdc71c55d4 100644 --- a/src/auth/basic/PAM/basic_pam_auth.cc +++ b/src/auth/basic/PAM/basic_pam_auth.cc @@ -97,7 +97,7 @@ #endif #if _SQUID_SOLARIS_ -static char *password = NULL; /* Workaround for Solaris 2.6 brokenness */ +static char *password = nullptr; /* Workaround for Solaris 2.6 brokenness */ #endif extern "C" int password_conversation(int num_msg, PAM_CONV_FUNC_CONST_PARM struct pam_message **msg, @@ -160,7 +160,7 @@ static void usage(char *program) int main(int argc, char *argv[]) { - pam_handle_t *pamh = NULL; + pam_handle_t *pamh = nullptr; int retval = PAM_SUCCESS; char *user; char *password_buf; @@ -172,7 +172,7 @@ main(int argc, char *argv[]) int no_realm = 0; /* make standard output line buffered */ - setvbuf(stdout, NULL, _IOLBF, 0); + setvbuf(stdout, nullptr, _IOLBF, 0); while (1) { int ch = getopt(argc, argv, "1n:t:or"); @@ -258,7 +258,7 @@ start: if (retval != PAM_SUCCESS) { debug("WARNING: failed to release PAM authenticator\n"); } - pamh = NULL; + pamh = nullptr; } /* Initialize persistent PAM connection */ retval = pam_start(service, "squid@", &conv, &pamh); @@ -289,7 +289,7 @@ error: retval = PAM_SUCCESS; #if defined(PAM_AUTHTOK) if (ttl != 0 && pamh) { - retval = pam_set_item(pamh, PAM_AUTHTOK, NULL); + retval = pam_set_item(pamh, PAM_AUTHTOK, nullptr); } #endif if (pamh && (ttl == 0 || retval != PAM_SUCCESS)) { @@ -297,14 +297,14 @@ error: if (retval != PAM_SUCCESS) { debug("WARNING: failed to release PAM authenticator\n"); } - pamh = NULL; + pamh = nullptr; } } if (pamh) { retval = pam_end(pamh, retval); if (retval != PAM_SUCCESS) { - pamh = NULL; + pamh = nullptr; debug("ERROR: failed to release PAM authenticator\n"); } } diff --git a/src/auth/basic/SASL/basic_sasl_auth.cc b/src/auth/basic/SASL/basic_sasl_auth.cc index 10e0dbd9a4..02ea2f48d6 100644 --- a/src/auth/basic/SASL/basic_sasl_auth.cc +++ b/src/auth/basic/SASL/basic_sasl_auth.cc @@ -71,7 +71,7 @@ main(int, char *argv[]) } #if SASL_VERSION_MAJOR < 2 - rc = sasl_server_new( APP_NAME_SASL, NULL, NULL, NULL, 0, &conn ); + rc = sasl_server_new( APP_NAME_SASL, nullptr, nullptr, nullptr, 0, &conn ); #else rc = sasl_server_new( APP_NAME_SASL, nullptr, nullptr, nullptr, nullptr, nullptr, 0, &conn ); #endif @@ -114,8 +114,8 @@ main(int, char *argv[]) debug("errstr %s\n", errstr); } if ( rc != SASL_BADAUTH ) { - debug("ERROR: %d %s\n", rc, sasl_errstring(rc, NULL, NULL)); - SEND_ERR(sasl_errstring(rc, NULL, NULL)); + debug("ERROR: %d %s\n", rc, sasl_errstring(rc, nullptr, nullptr)); + SEND_ERR(sasl_errstring(rc, nullptr, nullptr)); } else #endif SEND_ERR(""); diff --git a/src/auth/basic/SMB_LM/msntauth.cc b/src/auth/basic/SMB_LM/msntauth.cc index 48cf2770b2..c211a73a89 100644 --- a/src/auth/basic/SMB_LM/msntauth.cc +++ b/src/auth/basic/SMB_LM/msntauth.cc @@ -65,7 +65,7 @@ validate_user(char *username, char *password) { for (domaincontrollers_t::iterator dc = domaincontrollers.begin(); dc != domaincontrollers.end(); ++dc) { //std::cerr << "testing against " << dc->server << std::endl; - const int rv = Valid_User(username, password, dc->server.c_str(), NULL, dc->domain.c_str()); + const int rv = Valid_User(username, password, dc->server.c_str(), nullptr, dc->domain.c_str()); //std::cerr << "check result: " << rv << std::endl; if (rv == NTV_NO_ERROR) return true; @@ -91,7 +91,7 @@ main(int argc, char **argv) int err = 0; openlog("basic_smb_lm_auth", LOG_PID, LOG_USER); - setbuf(stdout, NULL); + setbuf(stdout, nullptr); for (int j = 1; j < argc; ++j) { std::string arg = argv[j]; diff --git a/src/auth/basic/SMB_LM/valid.cc b/src/auth/basic/SMB_LM/valid.cc index 7760f5ccb2..1aaaea918e 100644 --- a/src/auth/basic/SMB_LM/valid.cc +++ b/src/auth/basic/SMB_LM/valid.cc @@ -37,7 +37,7 @@ Valid_User(char *USERNAME, char *PASSWORD, const char *SERVER, char *, const cha SMB_Handle_Type con; SMB_Init(); - con = SMB_Connect_Server(NULL, SERVER, DOMAIN); + con = SMB_Connect_Server(nullptr, SERVER, DOMAIN); if (con == NULL) { return (NTV_SERVER_ERROR); } @@ -45,7 +45,7 @@ Valid_User(char *USERNAME, char *PASSWORD, const char *SERVER, char *, const cha SMB_Discon(con, 0); return (NTV_PROTOCOL_ERROR); } - if (SMB_Logon_Server(con, USERNAME, PASSWORD, NULL, 0) < 0) { + if (SMB_Logon_Server(con, USERNAME, PASSWORD, nullptr, 0) < 0) { SMB_Discon(con, 0); return (NTV_LOGON_ERROR); } diff --git a/src/auth/basic/SSPI/basic_sspi_auth.cc b/src/auth/basic/SSPI/basic_sspi_auth.cc index 317fc9aa3c..2e14a14a72 100644 --- a/src/auth/basic/SSPI/basic_sspi_auth.cc +++ b/src/auth/basic/SSPI/basic_sspi_auth.cc @@ -132,8 +132,8 @@ main(int argc, char **argv) atexit(UnloadSecurityDll); /* initialize FDescs */ - setbuf(stdout, NULL); - setbuf(stderr, NULL); + setbuf(stdout, nullptr); + setbuf(stderr, nullptr); while (fgets(wstr, HELPER_INPUT_BUFFER, stdin) != NULL) { diff --git a/src/auth/basic/SSPI/valid.cc b/src/auth/basic/SSPI/valid.cc index e93afc2b4e..db52719d6d 100644 --- a/src/auth/basic/SSPI/valid.cc +++ b/src/auth/basic/SSPI/valid.cc @@ -64,7 +64,7 @@ Valid_Group(char *UserName, char *Group) WCHAR wszUserName[256]; // Unicode user name WCHAR wszGroup[256]; // Unicode Group - LPLOCALGROUP_USERS_INFO_0 pBuf = NULL; + LPLOCALGROUP_USERS_INFO_0 pBuf = nullptr; LPLOCALGROUP_USERS_INFO_0 pTmpBuf; DWORD dwLevel = 0; DWORD dwFlags = LG_INCLUDE_INDIRECT; @@ -91,7 +91,7 @@ Valid_Group(char *UserName, char *Group) * function should also return the names of the local * groups in which the user is indirectly a member. */ - nStatus = NetUserGetLocalGroups(NULL, + nStatus = NetUserGetLocalGroups(nullptr, wszUserName, dwLevel, dwFlags, @@ -130,7 +130,7 @@ Valid_User(char *UserName, char *Password, char *Group) int result = NTV_SERVER_ERROR; size_t i; char NTDomain[256]; - char *domain_qualify = NULL; + char *domain_qualify = nullptr; char DomainUser[256]; char User[256]; diff --git a/src/auth/digest/LDAP/ldap_backend.cc b/src/auth/digest/LDAP/ldap_backend.cc index b22fb0cbb1..2db3e8a806 100644 --- a/src/auth/digest/LDAP/ldap_backend.cc +++ b/src/auth/digest/LDAP/ldap_backend.cc @@ -41,7 +41,7 @@ typedef WINLDAPAPI ULONG(LDAPAPI * PFldap_start_tls_s) (IN PLDAP, OUT PULONG, OU typedef WINLDAPAPI ULONG(LDAPAPI * PFldap_start_tls_s) (IN PLDAP, OUT PULONG, OUT LDAPMessage **, IN PLDAPControlA *, IN PLDAPControlA *); #endif /* LDAP_UNICODE */ PFldap_start_tls_s Win32_ldap_start_tls_s; -#define ldap_start_tls_s(l,s,c) Win32_ldap_start_tls_s(l,NULL,NULL,s,c) +#define ldap_start_tls_s(l,s,c) Win32_ldap_start_tls_s(l, nullptr, nullptr,s,c) #endif /* LDAP_VERSION3 */ #else @@ -72,7 +72,7 @@ static int port = LDAP_PORT; static int strip_nt_domain = 0; static int aliasderef = LDAP_DEREF_NEVER; #if defined(NETSCAPE_SSL) -static char *sslpath = NULL; +static char *sslpath = nullptr; static int sslinit = 0; #endif static int connect_timeout = 0; @@ -334,7 +334,7 @@ ldapconnect(void) #endif #if NETSCAPE_SSL if (sslpath) { - if (!sslinit && (ldapssl_client_init(sslpath, NULL) != LDAP_SUCCESS)) { + if (!sslinit && (ldapssl_client_init(sslpath, nullptr) != LDAP_SUCCESS)) { fprintf(stderr, "\nUnable to initialise SSL with cert path %s\n", sslpath); exit(EXIT_FAILURE); @@ -377,7 +377,7 @@ ldapconnect(void) #else fprintf(stderr, "TLS not supported with your LDAP library\n"); ldap_unbind(ld); - ld = NULL; + ld = nullptr; #endif } #endif diff --git a/src/auth/digest/eDirectory/ldap_backend.cc b/src/auth/digest/eDirectory/ldap_backend.cc index e896501918..6b504a35e3 100644 --- a/src/auth/digest/eDirectory/ldap_backend.cc +++ b/src/auth/digest/eDirectory/ldap_backend.cc @@ -40,7 +40,7 @@ typedef WINLDAPAPI ULONG(LDAPAPI * PFldap_start_tls_s) (IN PLDAP, OUT PULONG, OU typedef WINLDAPAPI ULONG(LDAPAPI * PFldap_start_tls_s) (IN PLDAP, OUT PULONG, OUT LDAPMessage **, IN PLDAPControlA *, IN PLDAPControlA *); #endif /* LDAP_UNICODE */ PFldap_start_tls_s Win32_ldap_start_tls_s; -#define ldap_start_tls_s(l,s,c) Win32_ldap_start_tls_s(l,NULL,NULL,s,c) +#define ldap_start_tls_s(l,s,c) Win32_ldap_start_tls_s(l, nullptr, nullptr,s,c) #endif /* LDAP_VERSION3 */ #else @@ -72,7 +72,7 @@ static int strip_nt_domain = 0; static int edir_universal_passwd = 0; static int aliasderef = LDAP_DEREF_NEVER; #if defined(NETSCAPE_SSL) -static char *sslpath = NULL; +static char *sslpath = nullptr; static int sslinit = 0; #endif static int connect_timeout = 0; @@ -363,7 +363,7 @@ ldapconnect(void) #endif #if NETSCAPE_SSL if (sslpath) { - if (!sslinit && (ldapssl_client_init(sslpath, NULL) != LDAP_SUCCESS)) { + if (!sslinit && (ldapssl_client_init(sslpath, nullptr) != LDAP_SUCCESS)) { fprintf(stderr, "\nUnable to initialise SSL with cert path %s\n", sslpath); exit(EXIT_FAILURE); @@ -404,7 +404,7 @@ ldapconnect(void) #else fprintf(stderr, "TLS not supported with your LDAP library\n"); ldap_unbind(ld); - ld = NULL; + ld = nullptr; #endif } #endif diff --git a/src/auth/negotiate/SSPI/negotiate_sspi_auth.cc b/src/auth/negotiate/SSPI/negotiate_sspi_auth.cc index 677f4ec8ea..7ef9ce2aea 100644 --- a/src/auth/negotiate/SSPI/negotiate_sspi_auth.cc +++ b/src/auth/negotiate/SSPI/negotiate_sspi_auth.cc @@ -82,7 +82,7 @@ char *negotiate_check_auth(SSP_blobP auth, int auth_length); * -d enable debugging. * -v enable verbose Negotiate packet debugging. */ -char *my_program_name = NULL; +char *my_program_name = nullptr; void usage() @@ -242,12 +242,12 @@ manage_request() if (status == SSP_ERROR) { FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, + nullptr, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), /* Default language */ (LPTSTR) & ErrorMessage, 0, - NULL); + nullptr); if (ErrorMessage[strlen(ErrorMessage) - 1] == '\n') ErrorMessage[strlen(ErrorMessage) - 1] = '\0'; if (ErrorMessage[strlen(ErrorMessage) - 1] == '\r') @@ -313,8 +313,8 @@ main(int argc, char *argv[]) atexit(UnloadSecurityDll); /* initialize FDescs */ - setbuf(stdout, NULL); - setbuf(stderr, NULL); + setbuf(stdout, nullptr); + setbuf(stderr, nullptr); while (manage_request()) { /* everything is done within manage_request */ diff --git a/src/auth/negotiate/kerberos/negotiate_kerberos_auth.cc b/src/auth/negotiate/kerberos/negotiate_kerberos_auth.cc index 474c836b44..35ab76cde5 100644 --- a/src/auth/negotiate/kerberos/negotiate_kerberos_auth.cc +++ b/src/auth/negotiate/kerberos/negotiate_kerberos_auth.cc @@ -887,8 +887,8 @@ cleanup: int main(int argc, char *const argv[]) { - setbuf(stdout, NULL); - setbuf(stdin, NULL); + setbuf(stdout, nullptr); + setbuf(stdin, nullptr); char buf[MAX_AUTHTOKEN_LEN]; while (1) { if (fgets(buf, sizeof(buf) - 1, stdin) == NULL) { diff --git a/src/auth/ntlm/SMB_LM/ntlm_smb_lm_auth.cc b/src/auth/ntlm/SMB_LM/ntlm_smb_lm_auth.cc index 783e624558..b0a6fac84b 100644 --- a/src/auth/ntlm/SMB_LM/ntlm_smb_lm_auth.cc +++ b/src/auth/ntlm/SMB_LM/ntlm_smb_lm_auth.cc @@ -92,7 +92,7 @@ void manage_request(void); static unsigned char challenge[NTLM_NONCE_LEN]; static unsigned char lmencoded_empty_pass[ENCODED_PASS_LEN], ntencoded_empty_pass[ENCODED_PASS_LEN]; -SMB_Handle_Type handle = NULL; +SMB_Handle_Type handle = nullptr; int ntlm_errno; static char credentials[MAX_USERNAME_LEN+MAX_DOMAIN_LEN+2]; /* we can afford to waste */ static char my_domain[100], my_domain_controller[100]; @@ -101,7 +101,7 @@ static char errstr[1001]; char error_messages_buffer[NTLM_BLOB_BUFFER_SIZE]; #endif char load_balance = 0, protocol_pedantic = 0; -dc *controllers = NULL; +dc *controllers = nullptr; int numcontrollers = 0; dc *current_dc; char smb_error_buffer[1000]; @@ -113,7 +113,7 @@ dc_disconnect() { if (handle != NULL) SMB_Discon(handle, 0); - handle = NULL; + handle = nullptr; } int @@ -126,7 +126,7 @@ connectedp() int is_dc_ok(char *domain, char *domain_controller) { - SMB_Handle_Type h = SMB_Connect_Server(NULL, domain_controller, domain); + SMB_Handle_Type h = SMB_Connect_Server(nullptr, domain_controller, domain); if (h == NULL) return 0; SMB_Discon(h, 0); @@ -143,7 +143,7 @@ init_challenge(char *domain, char *domain_controller) return 0; } debug("Connecting to server %s domain %s\n", domain_controller, domain); - handle = SMB_Connect_Server(NULL, domain_controller, domain); + handle = SMB_Connect_Server(nullptr, domain_controller, domain); smberr = SMB_Get_Last_Error(); SMB_Get_Error_Msg(smberr, errstr, 1000); @@ -154,13 +154,13 @@ init_challenge(char *domain, char *domain_controller) if (SMB_Negotiate(handle, SMB_Prots) < 0) { /* An error */ debug("Error negotiating protocol with SMB Server\n"); SMB_Discon(handle, 0); - handle = NULL; + handle = nullptr; return 2; } if (handle->Security == 0) { /* share-level security, unusable */ debug("SMB Server uses share-level security .. we need user security.\n"); SMB_Discon(handle, 0); - handle = NULL; + handle = nullptr; return 3; } memcpy(challenge, handle->Encrypt_Key, NTLM_NONCE_LEN); @@ -180,7 +180,7 @@ make_challenge(char *domain, char *domain_controller) my_domain_controller[sizeof(my_domain_controller)-1] = '\0'; if (init_challenge(my_domain, my_domain_controller) > 0) { - return NULL; + return nullptr; } ntlm_challenge chal; @@ -198,7 +198,7 @@ make_challenge(char *domain, char *domain_controller) static char b64buf[HELPER_INPUT_BUFFER-10]; /* 10 for other line fields, delimiters and terminator */ if (base64_encode_len(len) < sizeof(b64buf)-1) { debug("base64 encoding of the token challenge will exceed %" PRIuSIZE " bytes", sizeof(b64buf)); - return NULL; + return nullptr; } struct base64_encode_ctx ctx; @@ -227,7 +227,7 @@ ntlm_check_auth(ntlm_authenticate * auth, int auth_length) if (handle == NULL) { /*if null we aren't connected, but it shouldn't happen */ debug("Weird, we've been disconnected\n"); ntlm_errno = NTLM_ERR_NOT_CONNECTED; - return NULL; + return nullptr; } /* debug("fetching domain\n"); */ @@ -235,12 +235,12 @@ ntlm_check_auth(ntlm_authenticate * auth, int auth_length) if (tmp.str == NULL || tmp.l == 0) { debug("No domain supplied. Returning no-auth\n"); ntlm_errno = NTLM_ERR_LOGON; - return NULL; + return nullptr; } if (tmp.l > MAX_DOMAIN_LEN) { debug("Domain string exceeds %d bytes, rejecting\n", MAX_DOMAIN_LEN); ntlm_errno = NTLM_ERR_LOGON; - return NULL; + return nullptr; } memcpy(domain, tmp.str, tmp.l); user = domain + tmp.l; @@ -252,12 +252,12 @@ ntlm_check_auth(ntlm_authenticate * auth, int auth_length) if (tmp.str == NULL || tmp.l == 0) { debug("No username supplied. Returning no-auth\n"); ntlm_errno = NTLM_ERR_LOGON; - return NULL; + return nullptr; } if (tmp.l > MAX_USERNAME_LEN) { debug("Username string exceeds %d bytes, rejecting\n", MAX_USERNAME_LEN); ntlm_errno = NTLM_ERR_LOGON; - return NULL; + return nullptr; } memcpy(user, tmp.str, tmp.l); *(user + tmp.l) = '\0'; @@ -273,7 +273,7 @@ ntlm_check_auth(ntlm_authenticate * auth, int auth_length) if (len != ENCODED_PASS_LEN || offset + len > auth_length || offset == 0) { debug("LM response: insane data (pkt-sz: %d, fetch len: %d, offset: %d)\n", auth_length, len, offset); ntlm_errno = NTLM_ERR_LOGON; - return NULL; + return nullptr; } tmp.str = (char *)packet + offset; tmp.l = len; @@ -281,7 +281,7 @@ ntlm_check_auth(ntlm_authenticate * auth, int auth_length) if (tmp.l > MAX_PASSWD_LEN) { debug("Password string exceeds %d bytes, rejecting\n", MAX_PASSWD_LEN); ntlm_errno = NTLM_ERR_LOGON; - return NULL; + return nullptr; } /* Authenticating against the NT response doesn't seem to work... in SMB LM helper. */ @@ -294,7 +294,7 @@ ntlm_check_auth(ntlm_authenticate * auth, int auth_length) fprintf(stderr,"Empty LM password supplied for user %s\\%s. " "No-auth\n",domain,user); ntlm_errno=NTLM_ERR_LOGON; - return NULL; + return nullptr; } /* still fetch the NT response and check validity against empty password */ @@ -308,7 +308,7 @@ ntlm_check_auth(ntlm_authenticate * auth, int auth_length) if (len != ENCODED_PASS_LEN || offset + len > auth_length || offset == 0) { debug("NT response: insane data (pkt-sz: %d, fetch len: %d, offset: %d)\n", auth_length, len, offset); ntlm_errno = NTLM_ERR_LOGON; - return NULL; + return nullptr; } tmp.str = (char *)packet + offset; tmp.l = len; @@ -318,7 +318,7 @@ ntlm_check_auth(ntlm_authenticate * auth, int auth_length) if (memcmp(tmp.str,lmencoded_empty_pass,ENCODED_PASS_LEN)==0) { fprintf(stderr,"ERROR: Empty NT password supplied for user %s\\%s. No-auth\n", domain, user); ntlm_errno = NTLM_ERR_LOGON; - return NULL; + return nullptr; } } } @@ -330,7 +330,7 @@ ntlm_check_auth(ntlm_authenticate * auth, int auth_length) if (rv != NTLM_ERR_NONE) { /* failed */ ntlm_errno = rv; - return NULL; + return nullptr; } *(user - 1) = '\\'; /* hack. Performing, but ugly. */ @@ -357,7 +357,7 @@ timeout_during_auth(int) * -l last-ditch-mode * domain\controller ... */ -char *my_program_name = NULL; +char *my_program_name = nullptr; void usage() @@ -379,7 +379,7 @@ void process_options(int argc, char *argv[]) { int opt, j, had_error = 0; - dc *new_dc = NULL, *last_dc = NULL; + dc *new_dc = nullptr, *last_dc = nullptr; while (-1 != (opt = getopt(argc, argv, "bfld"))) { switch (opt) { case 'b': @@ -459,7 +459,7 @@ const char * obtain_challenge() { int j = 0; - const char *ch = NULL; + const char *ch = nullptr; for (j = 0; j < numcontrollers; ++j) { debug("obtain_challenge: selecting %s\\%s (attempt #%d)\n", current_dc->domain, current_dc->controller, j + 1); @@ -489,7 +489,7 @@ obtain_challenge() current_dc = current_dc->next; } /* all DCs failed. */ - return NULL; + return nullptr; } void @@ -498,7 +498,7 @@ manage_request() ntlmhdr *fast_header; char buf[NTLM_BLOB_BUFFER_SIZE]; char decoded[NTLM_BLOB_BUFFER_SIZE]; - char *ch2, *cred = NULL; + char *ch2, *cred = nullptr; if (fgets(buf, NTLM_BLOB_BUFFER_SIZE, stdin) == NULL) { fprintf(stderr, "fgets() failed! dying..... errno=%d (%s)\n", errno, @@ -674,8 +674,8 @@ main(int argc, char *argv[]) debug("options processed OK\n"); /* initialize FDescs */ - setbuf(stdout, NULL); - setbuf(stderr, NULL); + setbuf(stdout, nullptr); + setbuf(stderr, nullptr); /* select the first domain controller we're going to use */ current_dc = controllers; diff --git a/src/auth/ntlm/SSPI/ntlm_sspi_auth.cc b/src/auth/ntlm/SSPI/ntlm_sspi_auth.cc index 8cc8d7d890..1949ea7be9 100644 --- a/src/auth/ntlm/SSPI/ntlm_sspi_auth.cc +++ b/src/auth/ntlm/SSPI/ntlm_sspi_auth.cc @@ -110,7 +110,7 @@ Valid_Group(char *UserName, char *Group) WCHAR wszUserName[UNLEN+1]; // Unicode user name WCHAR wszGroup[GNLEN+1]; // Unicode Group - LPLOCALGROUP_USERS_INFO_0 pBuf = NULL; + LPLOCALGROUP_USERS_INFO_0 pBuf = nullptr; LPLOCALGROUP_USERS_INFO_0 pTmpBuf; DWORD dwLevel = 0; DWORD dwFlags = LG_INCLUDE_INDIRECT; @@ -137,7 +137,7 @@ Valid_Group(char *UserName, char *Group) * function should also return the names of the local * groups in which the user is indirectly a member. */ - nStatus = NetUserGetLocalGroups(NULL, + nStatus = NetUserGetLocalGroups(nullptr, wszUserName, dwLevel, dwFlags, @@ -181,10 +181,10 @@ char * AllocStrFromLSAStr(LSA_UNICODE_STRING LsaStr) safe_free(target); target = (char *)xmalloc(len); if (target == NULL) - return NULL; + return nullptr; /* copy unicode buffer */ - WideCharToMultiByte(CP_ACP, 0, LsaStr.Buffer, LsaStr.Length, target, len, NULL, NULL ); + WideCharToMultiByte(CP_ACP, 0, LsaStr.Buffer, LsaStr.Length, target, len, nullptr, nullptr); /* add null termination */ target[len-1] = '\0'; @@ -200,7 +200,7 @@ char * GetDomainName(void) PPOLICY_PRIMARY_DOMAIN_INFO ppdiDomainInfo; PWKSTA_INFO_100 pwkiWorkstationInfo; DWORD netret; - char * DomainName = NULL; + char * DomainName = nullptr; /* * Always initialize the object attributes to all zeroes. @@ -214,7 +214,7 @@ char * GetDomainName(void) * The wki100_computername field contains a pointer to a UNICODE * string containing the local computer name. */ - netret = NetWkstaGetInfo(NULL, 100, (LPBYTE *)&pwkiWorkstationInfo); + netret = NetWkstaGetInfo(nullptr, 100, (LPBYTE *)&pwkiWorkstationInfo); if (netret == NERR_Success) { /* * We have the workstation name in: @@ -224,7 +224,7 @@ char * GetDomainName(void) * the LsaOpenPolicy function. */ status = LsaOpenPolicy( - NULL, + nullptr, &ObjectAttributes, GENERIC_READ | POLICY_VIEW_LOCAL_INFORMATION, &PolicyHandle @@ -263,7 +263,7 @@ char * GetDomainName(void) */ debug("Member of Domain %s\n",DomainName); } else { - DomainName = NULL; + DomainName = nullptr; } } } @@ -357,7 +357,7 @@ helperfail(const char *reason) -A can specify a Windows Local Group name allowed to authenticate. -D can specify a Windows Local Group name not allowed to authenticate. */ -char *my_program_name = NULL; +char *my_program_name = nullptr; void usage() @@ -591,12 +591,12 @@ manage_request() FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, + nullptr, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language (LPTSTR) &ErrorMessage, 0, - NULL); + nullptr); if (ErrorMessage[strlen(ErrorMessage) - 1] == '\n') ErrorMessage[strlen(ErrorMessage) - 1] = '\0'; if (ErrorMessage[strlen(ErrorMessage) - 1] == '\r') @@ -648,8 +648,8 @@ main(int argc, char *argv[]) atexit(UnloadSecurityDll); /* initialize FDescs */ - setbuf(stdout, NULL); - setbuf(stderr, NULL); + setbuf(stdout, nullptr); + setbuf(stderr, nullptr); while (manage_request()) { /* everything is done within manage_request */ diff --git a/src/cache_cf.cc b/src/cache_cf.cc index aa12ba54f0..445144eae2 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -320,7 +320,7 @@ parseManyConfigFiles(char* files, int depth) char* file = strwordtok(files, &saveptr); while (file != NULL) { error_count += parseOneConfigFile(file, depth); - file = strwordtok(NULL, &saveptr); + file = strwordtok(nullptr, &saveptr); } #endif /* HAVE_GLOB */ return error_count; diff --git a/src/cf_gen.cc b/src/cf_gen.cc index 07e1caf5c8..3ffe4da46c 100644 --- a/src/cf_gen.cc +++ b/src/cf_gen.cc @@ -515,7 +515,7 @@ gen_default(const EntryList &head, std::ostream &fout) } } - fout << " cfg_filename = NULL;" << std::endl << + fout << " cfg_filename = nullptr;" << std::endl << "}" << std::endl << std::endl; return rc; } @@ -555,7 +555,7 @@ gen_default_if_none(const EntryList &head, std::ostream &fout) fout << "#endif" << std::endl; } - fout << " cfg_filename = NULL;" << std::endl << + fout << " cfg_filename = nullptr;" << std::endl << "}" << std::endl << std::endl; } @@ -588,7 +588,7 @@ gen_default_postscriptum(const EntryList &head, std::ostream &fout) fout << "#endif" << std::endl; } - fout << " cfg_filename = NULL;" << std::endl << + fout << " cfg_filename = nullptr;" << std::endl << "}" << std::endl << std::endl; } @@ -615,7 +615,7 @@ Entry::genParseAlias(const std::string &aName, std::ostream &fout) const fout << "parse_" << type << "(&" << loc << (array_flag ? "[0]" : "") << ");"; } fout << std::endl; - fout << " cfg_directive = NULL;" << std::endl; + fout << " cfg_directive = nullptr;" << std::endl; if (ifdef.size()) { fout << "#else" << std::endl << @@ -651,7 +651,7 @@ gen_parse(const EntryList &head, std::ostream &fout) "\tchar\t*token;\n" "\tif ((token = strtok(buff, w_space)) == NULL) \n" "\t\treturn 1;\t/* ignore empty lines */\n" - "\tConfigParser::SetCfgLine(strtok(NULL, \"\"));\n"; + "\tConfigParser::SetCfgLine(strtok(nullptr, \"\"));\n"; for (const auto &e : head) e.genParse(fout); diff --git a/src/clientStream.cc b/src/clientStream.cc index 31b85ca02f..43a9ac6b9e 100644 --- a/src/clientStream.cc +++ b/src/clientStream.cc @@ -72,9 +72,9 @@ * \code mycontext = thisObject->data; - thisObject->data = NULL; + thisObject->data = nullptr; delete thisObject->head; - mycontext = NULL; + mycontext = nullptr; return; \endcode * diff --git a/src/client_side.cc b/src/client_side.cc index f488fc454c..7623ea4459 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -2120,7 +2120,7 @@ ConnStateData::abortChunkedRequestBody(const err_type error) repContext->http->uri, CachePeer, repContext->http->request, - inBuf, NULL); + inBuf, nullptr); context->pullData(); } else { // close or otherwise we may get stuck as nobody will notice the error? @@ -2817,7 +2817,7 @@ ConnStateData::getSslContextDone(Security::ContextPointer &ctx) debugs(33, 2, "Failed to generate TLS context for " << tlsConnectHostOrIp); } - // If generated ssl context = NULL, try to use static ssl context. + // If generated ssl context = nullptr, try to use static ssl context. if (!ctx) { if (!port->secure.staticContext) { debugs(83, DBG_IMPORTANT, "Closing " << clientConnection->remote << " as lacking TLS context"); diff --git a/src/client_side_request.cc b/src/client_side_request.cc index 8affab7b2f..235dfad2d6 100644 --- a/src/client_side_request.cc +++ b/src/client_side_request.cc @@ -532,7 +532,7 @@ ClientRequestContext::hostHeaderVerifyFailed(const char *A, const char *B) http->getConn() != nullptr && http->getConn()->getAuth() != nullptr ? http->getConn()->getAuth() : http->request->auth_user_request); #else - NULL); + nullptr); #endif node = (clientStreamNode *)http->client_stream.tail->data; clientStreamRead(node, http, node->readBuffer); diff --git a/src/comm/ConnOpener.cc b/src/comm/ConnOpener.cc index e960b46f5c..4473fe41a1 100644 --- a/src/comm/ConnOpener.cc +++ b/src/comm/ConnOpener.cc @@ -227,7 +227,7 @@ Comm::ConnOpener::closeFd() // "Select" state. It will not clear ours. XXX: It should always clear // because a callback may have been active but was called before comm_close // Update: we now do this in cleanFd() - // Comm::SetSelect(temporaryFd_, COMM_SELECT_WRITE, NULL, NULL, 0); + // Comm::SetSelect(temporaryFd_, COMM_SELECT_WRITE, nullptr, nullptr, 0); comm_close(temporaryFd_); temporaryFd_ = -1; diff --git a/src/comm/ModDevPoll.cc b/src/comm/ModDevPoll.cc index 5cb2e1a633..5d4841bcde 100644 --- a/src/comm/ModDevPoll.cc +++ b/src/comm/ModDevPoll.cc @@ -373,7 +373,7 @@ Comm::DoSelect(int msec) DEBUG_DEVPOLL ? 0 : 8, "Calling read handler on FD " << fd ); - F->read_handler = NULL; + F->read_handler = nullptr; hdl(fd, F->read_data); ++ statCounter.select_fds; } else { @@ -383,7 +383,7 @@ Comm::DoSelect(int msec) "no read handler for FD " << fd ); // remove interest since no handler exist for this event. - SetSelect(fd, COMM_SELECT_READ, NULL, NULL, 0); + SetSelect(fd, COMM_SELECT_READ, nullptr, nullptr, 0); } } @@ -395,7 +395,7 @@ Comm::DoSelect(int msec) DEBUG_DEVPOLL ? 0 : 8, "Calling write handler on FD " << fd ); - F->write_handler = NULL; + F->write_handler = nullptr; hdl(fd, F->write_data); ++ statCounter.select_fds; } else { @@ -405,7 +405,7 @@ Comm::DoSelect(int msec) "no write handler for FD " << fd ); // remove interest since no handler exist for this event. - SetSelect(fd, COMM_SELECT_WRITE, NULL, NULL, 0); + SetSelect(fd, COMM_SELECT_WRITE, nullptr, nullptr, 0); } } } diff --git a/src/comm/ModKqueue.cc b/src/comm/ModKqueue.cc index 4887214aca..9b71102389 100644 --- a/src/comm/ModKqueue.cc +++ b/src/comm/ModKqueue.cc @@ -101,7 +101,7 @@ kq_update_events(int fd, short filter, PF * handler) if (kqoff == kqmax - 1) { int ret; - ret = kevent(kq, kqlst, kqmax, NULL, 0, &zero_timespec); + ret = kevent(kq, kqlst, kqmax, nullptr, 0, &zero_timespec); /* jdc -- someone needs to do error checking... */ if (ret == -1) { @@ -236,7 +236,7 @@ Comm::DoSelect(int msec) for (i = 0; i < num; ++i) { int fd = (int) ke[i].ident; - PF *hdl = NULL; + PF *hdl = nullptr; fde *F = &fd_table[fd]; if (ke[i].flags & EV_ERROR) { @@ -247,14 +247,14 @@ Comm::DoSelect(int msec) if (ke[i].filter == EVFILT_READ || F->flags.read_pending) { if ((hdl = F->read_handler) != NULL) { - F->read_handler = NULL; + F->read_handler = nullptr; hdl(fd, F->read_data); } } if (ke[i].filter == EVFILT_WRITE) { if ((hdl = F->write_handler) != NULL) { - F->write_handler = NULL; + F->write_handler = nullptr; hdl(fd, F->write_data); } } diff --git a/src/comm/ModSelectWin32.cc b/src/comm/ModSelectWin32.cc index 5b20c44377..bee51b04b8 100644 --- a/src/comm/ModSelectWin32.cc +++ b/src/comm/ModSelectWin32.cc @@ -179,7 +179,7 @@ comm_check_incoming_select_handlers(int nfds, int *fds) int i; int fd; int maxfd = 0; - PF *hdl = NULL; + PF *hdl = nullptr; fd_set read_mask; fd_set write_mask; FD_ZERO(&read_mask); @@ -211,7 +211,7 @@ comm_check_incoming_select_handlers(int nfds, int *fds) ++ statCounter.syscalls.selects; - if (select(maxfd, &read_mask, &write_mask, NULL, &zero_tv) < 1) + if (select(maxfd, &read_mask, &write_mask, nullptr, &zero_tv) < 1) return incoming_sockets_accepted; for (i = 0; i < nfds; ++i) { @@ -219,8 +219,8 @@ comm_check_incoming_select_handlers(int nfds, int *fds) if (FD_ISSET(fd, &read_mask)) { if ((hdl = fd_table[fd].read_handler) != NULL) { - fd_table[fd].read_handler = NULL; - commUpdateReadBits(fd, NULL); + fd_table[fd].read_handler = nullptr; + commUpdateReadBits(fd, nullptr); hdl(fd, fd_table[fd].read_data); } else { debugs(5, DBG_IMPORTANT, "comm_select_incoming: FD " << fd << " NULL read handler"); @@ -229,8 +229,8 @@ comm_check_incoming_select_handlers(int nfds, int *fds) if (FD_ISSET(fd, &write_mask)) { if ((hdl = fd_table[fd].write_handler) != NULL) { - fd_table[fd].write_handler = NULL; - commUpdateWriteBits(fd, NULL); + fd_table[fd].write_handler = nullptr; + commUpdateWriteBits(fd, nullptr); hdl(fd, fd_table[fd].write_data); } else { debugs(5, DBG_IMPORTANT, "comm_select_incoming: FD " << fd << " NULL write handler"); @@ -318,7 +318,7 @@ Comm::DoSelect(int msec) fd_set pendingfds; fd_set writefds; - PF *hdl = NULL; + PF *hdl = nullptr; int fd; int maxfd; int num; @@ -474,8 +474,8 @@ Comm::DoSelect(int msec) debugs(5, 6, "comm_select: FD " << fd << " ready for reading"); if ((hdl = F->read_handler)) { - F->read_handler = NULL; - commUpdateReadBits(fd, NULL); + F->read_handler = nullptr; + commUpdateReadBits(fd, nullptr); hdl(fd, F->read_data); ++ statCounter.select_fds; @@ -504,8 +504,8 @@ Comm::DoSelect(int msec) F = &fd_table[fd]; if ((hdl = F->write_handler)) { - F->write_handler = NULL; - commUpdateWriteBits(fd, NULL); + F->write_handler = nullptr; + commUpdateWriteBits(fd, nullptr); hdl(fd, F->write_data); ++ statCounter.select_fds; } @@ -549,8 +549,8 @@ Comm::DoSelect(int msec) debugs(5, 6, "comm_select: FD " << fd << " ready for writing"); if ((hdl = F->write_handler)) { - F->write_handler = NULL; - commUpdateWriteBits(fd, NULL); + F->write_handler = nullptr; + commUpdateWriteBits(fd, nullptr); hdl(fd, F->write_data); ++ statCounter.select_fds; @@ -657,8 +657,8 @@ examine_select(fd_set * readfds, fd_set * writefds) fd_set write_x; struct timeval tv; - AsyncCall::Pointer ch = NULL; - fde *F = NULL; + AsyncCall::Pointer ch = nullptr; + fde *F = nullptr; struct stat sb; debugs(5, DBG_CRITICAL, "examine_select: Examining open file descriptors..."); @@ -700,10 +700,10 @@ examine_select(fd_set * readfds, fd_set * writefds) ScheduleCallHere(F->timeoutHandler); } - F->closeHandler = NULL; - F->timeoutHandler = NULL; - F->read_handler = NULL; - F->write_handler = NULL; + F->closeHandler = nullptr; + F->timeoutHandler = nullptr; + F->read_handler = nullptr; + F->write_handler = nullptr; FD_CLR(fd, readfds); FD_CLR(fd, writefds); } diff --git a/src/debug/debug.cc b/src/debug/debug.cc index 1a1cf92120..5aa1c6bf82 100644 --- a/src/debug/debug.cc +++ b/src/debug/debug.cc @@ -782,7 +782,7 @@ Debug::LogMessage(const Context &context) if (!dbg_mutex) { HMODULE krnl_lib = GetModuleHandle("Kernel32"); - PFInitializeCriticalSectionAndSpinCount InitializeCriticalSectionAndSpinCount = NULL; + PFInitializeCriticalSectionAndSpinCount InitializeCriticalSectionAndSpinCount = nullptr; if (krnl_lib) InitializeCriticalSectionAndSpinCount = diff --git a/src/dns_internal.cc b/src/dns_internal.cc index 4da9153c3e..319d344003 100644 --- a/src/dns_internal.cc +++ b/src/dns_internal.cc @@ -496,26 +496,26 @@ idnsParseWIN32SearchList(const char * Separator) DWORD Type = 0; DWORD Size = 0; LONG Result; - Result = RegQueryValueEx(hndKey, "Domain", NULL, &Type, NULL, &Size); + Result = RegQueryValueEx(hndKey, "Domain", nullptr, &Type, nullptr, &Size); if (Result == ERROR_SUCCESS && Size) { t = (char *) xmalloc(Size); - RegQueryValueEx(hndKey, "Domain", NULL, &Type, (LPBYTE) t, &Size); + RegQueryValueEx(hndKey, "Domain", nullptr, &Type, (LPBYTE) t, &Size); debugs(78, DBG_IMPORTANT, "Adding domain " << t << " from Registry"); idnsAddPathComponent(t); xfree(t); } - Result = RegQueryValueEx(hndKey, "SearchList", NULL, &Type, NULL, &Size); + Result = RegQueryValueEx(hndKey, "SearchList", nullptr, &Type, nullptr, &Size); if (Result == ERROR_SUCCESS && Size) { t = (char *) xmalloc(Size); - RegQueryValueEx(hndKey, "SearchList", NULL, &Type, (LPBYTE) t, &Size); + RegQueryValueEx(hndKey, "SearchList", nullptr, &Type, (LPBYTE) t, &Size); token = strtok(t, Separator); while (token) { idnsAddPathComponent(token); debugs(78, DBG_IMPORTANT, "Adding domain " << token << " from Registry"); - token = strtok(NULL, Separator); + token = strtok(nullptr, Separator); } xfree(t); } @@ -546,34 +546,34 @@ idnsParseWIN32Registry(void) DWORD Type = 0; DWORD Size = 0; LONG Result; - Result = RegQueryValueEx(hndKey, "DhcpNameServer", NULL, &Type, NULL, &Size); + Result = RegQueryValueEx(hndKey, "DhcpNameServer", nullptr, &Type, nullptr, &Size); if (Result == ERROR_SUCCESS && Size) { t = (char *) xmalloc(Size); - RegQueryValueEx(hndKey, "DhcpNameServer", NULL, &Type, (LPBYTE) t, &Size); + RegQueryValueEx(hndKey, "DhcpNameServer", nullptr, &Type, (LPBYTE) t, &Size); token = strtok(t, ", "); while (token) { idnsAddNameserver(token); result = true; debugs(78, DBG_IMPORTANT, "Adding DHCP nameserver " << token << " from Registry"); - token = strtok(NULL, ","); + token = strtok(nullptr, ","); } xfree(t); } - Result = RegQueryValueEx(hndKey, "NameServer", NULL, &Type, NULL, &Size); + Result = RegQueryValueEx(hndKey, "NameServer", nullptr, &Type, nullptr, &Size); if (Result == ERROR_SUCCESS && Size) { t = (char *) xmalloc(Size); - RegQueryValueEx(hndKey, "NameServer", NULL, &Type, (LPBYTE) t, &Size); + RegQueryValueEx(hndKey, "NameServer", nullptr, &Type, (LPBYTE) t, &Size); token = strtok(t, ", "); while (token) { debugs(78, DBG_IMPORTANT, "Adding nameserver " << token << " from Registry"); idnsAddNameserver(token); result = true; - token = strtok(NULL, ", "); + token = strtok(nullptr, ", "); } xfree(t); } @@ -603,12 +603,12 @@ idnsParseWIN32Registry(void) char *keyname; FILETIME ftLastWriteTime; - if (RegQueryInfoKey(hndKey, NULL, NULL, NULL, &InterfacesCount, &MaxSubkeyLen, NULL, NULL, NULL, NULL, NULL, NULL) == ERROR_SUCCESS) { + if (RegQueryInfoKey(hndKey, nullptr, nullptr, nullptr, &InterfacesCount, &MaxSubkeyLen, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr) == ERROR_SUCCESS) { keyname = (char *) xmalloc(++MaxSubkeyLen); for (i = 0; i < (int) InterfacesCount; ++i) { DWORD j; j = MaxSubkeyLen; - if (RegEnumKeyEx(hndKey, i, keyname, &j, NULL, NULL, NULL, &ftLastWriteTime) == ERROR_SUCCESS) { + if (RegEnumKeyEx(hndKey, i, keyname, &j, nullptr, nullptr, nullptr, &ftLastWriteTime) == ERROR_SUCCESS) { char *newkeyname; newkeyname = (char *) xmalloc(sizeof(REG_TCPIP_PARA_INTERFACES) + j + 2); strcpy(newkeyname, REG_TCPIP_PARA_INTERFACES); @@ -618,30 +618,30 @@ idnsParseWIN32Registry(void) DWORD Type = 0; DWORD Size = 0; LONG Result; - Result = RegQueryValueEx(hndKey2, "DhcpNameServer", NULL, &Type, NULL, &Size); + Result = RegQueryValueEx(hndKey2, "DhcpNameServer", nullptr, &Type, nullptr, &Size); if (Result == ERROR_SUCCESS && Size) { t = (char *) xmalloc(Size); - RegQueryValueEx(hndKey2, "DhcpNameServer", NULL, &Type, (LPBYTE)t, &Size); + RegQueryValueEx(hndKey2, "DhcpNameServer", nullptr, &Type, (LPBYTE)t, &Size); token = strtok(t, ", "); while (token) { debugs(78, DBG_IMPORTANT, "Adding DHCP nameserver " << token << " from Registry"); idnsAddNameserver(token); result = true; - token = strtok(NULL, ", "); + token = strtok(nullptr, ", "); } xfree(t); } - Result = RegQueryValueEx(hndKey2, "NameServer", NULL, &Type, NULL, &Size); + Result = RegQueryValueEx(hndKey2, "NameServer", nullptr, &Type, nullptr, &Size); if (Result == ERROR_SUCCESS && Size) { t = (char *) xmalloc(Size); - RegQueryValueEx(hndKey2, "NameServer", NULL, &Type, (LPBYTE)t, &Size); + RegQueryValueEx(hndKey2, "NameServer", nullptr, &Type, (LPBYTE)t, &Size); token = strtok(t, ", "); while (token) { debugs(78, DBG_IMPORTANT, "Adding nameserver " << token << " from Registry"); idnsAddNameserver(token); result = true; - token = strtok(NULL, ", "); + token = strtok(nullptr, ", "); } xfree(t); @@ -675,18 +675,18 @@ idnsParseWIN32Registry(void) DWORD Type = 0; DWORD Size = 0; LONG Result; - Result = RegQueryValueEx(hndKey, "NameServer", NULL, &Type, NULL, &Size); + Result = RegQueryValueEx(hndKey, "NameServer", nullptr, &Type, nullptr, &Size); if (Result == ERROR_SUCCESS && Size) { t = (char *) xmalloc(Size); - RegQueryValueEx(hndKey, "NameServer", NULL, &Type, (LPBYTE) t, &Size); + RegQueryValueEx(hndKey, "NameServer", nullptr, &Type, (LPBYTE) t, &Size); token = strtok(t, ", "); while (token) { debugs(78, DBG_IMPORTANT, "Adding nameserver " << token << " from Registry"); idnsAddNameserver(token); result = true; - token = strtok(NULL, ", "); + token = strtok(nullptr, ", "); } xfree(t); } diff --git a/src/eui/Eui48.cc b/src/eui/Eui48.cc index 943fd8a6f7..b2ab2fda5d 100644 --- a/src/eui/Eui48.cc +++ b/src/eui/Eui48.cc @@ -377,7 +377,7 @@ Eui::Eui48::lookup(const Ip::Address &c) mib[5] = RTF_LLINFO; #endif - if (sysctl(mib, 6, NULL, &needed, NULL, 0) < 0) { + if (sysctl(mib, 6, nullptr, &needed, nullptr, 0) < 0) { debugs(28, DBG_CRITICAL, "ERROR: Cannot estimate ARP table size!"); clear(); return false; @@ -389,7 +389,7 @@ Eui::Eui48::lookup(const Ip::Address &c) return false; } - if (sysctl(mib, 6, buf, &needed, NULL, 0) < 0) { + if (sysctl(mib, 6, buf, &needed, nullptr, 0) < 0) { debugs(28, DBG_CRITICAL, "ERROR: Cannot retrieve ARP table!"); xfree(buf); clear(); @@ -446,7 +446,7 @@ Eui::Eui48::lookup(const Ip::Address &c) DWORD ipNetTableLen = 0; - PMIB_IPNETTABLE NetTable = NULL; + PMIB_IPNETTABLE NetTable = nullptr; DWORD i; diff --git a/src/fs_io.cc b/src/fs_io.cc index b5884923b8..eaf0dc1a42 100644 --- a/src/fs_io.cc +++ b/src/fs_io.cc @@ -89,7 +89,7 @@ file_close(int fd) * open files, so we won't allow delayed close. */ while (!diskWriteIsComplete(fd)) - diskHandleWrite(fd, NULL); + diskHandleWrite(fd, nullptr); #else F->flags.close_request = true; debugs(6, 2, "file_close: FD " << fd << ", delaying close"); diff --git a/src/http/url_rewriters/LFS/rredir.cc b/src/http/url_rewriters/LFS/rredir.cc index 8dceab7e5b..cd6d1e1d0d 100644 --- a/src/http/url_rewriters/LFS/rredir.cc +++ b/src/http/url_rewriters/LFS/rredir.cc @@ -59,7 +59,7 @@ main() int tlu = 0; /* make standard output line buffered */ - if (setvbuf(stdout, NULL, _IOLBF, 0) != 0) + if (setvbuf(stdout, nullptr, _IOLBF, 0) != 0) exit(EXIT_FAILURE); /* speed up the access() calls below */ diff --git a/src/icmp/Icmp6.cc b/src/icmp/Icmp6.cc index d9d69b9906..ebf8599d01 100644 --- a/src/icmp/Icmp6.cc +++ b/src/icmp/Icmp6.cc @@ -197,7 +197,7 @@ Icmp6::Recv(void) { int n; struct addrinfo *from = nullptr; -// struct ip6_hdr *ip = NULL; +// struct ip6_hdr *ip = nullptr; static char *pkt = nullptr; struct icmp6_hdr *icmp6header = nullptr; icmpEchoData *echo = nullptr; diff --git a/src/icmp/net_db.cc b/src/icmp/net_db.cc index 30865aaf34..cf38434ce2 100644 --- a/src/icmp/net_db.cc +++ b/src/icmp/net_db.cc @@ -1245,7 +1245,7 @@ netdbBinaryExchange(StoreEntry * s) memFree(buf, MEM_4K_BUF); #else - reply->setHeaders(Http::scBadRequest, "Bad Request", NULL, -1, squid_curtime, -2); + reply->setHeaders(Http::scBadRequest, "Bad Request", nullptr, -1, squid_curtime, -2); s->replaceHttpReply(reply); storeAppendPrintf(s, "NETDB support not compiled into this Squid cache.\n"); #endif diff --git a/src/ipc/mem/Segment.cc b/src/ipc/mem/Segment.cc index d71cb54a43..f73e00016e 100644 --- a/src/ipc/mem/Segment.cc +++ b/src/ipc/mem/Segment.cc @@ -312,7 +312,7 @@ Ipc::Mem::Segment::~Segment() { if (doUnlink) { delete [] static_cast(theMem); - theMem = NULL; + theMem = nullptr; Segments.erase(theName); debugs(54, 3, "unlinked " << theName << " fake segment"); } diff --git a/src/ipc_win32.cc b/src/ipc_win32.cc index f7416288b1..067f39cbf4 100644 --- a/src/ipc_win32.cc +++ b/src/ipc_win32.cc @@ -103,8 +103,8 @@ ipcCreate(int type, const char *prog, const char *const args[], const char *name pid_t pid; Ip::Address tmp_addr; - struct addrinfo *aiCS = NULL; - struct addrinfo *aiPS = NULL; + struct addrinfo *aiCS = nullptr; + struct addrinfo *aiPS = nullptr; int crfd = -1; int prfd = -1; @@ -121,7 +121,7 @@ ipcCreate(int type, const char *prog, const char *const args[], const char *name *wfd = -1; if (hIpc) - *hIpc = NULL; + *hIpc = nullptr; if (WIN32_OS_version != _WIN_OS_WINNT) { getsockopt(INVALID_SOCKET, SOL_SOCKET, SO_OPENTYPE, (char *) &opt, &optlen); @@ -239,7 +239,7 @@ ipcCreate(int type, const char *prog, const char *const args[], const char *name params.args = (char **) args; - thread = _beginthreadex(NULL, 0, ipc_thread_1, ¶ms, 0, NULL); + thread = _beginthreadex(nullptr, 0, ipc_thread_1, ¶ms, 0, nullptr); if (thread == 0) { int xerrno = errno; @@ -350,7 +350,7 @@ ipc_thread_1(void *in_params) int t1, t2, t3, retval = -1; int p2c[2] = {-1, -1}; int c2p[2] = {-1, -1}; - HANDLE hProcess = NULL, thread = NULL; + HANDLE hProcess = nullptr, thread = nullptr; pid_t pid = -1; struct thread_params thread_params; @@ -361,12 +361,12 @@ ipc_thread_1(void *in_params) PROCESS_INFORMATION pi; long F; int prfd_ipc = -1, pwfd_ipc = -1, crfd_ipc = -1, cwfd_ipc = -1; - char *prog = NULL, *buf1 = NULL; + char *prog = nullptr, *buf1 = nullptr; Ip::Address PS_ipc; Ip::Address CS_ipc; - struct addrinfo *aiPS_ipc = NULL; - struct addrinfo *aiCS_ipc = NULL; + struct addrinfo *aiPS_ipc = nullptr; + struct addrinfo *aiCS_ipc = nullptr; struct ipc_params *params = (struct ipc_params *) in_params; int type = params->type; @@ -393,7 +393,7 @@ ipc_thread_1(void *in_params) if (type == IPC_TCP_SOCKET) { debugs(54, 3, "ipcCreate: calling accept on FD " << crfd); - if ((fd = accept(crfd, NULL, NULL)) < 0) { + if ((fd = accept(crfd, nullptr, nullptr)) < 0) { int xerrno = errno; debugs(54, DBG_CRITICAL, "ipcCreate: FD " << crfd << " accept: " << xstrerr(xerrno)); goto cleanup; @@ -557,7 +557,7 @@ ipc_thread_1(void *in_params) do { strcat(buf1, str); strcat(buf1, " "); - } while ((str = strtok(NULL, w_space))); + } while ((str = strtok(nullptr, w_space))); x = 1; @@ -567,8 +567,8 @@ ipc_thread_1(void *in_params) strcat(buf1, " "); } - if (CreateProcess(buf1 + 4096, buf1, NULL, NULL, TRUE, CREATE_NO_WINDOW, - NULL, NULL, &si, &pi)) { + if (CreateProcess(buf1 + 4096, buf1, nullptr, nullptr, TRUE, CREATE_NO_WINDOW, + nullptr, nullptr, &si, &pi)) { pid = pi.dwProcessId; hProcess = pi.hProcess; } else { @@ -687,7 +687,7 @@ ipc_thread_1(void *in_params) else thread_params.rfd = prfd_ipc; - thread = (HANDLE)_beginthreadex(NULL, 0, ipc_thread_2, &thread_params, 0, NULL); + thread = (HANDLE)_beginthreadex(nullptr, 0, ipc_thread_2, &thread_params, 0, nullptr); if (!thread) { int xerrno = errno; diff --git a/src/log/access_log.cc b/src/log/access_log.cc index b268a379f1..5986a2d060 100644 --- a/src/log/access_log.cc +++ b/src/log/access_log.cc @@ -44,7 +44,7 @@ #include #if HEADERS_LOG -static Logfile *headerslog = NULL; +static Logfile *headerslog = nullptr; #endif #if MULTICAST_MISS_STREAM @@ -214,7 +214,7 @@ accessLogClose(void) logfileClose(headerslog); - headerslog = NULL; + headerslog = nullptr; #endif } @@ -544,7 +544,7 @@ headersLog(int cs, int pq, const HttpRequestMethod& method, void *data) if (0 == pq) { /* reply */ rep = data; - req = NULL; + req = nullptr; magic = 0x0050; hmask = rep->header.mask; @@ -553,7 +553,7 @@ headersLog(int cs, int pq, const HttpRequestMethod& method, void *data) } else { /* request */ req = data; - rep = NULL; + rep = nullptr; magic = 0x0051; hmask = req->header.mask; diff --git a/src/main.cc b/src/main.cc index f557237193..fc0bd0d686 100644 --- a/src/main.cc +++ b/src/main.cc @@ -1877,7 +1877,7 @@ watch_child(const CommandLine &masterCommand) #ifdef TIOCNOTTY if ((i = open("/dev/tty", O_RDWR | O_TEXT)) >= 0) { - ioctl(i, TIOCNOTTY, NULL); + ioctl(i, TIOCNOTTY, nullptr); close(i); } diff --git a/src/pconn.cc b/src/pconn.cc index 7db11481c2..2dfcda1609 100644 --- a/src/pconn.cc +++ b/src/pconn.cc @@ -25,7 +25,7 @@ #define PCONN_FDS_SZ 8 /* pconn set size, increase for better memcache hit rate */ -//TODO: re-attach to MemPools. WAS: static Mem::Allocator *pconn_fds_pool = NULL; +//TODO: re-attach to MemPools. WAS: static Mem::Allocator *pconn_fds_pool = nullptr; PconnModule * PconnModule::instance = nullptr; CBDATA_CLASS_INIT(IdleConnList); diff --git a/src/peer_digest.cc b/src/peer_digest.cc index e8648c6d5a..d0d0bced81 100644 --- a/src/peer_digest.cc +++ b/src/peer_digest.cc @@ -540,7 +540,7 @@ peerDigestFetchReply(void *data, char *buf, ssize_t size) /* preserve request -- we need its size to update counters */ /* requestUnlink(r); */ - /* fetch->entry->mem_obj->request = NULL; */ + /* fetch->entry->mem_obj->request = nullptr; */ } else if (status == Http::scOkay) { /* get rid of old entry if any */ diff --git a/src/peer_proxy_negotiate_auth.cc b/src/peer_proxy_negotiate_auth.cc index f97bfba318..f5d2f5dd14 100644 --- a/src/peer_proxy_negotiate_auth.cc +++ b/src/peer_proxy_negotiate_auth.cc @@ -75,7 +75,7 @@ gss_OID gss_mech_spnego = &_gss_mech_spnego; #if USE_IBM_KERBEROS #include const char *KRB5_CALLCONV error_message(long code) { - char *msg = NULL; + char *msg = nullptr; krb5_svc_get_msg(code, &msg); return msg; } @@ -251,7 +251,7 @@ restart: code = krb5_make_principal(kparam.context, &creds2.server, (krb5_const_realm)&client_realm, KRB5_TGS_NAME, - (krb5_const_realm)&client_realm, NULL); + (krb5_const_realm)&client_realm, nullptr); if (code) { debugs(11, 5, "Error while getting krbtgt principal : " << @@ -259,8 +259,8 @@ restart: return (1); } code = - krb5_get_kdc_cred(kparam.context, kparam.cc, flags, NULL, - NULL, &creds2, &creds); + krb5_get_kdc_cred(kparam.context, kparam.cc, flags, nullptr, + nullptr, &creds2, &creds); krb5_free_creds(kparam.context, &creds2); #endif if (code) { @@ -418,7 +418,7 @@ restart: krb5_get_init_creds_opt_set_renew_life(&options, rlife); code = krb5_get_init_creds_keytab(kparam.context, creds, principal, - keytab, 0, NULL, &options); + keytab, 0, nullptr, &options); #endif if (code) { debugs(11, 5, diff --git a/src/redirect.cc b/src/redirect.cc index 49c0d70210..d1d284be2a 100644 --- a/src/redirect.cc +++ b/src/redirect.cc @@ -267,7 +267,7 @@ constructHelperQuery(const char *name, helper *hlp, HLPCB *replyHandler, ClientH http->getConn() != nullptr && http->getConn()->getAuth() != nullptr ? http->getConn()->getAuth() : http->request->auth_user_request); #else - NULL); + nullptr); #endif node = (clientStreamNode *)http->client_stream.tail->data; diff --git a/src/security/cert_generators/file/certificate_db.cc b/src/security/cert_generators/file/certificate_db.cc index 9bf472dddd..439dad7237 100644 --- a/src/security/cert_generators/file/certificate_db.cc +++ b/src/security/cert_generators/file/certificate_db.cc @@ -49,7 +49,7 @@ void Ssl::Lock::lock() { #if _SQUID_WINDOWS_ - hFile = CreateFile(TEXT(filename.c_str()), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + hFile = CreateFile(TEXT(filename.c_str()), GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); if (hFile == INVALID_HANDLE_VALUE) #else fd = open(filename.c_str(), O_RDWR); diff --git a/src/ssl/bio.cc b/src/ssl/bio.cc index 763978ac93..0791b8b6c8 100644 --- a/src/ssl/bio.cc +++ b/src/ssl/bio.cc @@ -50,7 +50,7 @@ static BIO_METHOD SquidMethods = { squid_bio_write, squid_bio_read, squid_bio_puts, - NULL, // squid_bio_gets not supported + nullptr, // squid_bio_gets not supported squid_bio_ctrl, squid_bio_create, squid_bio_destroy, diff --git a/src/ssl/support.cc b/src/ssl/support.cc index 28e88136d8..89411e4720 100644 --- a/src/ssl/support.cc +++ b/src/ssl/support.cc @@ -148,17 +148,17 @@ ssl_temp_rsa_cb(SSL *, int, int keylen) default: debugs(83, DBG_IMPORTANT, "ERROR: ssl_temp_rsa_cb: Unexpected key length " << keylen); - return NULL; + return nullptr; } if (rsa == NULL) { debugs(83, DBG_IMPORTANT, "ERROR: ssl_temp_rsa_cb: Failed to generate key " << keylen); - return NULL; + return nullptr; } if (newkey) { if (Debug::Enabled(83, 5)) - PEM_write_RSAPrivateKey(debug_log, rsa, NULL, NULL, 0, NULL, NULL); + PEM_write_RSAPrivateKey(debug_log, rsa, nullptr, nullptr, 0, nullptr, nullptr); debugs(83, DBG_IMPORTANT, "Generated ephemeral RSA key of length " << keylen); } @@ -1052,7 +1052,7 @@ Ssl::verifySslCertificate(const Security::ContextPointer &ctx, CertificateProper X509 ***pCert = (X509 ***)ctx->cert; X509 * cert = pCert && *pCert ? **pCert : NULL; #elif SQUID_SSLGETCERTIFICATE_BUGGY - X509 * cert = NULL; + X509 * cert = nullptr; assert(0); #else // Temporary ssl for getting X509 certificate from SSL_CTX. diff --git a/src/store_client.cc b/src/store_client.cc index b213c89d34..f8024ccc11 100644 --- a/src/store_client.cc +++ b/src/store_client.cc @@ -95,7 +95,7 @@ static store_client * storeClientListSearch(const MemObject * mem, void *data) { dlink_node *node; - store_client *sc = NULL; + store_client *sc = nullptr; for (node = mem->clients.head; node; node = node->next) { sc = node->data; @@ -104,7 +104,7 @@ storeClientListSearch(const MemObject * mem, void *data) return sc; } - return NULL; + return nullptr; } int diff --git a/src/store_digest.cc b/src/store_digest.cc index 6b1b77a321..d5b1c83dc3 100644 --- a/src/store_digest.cc +++ b/src/store_digest.cc @@ -142,7 +142,7 @@ storeDigestInit(void) sd_state = StoreDigestState(); #else - store_digest = NULL; + store_digest = nullptr; debugs(71, 3, "Local cache digest is 'off'"); #endif } diff --git a/src/test_cache_digest.cc b/src/test_cache_digest.cc index b00eaf0765..d350709cf9 100644 --- a/src/test_cache_digest.cc +++ b/src/test_cache_digest.cc @@ -114,7 +114,7 @@ fileIteratorCreate(const char *fname, FI_READER reader) if (!fi->file) { fprintf(stderr, "cannot open %s: %s\n", fname, strerror(errno)); - return NULL; + return nullptr; } else fprintf(stderr, "opened %s\n", fname); @@ -218,7 +218,7 @@ cacheCreate(const char *name) static void cacheDestroy(Cache * cache) { - CacheEntry *e = NULL; + CacheEntry *e = nullptr; hash_table *hash; assert(cache); hash = cache->hash; @@ -241,7 +241,7 @@ cacheDestroy(Cache * cache) static void cacheResetDigest(Cache * cache) { - CacheEntry *e = NULL; + CacheEntry *e = nullptr; hash_table *hash; struct timeval t_start, t_end; @@ -257,7 +257,7 @@ cacheResetDigest(Cache * cache) if (!cache->count) return; - gettimeofday(&t_start, NULL); + gettimeofday(&t_start, nullptr); hash_first(hash); @@ -265,7 +265,7 @@ cacheResetDigest(Cache * cache) cache->digest->add(e->key); } - gettimeofday(&t_end, NULL); + gettimeofday(&t_end, nullptr); assert(cache->digest->count == cache->count); fprintf(stderr, "%s: init-ed digest with %d entries\n", cache->name, cache->digest->count); @@ -274,12 +274,12 @@ cacheResetDigest(Cache * cache) tvSubDsec(t_start, t_end), (double) 1e6 * tvSubDsec(t_start, t_end) / cache->count); /* check how long it takes to traverse the hash */ - gettimeofday(&t_start, NULL); + gettimeofday(&t_start, nullptr); hash_first(hash); for (e = (CacheEntry *)hash_next(hash); e; e = (CacheEntry *)hash_next(hash)) {} - gettimeofday(&t_end, NULL); + gettimeofday(&t_end, nullptr); fprintf(stderr, "%s: hash scan took: %f sec, %f sec/M\n", cache->name, tvSubDsec(t_start, t_end), @@ -380,7 +380,7 @@ accessLogReader(FileIterator * fi) char *url; char *method; HttpRequestMethod method_id = METHOD_NONE; - char *hier = NULL; + char *hier = nullptr; assert(fi); @@ -524,7 +524,7 @@ usage(const char *prg_name) int main(int argc, char *argv[]) { - FileIterator **fis = NULL; + FileIterator **fis = nullptr; const int fi_count = argc - 1; int active_fi_count = 0; time_t ready_time; diff --git a/src/tests/stub_wordlist.cc b/src/tests/stub_wordlist.cc index ff8a99c363..21b8a22f3c 100644 --- a/src/tests/stub_wordlist.cc +++ b/src/tests/stub_wordlist.cc @@ -12,6 +12,6 @@ #define STUB_API "wordlist.cc" #include "tests/STUB.h" -const char *wordlistAdd(wordlist **, const char *) STUB_RETVAL(NULL) +const char *wordlistAdd(wordlist **, const char *) STUB_RETVAL(nullptr) void wordlistDestroy(wordlist **) STUB diff --git a/src/tests/testAuth.cc b/src/tests/testAuth.cc index b0e4e74012..f4de96caa2 100644 --- a/src/tests/testAuth.cc +++ b/src/tests/testAuth.cc @@ -61,7 +61,7 @@ find_proxy_auth(char const *type) return proxy_auths[count][1]; } - return NULL; + return nullptr; } static @@ -77,7 +77,7 @@ getConfig(char const *type_str) Auth::Scheme::Pointer theScheme = Auth::Scheme::Find(type_str); if (theScheme == NULL) { - return NULL; + return nullptr; //fatalf("Unknown authentication scheme '%s'.\n", type_str); } @@ -98,7 +98,7 @@ setup_scheme(Auth::Config *scheme, char const **params, unsigned param_count) for (unsigned position=0; position < param_count; ++position) { char *param_str=xstrdup(params[position]); strtok(param_str, w_space); - ConfigParser::SetCfgLine(strtok(NULL, "")); + ConfigParser::SetCfgLine(strtok(nullptr, "")); scheme->parse(scheme, config.size(), param_str); } } diff --git a/src/tools.cc b/src/tools.cc index 2062888cd0..3e2cdd09c1 100644 --- a/src/tools.cc +++ b/src/tools.cc @@ -137,7 +137,7 @@ mail_warranty(void) char *filename; // XXX tempnam is obsolete since POSIX.2008-1 // tmpfile is not an option, we want the created files to stick around - if ((filename = tempnam(NULL, APP_SHORTNAME)) == NULL || + if ((filename = tempnam(nullptr, APP_SHORTNAME)) == NULL || (fp = fopen(filename, "w")) == NULL) { umask(prev_umask); return; diff --git a/src/unlinkd.cc b/src/unlinkd.cc index 1d5275a456..e96a95b077 100644 --- a/src/unlinkd.cc +++ b/src/unlinkd.cc @@ -74,7 +74,7 @@ unlinkdUnlink(const char *path) FD_SET(unlinkd_rfd, &R); to.tv_sec = 0; to.tv_usec = 100000; - select(unlinkd_rfd + 1, &R, NULL, NULL, &to); + select(unlinkd_rfd + 1, &R, nullptr, nullptr, &to); #endif } diff --git a/src/win32.cc b/src/win32.cc index 10983b11e3..ff23fe7a68 100644 --- a/src/win32.cc +++ b/src/win32.cc @@ -25,7 +25,7 @@ SQUIDCEXTERN LPCRITICAL_SECTION dbg_mutex; void WIN32_ExceptionHandlerCleanup(void); -static LPTOP_LEVEL_EXCEPTION_FILTER Win32_Old_ExceptionHandler = NULL; +static LPTOP_LEVEL_EXCEPTION_FILTER Win32_Old_ExceptionHandler = nullptr; int Win32__WSAFDIsSet(int fd, fd_set FAR * set) diff --git a/tools/cachemgr.cc b/tools/cachemgr.cc index 1a002386a0..9ab8d8c7ff 100644 --- a/tools/cachemgr.cc +++ b/tools/cachemgr.cc @@ -589,7 +589,7 @@ read_reply(int s, cachemgr_request * req) #if _SQUID_WINDOWS_ int reply; - char *tmpfile = tempnam(NULL, "tmp0000"); + char *tmpfile = tempnam(nullptr, "tmp0000"); FILE *fp = fopen(tmpfile, "w+"); #else diff --git a/tools/squidclient/Transport.cc b/tools/squidclient/Transport.cc index 80205083c8..8f5a50639c 100644 --- a/tools/squidclient/Transport.cc +++ b/tools/squidclient/Transport.cc @@ -431,7 +431,7 @@ doTlsHandshake(const char *type) static bool loadTlsParameters() { - const char *err = NULL; + const char *err = nullptr; int x; if ((x = gnutls_priority_set_direct(Transport::Config.session, Transport::Config.params, &err)) != GNUTLS_E_SUCCESS) { if (x == GNUTLS_E_INVALID_REQUEST) diff --git a/tools/squidclient/squidclient.cc b/tools/squidclient/squidclient.cc index 71b5f0cce5..bdb7c8f7fd 100644 --- a/tools/squidclient/squidclient.cc +++ b/tools/squidclient/squidclient.cc @@ -75,7 +75,7 @@ int total_bytes = 0; /* Bug 3854: AIX 6.1 tries to link in this fde.h global symbol * despite squidclient not using any of the fd_* code. */ -fde *fde::Table = NULL; +fde *fde::Table = nullptr; #endif #if _SQUID_WINDOWS_ -- 2.47.2