Skip to content

Commit

Permalink
Merge branch 'suspect_code_indent' into 'master'
Browse files Browse the repository at this point in the history
Fix Linux kernel coding style errors and warnings reported by checkpatch.pl

See merge request openconnect/openconnect!212
  • Loading branch information
dwmw2 committed Jun 29, 2021
2 parents 19752fc + 91fb117 commit be3a052
Show file tree
Hide file tree
Showing 14 changed files with 41 additions and 35 deletions.
3 changes: 2 additions & 1 deletion array.c
Expand Up @@ -48,7 +48,8 @@

#include "openconnect-internal.h"

static struct oc_auth_form *plain_auth_form() {
static struct oc_auth_form *plain_auth_form(void)
{
struct oc_auth_form *form;
struct oc_form_opt *opt, *opt2, *opt3;

Expand Down
2 changes: 1 addition & 1 deletion auth-common.c
Expand Up @@ -74,7 +74,7 @@ int xmlnode_match_prop(xmlNode *xml_node, const char *name, const char *match)
return -ENOENT;

if (strcmp(str, match))
ret = -EEXIST;
ret = -EEXIST;

free(str);
return ret;
Expand Down
4 changes: 2 additions & 2 deletions auth-globalprotect.c
Expand Up @@ -431,7 +431,7 @@ static int parse_portal_xml(struct openconnect_info *vpninfo, xmlNode *xml_node,
if (xmlnode_is_named(x2, "external"))
for (x3 = x2->children; x3; x3 = x3->next)
if (xmlnode_is_named(x3, "list"))
gateways = x3;
gateways = x3;
} else if (xmlnode_is_named(x, "hip-collection")) {
for (x2 = x->children; x2; x2 = x2->next) {
if (!xmlnode_get_val(x2, "hip-report-interval", &hip_interval)) {
Expand Down Expand Up @@ -656,7 +656,7 @@ static int gpst_login(struct openconnect_info *vpninfo, int portal, struct login
goto replay_form;
}
} else
break;
break;
}
}

Expand Down
8 changes: 4 additions & 4 deletions auth.c
Expand Up @@ -89,7 +89,7 @@ static int parse_auth_choice(struct openconnect_info *vpninfo, struct oc_auth_fo

/* Return early when there is a <select/> tag with no children */
if (max_choices == 0) {
return 0;
return 0;
}

opt = calloc(1, sizeof(*opt));
Expand Down Expand Up @@ -689,7 +689,7 @@ static int handle_auth_form(struct openconnect_info *vpninfo, struct oc_auth_for
*/
free(form->error);
if (!(form->error = strdup(_("Client certificate missing or incorrect (Certificate Validation Failure)"))))
return -ENOMEM;
return -ENOMEM;
} else
vpn_progress(vpninfo, PRG_ERR, "%s\n", form->error);
}
Expand Down Expand Up @@ -935,8 +935,8 @@ static int cstp_can_gen_tokencode(struct openconnect_info *vpninfo,
#endif
/* Otherwise it's an OATH token of some kind. */
if (!strcmp(opt->name, "secondary_password") ||
(form->auth_id && !strcmp(form->auth_id, "challenge")))
return can_gen_tokencode(vpninfo, form, opt);
(form->auth_id && !strcmp(form->auth_id, "challenge")))
return can_gen_tokencode(vpninfo, form, opt);

return -EINVAL;
}
Expand Down
2 changes: 1 addition & 1 deletion compat.c
Expand Up @@ -268,7 +268,7 @@ char *openconnect__win32_strerror(DWORD err)
return msgutf8;
}

