]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Maintenance: replace most NULL with nullptr (#1402)
authorAmos Jeffries <yadij@users.noreply.github.com>
Sun, 9 Jul 2023 17:15:28 +0000 (17:15 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Mon, 10 Jul 2023 10:00:54 +0000 (10:00 +0000)
65 files changed:
lib/hash.cc
lib/sspi/sspwin32.cc
src/DiskIO/AIO/AIODiskIOStrategy.cc
src/DiskIO/AIO/aio_win32.cc
src/DiskIO/DiskThreads/DiskThreadsDiskFile.cc
src/DiskIO/DiskThreads/aiops_win32.cc
src/WinSvc.cc
src/acl/external/AD_group/ext_ad_group_acl.cc
src/acl/external/LDAP_group/ext_ldap_group_acl.cc
src/acl/external/LM_group/ext_lm_group_acl.cc
src/acl/external/eDirectory_userip/ext_edirectory_userip_acl.cc
src/acl/external/kerberos_ldap_group/support_krb5.cc
src/acl/external/kerberos_ldap_group/support_ldap.cc
src/acl/external/kerberos_ldap_group/support_sasl.cc
src/acl/external/time_quota/ext_time_quota_acl.cc
src/auth/basic/LDAP/basic_ldap_auth.cc
src/auth/basic/PAM/basic_pam_auth.cc
src/auth/basic/SASL/basic_sasl_auth.cc
src/auth/basic/SMB_LM/msntauth.cc
src/auth/basic/SMB_LM/valid.cc
src/auth/basic/SSPI/basic_sspi_auth.cc
src/auth/basic/SSPI/valid.cc
src/auth/digest/LDAP/ldap_backend.cc
src/auth/digest/eDirectory/ldap_backend.cc
src/auth/negotiate/SSPI/negotiate_sspi_auth.cc
src/auth/negotiate/kerberos/negotiate_kerberos_auth.cc
src/auth/ntlm/SMB_LM/ntlm_smb_lm_auth.cc
src/auth/ntlm/SSPI/ntlm_sspi_auth.cc
src/cache_cf.cc
src/cf_gen.cc
src/clientStream.cc
src/client_side.cc
src/client_side_request.cc
src/comm/ConnOpener.cc
src/comm/ModDevPoll.cc
src/comm/ModKqueue.cc
src/comm/ModSelectWin32.cc
src/debug/debug.cc
src/dns_internal.cc
src/eui/Eui48.cc
src/fs_io.cc
src/http/url_rewriters/LFS/rredir.cc
src/icmp/Icmp6.cc
src/icmp/net_db.cc
src/ipc/mem/Segment.cc
src/ipc_win32.cc
src/main.cc
src/pconn.cc
src/peer_digest.cc
src/peer_proxy_negotiate_auth.cc
src/redirect.cc
src/security/cert_generators/file/certificate_db.cc
src/ssl/bio.cc
src/ssl/support.cc
src/store_client.cc
src/store_digest.cc
src/test_cache_digest.cc
src/tests/stub_wordlist.cc
src/tests/testAuth.cc
src/tools.cc
src/unlinkd.cc
src/win32.cc
tools/cachemgr.cc
tools/squidclient/Transport.cc
tools/squidclient/squidclient.cc

index dfce188f684dccc35ce3902d3f6a1aae5a0fa3d3..b661f53b14375b44df078b0bd6d7763f431c73e8 100644 (file)
@@ -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");
index 3006809bb665fd7a0e001fc67c5be0383bdcfec3..129a73924b4c243d9878a65d2344fa160aeabd3a 100644 (file)
@@ -49,8 +49,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 = {};
 
@@ -60,18 +60,18 @@ BOOL NTLM_LocalCall = FALSE;
 #endif
 
 /* 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)
@@ -88,24 +88,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
@@ -113,7 +113,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;
@@ -134,7 +134,7 @@ HMODULE LoadSecurityDll(int mode, const char * SSP_Package)
     _AcceptSecurityContext = farproc_cast<ACCEPT_SECURITY_CONTEXT_FN>(GetProcAddress(hModule, "AcceptSecurityContext"));
     if (!_AcceptSecurityContext) {
         UnloadSecurityDll();
-        hModule = NULL;
+        hModule = nullptr;
         return hModule;
     }
 #ifdef UNICODE
@@ -144,31 +144,31 @@ HMODULE LoadSecurityDll(int mode, const char * SSP_Package)
 #endif
     if (!_AcquireCredentialsHandle) {
         UnloadSecurityDll();
-        hModule = NULL;
+        hModule = nullptr;
         return hModule;
     }
     _CompleteAuthToken = farproc_cast<COMPLETE_AUTH_TOKEN_FN>(GetProcAddress(hModule, "CompleteAuthToken"));
     if (!_CompleteAuthToken) {
         UnloadSecurityDll();
-        hModule = NULL;
+        hModule = nullptr;
         return hModule;
     }
     _DeleteSecurityContext = farproc_cast<DELETE_SECURITY_CONTEXT_FN>(GetProcAddress(hModule, "DeleteSecurityContext"));
     if (!_DeleteSecurityContext) {
         UnloadSecurityDll();
-        hModule = NULL;
+        hModule = nullptr;
         return hModule;
     }
     _FreeContextBuffer = farproc_cast<FREE_CONTEXT_BUFFER_FN>(GetProcAddress(hModule, "FreeContextBuffer"));
     if (!_FreeContextBuffer) {
         UnloadSecurityDll();
-        hModule = NULL;
+        hModule = nullptr;
         return hModule;
     }
     _FreeCredentialsHandle = farproc_cast<FREE_CREDENTIALS_HANDLE_FN>(GetProcAddress(hModule, "FreeCredentialsHandle"));
     if (!_FreeCredentialsHandle) {
         UnloadSecurityDll();
-        hModule = NULL;
+        hModule = nullptr;
         return hModule;
     }
 #ifdef UNICODE
@@ -178,7 +178,7 @@ HMODULE LoadSecurityDll(int mode, const char * SSP_Package)
 #endif
     if (!_InitializeSecurityContext) {
         UnloadSecurityDll();
-        hModule = NULL;
+        hModule = nullptr;
         return hModule;
     }
 #ifdef UNICODE
@@ -188,7 +188,7 @@ HMODULE LoadSecurityDll(int mode, const char * SSP_Package)
 #endif
     if (!_QuerySecurityPackageInfo) {
         UnloadSecurityDll();
-        hModule = NULL;
+        hModule = nullptr;
     }
 
 #ifdef UNICODE
@@ -198,7 +198,7 @@ HMODULE LoadSecurityDll(int mode, const char * SSP_Package)
 #endif
     if (!_QueryContextAttributes) {
         UnloadSecurityDll();
-        hModule = NULL;
+        hModule = nullptr;
     }
 
     /* Get max token size */
@@ -235,8 +235,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;
@@ -261,7 +261,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)
@@ -305,8 +305,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);
@@ -418,14 +418,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.
@@ -444,7 +444,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);
@@ -466,7 +466,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;
@@ -489,7 +489,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);
@@ -507,7 +507,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)
@@ -575,7 +575,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)
@@ -610,6 +610,6 @@ const char * WINAPI SSP_ValidateNegotiateCredentials(PVOID PAutenticateBuf, int
         encoded[dstLen] = '\0';
         return encoded;
     }
