From 04f7fd383874c87ef7237a808cf8837fb84e9df6 Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Mon, 15 Jun 2009 00:18:00 +1200 Subject: [PATCH] SourceFormat enforcement --- helpers/external_acl/session/squid_session.c | 2 +- helpers/ntlm_auth/smb_lm/libntlmssp.c | 26 ++-- helpers/ntlm_auth/smb_lm/smbval/smblib-priv.h | 4 +- helpers/ntlm_auth/smb_lm/smbval/smblib-util.c | 26 ++-- helpers/ntlm_auth/smb_lm/smbval/smblib.c | 6 +- lib/hash.c | 2 +- src/AccessLogEntry.h | 3 +- src/ClientInfo.h | 3 +- src/WinSvc.cc | 2 +- src/acl/Tag.cc | 6 +- src/acl/Tag.h | 6 +- src/cache_cf.cc | 8 +- src/client_side.cc | 6 +- src/comm.cc | 8 +- src/debug.cc | 3 +- src/dns_internal.cc | 140 +++++++++--------- src/dnsserver.cc | 2 +- src/ftp.cc | 7 +- src/helper.cc | 4 +- src/htcp.cc | 20 +-- src/icp_v2.cc | 16 +- src/ident/Config.h | 6 +- src/ident/Ident.cc | 13 +- src/ident/Ident.h | 3 +- src/refresh.cc | 4 +- src/snmp_core.cc | 16 +- src/tunnel.cc | 4 +- src/url.cc | 2 +- src/wccp.cc | 8 +- src/wccp2.cc | 8 +- 30 files changed, 185 insertions(+), 179 deletions(-) diff --git a/helpers/external_acl/session/squid_session.c b/helpers/external_acl/session/squid_session.c index 891ce341db..8b5b80618b 100644 --- a/helpers/external_acl/session/squid_session.c +++ b/helpers/external_acl/session/squid_session.c @@ -36,7 +36,7 @@ #include #endif -/* At this point all Bit Types are already defined, so we must +/* At this point all Bit Types are already defined, so we must protect from multiple type definition on platform where __BIT_TYPES_DEFINED__ is not defined. */ diff --git a/helpers/ntlm_auth/smb_lm/libntlmssp.c b/helpers/ntlm_auth/smb_lm/libntlmssp.c index 6cdc16ed41..d6e58b5449 100644 --- a/helpers/ntlm_auth/smb_lm/libntlmssp.c +++ b/helpers/ntlm_auth/smb_lm/libntlmssp.c @@ -43,19 +43,19 @@ SMB_Handle_Type SMB_Connect_Server(SMB_Handle_Type Con_Handle, char *server, cha /* this one is reallllly haackiish. We really should be using anything from smblib-priv.h */ static char const *SMB_Prots[] = {"PC NETWORK PROGRAM 1.0", - "MICROSOFT NETWORKS 1.03", - "MICROSOFT NETWORKS 3.0", - "DOS LANMAN1.0", - "LANMAN1.0", - "DOS LM1.2X002", - "LM1.2X002", - "DOS LANMAN2.1", - "LANMAN2.1", - "Samba", - "NT LM 0.12", - "NT LANMAN 1.0", - NULL - }; + "MICROSOFT NETWORKS 1.03", + "MICROSOFT NETWORKS 3.0", + "DOS LANMAN1.0", + "LANMAN1.0", + "DOS LM1.2X002", + "LM1.2X002", + "DOS LANMAN2.1", + "LANMAN2.1", + "Samba", + "NT LM 0.12", + "NT LANMAN 1.0", + NULL + }; #if 0 int SMB_Discon(SMB_Handle_Type Con_Handle, BOOL KeepHandle); diff --git a/helpers/ntlm_auth/smb_lm/smbval/smblib-priv.h b/helpers/ntlm_auth/smb_lm/smbval/smblib-priv.h index 0530de7362..b801e1d780 100644 --- a/helpers/ntlm_auth/smb_lm/smbval/smblib-priv.h +++ b/helpers/ntlm_auth/smb_lm/smbval/smblib-priv.h @@ -638,7 +638,7 @@ extern int SMBlib_SMB_Error; /* last Error */ #endif extern SMB_Tree_Handle SMB_TreeConnect(SMB_Handle_Type con, SMB_Tree_Handle tree, - char *path, char *password, char const *dev); + char *path, char *password, char const *dev); extern int SMB_Init(void); extern void SMB_Get_My_Name(char *name, int len); @@ -646,7 +646,7 @@ extern int SMB_Negotiate(SMB_Handle_Type Con_Handle, char const *Prots[]); extern int SMB_Discon(SMB_Handle_Type Con_Handle, BOOL KeepHandle); extern int SMB_Logon_Server(SMB_Handle_Type Con_Handle, char *UserName, - char *PassWord, char *UserDomain, int precrypted); + char *PassWord, char *UserDomain, int precrypted); extern int SMB_Get_Error_Msg(int msg, char *msgbuf, int len); diff --git a/helpers/ntlm_auth/smb_lm/smbval/smblib-util.c b/helpers/ntlm_auth/smb_lm/smbval/smblib-util.c index 07b7b6712b..b25814b1e0 100644 --- a/helpers/ntlm_auth/smb_lm/smbval/smblib-util.c +++ b/helpers/ntlm_auth/smb_lm/smbval/smblib-util.c @@ -60,19 +60,19 @@ static int SMB_Types[] = {SMB_P_Core, }; static char const *SMB_Prots[] = {"PC NETWORK PROGRAM 1.0", - "MICROSOFT NETWORKS 1.03", - "MICROSOFT NETWORKS 3.0", - "DOS LANMAN1.0", - "LANMAN1.0", - "DOS LM1.2X002", - "LM1.2X002", - "DOS LANMAN2.1", - "LANMAN2.1", - "Samba", - "NT LM 0.12", - "NT LANMAN 1.0", - NULL - }; + "MICROSOFT NETWORKS 1.03", + "MICROSOFT NETWORKS 3.0", + "DOS LANMAN1.0", + "LANMAN1.0", + "DOS LM1.2X002", + "LM1.2X002", + "DOS LANMAN2.1", + "LANMAN2.1", + "Samba", + "NT LM 0.12", + "NT LANMAN 1.0", + NULL + }; /* Print out an SMB pkt in all its gory detail ... */ #if 0 // DEAD CODE diff --git a/helpers/ntlm_auth/smb_lm/smbval/smblib.c b/helpers/ntlm_auth/smb_lm/smbval/smblib.c index 36edea8603..1e06998c9f 100644 --- a/helpers/ntlm_auth/smb_lm/smbval/smblib.c +++ b/helpers/ntlm_auth/smb_lm/smbval/smblib.c @@ -88,7 +88,7 @@ SMB_Term() } /** - * SMB_Create: Create a connection structure and return for later use + * SMB_Create: Create a connection structure and return for later use * We have other helper routines to set variables */ SMB_Handle_Type @@ -209,8 +209,8 @@ SMB_Connect_Server(SMB_Handle_Type Con_Handle, /* use the handle passed */ char const *SMB_Prots_Restrict[] = {"PC NETWORK PROGRAM 1.0", - NULL - }; + NULL + }; SMB_Handle_Type diff --git a/lib/hash.c b/lib/hash.c index c998a10425..0db0e8476c 100644 --- a/lib/hash.c +++ b/lib/hash.c @@ -312,7 +312,7 @@ hashFreeItems(hash_table * hid, HASHFREE * free_func) void hashFreeMemory(hash_table * hid) { - if(hid == NULL) + if (hid == NULL) return; if (hid->buckets) xfree(hid->buckets); diff --git a/src/AccessLogEntry.h b/src/AccessLogEntry.h index ef571b758c..dd35279419 100644 --- a/src/AccessLogEntry.h +++ b/src/AccessLogEntry.h @@ -69,7 +69,8 @@ public: icp_opcode opcode; } icp; - class HtcpDetails { + class HtcpDetails + { public: HtcpDetails() : opcode(NULL) {}; diff --git a/src/ClientInfo.h b/src/ClientInfo.h index c0d728eb7f..52c63d0f12 100644 --- a/src/ClientInfo.h +++ b/src/ClientInfo.h @@ -6,7 +6,8 @@ #include "enums.h" #include "typedefs.h" -class ClientInfo { +class ClientInfo +{ public: hash_link hash; /* must be first */ diff --git a/src/WinSvc.cc b/src/WinSvc.cc index f7fc1ab6c4..5bfebdcf2b 100644 --- a/src/WinSvc.cc +++ b/src/WinSvc.cc @@ -537,7 +537,7 @@ int WIN32_Subsystem_Init(int * argc, char *** argv) safe_free(ConfigFile); /* get config file from Windows Registry */ - if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, REGKEY, 0, KEY_QUERY_VALUE, &hndKey) == ERROR_SUCCESS) { + if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, REGKEY, 0, KEY_QUERY_VALUE, &hndKey) == ERROR_SUCCESS) { DWORD Type = 0; DWORD Size = 0; LONG Result; diff --git a/src/acl/Tag.cc b/src/acl/Tag.cc index bc81eb70a4..5641e6e301 100644 --- a/src/acl/Tag.cc +++ b/src/acl/Tag.cc @@ -19,12 +19,12 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. @@ -44,7 +44,7 @@ int ACLTagStrategy::match (ACLData * &data, ACLFilledChecklist *checklist) { if (checklist->conn() != NULL) - return data->match (checklist->request->tag.termedBuf()); + return data->match (checklist->request->tag.termedBuf()); return 0; } diff --git a/src/acl/Tag.h b/src/acl/Tag.h index 5ff986a4fc..72330f8a03 100644 --- a/src/acl/Tag.h +++ b/src/acl/Tag.h @@ -18,12 +18,12 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. @@ -52,7 +52,7 @@ public: private: static ACLTagStrategy Instance_; - ACLTagStrategy(){} + ACLTagStrategy() {} ACLTagStrategy&operator=(ACLTagStrategy const &); }; diff --git a/src/cache_cf.cc b/src/cache_cf.cc index be7315f6a1..f30575d5c5 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -585,10 +585,10 @@ configDoConfigure(void) } for (R = Config.Refresh; R; R = R->next) { - if (!R->flags.ignore_must_revalidate) - continue; - debugs(22, 1, "WARNING: use of 'ignore-must-revalidate' in 'refresh_pattern' violates HTTP"); - break; + if (!R->flags.ignore_must_revalidate) + continue; + debugs(22, 1, "WARNING: use of 'ignore-must-revalidate' in 'refresh_pattern' violates HTTP"); + break; } for (R = Config.Refresh; R; R = R->next) { diff --git a/src/client_side.cc b/src/client_side.cc index bfad70968d..6e507fcd6a 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -3224,9 +3224,9 @@ clientHttpsConnectionsOpen(void) enter_suid(); fd = comm_open_listener(SOCK_STREAM, - IPPROTO_TCP, - s->http.s, - COMM_NONBLOCKING, "HTTPS Socket"); + IPPROTO_TCP, + s->http.s, + COMM_NONBLOCKING, "HTTPS Socket"); leave_suid(); if (fd < 0) diff --git a/src/comm.cc b/src/comm.cc index 949a6d46ae..d3a4294850 100644 --- a/src/comm.cc +++ b/src/comm.cc @@ -613,10 +613,10 @@ comm_open(int sock_type, int comm_open_listener(int sock_type, - int proto, - IpAddress &addr, - int flags, - const char *note) + int proto, + IpAddress &addr, + int flags, + const char *note) { int sock = -1; diff --git a/src/debug.cc b/src/debug.cc index 4088ba335b..8f29b62737 100644 --- a/src/debug.cc +++ b/src/debug.cc @@ -75,7 +75,8 @@ typedef BOOL (WINAPI * PFInitializeCriticalSectionAndSpinCount) (LPCRITICAL_SECT void _db_print(const char *format,...) { - char f[BUFSIZ]; f[0]='\0'; + char f[BUFSIZ]; + f[0]='\0'; va_list args1; va_list args2; va_list args3; diff --git a/src/dns_internal.cc b/src/dns_internal.cc index 15982731d3..72dada31a7 100644 --- a/src/dns_internal.cc +++ b/src/dns_internal.cc @@ -380,7 +380,7 @@ idnsParseWIN32SearchList(const char * Separator) DWORD Type = 0; DWORD Size = 0; LONG Result; - Result = RegQueryValueEx(hndKey, "Domain", NULL, &Type, NULL, &Size); + Result = RegQueryValueEx(hndKey, "Domain", NULL, &Type, NULL, &Size); if (Result == ERROR_SUCCESS && Size) { t = (char *) xmalloc(Size); @@ -389,11 +389,11 @@ idnsParseWIN32SearchList(const char * Separator) idnsAddPathComponent(t); xfree(t); } - Result = RegQueryValueEx(hndKey, "SearchList", NULL, &Type, NULL, &Size); + Result = RegQueryValueEx(hndKey, "SearchList", NULL, &Type, NULL, &Size); if (Result == ERROR_SUCCESS && Size) { t = (char *) xmalloc(Size); - RegQueryValueEx(hndKey, "SearchList", NULL, &Type, (LPBYTE) t, &Size); + RegQueryValueEx(hndKey, "SearchList", NULL, &Type, (LPBYTE) t, &Size); token = strtok(t, Separator); while (token) { @@ -425,11 +425,11 @@ idnsParseWIN32Registry(void) case _WIN_OS_WINNT: /* get nameservers from the Windows NT registry */ - if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, REG_TCPIP_PARA, 0, KEY_QUERY_VALUE, &hndKey) == ERROR_SUCCESS) { + if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, REG_TCPIP_PARA, 0, KEY_QUERY_VALUE, &hndKey) == ERROR_SUCCESS) { DWORD Type = 0; DWORD Size = 0; LONG Result; - Result = RegQueryValueEx(hndKey, "DhcpNameServer", NULL, &Type, NULL, &Size); + Result = RegQueryValueEx(hndKey, "DhcpNameServer", NULL, &Type, NULL, &Size); if (Result == ERROR_SUCCESS && Size) { t = (char *) xmalloc(Size); @@ -478,62 +478,62 @@ idnsParseWIN32Registry(void) /* get nameservers from the Windows 2000 registry */ /* search all interfaces for DNS server addresses */ - if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, REG_TCPIP_PARA_INTERFACES, 0, KEY_READ, &hndKey) == ERROR_SUCCESS) { + if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, REG_TCPIP_PARA_INTERFACES, 0, KEY_READ, &hndKey) == ERROR_SUCCESS) { int i; - DWORD MaxSubkeyLen, InterfacesCount; - char *keyname; - FILETIME ftLastWriteTime; - - if (RegQueryInfoKey(hndKey, NULL, NULL, NULL, &InterfacesCount, &MaxSubkeyLen, NULL, NULL, NULL, NULL, NULL, NULL) == 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) { - char *newkeyname; - newkeyname = (char *) xmalloc(sizeof(REG_TCPIP_PARA_INTERFACES) + j + 2); - strcpy(newkeyname, REG_TCPIP_PARA_INTERFACES); - strcat(newkeyname, "\\"); - strcat(newkeyname, keyname); - if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, newkeyname, 0, KEY_QUERY_VALUE, &hndKey2) == ERROR_SUCCESS) { - DWORD Type = 0; - DWORD Size = 0; - LONG Result; - Result = RegQueryValueEx(hndKey2, "DhcpNameServer", NULL, &Type, NULL, &Size); - if (Result == ERROR_SUCCESS && Size) { - t = (char *) xmalloc(Size); - RegQueryValueEx(hndKey2, "DhcpNameServer", NULL, &Type, (LPBYTE)t, &Size); - token = strtok(t, ", "); - while (token) { + DWORD MaxSubkeyLen, InterfacesCount; + char *keyname; + FILETIME ftLastWriteTime; + + if (RegQueryInfoKey(hndKey, NULL, NULL, NULL, &InterfacesCount, &MaxSubkeyLen, NULL, NULL, NULL, NULL, NULL, NULL) == 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) { + char *newkeyname; + newkeyname = (char *) xmalloc(sizeof(REG_TCPIP_PARA_INTERFACES) + j + 2); + strcpy(newkeyname, REG_TCPIP_PARA_INTERFACES); + strcat(newkeyname, "\\"); + strcat(newkeyname, keyname); + if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, newkeyname, 0, KEY_QUERY_VALUE, &hndKey2) == ERROR_SUCCESS) { + DWORD Type = 0; + DWORD Size = 0; + LONG Result; + Result = RegQueryValueEx(hndKey2, "DhcpNameServer", NULL, &Type, NULL, &Size); + if (Result == ERROR_SUCCESS && Size) { + t = (char *) xmalloc(Size); + RegQueryValueEx(hndKey2, "DhcpNameServer", NULL, &Type, (LPBYTE)t, &Size); + token = strtok(t, ", "); + while (token) { debugs(78, 1, "Adding DHCP nameserver " << token << " from Registry"); - idnsAddNameserver(token); - token = strtok(NULL, ", "); - } - xfree(t); - } - - Result = RegQueryValueEx(hndKey2, "NameServer", NULL, &Type, NULL, &Size); - if (Result == ERROR_SUCCESS && Size) { - t = (char *) xmalloc(Size); - RegQueryValueEx(hndKey2, "NameServer", NULL, &Type, (LPBYTE)t, &Size); - token = strtok(t, ", "); - while (token) { - debugs(78, 1, "Adding nameserver " << token << " from Registry"); - idnsAddNameserver(token); - token = strtok(NULL, ", "); - } - - xfree(t); + idnsAddNameserver(token); + token = strtok(NULL, ", "); + } + xfree(t); + } + + Result = RegQueryValueEx(hndKey2, "NameServer", NULL, &Type, NULL, &Size); + if (Result == ERROR_SUCCESS && Size) { + t = (char *) xmalloc(Size); + RegQueryValueEx(hndKey2, "NameServer", NULL, &Type, (LPBYTE)t, &Size); + token = strtok(t, ", "); + while (token) { + debugs(78, 1, "Adding nameserver " << token << " from Registry"); + idnsAddNameserver(token); + token = strtok(NULL, ", "); + } + + xfree(t); } RegCloseKey(hndKey2); } - xfree(newkeyname); + xfree(newkeyname); } } - xfree(keyname); + xfree(keyname); } RegCloseKey(hndKey); @@ -550,11 +550,11 @@ idnsParseWIN32Registry(void) case _WIN_OS_WINME: /* get nameservers from the Windows 9X registry */ - if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, REG_VXD_MSTCP, 0, KEY_QUERY_VALUE, &hndKey) == ERROR_SUCCESS) { + if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, REG_VXD_MSTCP, 0, KEY_QUERY_VALUE, &hndKey) == ERROR_SUCCESS) { DWORD Type = 0; DWORD Size = 0; LONG Result; - Result = RegQueryValueEx(hndKey, "NameServer", NULL, &Type, NULL, &Size); + Result = RegQueryValueEx(hndKey, "NameServer", NULL, &Type, NULL, &Size); if (Result == ERROR_SUCCESS && Size) { t = (char *) xmalloc(Size); @@ -1370,23 +1370,23 @@ idnsInit(void) #if IPV6_SPECIAL_SPLITSTACK if ( addr.IsAnyAddr() || addr.IsIPv6() ) DnsSocketB = comm_open_listener(SOCK_DGRAM, - IPPROTO_UDP, - addr, - COMM_NONBLOCKING, - "DNS Socket v6"); + IPPROTO_UDP, + addr, + COMM_NONBLOCKING, + "DNS Socket v6"); if ( addr.IsAnyAddr() || addr.IsIPv4() ) DnsSocketA = comm_open_listener(SOCK_DGRAM, - IPPROTO_UDP, - addr, - COMM_NONBLOCKING, - "DNS Socket v4"); + IPPROTO_UDP, + addr, + COMM_NONBLOCKING, + "DNS Socket v4"); #else - DnsSocketA = comm_open_listener(SOCK_DGRAM, - IPPROTO_UDP, - addr, - COMM_NONBLOCKING, - "DNS Socket"); + DnsSocketA = comm_open_listener(SOCK_DGRAM, + IPPROTO_UDP, + addr, + COMM_NONBLOCKING, + "DNS Socket"); #endif if (DnsSocketA < 0 && DnsSocketB < 0) @@ -1396,12 +1396,12 @@ idnsInit(void) * statement. Doing so messes up the internal Debug::level */ #if IPV6_SPECIAL_SPLITSTACK - if(DnsSocketB >= 0) { + if (DnsSocketB >= 0) { port = comm_local_port(DnsSocketB); debugs(78, 1, "DNS Socket created at " << addr << ", FD " << DnsSocketB); } #endif - if(DnsSocketA >= 0) { + if (DnsSocketA >= 0) { port = comm_local_port(DnsSocketA); debugs(78, 1, "DNS Socket created at " << addr << ", FD " << DnsSocketA); } @@ -1452,13 +1452,13 @@ idnsShutdown(void) if (DnsSocketA < 0 && DnsSocketB < 0) return; - if(DnsSocketA >= 0 ) { + if (DnsSocketA >= 0 ) { comm_close(DnsSocketA); DnsSocketA = -1; } #if IPV6_SPECIAL_SPLITSTACK - if(DnsSocketA >= 0 ) { + if (DnsSocketA >= 0 ) { comm_close(DnsSocketB); DnsSocketB = -1; } diff --git a/src/dnsserver.cc b/src/dnsserver.cc index eff9b728db..648b07b5c1 100644 --- a/src/dnsserver.cc +++ b/src/dnsserver.cc @@ -433,7 +433,7 @@ squid_res_setservers(int reset) ipa.GetInAddr(_SQUID_RES_NSADDR_LIST[_SQUID_RES_NSADDR_COUNT++].sin_addr); } else if ( ipa.IsIPv6() ) { #if USE_IPV6 && defined(_SQUID_RES_NSADDR6_LIST) - /* because things NEVER seem to resolve in tests without _res.nscount being a total. */ + /* because things NEVER seem to resolve in tests without _res.nscount being a total. */ if (_SQUID_RES_NSADDR_COUNT == MAXNS) { fprintf(stderr, "Too many -s options, only %d are allowed\n", MAXNS); return; diff --git a/src/ftp.cc b/src/ftp.cc index d5504917b5..dc232e50ed 100644 --- a/src/ftp.cc +++ b/src/ftp.cc @@ -534,7 +534,7 @@ FtpStateData::loginParser(const char *login, int escaped) *s = '\0'; /* if there was a username part */ - if(s > login) { + if (s > login) { xstrncpy(user, login, MAX_URL); if (escaped) rfc1738_unescape(user); @@ -548,8 +548,7 @@ FtpStateData::loginParser(const char *login, int escaped) password_url = 1; } } - } - else if (login[0]) { + } else if (login[0]) { /* no password, just username */ xstrncpy(user, login, MAX_URL); if (escaped) @@ -3216,7 +3215,7 @@ ftpReadRest(FtpStateData * ftpState) assert(ftpState->restart_offset > 0); if (code == 350) { - ftpState->setCurrentOffset(ftpState->restart_offset); + ftpState->setCurrentOffset(ftpState->restart_offset); ftpSendRetr(ftpState); } else if (code > 0) { debugs(9, 3, HERE << "REST not supported"); diff --git a/src/helper.cc b/src/helper.cc index a85e065a51..9be0b5d8d6 100644 --- a/src/helper.cc +++ b/src/helper.cc @@ -107,7 +107,7 @@ helperOpenServers(helper * hlp) debugs(84, 1, "helperOpenServers: Starting " << need_new << "/" << hlp->n_to_start << " '" << shortname << "' processes"); - if(need_new < 1) { + if (need_new < 1) { debugs(84, 1, "helperOpenServers: No '" << shortname << "' processes needed."); } @@ -213,7 +213,7 @@ helperStatefulOpenServers(statefulhelper * hlp) debugs(84, 1, "helperOpenServers: Starting " << need_new << "/" << hlp->n_to_start << " '" << shortname << "' processes"); - if(need_new < 1) { + if (need_new < 1) { debugs(84, 1, "helperStatefulOpenServers: No '" << shortname << "' processes needed."); } diff --git a/src/htcp.cc b/src/htcp.cc index c28412bd5d..96a42281b3 100644 --- a/src/htcp.cc +++ b/src/htcp.cc @@ -1488,10 +1488,10 @@ htcpInit(void) enter_suid(); htcpInSocket = comm_open_listener(SOCK_DGRAM, - IPPROTO_UDP, - incomingAddr, - COMM_NONBLOCKING, - "HTCP Socket"); + IPPROTO_UDP, + incomingAddr, + COMM_NONBLOCKING, + "HTCP Socket"); leave_suid(); if (htcpInSocket < 0) @@ -1507,10 +1507,10 @@ htcpInit(void) enter_suid(); htcpOutSocket = comm_open_listener(SOCK_DGRAM, - IPPROTO_UDP, - outgoingAddr, - COMM_NONBLOCKING, - "Outgoing HTCP Socket"); + IPPROTO_UDP, + outgoingAddr, + COMM_NONBLOCKING, + "Outgoing HTCP Socket"); leave_suid(); if (htcpOutSocket < 0) @@ -1708,9 +1708,9 @@ htcpLogHtcp(IpAddress &caddr, int opcode, log_type logcode, const char *url) { AccessLogEntry al; if (LOG_TAG_NONE == logcode) - return; + return; if (!Config.onoff.log_udp) - return; + return; al.htcp.opcode = htcpOpcodeStr[opcode]; al.url = url; al.cache.caddr = caddr; diff --git a/src/icp_v2.cc b/src/icp_v2.cc index e41c78594c..32b2e72f33 100644 --- a/src/icp_v2.cc +++ b/src/icp_v2.cc @@ -665,10 +665,10 @@ icpConnectionsOpen(void) addr = Config.Addrs.udp_incoming; addr.SetPort(port); theInIcpConnection = comm_open_listener(SOCK_DGRAM, - IPPROTO_UDP, - addr, - COMM_NONBLOCKING, - "ICP Socket"); + IPPROTO_UDP, + addr, + COMM_NONBLOCKING, + "ICP Socket"); leave_suid(); if (theInIcpConnection < 0) @@ -691,10 +691,10 @@ icpConnectionsOpen(void) enter_suid(); addr.SetPort(port); theOutIcpConnection = comm_open_listener(SOCK_DGRAM, - IPPROTO_UDP, - addr, - COMM_NONBLOCKING, - "ICP Port"); + IPPROTO_UDP, + addr, + COMM_NONBLOCKING, + "ICP Port"); leave_suid(); if (theOutIcpConnection < 0) diff --git a/src/ident/Config.h b/src/ident/Config.h index 2b440223cc..5de6c93643 100644 --- a/src/ident/Config.h +++ b/src/ident/Config.h @@ -7,9 +7,11 @@ #include "acl/Acl.h" -namespace Ident { +namespace Ident +{ -class IdentConfig { +class IdentConfig +{ public: acl_access *identLookup; time_t timeout; diff --git a/src/ident/Ident.cc b/src/ident/Ident.cc index a6c84974ff..90014cc1f6 100644 --- a/src/ident/Ident.cc +++ b/src/ident/Ident.cc @@ -41,7 +41,8 @@ #include "ident/Ident.h" #include "MemBuf.h" -namespace Ident { +namespace Ident +{ #define IDENT_PORT 113 #define IDENT_KEY_SZ 50 @@ -238,10 +239,10 @@ Ident::Start(IpAddress &me, IpAddress &my_peer, IDCB * callback, void *data) addr.SetPort(0); // NP: use random port for secure outbound to IDENT_PORT fd = comm_open_listener(SOCK_STREAM, - IPPROTO_TCP, - addr, - COMM_NONBLOCKING, - "ident"); + IPPROTO_TCP, + addr, + COMM_NONBLOCKING, + "ident"); if (fd == COMM_ERROR) { /* Failed to get a local socket */ @@ -266,7 +267,7 @@ Ident::Start(IpAddress &me, IpAddress &my_peer, IDCB * callback, void *data) void Ident::Init(void) { - if(ident_hash) { + if (ident_hash) { debugs(30, DBG_CRITICAL, "WARNING: Ident already initialized."); return; } diff --git a/src/ident/Ident.h b/src/ident/Ident.h index f632b1022a..fe035f26c9 100644 --- a/src/ident/Ident.h +++ b/src/ident/Ident.h @@ -17,7 +17,8 @@ class IpAddress; -namespace Ident { +namespace Ident +{ /** \ingroup IdentAPI diff --git a/src/refresh.cc b/src/refresh.cc index 90de81ef26..ea3199bf90 100644 --- a/src/refresh.cc +++ b/src/refresh.cc @@ -273,9 +273,9 @@ refreshCheck(const StoreEntry * entry, HttpRequest * request, time_t delta) if (EBIT_TEST(entry->flags, ENTRY_REVALIDATE) && staleness > -1 #if HTTP_VIOLATIONS - && !R->flags.ignore_must_revalidate + && !R->flags.ignore_must_revalidate #endif - ) { + ) { debugs(22, 3, "refreshCheck: YES: Must revalidate stale response"); return STALE_MUST_REVALIDATE; } diff --git a/src/snmp_core.cc b/src/snmp_core.cc index ebff872735..8fc7635cc0 100644 --- a/src/snmp_core.cc +++ b/src/snmp_core.cc @@ -366,10 +366,10 @@ snmpConnectionOpen(void) Config.Addrs.snmp_incoming.SetPort(Config.Port.snmp); enter_suid(); theInSnmpConnection = comm_open_listener(SOCK_DGRAM, - IPPROTO_UDP, - Config.Addrs.snmp_incoming, - COMM_NONBLOCKING, - "SNMP Port"); + IPPROTO_UDP, + Config.Addrs.snmp_incoming, + COMM_NONBLOCKING, + "SNMP Port"); leave_suid(); if (theInSnmpConnection < 0) @@ -383,10 +383,10 @@ snmpConnectionOpen(void) Config.Addrs.snmp_outgoing.SetPort(Config.Port.snmp); enter_suid(); theOutSnmpConnection = comm_open_listener(SOCK_DGRAM, - IPPROTO_UDP, - Config.Addrs.snmp_outgoing, - COMM_NONBLOCKING, - "SNMP Port"); + IPPROTO_UDP, + Config.Addrs.snmp_outgoing, + COMM_NONBLOCKING, + "SNMP Port"); leave_suid(); if (theOutSnmpConnection < 0) diff --git a/src/tunnel.cc b/src/tunnel.cc index a235b9248f..cc6b813edd 100644 --- a/src/tunnel.cc +++ b/src/tunnel.cc @@ -342,7 +342,7 @@ TunnelStateData::writeServerDone(char *buf, size_t len, comm_err_t flag, int xer { debugs(26, 3, "tunnelWriteServer: FD " << server.fd() << ", " << len << " bytes written"); - if(flag == COMM_ERR_CLOSING) + if (flag == COMM_ERR_CLOSING) return; /* Error? */ @@ -403,7 +403,7 @@ TunnelStateData::writeClientDone(char *buf, size_t len, comm_err_t flag, int xer { debugs(26, 3, "tunnelWriteClient: FD " << client.fd() << ", " << len << " bytes written"); - if(flag == COMM_ERR_CLOSING) + if (flag == COMM_ERR_CLOSING) return; /* Error? */ diff --git a/src/url.cc b/src/url.cc index 2cad9e6fbb..8e105266bc 100644 --- a/src/url.cc +++ b/src/url.cc @@ -548,7 +548,7 @@ urlCanonicalFakeHttps(const HttpRequest * request) LOCAL_ARRAY(char, buf, MAX_URL); // method CONNECT and port HTTPS - if(request->method == METHOD_CONNECT && request->port == 443) { + if (request->method == METHOD_CONNECT && request->port == 443) { snprintf(buf, MAX_URL, "https://%s/*", request->GetHost()); return buf; } diff --git a/src/wccp.cc b/src/wccp.cc index 6b99312640..d164b9e8c9 100644 --- a/src/wccp.cc +++ b/src/wccp.cc @@ -148,10 +148,10 @@ wccpConnectionOpen(void) Config.Wccp.address.SetPort(WCCP_PORT); theWccpConnection = comm_open_listener(SOCK_DGRAM, - IPPROTO_UDP, - Config.Wccp.address, - COMM_NONBLOCKING, - "WCCP Socket"); + IPPROTO_UDP, + Config.Wccp.address, + COMM_NONBLOCKING, + "WCCP Socket"); if (theWccpConnection < 0) fatal("Cannot open WCCP Port"); diff --git a/src/wccp2.cc b/src/wccp2.cc index 7d5f66cc4f..a3cd000058 100644 --- a/src/wccp2.cc +++ b/src/wccp2.cc @@ -996,10 +996,10 @@ wccp2ConnectionOpen(void) Config.Wccp2.address.SetPort(WCCP_PORT); theWccp2Connection = comm_open_listener(SOCK_DGRAM, - 0, - Config.Wccp2.address, - COMM_NONBLOCKING, - "WCCPv2 Socket"); + 0, + Config.Wccp2.address, + COMM_NONBLOCKING, + "WCCPv2 Socket"); if (theWccp2Connection < 0) fatal("Cannot open WCCP Port"); -- 2.47.2