int openconnect__win32_sock_init()
int openconnect__win32_sock_init(void)
{
WSADATA data;
if (WSAStartup (MAKEWORD(1, 1), &data) != 0) {
Expand Down
3 changes: 2 additions & 1 deletion f5.c
Expand Up @@ -37,7 +37,8 @@

#define XCAST(x) ((const xmlChar *)(x))

static struct oc_auth_form *plain_auth_form() {
static struct oc_auth_form *plain_auth_form(void)
{
struct oc_auth_form *form;
struct oc_form_opt *opt, *opt2;

Expand Down
16 changes: 8 additions & 8 deletions fortinet.c
Expand Up @@ -343,14 +343,14 @@ static int parse_fortinet_xml_config(struct openconnect_info *vpninfo, char *buf
} else if (xmlnode_is_named(xml_node, "fos")) {
char platform[80], *p = platform, *e = platform + 80;
if (!xmlnode_get_prop(xml_node, "platform", &s)) {
p+=snprintf(p, e-p, "%s", s);
if (!xmlnode_get_prop(xml_node, "major", &s)) p+=snprintf(p, e-p, " v%s", s);
if (!xmlnode_get_prop(xml_node, "minor", &s)) p+=snprintf(p, e-p, ".%s", s);
if (!xmlnode_get_prop(xml_node, "patch", &s)) p+=snprintf(p, e-p, ".%s", s);
if (!xmlnode_get_prop(xml_node, "build", &s)) p+=snprintf(p, e-p, " build %s", s);
if (!xmlnode_get_prop(xml_node, "branch", &s)) snprintf(p, e-p, " branch %s", s);
vpn_progress(vpninfo, PRG_INFO,
_("Reported platform is %s\n"), platform);
p+=snprintf(p, e-p, "%s", s);
if (!xmlnode_get_prop(xml_node, "major", &s)) p+=snprintf(p, e-p, " v%s", s);
if (!xmlnode_get_prop(xml_node, "minor", &s)) p+=snprintf(p, e-p, ".%s", s);
if (!xmlnode_get_prop(xml_node, "patch", &s)) p+=snprintf(p, e-p, ".%s", s);
if (!xmlnode_get_prop(xml_node, "build", &s)) p+=snprintf(p, e-p, " build %s", s);
if (!xmlnode_get_prop(xml_node, "branch", &s)) snprintf(p, e-p, " branch %s", s);
vpn_progress(vpninfo, PRG_INFO,
_("Reported platform is %s\n"), platform);
}
} else if (xmlnode_is_named(xml_node, "ipv4")) {
for (x = xml_node->children; x; x=x->next) {
Expand Down
4 changes: 2 additions & 2 deletions gnutls.c
Expand Up @@ -67,7 +67,7 @@ static int gnutls_pin_callback(void *priv, int attempt, const char *uri,

static char tls_library_version[32] = "";

const char *openconnect_get_tls_library_version()
const char *openconnect_get_tls_library_version(void)
{
if (!*tls_library_version) {
snprintf(tls_library_version, sizeof(tls_library_version), "GnuTLS %s",
Expand All @@ -76,7 +76,7 @@ const char *openconnect_get_tls_library_version()
return tls_library_version;
}

int can_enable_insecure_crypto()
int can_enable_insecure_crypto(void)
{
/* XX: As of GnuTLS 3.6.13, no released version has (yet) removed 3DES/RC4 from default builds,
* but like OpenSSL (removed in 1.1.0) it may happen. */
Expand Down
16 changes: 9 additions & 7 deletions main.c
Expand Up @@ -1013,7 +1013,7 @@ static inline char *__dup_config_arg(char **argv, char *config_arg)
char *res;

if (config_file || is_arg_utf8(config_arg))
return xstrdup(config_arg);
return xstrdup(config_arg);

res = convert_arg_to_utf8(argv, config_arg);
/* Force a copy, even if conversion failed */
Expand Down Expand Up @@ -1511,7 +1511,8 @@ static void print_connection_stats(void *_vpninfo, const struct oc_stats *stats)
}

#ifndef _WIN32
static int background_self(struct openconnect_info *vpninfo, char *pidfile) {
static int background_self(struct openconnect_info *vpninfo, char *pidfile)
{
FILE *fp = NULL;
int pid;

Expand Down Expand Up @@ -1550,7 +1551,8 @@ static int background_self(struct openconnect_info *vpninfo, char *pidfile) {
}
#endif /* _WIN32 */

static void fully_up_cb(void *_vpninfo) {
static void fully_up_cb(void *_vpninfo)
{
struct openconnect_info *vpninfo = _vpninfo;

print_connection_info(vpninfo);
Expand Down Expand Up @@ -2330,9 +2332,9 @@ static int validate_peer_cert(void *_vpninfo, const char *reason)
if (!err)
return 0;
else if (err < 0) {
vpn_progress(vpninfo, PRG_ERR,
_("Could not check server's certificate against %s\n"),
this->fingerprint);
vpn_progress(vpninfo, PRG_ERR,
_("Could not check server's certificate against %s\n"),
this->fingerprint);
}
}
}
Expand Down Expand Up @@ -2666,7 +2668,7 @@ static int lock_token(void *tokdata)
/* FIXME: Actually lock the file */
err = openconnect_read_file(vpninfo, token_filename, &file_token);
if (err < 0)
return err;
return err;

err = openconnect_set_token_mode(vpninfo, vpninfo->token_mode, file_token);
free(file_token);
Expand Down
4 changes: 2 additions & 2 deletions openssl.c
Expand Up @@ -52,7 +52,7 @@ typedef int (*X509_STORE_CTX_get_issuer_fn)(X509 **issuer,

static char tls_library_version[32] = "";

const char *openconnect_get_tls_library_version()
const char *openconnect_get_tls_library_version(void)
{
if (!*tls_library_version) {
strncpy(tls_library_version, SSLeay_version(SSLEAY_VERSION), sizeof(tls_library_version));
Expand All @@ -61,7 +61,7 @@ const char *openconnect_get_tls_library_version()
return tls_library_version;
}

int can_enable_insecure_crypto()
int can_enable_insecure_crypto(void)
{
if (EVP_des_ede3_cbc() == NULL ||
EVP_rc4() == NULL)
Expand Down
6 changes: 4 additions & 2 deletions ppp.c
Expand Up @@ -190,7 +190,8 @@ static const char *lcp_names[] = {
"Discard-Request",
};

inline static const char *proto_names(uint16_t proto) {
inline static const char *proto_names(uint16_t proto)
{
static char unknown[21];

switch (proto) {
Expand Down Expand Up @@ -1029,7 +1030,8 @@ static int handle_state_transition(struct openconnect_info *vpninfo, int dtls,
return ret;
}

static inline void add_ppp_header(struct pkt *p, struct oc_ppp *ppp, int proto) {
static inline void add_ppp_header(struct pkt *p, struct oc_ppp *ppp, int proto)
{
unsigned char *ph = p->data;
/* XX: store PPP header, in reverse */
*--ph = proto & 0xff;
Expand Down
2 changes: 1 addition & 1 deletion pulse.c
Expand Up @@ -376,7 +376,7 @@ static int process_attr(struct openconnect_info *vpninfo, struct oc_vpn_option *
if (!attrlen)
goto badlen;
if (!data[attrlen-1])
attrlen--;
attrlen--;
vpn_progress(vpninfo, PRG_DEBUG, _("Received DNS search domain %.*s\n"),
attrlen, (char *)data);
new_ip_info->domain = add_option_dup(new_opts, "search", (char *)data, attrlen);
Expand Down
4 changes: 2 additions & 2 deletions script.c
Expand Up @@ -347,8 +347,8 @@ void prepare_script_env(struct openconnect_info *vpninfo)
if (vpninfo->ip_info.netmask6 && !vpninfo->ip_info.addr6) {
char *slash = strchr(vpninfo->ip_info.netmask6, '/');
if (slash)
script_setenv(vpninfo, "INTERNAL_IP6_ADDRESS", vpninfo->ip_info.netmask6,
slash - vpninfo->ip_info.netmask6, 0);
script_setenv(vpninfo, "INTERNAL_IP6_ADDRESS", vpninfo->ip_info.netmask6,
slash - vpninfo->ip_info.netmask6, 0);
}

if (vpninfo->ip_info.dns[0])
Expand Down
2 changes: 1 addition & 1 deletion ssl.c
Expand Up @@ -65,7 +65,7 @@
#endif
#endif

static inline int connect_pending()
static inline int connect_pending(void)
{
#ifdef _WIN32
return WSAGetLastError() == WSAEWOULDBLOCK;
Expand Down

0 comments on commit be3a052

Please sign in to comment.