-    return NULL;
+    return nullptr;
 }
 #endif /* HAVE_AUTH_MODULE_NEGOTIATE */
index 825096cf4422dbe23d75c0f13eecd58016489403..9e6c68015585a6e5d3ca14f2b828d94b36f10019 100644 (file)
@@ -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);
 
index 227c669a6757c53e9bbc05eda6cd27e7c58bcc32..d510eb3fc97f36e13832ec59b4797952e3c184e6 100644 (file)
@@ -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 */
index 802999f60dac1500632c20d9bed11b60cebe3550..adbe6aef1c771da1c5b72770fdb6dcd2cd57695a 100644 (file)
@@ -67,7 +67,7 @@ DiskThreadsDiskFile::open(int flags, mode_t mode, RefCount<IORequestor> 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<IORequestor> callba
 
 #else
 
-    openDone (fd, NULL, fd, 0);
+    openDone (fd, nullptr, fd, 0);
 
 #endif
 }
index 35d72c0191254a7ee1c5ff4d38b0d808dccc932f..85c36537de8987b52243bf656d6d0fde6aefb397 100644 (file)
@@ -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);
index 670784a88193566ae0fce5e9013d6d9de3385cf1..f9e6634c72553a72e78d8daec394c6ba1a5402e1 100644 (file)
@@ -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<char *>(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<char *>(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<char*>(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<char*>(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];
index 228789cea6f4b68c1ce9b351e602f98e26e2501e..0a16a1b25a18ecdf25c49de2fcc056f444c14dca 100644 (file)
@@ -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) {
index e73f7169ded864f25128d6501917dc9b12a38e7b..435a49c38791b6adf5a963ddb6999aa1bbfe46cc 100644 (file)
@@ -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 {
index c26c15436258dc103dce935cf2ff523f2b61698b..fb8debe56a3fcc472ae4cac5c181630e67717a3e 100644 (file)
@@ -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."));
index bb2b391efa5fcc85ac5a3f372be6c48264d0ffab..8a3a381fb0869e03ee0ff4f8424136b486c58bfd 100644 (file)
@@ -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));
index 31a95e1ac9781e1310bf73cc42fef66a3c071a32..8083923afa8463c4e678689d84ba8195be042e39 100644 (file)
@@ -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);
index acd31049ecc567cbd199a2b9b120f058884abf95..9a1f8ed752f5e957c6d4febf2b0c81e6cb429fc6 100644 (file)
@@ -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"
@@ -529,7 +529,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
@@ -612,8 +612,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) {
@@ -623,11 +623,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);
@@ -840,7 +840,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"
@@ -914,7 +914,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"
@@ -946,18 +946,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",
@@ -1096,8 +1096,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;
index 03ee1401841ddcc5ca0953b540e9f1d96762a987..6633c7c5349808341e0bb5834ce2fe08beaef479 100644 (file)
@@ -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;
index be6da4309632007e8af1858d92b7db03ccbee631..38fc70a923f01ceffe00c156a472cfff8d5d665c 100644 (file)
@@ -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();
 
index c3aa9aa54cd9434cc1de037c7769bbdfd4e4402d..4d9a78574cbae852c082712452165735d6656122 100644 (file)
@@ -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);
index becc413dfc659797c2900c632e872bf42472b097..fdc71c55d4d5e83c0c3827369f529ef40f4e2003 100644 (file)
@@ -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");
         }
     }
index 10e0dbd9a46aabd46944bdb021354ca9dbceb030..02ea2f48d65d8d2fb573d1713d2fc2814366e54f 100644 (file)
@@ -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("");
index 48cf2770b2188c6d63f45d711cc7d91fe5b52f35..c211a73a8992dee0fdc00ed433c4faa082853af2 100644 (file)
@@ -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];
index 7760f5ccb2fa6a94f098a4cd1227178c199fe3ef..1aaaea918ea72f7a7e8bcbbb34613ac1309abc85 100644 (file)
@@ -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);
     }
index 3da82077a5d0508dca79268549011fad12267d4e..96c3cdfc87790f69a3a8090692333eb247e769c0 100644 (file)
@@ -126,8 +126,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) {
 
index 0fba1fc7bcb7b062197bff47be4ca762243005b7..aaab88d40937501aa827c6218dde4543fe87b359 100644 (file)
@@ -56,7 +56,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;
@@ -83,7 +83,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,
@@ -122,7 +122,7 @@ Valid_User(char *UserName, char *Password, char *)
     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];
 
index b22fb0cbb1c222c9c3d351c74b8095f547e98bc9..2db3e8a806c48f883bc98f4c9461261255c0ef14 100644 (file)
@@ -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
index e89650191825d44965b79c4eeb9b896754800fe5..6b504a35e379a1137c0954982212e77a13b9eb33 100644 (file)
@@ -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
index d88d7a541e419bbcd88f8aa3eda4b41426cec1d6..e35b2e117e3b30616a9ec51301b4e373d75bb398 100644 (file)
@@ -77,7 +77,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()
@@ -237,12 +237,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')
@@ -308,8 +308,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 */
index 474c836b44a7acaabbe66d5050cce9f387db26ea..35ab76cde525b1e90b454baac740ab053001ffbd 100644 (file)
@@ -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) {
index cf3a0d3ade99b342a54cb1ed8bdab575ac13255e..78aee1b42cfb7999e26449d765d285b8800ea0ed 100644 (file)
@@ -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 %zu 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;
index 85e2cb670c08f1db9f5590dc730864b23f0e6ab2..89c8f898e4f0471b9916627e8e36f08d334f3252 100644 (file)
@@ -104,7 +104,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;
@@ -131,7 +131,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,
@@ -175,10 +175,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';
@@ -194,7 +194,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.
@@ -208,7 +208,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:
@@ -218,7 +218,7 @@ char * GetDomainName(void)
          * the LsaOpenPolicy function.
          */
         status = LsaOpenPolicy(
-                     NULL,
+                     nullptr,
                      &ObjectAttributes,
                      GENERIC_READ | POLICY_VIEW_LOCAL_INFORMATION,
                      &PolicyHandle
@@ -257,7 +257,7 @@ char * GetDomainName(void)
                      */
                     debug("Member of Domain %s\n",DomainName);
                 } else {
-                    DomainName = NULL;
+                    DomainName = nullptr;
                 }
             }
         }
@@ -351,7 +351,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()
@@ -585,12 +585,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')
@@ -642,8 +642,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 */
index 71fb82d848925712aaf4c6889217f3ccc2d04210..643d88f26beb0c3f41f41426e52fa319fdbcf519 100644 (file)
@@ -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;
index 07e1caf5c8b3cdba6d630faec8a4b9b730200c7a..3ffe4da46c44ceadaef42dc7cf1608fa5f4c9a9a 100644 (file)
@@ -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);
index 95da5eee67054f5c6afa9a9b149f275791618389..ecc316aacf59c5c56baf0e0c9416aecf6c3e52eb 100644 (file)
@@ -72,9 +72,9 @@
  *
  \code
    mycontext = thisObject->data;
-   thisObject->data = NULL;
+   thisObject->data = nullptr;
    delete thisObject->head;
-   mycontext = NULL;
+   mycontext = nullptr;
    return;
  \endcode
  *
index 2d60f2c1fe813bf7f958b1797fbaae2dbafca106..6531396204548b8ebac343b0196d64068a242431 100644 (file)
@@ -2113,7 +2113,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?
@@ -2810,7 +2810,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");
index 527c26116da75f2d3db80f98a1deaecee7690336..36d0aca11db29c05463f3b13ee9a15c48e820089 100644 (file)
@@ -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);
index e960b46f5c7cdf893e178cd3590a4501562c9125..4473fe41a164d27a5482f75e6fbfc980650e87f9 100644 (file)
@@ -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;
index 5cb2e1a633269a1e2d774ac6f1deb21c98e07054..5d4841bcdeaa93a56c5da306d3fb68e2d35d24a1 100644 (file)
@@ -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);
             }
         }
     }
index 4887214aca60c39ca33bddfdeb24809e5d4aba85..9b71102389b398da5e49fafcc8daa17d4ab38f69 100644 (file)
@@ -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);
             }
         }
index 5b20c443775b1c41f2a5d99400321b93a8b45aef..bee51b04b8ce06e37ba5544f3eb9819229fbfdca 100644 (file)
@@ -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);
     }
index 47d3a0345aa89f63e54b204cc23132bc56728069..90198f0861b2dbbc465f90d6479192d7cdfbe8dd 100644 (file)
@@ -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 =
index 4da9153c3e221dbd327291b929f71123ac2ea248..319d34400304ca8b3367a697512871c1b06f51f2 100644 (file)
@@ -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);
             }
index 943fd8a6f7ea4b80c05dadec508737f775531e8b..b2ab2fda5d0df7c2c159eb554bbc52765d451fad 100644 (file)
@@ -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;
 
index 37da679cf97a1ced7bdcf69d9334669bac44dc6f..2309a9975b93f0b5550732fd712ed5842bf3ebd6 100644 (file)
@@ -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");
index b2613c696af50a8c4b4881204813093c8cd78ee4..5734adddcbc3657cce3f1f96e474ad6624fd9cbf 100644 (file)
@@ -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 */
index d9d69b9906c803b99c395ebcf1238f591a632828..ebf8599d01338c3a88651ddbdfde9851605ecab7 100644 (file)
@@ -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;
index 702918b9808b995a85f25a3837deeb06e67f2e22..46dd0b009e856c557b97a2d5f300595e28f549e1 100644 (file)
@@ -1184,7 +1184,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
index d71cb54a4329e71dde957b9d7592ca33c5f8c8b0..f73e00016e7a585140a49c3c3c5612be5b7e5188 100644 (file)
@@ -312,7 +312,7 @@ Ipc::Mem::Segment::~Segment()
 {
     if (doUnlink) {
         delete [] static_cast<char *>(theMem);
-        theMem = NULL;
+        theMem = nullptr;
         Segments.erase(theName);
         debugs(54, 3, "unlinked " << theName << " fake segment");
     }
index f7416288b1494e5ad789b3abcc2f6d4deed2857a..067f39cbf4edaea16190ebec4e47a2ed2dc05537 100644 (file)
@@ -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, &params, 0, NULL);
+    thread = _beginthreadex(nullptr, 0, ipc_thread_1, &params, 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;
index f55723719333e48b360cac4f7bcb5910a67d67c5..fc0bd0d686bccfbd90b6d513c67e76d624fd8d96 100644 (file)
@@ -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);
     }
 
index 7db11481c276c187077036b0b68cec58b6a19e7f..2dfcda160971be1cc108a48771f92063bade84cd 100644 (file)
@@ -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);
 
index 836e6b1d726d44640ecd5db0bdb36c15670003bf..836dcccdc8b1024ac1df29aeb4e1a8dfe5372cab 100644 (file)
@@ -489,7 +489,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; */
 
             if (!fetch->pd->cd) {
                 peerDigestFetchAbort(fetch, buf, "304 without the old in-memory digest");
index f97bfba3181643837ce7b95f68481a5950a800dc..f5d2f5dd145d77c3d697e2be722513aaed2e11c4 100644 (file)
@@ -75,7 +75,7 @@ gss_OID gss_mech_spnego = &_gss_mech_spnego;
 #if USE_IBM_KERBEROS
 #include <ibm_svc/krb5_svc.h>
 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,
index 49c0d7021005ad9bbf6c3dd83fed49df9d8ae1e8..d1d284be2a1cc3ef3397b1f9434f209b4cd9db72 100644 (file)
@@ -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;
index 9bf472dddd367f9ff618cdfb4bbce31a984cfa1d..439dad723797d44cbad35c72cfda9c979584f425 100644 (file)
@@ -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);
index 763978ac937db32a68fc058a7532bd9d3919f23c..0791b8b6c87928039807cf452e838155750d3ce5 100644 (file)
@@ -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,
index 28e88136d803cad2e961d0a01ade421d3f9d89f4..89411e4720f65c61ab4e6399ff98ea1334c02308 100644 (file)
@@ -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.
index 66977046c94c5338f37b3bc8227c410909e33d83..7fedc24ebda719f5f6b3f193b33ee05c508e2cba 100644 (file)
@@ -97,7 +97,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;
@@ -106,7 +106,7 @@ storeClientListSearch(const MemObject * mem, void *data)
             return sc;
     }
 
-    return NULL;
+    return nullptr;
 }
 
 int
index a965bc82ab225ac472af45e361b2dceb708a4048..3cf348ad4eba9051840569da0db5cf873467848e 100644 (file)
@@ -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
 }
index b00eaf076536927ea34020631aa55263dd87c240..d350709cf9c1893e27a05c918eecaff59f97c213 100644 (file)
@@ -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;
index ff8a99c363537985d5ec2281b426dcfd192cc471..21b8a22f3c71e58aa5aadabb3d3f39c485c6b9a8 100644 (file)
@@ -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
 
index e9da1ded83d6c0f0520a2cbaa56687ea09d093cc..a40f69a739c6ae30135ec13b4a079c6096f14d89 100644 (file)
@@ -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);
     }
 }
index bd0f845a5199ad1146c7820dd2a94233da0472bb..561250e7dcaf0260bec1a300d46378fd46aa9f08 100644 (file)
@@ -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;
index 1d5275a4561d039bd57d82739a95dc06c9f8e22e..e96a95b077bc2474c9067810294c0545fa9ad57d 100644 (file)
@@ -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
     }
 
index f79110280e234148694b6b589db8ec8b4fabb193..91adc6350f526902398c9a4d44a311d7e8067926 100644 (file)
@@ -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)
index 1a002386a0a0d64b3dc8301c3669f7991ded9aae..9ab8d8c7fff3ae65cead4702a773c777faea7d7f 100644 (file)
@@ -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
 
index 80205083c89df307896300aa919b4774c85035fc..8f5a50639c148aaa42d5b4b6efa4fbb717d65d90 100644 (file)
@@ -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)
index 71b5f0cce55ed4b017aa652c7f9677fc5467137a..bdb7c8f7fd6487d60467ad4981d60be03b340791 100644 (file)
@@ -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_