From e87f59e107f05e9c86d16e6584acf9fc23143e80 Mon Sep 17 00:00:00 2001 From: sunghan Date: Mon, 8 May 2017 19:04:38 +0900 Subject: [PATCH] fix violations of coding style refer Tizen C coding style at https://wiki.tizen.org/wiki/Native_Platform_Coding_Idiom_and_Style_Guide#C_Coding_Style --- apps/examples/easysetup/easysetup_main.c | 23 ++--- apps/examples/easysetup/wifi_api.c | 30 +++--- apps/examples/iperf/iperf_api.c | 2 +- apps/examples/mqtt_test/mqtt_client_pub.c | 8 +- apps/examples/mqtt_test/mqtt_client_sub.c | 8 +- apps/examples/slsiwifi/nettest_functions.c | 6 +- apps/examples/smart/smart_main.c | 2 +- apps/examples/tls_client/tls_client_main.c | 114 ++++++++++----------- apps/examples/tls_selftest/tls_selftest_main.c | 8 +- apps/examples/wakaama_client/wakaama_client.c | 14 +-- apps/netutils/dhcpc/dhcpc.c | 4 +- apps/netutils/er-coap/er-coap-13.c | 2 +- apps/netutils/mdns/mdns.c | 20 ++-- apps/netutils/mdns/mdnsd.c | 16 +-- apps/netutils/mqtt/lib/time_mosq.c | 2 +- apps/netutils/webserver/http.c | 2 +- apps/netutils/webserver/http_client.c | 3 +- apps/netutils/wifi/slsi_wifi_api.c | 59 +++++------ apps/system/utils/netcmd.c | 2 +- apps/wpa_supplicant/src/ap/sta_info.c | 2 +- apps/wpa_supplicant/src/ap/vlan_init.c | 4 +- apps/wpa_supplicant/src/ap/wnm_ap.c | 2 +- apps/wpa_supplicant/src/crypto/aes-internal-dec.c | 4 +- apps/wpa_supplicant/src/crypto/aes-internal-enc.c | 2 +- .../wpa_supplicant/src/crypto/crypto_libtomcrypt.c | 2 +- apps/wpa_supplicant/src/crypto/dh_groups.c | 2 +- apps/wpa_supplicant/src/crypto/md4-internal.c | 2 +- apps/wpa_supplicant/src/crypto/md5-internal.c | 2 +- apps/wpa_supplicant/src/crypto/sha1-internal.c | 12 +-- apps/wpa_supplicant/src/crypto/sha256-internal.c | 10 +- apps/wpa_supplicant/src/crypto/tls_gnutls.c | 2 +- apps/wpa_supplicant/src/crypto/tls_openssl.c | 8 +- .../src/drivers/driver_nl80211_capa.c | 41 ++++---- .../wpa_supplicant/src/eap_server/eap_server_tnc.c | 4 +- apps/wpa_supplicant/src/radius/radius_server.c | 4 +- apps/wpa_supplicant/src/rsn_supp/tdls.c | 8 +- apps/wpa_supplicant/src/tls/libtommath.c | 4 +- apps/wpa_supplicant/src/utils/edit.c | 16 +-- apps/wpa_supplicant/src/wps/wps_registrar.c | 2 +- apps/wpa_supplicant/wpa_supplicant/scan.c | 2 +- framework/src/arastorage/index_manager.c | 2 +- os/arch/arm/src/s5j/s5j_adc.c | 3 +- os/arch/arm/src/s5j/s5j_gpio.c | 2 +- os/arch/arm/src/s5j/s5j_pwrcal.c | 2 +- os/arch/arm/src/s5j/s5j_rtc.c | 6 +- os/arch/arm/src/s5j/s5j_rtc_lowerhalf.c | 6 +- os/arch/arm/src/s5j/s5j_serial.c | 2 +- os/arch/arm/src/s5j/s5j_spi.c | 63 ++++++------ os/arch/arm/src/sidk_s5jt200/src/s5jt200_eeprom.c | 8 +- os/arch/arm/src/sidk_s5jt200/src/s5jt200_tash.c | 2 +- os/drivers/bch/bchdev_driver.c | 3 +- os/drivers/rtc.c | 23 ++--- os/drivers/wireless/scsc/mgt.c | 10 +- os/drivers/wireless/scsc/misc/miframman.c | 6 +- os/drivers/wireless/scsc/mlme.c | 4 +- os/drivers/wireless/scsc/netif.c | 4 +- os/drivers/wireless/scsc/rx.c | 6 +- os/fs/smartfs/smartfs_smart.c | 2 +- os/kernel/pthread/pthread_mutexdestroy.c | 36 +++---- os/kernel/pthread/pthread_mutexlock.c | 9 +- os/net/lwip/src/core/ipv4/ip.c | 2 +- os/net/tls/dhm.c | 16 +-- os/net/tls/ecp_curves.c | 2 +- os/net/tls/ssl_ciphersuites.c | 2 +- 64 files changed, 326 insertions(+), 355 deletions(-) diff --git a/apps/examples/easysetup/easysetup_main.c b/apps/examples/easysetup/easysetup_main.c index 4e38f79..6ef9573 100644 --- a/apps/examples/easysetup/easysetup_main.c +++ b/apps/examples/easysetup/easysetup_main.c @@ -32,8 +32,7 @@ /**************************************************************************** * Public Functions ****************************************************************************/ -struct ap_info_t -{ +struct ap_info_t { char ssid[32]; char security[32]; char pwd[64]; @@ -280,7 +279,7 @@ static int start_webserver(void) https_server = http_server_init(https_port); if (https_server == NULL) { - printf ("Error: Cannot allocate server structure!!\n"); + printf("Error: Cannot allocate server structure!!\n"); return -1; } @@ -293,25 +292,25 @@ static int start_webserver(void) /* THIS CODE SHOULD BE REMOVED AFTER USING SSS KEY AND CERT */ if ((ret = see_setup_key(sss_da_rsa_ca, sizeof(sss_da_rsa_ca), SECURE_STORAGE_TYPE_KEY_RSA, EASY_CA_KEY_INDEX)) != 0) { - printf( "Error: see_setup_key ca 0x%x\n\n", ret); + printf("Error: see_setup_key ca 0x%x\n\n", ret); return -1; } if ((ret = see_setup_key(sss_da_rsa_dev, sizeof(sss_da_rsa_dev), SECURE_STORAGE_TYPE_KEY_RSA, EASY_DEV_KEY_INDEX)) != 0) { - printf( "Error: see_setup_key dev 0x%x\n\n", ret); + printf("Error: see_setup_key dev 0x%x\n\n", ret); return -1; } if ((ret = see_set_certificate(sss_ca_crt, sizeof(sss_ca_crt), EASY_CA_CERT_INDEX, CERT_PEM)) != 0) { - printf ("Error: set_cert fail %d\n", ret); + printf("Error: set_cert fail %d\n", ret); return -1; } if ((ret = see_set_certificate(sss_dev_crt, sizeof(sss_dev_crt), EASY_DEV_CERT_INDEX, CERT_PEM)) != 0) { - printf ("Error: set_cert fail %d\n", ret); + printf("Error: set_cert fail %d\n", ret); return -1; } @@ -335,22 +334,22 @@ static int start_webserver(void) return -1; } - http_server_register_cb (https_server, HTTP_METHOD_GET, root_uri, http_get_cb); + http_server_register_cb(https_server, HTTP_METHOD_GET, root_uri, http_get_cb); http_server_register_cb(https_server, HTTP_METHOD_POST, network_uri, http_post_cb); http_server_register_cb(https_server, HTTP_METHOD_POST, control_uri, http_post_ctrl_cb); - http_server_start (https_server); + http_server_start(https_server); return 0; } static int stop_webserver(void) { - http_server_deregister_cb (https_server, HTTP_METHOD_GET, root_uri); + http_server_deregister_cb(https_server, HTTP_METHOD_GET, root_uri); http_server_deregister_cb(https_server, HTTP_METHOD_POST, network_uri); http_server_deregister_cb(https_server, HTTP_METHOD_POST, control_uri); http_server_stop(https_server); - http_server_release (&https_server); + http_server_release(&https_server); #if defined(CONFIG_HW_RSA) see_free(); @@ -529,7 +528,7 @@ _START_: printf("DHCP Client Start ::"); print_laptime(); g_stop_easysetup = 0; - if (start_webserver() !=0) { + if (start_webserver() != 0) { printf("webserver start fail\n"); return -1; } diff --git a/apps/examples/easysetup/wifi_api.c b/apps/examples/easysetup/wifi_api.c index 44938a7..46f1aa9 100644 --- a/apps/examples/easysetup/wifi_api.c +++ b/apps/examples/easysetup/wifi_api.c @@ -42,28 +42,28 @@ int wifi_securitymode_check(char *sec_type) sec_type, sizeof(SLSI_WIFI_SECURITY_OPEN)) == 0) { ret = 0; } else if (strncmp(SLSI_WIFI_SECURITY_WEP_OPEN, - sec_type, sizeof(SLSI_WIFI_SECURITY_WEP_OPEN)) == 0 ) { + sec_type, sizeof(SLSI_WIFI_SECURITY_WEP_OPEN)) == 0) { ret = 0; } else if (strncmp(SLSI_WIFI_SECURITY_WEP_SHARED, - sec_type, sizeof(SLSI_WIFI_SECURITY_WEP_SHARED)) == 0 ) { + sec_type, sizeof(SLSI_WIFI_SECURITY_WEP_SHARED)) == 0) { ret = 0; } else if (strncmp(SLSI_WIFI_SECURITY_WPA_MIXED, - sec_type, sizeof(SLSI_WIFI_SECURITY_WPA_MIXED)) == 0 ) { + sec_type, sizeof(SLSI_WIFI_SECURITY_WPA_MIXED)) == 0) { ret = 0; } else if (strncmp(SLSI_WIFI_SECURITY_WPA_TKIP, - sec_type, sizeof(SLSI_WIFI_SECURITY_WPA_TKIP)) == 0 ) { + sec_type, sizeof(SLSI_WIFI_SECURITY_WPA_TKIP)) == 0) { ret = 0; } else if (strncmp(SLSI_WIFI_SECURITY_WPA_AES, - sec_type, sizeof(SLSI_WIFI_SECURITY_WPA_AES)) == 0 ) { + sec_type, sizeof(SLSI_WIFI_SECURITY_WPA_AES)) == 0) { ret = 0; } else if (strncmp(SLSI_WIFI_SECURITY_WPA2_MIXED, - sec_type, sizeof(SLSI_WIFI_SECURITY_WPA2_MIXED)) == 0 ) { + sec_type, sizeof(SLSI_WIFI_SECURITY_WPA2_MIXED)) == 0) { ret = 0; } else if (strncmp(SLSI_WIFI_SECURITY_WPA2_TKIP, - sec_type, sizeof(SLSI_WIFI_SECURITY_WPA2_TKIP)) == 0 ) { + sec_type, sizeof(SLSI_WIFI_SECURITY_WPA2_TKIP)) == 0) { ret = 0; } else if (strncmp(SLSI_WIFI_SECURITY_WPA2_AES, - sec_type, sizeof(SLSI_WIFI_SECURITY_WPA2_AES)) == 0 ) { + sec_type, sizeof(SLSI_WIFI_SECURITY_WPA2_AES)) == 0) { ret = 0; } @@ -75,7 +75,7 @@ static slsi_security_config_t *get_security_config_(char *sec_type, char *psk) { slsi_security_config_t *ret = NULL; if (strncmp(SLSI_WIFI_SECURITY_OPEN, - sec_type, sizeof(SLSI_WIFI_SECURITY_OPEN)) != 0 ) { + sec_type, sizeof(SLSI_WIFI_SECURITY_OPEN)) != 0) { ret = (slsi_security_config_t *)zalloc(sizeof(slsi_security_config_t)); if (ret) { if (strncmp(SLSI_WIFI_SECURITY_WEP_OPEN, @@ -85,16 +85,16 @@ static slsi_security_config_t *get_security_config_(char *sec_type, char *psk) sec_type, sizeof(SLSI_WIFI_SECURITY_WEP_SHARED)) == 0) { ret->secmode = SLSI_SEC_MODE_WEP_SHARED; } else if (strncmp(SLSI_WIFI_SECURITY_WPA_MIXED, - sec_type,sizeof(SLSI_WIFI_SECURITY_WPA_MIXED)) == 0) { + sec_type, sizeof(SLSI_WIFI_SECURITY_WPA_MIXED)) == 0) { ret->secmode = SLSI_SEC_MODE_WPA_MIXED; } else if (strncmp(SLSI_WIFI_SECURITY_WPA_TKIP, - sec_type,sizeof(SLSI_WIFI_SECURITY_WPA_TKIP)) == 0) { + sec_type, sizeof(SLSI_WIFI_SECURITY_WPA_TKIP)) == 0) { ret->secmode = SLSI_SEC_MODE_WPA_TKIP; } else if (strncmp(SLSI_WIFI_SECURITY_WPA_AES, - sec_type,sizeof(SLSI_WIFI_SECURITY_WPA_AES)) == 0) { + sec_type, sizeof(SLSI_WIFI_SECURITY_WPA_AES)) == 0) { ret->secmode = SLSI_SEC_MODE_WPA_CCMP; } else if (strncmp(SLSI_WIFI_SECURITY_WPA2_MIXED, - sec_type,sizeof(SLSI_WIFI_SECURITY_WPA2_MIXED)) == 0) { + sec_type, sizeof(SLSI_WIFI_SECURITY_WPA2_MIXED)) == 0) { ret->secmode = SLSI_SEC_MODE_WPA2_MIXED; } else if (strncmp(SLSI_WIFI_SECURITY_WPA2_TKIP, sec_type, sizeof(SLSI_WIFI_SECURITY_WPA2_TKIP)) == 0) { @@ -127,7 +127,7 @@ static void linkDownHandler(slsi_reason_t* reason) { if (reason) { printf("Disconnected from network reason_code: %d %s\n", reason->reason_code, - reason->locally_generated ? "(locally_generated)": ""); + reason->locally_generated ? "(locally_generated)" : ""); } else { printf("Disconnected from network\n"); } @@ -244,7 +244,7 @@ int dhcpc_start(void) gnet_if->dhcp = NULL; } - printf( " netic hwaddr_len %d\n" + printf(" netic hwaddr_len %d\n" " netic hwaddr %x%x%x%x%x%x\n" " netic mtu %d\n" " netic flags %x\n", diff --git a/apps/examples/iperf/iperf_api.c b/apps/examples/iperf/iperf_api.c index 542cffd..54baa85 100644 --- a/apps/examples/iperf/iperf_api.c +++ b/apps/examples/iperf/iperf_api.c @@ -1759,7 +1759,7 @@ struct iperf_test *iperf_new_test(void) /* By default all output goes to stdout */ test->outfile = stdout; - if (sem_init(&(test->sem_iperf_api),0 ,1) != OK) { + if (sem_init(&(test->sem_iperf_api), 0, 1) != OK) { printf("iperf_new_test : failed on sem_init\n"); } diff --git a/apps/examples/mqtt_test/mqtt_client_pub.c b/apps/examples/mqtt_test/mqtt_client_pub.c index 8efbebd..a1e6535 100644 --- a/apps/examples/mqtt_test/mqtt_client_pub.c +++ b/apps/examples/mqtt_test/mqtt_client_pub.c @@ -47,11 +47,11 @@ #define MQTT_CLIENT_PUB_COMMAND_NAME "mqtt_pub" #define MQTT_ID_MAX_LENGTH 23 -#define MQTT_PUB_STACK_SIZE 20480 -#define MQTT_PUB_SCHED_PRI 100 -#define MQTT_PUB_SCHED_POLICY SCHED_RR +#define MQTT_PUB_STACK_SIZE 20480 +#define MQTT_PUB_SCHED_PRI 100 +#define MQTT_PUB_SCHED_POLICY SCHED_RR -#define MQTT_PUB_DEBUG_PRINT(client_handle,...) \ +#define MQTT_PUB_DEBUG_PRINT(client_handle, ...) \ do { \ if (client_handle && (client_handle)->config && (client_handle)->config->debug) \ printf(__VA_ARGS__); \ diff --git a/apps/examples/mqtt_test/mqtt_client_sub.c b/apps/examples/mqtt_test/mqtt_client_sub.c index 98a07fd..d31a857 100644 --- a/apps/examples/mqtt_test/mqtt_client_sub.c +++ b/apps/examples/mqtt_test/mqtt_client_sub.c @@ -45,11 +45,11 @@ #define MQTT_CLIENT_SUB_COMMAND_NAME "mqtt_sub" #define MQTT_ID_MAX_LENGTH 23 -#define MQTT_SUB_STACK_SIZE 20480 -#define MQTT_SUB_SCHED_PRI 100 -#define MQTT_SUB_SCHED_POLICY SCHED_RR +#define MQTT_SUB_STACK_SIZE 20480 +#define MQTT_SUB_SCHED_PRI 100 +#define MQTT_SUB_SCHED_POLICY SCHED_RR -#define MQTT_SUB_DEBUG_PRINT(client_handle,...) \ +#define MQTT_SUB_DEBUG_PRINT(client_handle, ...) \ do { \ if (client_handle && (client_handle)->config && (client_handle)->config->debug) \ printf(__VA_ARGS__); \ diff --git a/apps/examples/slsiwifi/nettest_functions.c b/apps/examples/slsiwifi/nettest_functions.c index 6d67a6e..b7c252e 100644 --- a/apps/examples/slsiwifi/nettest_functions.c +++ b/apps/examples/slsiwifi/nettest_functions.c @@ -106,9 +106,9 @@ static ip_addr_t client_ip; static int8_t tc = 1; #define TESTPRINT(fmt, ...) \ - printf("\n\n**************************************************************************\n" \ - "[TESTCASE %d] " fmt "\n**************************************************************************\n" \ - ,tc++, ##__VA_ARGS__) + printf("\n\n**************************************************************************\n" \ + "[TESTCASE %d] " fmt "\n**************************************************************************\n" \ + , tc++, ##__VA_ARGS__) #define PING_MAX_TRY_COUNTER 10 diff --git a/apps/examples/smart/smart_main.c b/apps/examples/smart/smart_main.c index f6c3ee6..1df8dc2 100644 --- a/apps/examples/smart/smart_main.c +++ b/apps/examples/smart/smart_main.c @@ -97,7 +97,7 @@ #endif #define EXAMPLES_SMART_BUFSIZE \ - (CONFIG_RAMMTD_ERASESIZE * CONFIG_EXAMPLES_SMART_NEBLOCKS) + (CONFIG_RAMMTD_ERASESIZE * CONFIG_EXAMPLES_SMART_NEBLOCKS) #endif #ifndef CONFIG_EXAMPLES_SMART_MAXNAME diff --git a/apps/examples/tls_client/tls_client_main.c b/apps/examples/tls_client/tls_client_main.c index bb45bc1..1ec36fd 100644 --- a/apps/examples/tls_client/tls_client_main.c +++ b/apps/examples/tls_client/tls_client_main.c @@ -863,56 +863,50 @@ usage: opt.arc4 = MBEDTLS_SSL_ARC4_ENABLED; } } - #if defined(MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED) - /* - * Unhexify the pre-shared key if any is given - */ - if( strlen( opt.psk ) ) - { - unsigned char c; - size_t j; - - if( strlen( opt.psk ) % 2 != 0 ) - { - mbedtls_printf("pre-shared key not valid hex\n"); - goto exit; - } - - psk_len = strlen( opt.psk ) / 2; - - for( j = 0; j < strlen( opt.psk ); j += 2 ) - { - c = opt.psk[j]; - if( c >= '0' && c <= '9' ) - c -= '0'; - else if( c >= 'a' && c <= 'f' ) - c -= 'a' - 10; - else if( c >= 'A' && c <= 'F' ) - c -= 'A' - 10; - else - { - mbedtls_printf("pre-shared key not valid hex\n"); - goto exit; - } - psk[ j / 2 ] = c << 4; - - c = opt.psk[j + 1]; - if( c >= '0' && c <= '9' ) - c -= '0'; - else if( c >= 'a' && c <= 'f' ) - c -= 'a' - 10; - else if( c >= 'A' && c <= 'F' ) - c -= 'A' - 10; - else - { - mbedtls_printf("pre-shared key not valid hex\n"); - goto exit; - } - psk[ j / 2 ] |= c; - } - } -#endif /* MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED */ + /* + * Unhexify the pre-shared key if any is given + */ + if (strlen(opt.psk)) { + unsigned char c; + size_t j; + + if (strlen(opt.psk) % 2 != 0) { + mbedtls_printf("pre-shared key not valid hex\n"); + goto exit; + } + + psk_len = strlen(opt.psk) / 2; + + for (j = 0; j < strlen(opt.psk); j += 2) { + c = opt.psk[j]; + if (c >= '0' && c <= '9') { + c -= '0'; + } else if (c >= 'a' && c <= 'f') { + c -= 'a' - 10; + } else if (c >= 'A' && c <= 'F') { + c -= 'A' - 10; + } else { + mbedtls_printf("pre-shared key not valid hex\n"); + goto exit; + } + psk[j / 2] = c << 4; + + c = opt.psk[j + 1]; + if (c >= '0' && c <= '9') { + c -= '0'; + } else if (c >= 'a' && c <= 'f') { + c -= 'a' - 10; + } else if (c >= 'A' && c <= 'F') { + c -= 'A' - 10; + } else { + mbedtls_printf("pre-shared key not valid hex\n"); + goto exit; + } + psk[j / 2] |= c; + } + } +#endif /* MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED */ #if defined(MBEDTLS_SSL_ALPN) if (opt.alpn_string != NULL) { @@ -952,7 +946,7 @@ usage: #ifdef CONFIG_EXAMPLES_TLS_ARTIK_KEY unsigned int cert_buflen = SEE_MAX_BUF_SIZE; char *cert_buf = NULL; - const char cert_start[2] = {0x30, 0x82}; + const char cert_start[2] = { 0x30, 0x82 }; cert_buf = (char *)malloc(SEE_MAX_BUF_SIZE); @@ -967,7 +961,7 @@ usage: goto exit; } - char *cert_offset[3] = {NULL, NULL, NULL}; + char *cert_offset[3] = { NULL, NULL, NULL }; cert_offset[0] = cert_buf + 4; cert_offset[1] = strstr(cert_offset[0] + 4, cert_start); @@ -993,12 +987,12 @@ usage: */ const mbedtls_pk_info_t *pk_info; - if((pk_info = mbedtls_pk_info_from_type(MBEDTLS_PK_ECKEY))== NULL) { + if ((pk_info = mbedtls_pk_info_from_type(MBEDTLS_PK_ECKEY)) == NULL) { mbedtls_printf(" failed\n ! mbedtls_pk_info_from_type -0x%x\n", -ret); goto exit; } - if((ret = mbedtls_pk_setup(&pkey, pk_info)) != 0) { + if ((ret = mbedtls_pk_setup(&pkey, pk_info)) != 0) { mbedtls_printf(" failed\n ! mbedtls_pk_setup -0x%x\n", -ret); goto exit; } @@ -1060,7 +1054,7 @@ usage: goto exit; } #endif -#endif /* EXAMPLES_ARTIK_KEY */ +#endif /* EXAMPLES_ARTIK_KEY */ mbedtls_printf(" . Connecting to %s/%s/%s...", opt.transport == MBEDTLS_SSL_TRANSPORT_STREAM ? "tcp" : "udp", opt.server_addr, opt.server_port); fflush(stdout); @@ -1178,13 +1172,10 @@ usage: #endif #if defined(MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED) - if( ( ret = mbedtls_ssl_conf_psk( &conf, psk, psk_len, - (const unsigned char *) opt.psk_identity, - strlen( opt.psk_identity ) ) ) != 0 ) - { - mbedtls_printf( " failed\n ! mbedtls_ssl_conf_psk returned %d\n\n", ret ); - goto exit; - } + if ((ret = mbedtls_ssl_conf_psk(&conf, psk, psk_len, (const unsigned char *)opt.psk_identity, strlen(opt.psk_identity))) != 0) { + mbedtls_printf(" failed\n ! mbedtls_ssl_conf_psk returned %d\n\n", ret); + goto exit; + } #endif if (opt.min_version != DFL_MIN_VERSION) { @@ -1194,7 +1185,6 @@ usage: if (opt.max_version != DFL_MAX_VERSION) { mbedtls_ssl_conf_max_version(&conf, MBEDTLS_SSL_MAJOR_VERSION_3, opt.max_version); } - #if defined(MBEDTLS_SSL_FALLBACK_SCSV) if (opt.fallback != DFL_FALLBACK) { mbedtls_ssl_conf_fallback(&conf, opt.fallback); diff --git a/apps/examples/tls_selftest/tls_selftest_main.c b/apps/examples/tls_selftest/tls_selftest_main.c index a7e9cca..5864629 100644 --- a/apps/examples/tls_selftest/tls_selftest_main.c +++ b/apps/examples/tls_selftest/tls_selftest_main.c @@ -75,10 +75,10 @@ #define TLS_SELFTEST_SCHED_POLICY SCHED_RR -#define DO_TLS_TEST(func, v) \ -if ((ret = func(v)) != 0) { \ - printf("fail %d\n", ret); \ - fail_cnt++; \ +#define DO_TLS_TEST(func, v) \ +if ((ret = func(v)) != 0) { \ + printf("fail %d\n", ret); \ + fail_cnt++; \ } pthread_addr_t tls_selftest_cb(void *args) diff --git a/apps/examples/wakaama_client/wakaama_client.c b/apps/examples/wakaama_client/wakaama_client.c index c481e99..6abf754 100644 --- a/apps/examples/wakaama_client/wakaama_client.c +++ b/apps/examples/wakaama_client/wakaama_client.c @@ -33,13 +33,13 @@ #define NET_DEVNAME "wl1" -#define WAKAAMA_CHECK_ARG() do {\ - if (opt >= argc) { \ - app_print_usage(); \ - return 0; \ - } \ -} \ -while (0); +#define WAKAAMA_CHECK_ARG() \ + do {\ + if (opt >= argc) { \ + app_print_usage(); \ + return 0; \ + } \ + } while (0); #if defined(CONFIG_NET_LWIP_DHCPC) && !defined(CONFIG_NETUTILS_DHCPC) diff --git a/apps/netutils/dhcpc/dhcpc.c b/apps/netutils/dhcpc/dhcpc.c index 4491351..354a0f1 100644 --- a/apps/netutils/dhcpc/dhcpc.c +++ b/apps/netutils/dhcpc/dhcpc.c @@ -74,7 +74,7 @@ #include #include -#if defined (CONFIG_NETDB_DNSCLIENT) && defined (CONFIG_NETDB_DNSSERVER_BY_DHCP) +#if defined(CONFIG_NETDB_DNSCLIENT) && defined(CONFIG_NETDB_DNSSERVER_BY_DHCP) #include #endif /**************************************************************************** @@ -619,7 +619,7 @@ int dhcpc_request(void *handle, struct dhcpc_state *presult) ndbg("Got default router %d.%d.%d.%d\n", (presult->default_router.s_addr) & 0xff, (presult->default_router.s_addr >> 8) & 0xff, (presult->default_router.s_addr >> 16) & 0xff, (presult->default_router.s_addr >> 24) & 0xff); ndbg("Lease expires in %d seconds\n", presult->lease_time); -#if defined (CONFIG_NETDB_DNSCLIENT) && defined (CONFIG_NETDB_DNSSERVER_BY_DHCP) +#if defined(CONFIG_NETDB_DNSCLIENT) && defined(CONFIG_NETDB_DNSSERVER_BY_DHCP) struct sockaddr_in dns; if (presult->dnsaddr.s_addr != 0) { ndbg("Set DNS IP address via dns_add_nameserver\n"); diff --git a/apps/netutils/er-coap/er-coap-13.c b/apps/netutils/er-coap/er-coap-13.c index 7832ad6..010b989 100644 --- a/apps/netutils/er-coap/er-coap-13.c +++ b/apps/netutils/er-coap/er-coap-13.c @@ -50,7 +50,7 @@ #include #define PRINTF(...) printf(__VA_ARGS__) #define PRINT6ADDR(addr) PRINTF("[%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x]", ((uint8_t *)addr)[0], ((uint8_t *)addr)[1], ((uint8_t *)addr)[2], ((uint8_t *)addr)[3], ((uint8_t *)addr)[4], ((uint8_t *)addr)[5], ((uint8_t *)addr)[6], ((uint8_t *)addr)[7], ((uint8_t *)addr)[8], ((uint8_t *)addr)[9], ((uint8_t *)addr)[10], ((uint8_t *)addr)[11], ((uint8_t *)addr)[12], ((uint8_t *)addr)[13], ((uint8_t *)addr)[14], ((uint8_t *)addr)[15]) -#define PRINTLLADDR(lladdr) PRINTF("[%02x:%02x:%02x:%02x:%02x:%02x]",(lladdr)->addr[0], (lladdr)->addr[1], (lladdr)->addr[2], (lladdr)->addr[3],(lladdr)->addr[4], (lladdr)->addr[5]) +#define PRINTLLADDR(lladdr) PRINTF("[%02x:%02x:%02x:%02x:%02x:%02x]", (lladdr)->addr[0], (lladdr)->addr[1], (lladdr)->addr[2], (lladdr)->addr[3], (lladdr)->addr[4], (lladdr)->addr[5]) #else #define PRINTF(...) #define PRINT6ADDR(addr) diff --git a/apps/netutils/mdns/mdns.c b/apps/netutils/mdns/mdns.c index 7de29b4..f84af40 100644 --- a/apps/netutils/mdns/mdns.c +++ b/apps/netutils/mdns/mdns.c @@ -430,17 +430,17 @@ int rr_list_append(struct rr_list **rr_head, struct rr_entry *rr) } #define FILL_QN_ENTRY(rr, _name, _type, _unicast_query) \ - rr->name = _name; \ - rr->type = _type; \ - rr->unicast_query = _unicast_query; \ - rr->rr_class = 1; + rr->name = _name; \ + rr->type = _type; \ + rr->unicast_query = _unicast_query; \ + rr->rr_class = 1; #define FILL_RR_ENTRY(rr, _name, _type) \ - rr->name = _name; \ - rr->type = _type; \ - rr->ttl = DEFAULT_TTL; \ - rr->cache_flush = 1; \ - rr->rr_class = 1; + rr->name = _name; \ + rr->type = _type; \ + rr->ttl = DEFAULT_TTL; \ + rr->cache_flush = 1; \ + rr->rr_class = 1; struct rr_entry *qn_create(uint8_t *name, enum rr_type type, int unicast_query) { @@ -1302,7 +1302,7 @@ done: return off; } -#if MDNS_DEBUG_PRINTF==1 && MDNS_MEMORY_DEBUG==1 +#if (MDNS_DEBUG_PRINTF == 1) && (MDNS_MEMORY_DEBUG == 1) struct mdns_meminfo_node { char *func; int line; diff --git a/apps/netutils/mdns/mdnsd.c b/apps/netutils/mdns/mdnsd.c index 26c41cb..a4e199b 100644 --- a/apps/netutils/mdns/mdnsd.c +++ b/apps/netutils/mdns/mdnsd.c @@ -92,11 +92,11 @@ #include "mdns.h" #include -#if MDNS_DEBUG_PRINTF==1 && MDNS_RR_DEBUG==1 +#if (MDNS_DEBUG_PRINTF == 1) && (MDNS_RR_DEBUG == 1) #define MDNSD_RR_DEBUG #endif -#if MDNS_DEBUG_PRINTF==1 && MDNS_MEMORY_DEBUG==1 +#if (MDNS_DEBUG_PRINTF == 1) && (MDNS_MEMORY_DEBUG == 1) #define MDNSD_MEMORY_DEBUG #endif @@ -117,11 +117,11 @@ #define PACKET_SIZE 1536 /* maximum packet size : */ #define SERVICES_DNS_SD_NLABEL \ - ((uint8_t *)"\x09_services\x07_dns-sd\x04_udp\x05local") + ((uint8_t *)"\x09_services\x07_dns-sd\x04_udp\x05local") #define TIME_GET(time) gettimeofday(&time, NULL) #define TIME_DIFF_USEC(old_time, cur_time) \ - ((cur_time.tv_sec * 1000000 + cur_time.tv_usec) - (old_time.tv_sec * 1000000 + old_time.tv_usec)) + ((cur_time.tv_sec * 1000000 + cur_time.tv_usec) - (old_time.tv_sec * 1000000 + old_time.tv_usec)) #define MAX_ECONNRESET_COUNT 5 @@ -1012,7 +1012,7 @@ static int process_mdns_pkt(struct mdnsd *svr, struct mdns_pkt *pkt, struct mdns int create_pipe(int handles[2]) { -#if PIPE_SOCKET_TYPE ==1 +#if (PIPE_SOCKET_TYPE == 1) int result = -1; struct sockaddr_in serv_addr; @@ -1070,7 +1070,7 @@ errout: int read_pipe(int s, char *buf, int len) { -#if PIPE_SOCKET_TYPE ==1 +#if (PIPE_SOCKET_TYPE == 1) int ret; struct sockaddr_in fromaddr; socklen_t sockaddr_size = sizeof(struct sockaddr_in); @@ -1082,7 +1082,7 @@ int read_pipe(int s, char *buf, int len) int write_pipe(int s, char *buf, int len, int port) { -#if PIPE_SOCKET_TYPE ==1 +#if (PIPE_SOCKET_TYPE == 1) static struct sockaddr_in toaddr; memset(&toaddr, 0, sizeof(struct sockaddr_in)); @@ -1729,7 +1729,7 @@ static int init_mdns_context(int domain) } /* create main_loop thread */ - if ((pthread_create(&tid, &attr, (void * ( *)(void *))main_loop, (void *)g_svr) != 0)) { + if ((pthread_create(&tid, &attr, (void * (*)(void *))main_loop, (void *)g_svr) != 0)) { ndbg("ERROR: pthread_create() failed.\n"); goto errout_with_mutex; } diff --git a/apps/netutils/mqtt/lib/time_mosq.c b/apps/netutils/mqtt/lib/time_mosq.c index 41e7bdd..3982e6b 100644 --- a/apps/netutils/mqtt/lib/time_mosq.c +++ b/apps/netutils/mqtt/lib/time_mosq.c @@ -74,7 +74,7 @@ time_t mosquitto_time(void) } else { return GetTickCount() / 1000; /* FIXME - need to deal with overflow. */ } -#elif _POSIX_TIMERS>0 && defined(_POSIX_MONOTONIC_CLOCK) +#elif (_POSIX_TIMERS > 0) && defined(_POSIX_MONOTONIC_CLOCK) struct timespec tp; clock_gettime(CLOCK_MONOTONIC, &tp); diff --git a/apps/netutils/webserver/http.c b/apps/netutils/webserver/http.c index cc36972..d1d50fa 100644 --- a/apps/netutils/webserver/http.c +++ b/apps/netutils/webserver/http.c @@ -205,7 +205,7 @@ pthread_addr_t http_server_handler(pthread_addr_t arg) } } } -stop : +stop: HTTP_LOGD("http_server_hander stop :%d\n", server->port); if (msg_q >= 0) { diff --git a/apps/netutils/webserver/http_client.c b/apps/netutils/webserver/http_client.c index 863eef4..8d51073 100644 --- a/apps/netutils/webserver/http_client.c +++ b/apps/netutils/webserver/http_client.c @@ -374,8 +374,7 @@ int http_recv_and_handle_request(struct http_client_t *client, struct http_keyva int read_finish = false; int method = HTTP_METHOD_UNKNOWN; - char url[HTTP_CONF_MAX_REQUEST_HEADER_URL_LENGTH] = - { 0, }; + char url[HTTP_CONF_MAX_REQUEST_HEADER_URL_LENGTH] = { 0, }; int buf_len = 0; int remain = HTTP_CONF_MAX_REQUEST_LENGTH; int enc = HTTP_CONTENT_LENGTH; diff --git a/apps/netutils/wifi/slsi_wifi_api.c b/apps/netutils/wifi/slsi_wifi_api.c index 1a1424f..83454b5 100644 --- a/apps/netutils/wifi/slsi_wifi_api.c +++ b/apps/netutils/wifi/slsi_wifi_api.c @@ -58,7 +58,7 @@ extern size_t printf_decode(u8 *buf, size_t maxlen, const char *str); extern void printf_encode(char *txt, size_t maxlen, const u8 *data, size_t len); #ifdef CONFIG_DEBUG_WLAN_API_VERBOSE -#define VPRINT(format, ...) printf("SLSI API VERBOSE (%s): " format,__FUNCTION__, ##__VA_ARGS__) +#define VPRINT(format, ...) printf("SLSI API VERBOSE (%s): " format, __FUNCTION__, ##__VA_ARGS__) #define SLSI_API_VERBOSE (1) #ifndef CONFIG_DEBUG_WLAN_API_DEBUG #define CONFIG_DEBUG_WLAN_API_DEBUG @@ -69,7 +69,7 @@ extern void printf_encode(char *txt, size_t maxlen, const u8 *data, size_t len); #endif //CONFIG_DEBUG_WLAN_API_VERBOSE #ifdef CONFIG_DEBUG_WLAN_API_DEBUG -#define DPRINT(format, ...) printf("SLSI API DEBUG (%s): " format,__FUNCTION__, ##__VA_ARGS__) +#define DPRINT(format, ...) printf("SLSI API DEBUG (%s): " format, __FUNCTION__, ##__VA_ARGS__) #ifndef CONFIG_DEBUG_WLAN_API_ERROR #define CONFIG_DEBUG_WLAN_API_ERROR #endif @@ -78,7 +78,7 @@ extern void printf_encode(char *txt, size_t maxlen, const u8 *data, size_t len); #endif //CONFIG_DEBUG_WLAN_API_DEBUG #ifdef CONFIG_DEBUG_WLAN_API_ERROR -#define EPRINT(format, ...) printf("SLSI API ERROR (%s): " format,__FUNCTION__, ##__VA_ARGS__) +#define EPRINT(format, ...) printf("SLSI API ERROR (%s): " format, __FUNCTION__, ##__VA_ARGS__) #else #define EPRINT(a, ...) (void)0 #endif //CONFIG_DEBUG_WLAN_API_ERROR @@ -317,38 +317,39 @@ static char *sup_argv[6]; #endif #define LOCKUNLOCK_CRITICAL { \ - EPRINT("LOCKUNLOCK_CRITICAL - %s\n", __func__); \ - if (SLSI_API_VERBOSE) fflush(stdout); \ - pthread_mutex_trylock(&mutex_state); \ - pthread_mutex_unlock(&mutex_state); \ + EPRINT("LOCKUNLOCK_CRITICAL - %s\n", __func__); \ + if (SLSI_API_VERBOSE) fflush(stdout); \ + pthread_mutex_trylock(&mutex_state); \ + pthread_mutex_unlock(&mutex_state); \ } #define ENTER_CRITICAL { \ - VPRINT("ENTER_CRITICAL in API - %s\n", __func__); \ - if (!g_mutex_initialized) { \ - VPRINT("Initializing the mutex\n"); \ - if (pthread_mutex_init(&mutex_state, NULL) != OK) { \ - EPRINT("Could not initialize mutex\n"); \ - } else { \ - VPRINT("Mutex ready\n"); \ - g_mutex_initialized = TRUE; \ - } \ - } \ - if (SLSI_API_VERBOSE) fflush(stdout); \ - int err = pthread_mutex_lock(&mutex_state); \ - if (err != OK) { \ - EPRINT("mutex lock failed with error %d",err); \ - } \ - if (g_state == SLSI_WIFIAPI_STATE_RECOVERING || g_recovering ) { \ - VPRINT("sem_wait recovering - %s\n", __func__); \ - if (SLSI_API_VERBOSE) fflush(stdout); \ - sem_wait(&g_sem_api_block);} \ + VPRINT("ENTER_CRITICAL in API - %s\n", __func__); \ + if (!g_mutex_initialized) { \ + VPRINT("Initializing the mutex\n"); \ + if (pthread_mutex_init(&mutex_state, NULL) != OK) { \ + EPRINT("Could not initialize mutex\n"); \ + } else { \ + VPRINT("Mutex ready\n"); \ + g_mutex_initialized = TRUE; \ + } \ + } \ + if (SLSI_API_VERBOSE) fflush(stdout); \ + int err = pthread_mutex_lock(&mutex_state); \ + if (err != OK) { \ + EPRINT("mutex lock failed with error %d", err); \ + } \ + if (g_state == SLSI_WIFIAPI_STATE_RECOVERING || g_recovering) { \ + VPRINT("sem_wait recovering - %s\n", __func__); \ + if (SLSI_API_VERBOSE) fflush(stdout); \ + sem_wait(&g_sem_api_block); \ + } \ } #define LEAVE_CRITICAL { \ - VPRINT("LEAVE_CRITICAL in API - %s\n", __func__); \ - if (SLSI_API_VERBOSE) fflush(stdout); \ - pthread_mutex_unlock(&mutex_state); \ + VPRINT("LEAVE_CRITICAL in API - %s\n", __func__); \ + if (SLSI_API_VERBOSE) fflush(stdout); \ + pthread_mutex_unlock(&mutex_state); \ } /* diff --git a/apps/system/utils/netcmd.c b/apps/system/utils/netcmd.c index c53d064..1614065 100644 --- a/apps/system/utils/netcmd.c +++ b/apps/system/utils/netcmd.c @@ -605,7 +605,7 @@ int cmd_ifconfig(int argc, char **argv) printf("IP address %s\n", inet_ntoa(ds.ipaddr)); printf("Netmask %s\n", inet_ntoa(ds.netmask)); printf("Gateway %s\n", inet_ntoa(ds.default_router)); -#if defined (CONFIG_NETDB_DNSCLIENT) && defined (CONFIG_NETDB_DNSSERVER_BY_DHCP) +#if defined(CONFIG_NETDB_DNSCLIENT) && defined(CONFIG_NETDB_DNSSERVER_BY_DHCP) printf("Default DNS %s\n", inet_ntoa(ds.dnsaddr)); #endif dhcpc_close(handle); diff --git a/apps/wpa_supplicant/src/ap/sta_info.c b/apps/wpa_supplicant/src/ap/sta_info.c index 335cae8..e0bbe26 100644 --- a/apps/wpa_supplicant/src/ap/sta_info.c +++ b/apps/wpa_supplicant/src/ap/sta_info.c @@ -869,7 +869,7 @@ void ap_sta_set_authorized(struct hostapd_data *hapd, struct sta_info *sta, int u8 ip_addr_buf[4]; #endif /* CONFIG_P2P */ - if (! !authorized == ! !(sta->flags & WLAN_STA_AUTHORIZED)) { + if (!!authorized == !!(sta->flags & WLAN_STA_AUTHORIZED)) { return; } diff --git a/apps/wpa_supplicant/src/ap/vlan_init.c b/apps/wpa_supplicant/src/ap/vlan_init.c index 597010d..d35078a 100644 --- a/apps/wpa_supplicant/src/ap/vlan_init.c +++ b/apps/wpa_supplicant/src/ap/vlan_init.c @@ -173,13 +173,13 @@ static int ifconfig_down(const char *if_name) * underscore). */ #define _GET_VLAN_REALDEV_NAME_CMD 8 -#define _GET_VLAN_VID_CMD 9 +#define _GET_VLAN_VID_CMD 9 /* This value should be 256 ONLY. If it is something else, then hostapd * might crash!, as this value has been hard-coded in 2.4.x kernel * bridging code. */ -#define MAX_BR_PORTS 256 +#define MAX_BR_PORTS 256 static int br_delif(const char *br_name, const char *if_name) { diff --git a/apps/wpa_supplicant/src/ap/wnm_ap.c b/apps/wpa_supplicant/src/ap/wnm_ap.c index 46c3e81..f7e86be 100644 --- a/apps/wpa_supplicant/src/ap/wnm_ap.c +++ b/apps/wpa_supplicant/src/ap/wnm_ap.c @@ -113,7 +113,7 @@ static int ieee802_11_send_wnmsleep_resp(struct hostapd_data *hapd, const u8 *ad #endif /* CONFIG_IEEE80211W */ WPA_PUT_LE16((u8 *) - & mgmt->u.action.u.wnm_sleep_resp.keydata_len, gtk_elem_len + igtk_elem_len); + &mgmt->u.action.u.wnm_sleep_resp.keydata_len, gtk_elem_len + igtk_elem_len); } os_memcpy(pos, &wnmsleep_ie, wnmsleep_ie_len); /* copy TFS IE here */ diff --git a/apps/wpa_supplicant/src/crypto/aes-internal-dec.c b/apps/wpa_supplicant/src/crypto/aes-internal-dec.c index d842728..39eb376 100644 --- a/apps/wpa_supplicant/src/crypto/aes-internal-dec.c +++ b/apps/wpa_supplicant/src/crypto/aes-internal-dec.c @@ -79,7 +79,7 @@ void *aes_decrypt_init(const u8 *key, size_t len) return rk; } -static void rijndaelDecrypt(const u32 rk[ /*44 */ ], int Nr, const u8 ct[16], +static void rijndaelDecrypt(const u32 rk[/* 44 */], int Nr, const u8 ct[16], u8 pt[16]) { u32 s0, s1, s2, s3, t0, t1, t2, t3; @@ -96,7 +96,7 @@ static void rijndaelDecrypt(const u32 rk[ /*44 */ ], int Nr, const u8 ct[16], s2 = GETU32(ct + 8) ^ rk[2]; s3 = GETU32(ct + 12) ^ rk[3]; -#define ROUND(i,d,s) \ +#define ROUND(i, d, s) \ d##0 = TD0(s##0) ^ TD1(s##3) ^ TD2(s##2) ^ TD3(s##1) ^ rk[4 * i]; \ d##1 = TD0(s##1) ^ TD1(s##0) ^ TD2(s##3) ^ TD3(s##2) ^ rk[4 * i + 1]; \ d##2 = TD0(s##2) ^ TD1(s##1) ^ TD2(s##0) ^ TD3(s##3) ^ rk[4 * i + 2]; \ diff --git a/apps/wpa_supplicant/src/crypto/aes-internal-enc.c b/apps/wpa_supplicant/src/crypto/aes-internal-enc.c index 43a16f1..64f8915 100644 --- a/apps/wpa_supplicant/src/crypto/aes-internal-enc.c +++ b/apps/wpa_supplicant/src/crypto/aes-internal-enc.c @@ -36,7 +36,7 @@ static void rijndaelEncrypt(const u32 rk[], int Nr, const u8 pt[16], u8 ct[16]) s2 = GETU32(pt + 8) ^ rk[2]; s3 = GETU32(pt + 12) ^ rk[3]; -#define ROUND(i,d,s) \ +#define ROUND(i, d, s) \ d##0 = TE0(s##0) ^ TE1(s##1) ^ TE2(s##2) ^ TE3(s##3) ^ rk[4 * i]; \ d##1 = TE0(s##1) ^ TE1(s##2) ^ TE2(s##3) ^ TE3(s##0) ^ rk[4 * i + 1]; \ d##2 = TE0(s##2) ^ TE1(s##3) ^ TE2(s##0) ^ TE3(s##1) ^ rk[4 * i + 2]; \ diff --git a/apps/wpa_supplicant/src/crypto/crypto_libtomcrypt.c b/apps/wpa_supplicant/src/crypto/crypto_libtomcrypt.c index 107e897..0463b39 100644 --- a/apps/wpa_supplicant/src/crypto/crypto_libtomcrypt.c +++ b/apps/wpa_supplicant/src/crypto/crypto_libtomcrypt.c @@ -18,7 +18,7 @@ #define mp_unsigned_bin_size(a) ltc_mp.unsigned_size(a) #define mp_to_unsigned_bin(a, b) ltc_mp.unsigned_write(a, b) #define mp_read_unsigned_bin(a, b, c) ltc_mp.unsigned_read(a, b, c) -#define mp_exptmod(a,b,c,d) ltc_mp.exptmod(a,b,c,d) +#define mp_exptmod(a, b, c, d) ltc_mp.exptmod(a, b, c, d) #endif int md4_vector(size_t num_elem, const u8 *addr[], const size_t *len, u8 *mac) diff --git a/apps/wpa_supplicant/src/crypto/dh_groups.c b/apps/wpa_supplicant/src/crypto/dh_groups.c index 9030a5c..4f646c4 100644 --- a/apps/wpa_supplicant/src/crypto/dh_groups.c +++ b/apps/wpa_supplicant/src/crypto/dh_groups.c @@ -1167,7 +1167,7 @@ static const u8 dh_group24_order[] = { #endif /* ALL_DH_GROUPS */ -#define DH_GROUP(id,safe) \ +#define DH_GROUP(id, safe) \ { id, dh_group ## id ## _generator, sizeof(dh_group ## id ## _generator), \ dh_group ## id ## _prime, sizeof(dh_group ## id ## _prime), \ dh_group ## id ## _order, sizeof(dh_group ## id ## _order), safe } diff --git a/apps/wpa_supplicant/src/crypto/md4-internal.c b/apps/wpa_supplicant/src/crypto/md4-internal.c index 48a79ce..1131c1c 100644 --- a/apps/wpa_supplicant/src/crypto/md4-internal.c +++ b/apps/wpa_supplicant/src/crypto/md4-internal.c @@ -181,7 +181,7 @@ static void MD4Final(unsigned char digest[MD4_DIGEST_LENGTH], MD4_CTX *ctx) /* This is the central step in the MD4 algorithm. */ #define MD4STEP(f, w, x, y, z, data, s) \ - ( w += f(x, y, z) + data, w = w<>(32-s) ) + (w += f(x, y, z) + data, w = w << s | w >> (32 - s)) /* * The core of the MD4 algorithm, this alters an existing MD4 hash to diff --git a/apps/wpa_supplicant/src/crypto/md5-internal.c b/apps/wpa_supplicant/src/crypto/md5-internal.c index aef32fe..978292a 100644 --- a/apps/wpa_supplicant/src/crypto/md5-internal.c +++ b/apps/wpa_supplicant/src/crypto/md5-internal.c @@ -192,7 +192,7 @@ void MD5Final(unsigned char digest[16], struct MD5Context *ctx) /* This is the central step in the MD5 algorithm. */ #define MD5STEP(f, w, x, y, z, data, s) \ - ( w += f(x, y, z) + data, w = w<>(32-s), w += x ) + (w += f(x, y, z) + data, w = w<>(32-s), w += x) /* * The core of the MD5 algorithm, this alters an existing MD5 hash to diff --git a/apps/wpa_supplicant/src/crypto/sha1-internal.c b/apps/wpa_supplicant/src/crypto/sha1-internal.c index 2b60378..cd693a3 100644 --- a/apps/wpa_supplicant/src/crypto/sha1-internal.c +++ b/apps/wpa_supplicant/src/crypto/sha1-internal.c @@ -137,20 +137,20 @@ A million repetitions of "a" block->l[(i + 8) & 15] ^ block->l[(i + 2) & 15] ^ block->l[i & 15], 1)) /* (R0+R1), R2, R3, R4 are the different operations used in SHA1 */ -#define R0(v,w,x,y,z,i) \ +#define R0(v, w, x, y, z, i) \ z += ((w & (x ^ y)) ^ y) + blk0(i) + 0x5A827999 + rol(v, 5); \ w = rol(w, 30); -#define R1(v,w,x,y,z,i) \ +#define R1(v, w, x, y, z, i) \ z += ((w & (x ^ y)) ^ y) + blk(i) + 0x5A827999 + rol(v, 5); \ w = rol(w, 30); -#define R2(v,w,x,y,z,i) \ +#define R2(v, w, x, y, z, i) \ z += (w ^ x ^ y) + blk(i) + 0x6ED9EBA1 + rol(v, 5); w = rol(w, 30); -#define R3(v,w,x,y,z,i) \ +#define R3(v, w, x, y, z, i) \ z += (((w | x) & y) | (w & x)) + blk(i) + 0x8F1BBCDC + rol(v, 5); \ w = rol(w, 30); -#define R4(v,w,x,y,z,i) \ +#define R4(v, w, x, y, z, i) \ z += (w ^ x ^ y) + blk(i) + 0xCA62C1D6 + rol(v, 5); \ - w=rol(w, 30); + w = rol(w, 30); #ifdef VERBOSE /* SAK */ void SHAPrintContext(SHA1_CTX *context, char *msg) diff --git a/apps/wpa_supplicant/src/crypto/sha256-internal.c b/apps/wpa_supplicant/src/crypto/sha256-internal.c index a61ce46..55a5569 100644 --- a/apps/wpa_supplicant/src/crypto/sha256-internal.c +++ b/apps/wpa_supplicant/src/crypto/sha256-internal.c @@ -61,10 +61,10 @@ static const unsigned long K[64] = { /* Various logical functions */ #define RORc(x, y) \ -( ((((unsigned long) (x) & 0xFFFFFFFFUL) >> (unsigned long) ((y) & 31)) | \ - ((unsigned long) (x) << (unsigned long) (32 - ((y) & 31)))) & 0xFFFFFFFFUL) -#define Ch(x,y,z) (z ^ (x & (y ^ z))) -#define Maj(x,y,z) (((x | y) & z) | (x & y)) + (((((unsigned long)(x) & 0xFFFFFFFFUL) >> (unsigned long)((y) & 31)) | \ + ((unsigned long)(x) << (unsigned long)(32 - ((y) & 31)))) & 0xFFFFFFFFUL) +#define Ch(x, y, z) (z ^ (x & (y ^ z))) +#define Maj(x, y, z) (((x | y) & z) | (x & y)) #define S(x, n) RORc((x), (n)) #define R(x, n) (((x)&0xFFFFFFFFUL)>>(n)) #define Sigma0(x) (S(x, 2) ^ S(x, 13) ^ S(x, 22)) @@ -98,7 +98,7 @@ static int sha256_compress(struct sha256_state *md, unsigned char *buf) } /* Compress */ -#define RND(a,b,c,d,e,f,g,h,i) \ +#define RND(a, b, c, d, e, f, g, h, i) \ t0 = h + Sigma1(e) + Ch(e, f, g) + K[i] + W[i]; \ t1 = Sigma0(a) + Maj(a, b, c); \ d += t0; \ diff --git a/apps/wpa_supplicant/src/crypto/tls_gnutls.c b/apps/wpa_supplicant/src/crypto/tls_gnutls.c index 451d37c..8ba8891 100644 --- a/apps/wpa_supplicant/src/crypto/tls_gnutls.c +++ b/apps/wpa_supplicant/src/crypto/tls_gnutls.c @@ -46,7 +46,7 @@ struct tls_connection { size_t pre_shared_secret_len; int established; int verify_peer; - unsigned int disable_time_checks: 1; + unsigned int disable_time_checks : 1; struct wpabuf *push_buf; struct wpabuf *pull_buf; diff --git a/apps/wpa_supplicant/src/crypto/tls_openssl.c b/apps/wpa_supplicant/src/crypto/tls_openssl.c index ce703bd..09ccb90 100644 --- a/apps/wpa_supplicant/src/crypto/tls_openssl.c +++ b/apps/wpa_supplicant/src/crypto/tls_openssl.c @@ -98,10 +98,10 @@ struct tls_connection { u8 *session_ticket; size_t session_ticket_len; - unsigned int ca_cert_verify: 1; - unsigned int cert_probe: 1; - unsigned int server_cert_only: 1; - unsigned int invalid_hb_used: 1; + unsigned int ca_cert_verify : 1; + unsigned int cert_probe : 1; + unsigned int server_cert_only : 1; + unsigned int invalid_hb_used : 1; u8 srv_cert_hash[32]; diff --git a/apps/wpa_supplicant/src/drivers/driver_nl80211_capa.c b/apps/wpa_supplicant/src/drivers/driver_nl80211_capa.c index 15c01f9..f4497f7 100644 --- a/apps/wpa_supplicant/src/drivers/driver_nl80211_capa.c +++ b/apps/wpa_supplicant/src/drivers/driver_nl80211_capa.c @@ -61,23 +61,23 @@ struct wiphy_info_data { unsigned int num_multichan_concurrent; - unsigned int error: 1; - unsigned int device_ap_sme: 1; - unsigned int poll_command_supported: 1; - unsigned int data_tx_status: 1; - unsigned int monitor_supported: 1; - unsigned int auth_supported: 1; - unsigned int connect_supported: 1; - unsigned int p2p_go_supported: 1; - unsigned int p2p_client_supported: 1; - unsigned int p2p_go_ctwindow_supported: 1; - unsigned int p2p_concurrent: 1; - unsigned int channel_switch_supported: 1; - unsigned int set_qos_map_supported: 1; - unsigned int have_low_prio_scan: 1; - unsigned int wmm_ac_supported: 1; - unsigned int mac_addr_rand_scan_supported: 1; - unsigned int mac_addr_rand_sched_scan_supported: 1; + unsigned int error : 1; + unsigned int device_ap_sme : 1; + unsigned int poll_command_supported : 1; + unsigned int data_tx_status : 1; + unsigned int monitor_supported : 1; + unsigned int auth_supported : 1; + unsigned int connect_supported : 1; + unsigned int p2p_go_supported : 1; + unsigned int p2p_client_supported : 1; + unsigned int p2p_go_ctwindow_supported : 1; + unsigned int p2p_concurrent : 1; + unsigned int channel_switch_supported : 1; + unsigned int set_qos_map_supported : 1; + unsigned int have_low_prio_scan : 1; + unsigned int wmm_ac_supported : 1; + unsigned int mac_addr_rand_scan_supported : 1; + unsigned int mac_addr_rand_sched_scan_supported : 1; }; static unsigned int probe_resp_offload_support(int supp_protocols) @@ -150,11 +150,8 @@ static int wiphy_info_iface_comb_process(struct wiphy_info_data *info, struct nl [NL80211_IFACE_COMB_NUM_CHANNELS] = {.type = NLA_U32}, [NL80211_IFACE_COMB_RADAR_DETECT_WIDTHS] = {.type = NLA_U32}, }, iface_limit_policy[NUM_NL80211_IFACE_LIMIT] = { - [NL80211_IFACE_LIMIT_TYPES] = { - .type = NLA_NESTED - }, [NL80211_IFACE_LIMIT_MAX] = { - .type = NLA_U32 - }, + [NL80211_IFACE_LIMIT_TYPES] = {.type = NLA_NESTED}, + [NL80211_IFACE_LIMIT_MAX] = {.type = NLA_U32}, }; err = nla_parse_nested(tb_comb, MAX_NL80211_IFACE_COMB, nl_combi, iface_combination_policy); diff --git a/apps/wpa_supplicant/src/eap_server/eap_server_tnc.c b/apps/wpa_supplicant/src/eap_server/eap_server_tnc.c index 90c28cb..2cfd84e 100644 --- a/apps/wpa_supplicant/src/eap_server/eap_server_tnc.c +++ b/apps/wpa_supplicant/src/eap_server/eap_server_tnc.c @@ -23,8 +23,8 @@ struct eap_tnc_data { struct wpabuf *out_buf; size_t out_used; size_t fragment_size; - unsigned int was_done: 1; - unsigned int was_fail: 1; + unsigned int was_done : 1; + unsigned int was_fail : 1; }; /* EAP-TNC Flags */ diff --git a/apps/wpa_supplicant/src/radius/radius_server.c b/apps/wpa_supplicant/src/radius/radius_server.c index da5abb0..33f0000 100644 --- a/apps/wpa_supplicant/src/radius/radius_server.c +++ b/apps/wpa_supplicant/src/radius/radius_server.c @@ -85,8 +85,8 @@ struct radius_session { struct radius_msg *last_reply; u8 last_authenticator[16]; - unsigned int remediation: 1; - unsigned int macacl: 1; + unsigned int remediation : 1; + unsigned int macacl : 1; struct hostapd_radius_attr *accept_attr; }; diff --git a/apps/wpa_supplicant/src/rsn_supp/tdls.c b/apps/wpa_supplicant/src/rsn_supp/tdls.c index 2f7a107..a3fda4d 100644 --- a/apps/wpa_supplicant/src/rsn_supp/tdls.c +++ b/apps/wpa_supplicant/src/rsn_supp/tdls.c @@ -90,7 +90,7 @@ static int wpa_tdls_send_teardown(struct wpa_sm *sm, const u8 *addr, u16 reason_ struct wpa_tdls_peer { struct wpa_tdls_peer *next; - unsigned int reconfig_key: 1; + unsigned int reconfig_key : 1; int initiator; /* whether this end was initiator for TDLS setup */ u8 addr[ETH_ALEN]; /* other end MAC address */ u8 inonce[WPA_NONCE_LEN]; /* Initiator Nonce */ @@ -876,10 +876,10 @@ skip_ftie: /** * wpa_tdls_send_error - To send suitable TDLS status response with * appropriate status code mentioning reason for error/failure. - * @dst - MAC addr of Peer station + * @dst - MAC addr of Peer station * @tdls_action - TDLS frame type for which error code is sent - * @initiator - was this end the initiator of the connection - * @status - status code mentioning reason + * @initiator - was this end the initiator of the connection + * @status - status code mentioning reason */ static int wpa_tdls_send_error(struct wpa_sm *sm, const u8 *dst, u8 tdls_action, u8 dialog_token, int initiator, u16 status) diff --git a/apps/wpa_supplicant/src/tls/libtommath.c b/apps/wpa_supplicant/src/tls/libtommath.c index 297ee28..65d1bb4 100644 --- a/apps/wpa_supplicant/src/tls/libtommath.c +++ b/apps/wpa_supplicant/src/tls/libtommath.c @@ -60,11 +60,11 @@ /* from tommath.h */ #ifndef MIN -#define MIN(x,y) ((x)<(y)?(x):(y)) +#define MIN(x, y) ((x) < (y) ? (x) : (y)) #endif #ifndef MAX -#define MAX(x,y) ((x)>(y)?(x):(y)) +#define MAX(x, y) ((x) > (y) ? (x) : (y)) #endif #define OPT_CAST(x) diff --git a/apps/wpa_supplicant/src/utils/edit.c b/apps/wpa_supplicant/src/utils/edit.c index aa9b7fd..fffc9b5 100644 --- a/apps/wpa_supplicant/src/utils/edit.c +++ b/apps/wpa_supplicant/src/utils/edit.c @@ -963,14 +963,14 @@ static enum edit_key_code search_key(enum edit_key_code c) { switch (c) { case EDIT_KEY_ENTER: - case EDIT_KEY_CTRL_J: - case EDIT_KEY_LEFT: - case EDIT_KEY_RIGHT: - case EDIT_KEY_HOME: - case EDIT_KEY_END: - case EDIT_KEY_CTRL_A: - case EDIT_KEY_CTRL_E: - search_stop(); + case EDIT_KEY_CTRL_J: + case EDIT_KEY_LEFT: + case EDIT_KEY_RIGHT: + case EDIT_KEY_HOME: + case EDIT_KEY_END: + case EDIT_KEY_CTRL_A: + case EDIT_KEY_CTRL_E: + search_stop(); return c; case EDIT_KEY_DOWN: case EDIT_KEY_UP: diff --git a/apps/wpa_supplicant/src/wps/wps_registrar.c b/apps/wpa_supplicant/src/wps/wps_registrar.c index 1d4f91c..4d8d21a 100644 --- a/apps/wpa_supplicant/src/wps/wps_registrar.c +++ b/apps/wpa_supplicant/src/wps/wps_registrar.c @@ -31,7 +31,7 @@ struct wps_nfc_pw_token { struct dl_list list; u8 pubkey_hash[WPS_OOB_PUBKEY_HASH_LEN]; - unsigned int peer_pk_hash_known: 1; + unsigned int peer_pk_hash_known : 1; u16 pw_id; u8 dev_pw[WPS_OOB_DEVICE_PASSWORD_LEN * 2 + 1]; size_t dev_pw_len; diff --git a/apps/wpa_supplicant/wpa_supplicant/scan.c b/apps/wpa_supplicant/wpa_supplicant/scan.c index ff14b1e..bc290d7 100644 --- a/apps/wpa_supplicant/wpa_supplicant/scan.c +++ b/apps/wpa_supplicant/wpa_supplicant/scan.c @@ -1534,7 +1534,7 @@ struct wpabuf *wpa_scan_get_vendor_ie_multi(const struct wpa_scan_res *res, u32 * better. */ static int wpa_scan_result_compar(const void *a, const void *b) { -#define MIN(a,b) a < b ? a : b +#define MIN(a, b) a < b ? a : b struct wpa_scan_res **_wa = (void *)a; struct wpa_scan_res **_wb = (void *)b; struct wpa_scan_res *wa = *_wa; diff --git a/framework/src/arastorage/index_manager.c b/framework/src/arastorage/index_manager.c index fbbcc73..c2d6dfa 100644 --- a/framework/src/arastorage/index_manager.c +++ b/framework/src/arastorage/index_manager.c @@ -476,7 +476,7 @@ db_result_t db_indexing(relation_t *rel) cardinality = relation_cardinality(rel); - for(tuple_id = 0; tuple_id < cardinality; tuple_id++) { + for (tuple_id = 0; tuple_id < cardinality; tuple_id++) { memset(row, 0, sizeof(row)); result = storage_get_row(rel, &tuple_id, row); if (DB_ERROR(result)) { diff --git a/os/arch/arm/src/s5j/s5j_adc.c b/os/arch/arm/src/s5j/s5j_adc.c index 24941d4..c131275 100644 --- a/os/arch/arm/src/s5j/s5j_adc.c +++ b/os/arch/arm/src/s5j/s5j_adc.c @@ -74,8 +74,7 @@ ****************************************************************************/ /* This structure describes the state of one ADC block */ -struct s5j_dev_s -{ +struct s5j_dev_s { FAR const struct adc_callback_s *cb; struct adc_dev_s *dev; /* A reference to the outer (parent) */ diff --git a/os/arch/arm/src/s5j/s5j_gpio.c b/os/arch/arm/src/s5j/s5j_gpio.c index e864da4..ec8132c 100644 --- a/os/arch/arm/src/s5j/s5j_gpio.c +++ b/os/arch/arm/src/s5j/s5j_gpio.c @@ -360,7 +360,7 @@ int s5j_configgpio(uint32_t cfgset) /* Get the pin number */ pin = (cfgset & GPIO_PIN_MASK) >> GPIO_PIN_SHIFT; - switch(cfgset & GPIO_FUNC_MASK) { + switch (cfgset & GPIO_FUNC_MASK) { case GPIO_INPUT: ret = s5j_configinput(cfgset, port, pin); break; diff --git a/os/arch/arm/src/s5j/s5j_pwrcal.c b/os/arch/arm/src/s5j/s5j_pwrcal.c index 5725d2f..e6613ca 100644 --- a/os/arch/arm/src/s5j/s5j_pwrcal.c +++ b/os/arch/arm/src/s5j/s5j_pwrcal.c @@ -157,7 +157,7 @@ int cal_clk_setrate(unsigned int id, unsigned long rate) unsigned long cal_clk_getrate(unsigned int id) { - unsigned long rate=0; + unsigned long rate = 0; switch (id) { case d1_spi0: diff --git a/os/arch/arm/src/s5j/s5j_rtc.c b/os/arch/arm/src/s5j/s5j_rtc.c index dcb8f79..073e0fe 100644 --- a/os/arch/arm/src/s5j/s5j_rtc.c +++ b/os/arch/arm/src/s5j/s5j_rtc.c @@ -91,8 +91,7 @@ volatile bool g_rtc_enabled = false; /**************************************************************************** * Private Types ****************************************************************************/ -struct rtc_regvals_s -{ +struct rtc_regvals_s { uint8_t bcdsec; uint8_t bcdmin; uint8_t bcdhour; @@ -109,7 +108,8 @@ struct rtc_regvals_s ****************************************************************************/ static uint32_t rtc_bin2bcd(int value) { - uint32_t hundreds, tens; + uint32_t hundreds; + uint32_t tens; hundreds = tens = 0; diff --git a/os/arch/arm/src/s5j/s5j_rtc_lowerhalf.c b/os/arch/arm/src/s5j/s5j_rtc_lowerhalf.c index 237abc8..28ce442 100644 --- a/os/arch/arm/src/s5j/s5j_rtc_lowerhalf.c +++ b/os/arch/arm/src/s5j/s5j_rtc_lowerhalf.c @@ -81,15 +81,13 @@ * Private Types ****************************************************************************/ #ifdef CONFIG_RTC_ALARM -struct s5j_cbinfo_s -{ +struct s5j_cbinfo_s { volatile rtc_alarm_callback_t cb; /* Callback when the alarm expires */ volatile FAR void *priv; /* Private arg passed to callback */ }; #endif /* CONFIG_RTC_ALARM */ -struct s5j_lowerhalf_s -{ +struct s5j_lowerhalf_s { /* * This is the contained reference to the read-only, lower-half * operations vtable (which may lie in FLASH or ROM diff --git a/os/arch/arm/src/s5j/s5j_serial.c b/os/arch/arm/src/s5j/s5j_serial.c index ef9a68b..5ac051b 100644 --- a/os/arch/arm/src/s5j/s5j_serial.c +++ b/os/arch/arm/src/s5j/s5j_serial.c @@ -812,7 +812,7 @@ static struct up_dev_s g_uart3priv = { .irq = S5J_IRQ_UART3, .parity = CONFIG_UART3_PARITY, .bits = CONFIG_UART3_BITS, - .stopbits2 = CONFIG_UART3_2STOP, + .stopbits2 = CONFIG_UART3_2STOP, .rxd = GPIO_UART3_RXD, .txd = GPIO_UART3_TXD, #ifdef CONFIG_S5J_UART3_FLOWCONTROL diff --git a/os/arch/arm/src/s5j/s5j_spi.c b/os/arch/arm/src/s5j/s5j_spi.c index 75800a8..2ecec3c 100644 --- a/os/arch/arm/src/s5j/s5j_spi.c +++ b/os/arch/arm/src/s5j/s5j_spi.c @@ -187,8 +187,7 @@ static void spi_recvblock(FAR struct spi_dev_s *dev, void *rxbuffer, size_t nwor * Private Data *****************************************************************************/ -static const struct spi_ops_s g_spiops = -{ +static const struct spi_ops_s g_spiops = { #ifndef CONFIG_SPI_OWNBUS .lock = spi_lock, #endif @@ -210,8 +209,7 @@ static const struct spi_ops_s g_spiops = .registercallback = 0, }; -static struct s5j_spidev_s g_spi0dev = -{ +static struct s5j_spidev_s g_spi0dev = { .spidev = { .ops = &g_spiops }, .base = S5J_SPI0_BASE, .port = SPI_PORT0, @@ -221,8 +219,7 @@ static struct s5j_spidev_s g_spi0dev = .gpio_miso = GPIO_SPI0_MISO, .gpio_mosi = GPIO_SPI0_MOSI, }; -static struct s5j_spidev_s g_spi1dev = -{ +static struct s5j_spidev_s g_spi1dev = { .spidev = { .ops = &g_spiops }, .base = S5J_SPI1_BASE, .port = SPI_PORT1, @@ -232,8 +229,7 @@ static struct s5j_spidev_s g_spi1dev = .gpio_miso = GPIO_SPI1_MISO, .gpio_mosi = GPIO_SPI1_MOSI, }; -static struct s5j_spidev_s g_spi2dev = -{ +static struct s5j_spidev_s g_spi2dev = { .spidev = { .ops = &g_spiops }, .base = S5J_SPI2_BASE, .port = SPI_PORT2, @@ -243,8 +239,7 @@ static struct s5j_spidev_s g_spi2dev = .gpio_miso = GPIO_SPI2_MISO, .gpio_mosi = GPIO_SPI2_MOSI, }; -static struct s5j_spidev_s g_spi3dev = -{ +static struct s5j_spidev_s g_spi3dev = { .spidev = { .ops = &g_spiops }, .base = S5J_SPI3_BASE, .port = SPI_PORT3, @@ -373,21 +368,21 @@ static void spi_setbits(struct spi_dev_s *dev, int nbits) mode_cfg = mode_cfg & (~(MODE_CFG_BUS_WDT_MASK | MODE_CFG_CH_WDT_MASK)); switch (nbits) { - case 8: - mode_cfg = mode_cfg | MODE_CFG_BUS_WIDTH_8 | MODE_CFG_CH_WIDTH_8; - break; + case 8: + mode_cfg = mode_cfg | MODE_CFG_BUS_WIDTH_8 | MODE_CFG_CH_WIDTH_8; + break; - case 16: - mode_cfg = mode_cfg | MODE_CFG_BUS_WIDTH_16 | MODE_CFG_CH_WIDTH_16; - break; + case 16: + mode_cfg = mode_cfg | MODE_CFG_BUS_WIDTH_16 | MODE_CFG_CH_WIDTH_16; + break; - case 32: - mode_cfg = mode_cfg | MODE_CFG_BUS_WIDTH_32 | MODE_CFG_CH_WIDTH_32; - break; + case 32: + mode_cfg = mode_cfg | MODE_CFG_BUS_WIDTH_32 | MODE_CFG_CH_WIDTH_32; + break; - default: - DEBUGASSERT(0 == 1); - break; + default: + DEBUGASSERT(0 == 1); + break; } putreg32(mode_cfg, &pSPIRegs->MODE_CFG); @@ -541,18 +536,18 @@ struct spi_dev_s *up_spiinitialize(int port) } switch (port) { - case 0: - priv = &g_spi0dev; - break; - case 1: - priv = &g_spi1dev; - break; - case 2: - priv = &g_spi2dev; - break; - case 3: - priv = &g_spi3dev; - break; + case 0: + priv = &g_spi0dev; + break; + case 1: + priv = &g_spi1dev; + break; + case 2: + priv = &g_spi2dev; + break; + case 3: + priv = &g_spi3dev; + break; } lldbg("Prepare SPI%d for Master operation\n", priv->port); diff --git a/os/arch/arm/src/sidk_s5jt200/src/s5jt200_eeprom.c b/os/arch/arm/src/sidk_s5jt200/src/s5jt200_eeprom.c index 89062a5..f001d60 100644 --- a/os/arch/arm/src/sidk_s5jt200/src/s5jt200_eeprom.c +++ b/os/arch/arm/src/sidk_s5jt200/src/s5jt200_eeprom.c @@ -154,10 +154,10 @@ static const uint16_t gpio_mosi = (GPIO_OUTPUT|GPIO_FLOAT|GPIO_PORTP4|GPIO_PIN3) /* Device geometry description, compact form (2 bytes per entry) */ struct ee_geom_s { - uint8_t bytes: 4; /* Power of two of 128 bytes (0:128 1:256 2:512 etc) */ - uint8_t org: 4; /* Organization, bytes */ - uint8_t addrlen: 4; /* Number of bytes in command address field */ - uint8_t flags: 4; /* Special Features ??? */ + uint8_t bytes : 4; /* Power of two of 128 bytes (0:128 1:256 2:512 etc) */ + uint8_t org : 4; /* Organization, bytes */ + uint8_t addrlen : 4; /* Number of bytes in command address field */ + uint8_t flags : 4; /* Special Features ??? */ }; static const struct ee_geom_s g_ee_devices[] = { diff --git a/os/arch/arm/src/sidk_s5jt200/src/s5jt200_tash.c b/os/arch/arm/src/sidk_s5jt200/src/s5jt200_tash.c index a71b124..ccaba5e 100644 --- a/os/arch/arm/src/sidk_s5jt200/src/s5jt200_tash.c +++ b/os/arch/arm/src/sidk_s5jt200/src/s5jt200_tash.c @@ -362,7 +362,7 @@ int board_app_initialize(void) #endif #ifdef CONFIG_EXAMPLES_EEPROM_TEST - ee_test_main(0, NULL); + ee_test_main(0, NULL); #endif /* to suppress a compiler warning */ diff --git a/os/drivers/bch/bchdev_driver.c b/os/drivers/bch/bchdev_driver.c index da7845b..2327790 100644 --- a/os/drivers/bch/bchdev_driver.c +++ b/os/drivers/bch/bchdev_driver.c @@ -95,8 +95,7 @@ static int bch_unlink(FAR struct inode *inode); /**************************************************************************** * Public Data ****************************************************************************/ -const struct file_operations bch_fops = -{ +const struct file_operations bch_fops = { bch_open, /* open */ bch_close, /* close */ bch_read, /* read */ diff --git a/os/drivers/rtc.c b/os/drivers/rtc.c index 43096fb..1e5b825 100644 --- a/os/drivers/rtc.c +++ b/os/drivers/rtc.c @@ -71,17 +71,15 @@ ****************************************************************************/ #ifdef CONFIG_RTC_ALARM -struct rtc_alarminfo_s -{ - bool active; /* True: alarm is active */ - uint8_t signo; /* Signal number for alarm notification */ - pid_t pid; /* Identifies task to be notified */ +struct rtc_alarminfo_s { + bool active; /* True: alarm is active */ + uint8_t signo; /* Signal number for alarm notification */ + pid_t pid; /* Identifies task to be notified */ union sigval sigvalue; /* Data passed with notification */ }; #endif -struct rtc_upperhalf_s -{ +struct rtc_upperhalf_s { FAR struct rtc_lowerhalf_s *lower; /* Contained lower half driver */ #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS @@ -134,21 +132,20 @@ static int rtc_unlink(FAR struct inode *inode); * Private Data ****************************************************************************/ -static const struct file_operations rtc_fops = -{ +static const struct file_operations rtc_fops = { #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS rtc_open, /* open */ rtc_close, /* close */ #else - 0, /* open */ - 0, /* close */ + 0, /* open */ + 0, /* close */ #endif rtc_read, /* read */ rtc_write, /* write */ - 0, /* seek */ + 0, /* seek */ rtc_ioctl, /* ioctl */ #ifndef CONFIG_DISABLE_POLL - 0, /* poll */ + 0, /* poll */ #endif #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS rtc_unlink /* unlink */ diff --git a/os/drivers/wireless/scsc/mgt.c b/os/drivers/wireless/scsc/mgt.c index ce82452..1f2181a 100644 --- a/os/drivers/wireless/scsc/mgt.c +++ b/os/drivers/wireless/scsc/mgt.c @@ -444,10 +444,10 @@ static int slsi_mib_initial_get(struct slsi_dev *sdev) struct slsi_mib_data mibrsp = { 0, NULL }; int rxLength = 0; int r; - static const struct slsi_mib_get_entry getValues[] = { {SLSI_PSID_UNIFI_FAST_POWER_SAVE_TIMEOUT, {0, 0}}, - {SLSI_PSID_UNIFI_CHIP_VERSION, {0, 0}}, - {SLSI_PSID_UNIFI_FIRMWARE_BUILD_ID, {0, 0}}, - {SLSI_PSID_UNIFI_FIRMWARE_PATCH_BUILD_ID, {0, 0}}, + static const struct slsi_mib_get_entry getValues[] = { { SLSI_PSID_UNIFI_FAST_POWER_SAVE_TIMEOUT, { 0, 0 } }, + { SLSI_PSID_UNIFI_CHIP_VERSION, { 0, 0 } }, + { SLSI_PSID_UNIFI_FIRMWARE_BUILD_ID, { 0, 0 } }, + { SLSI_PSID_UNIFI_FIRMWARE_PATCH_BUILD_ID, { 0, 0 } }, }; r = slsi_mib_encode_get_list(&mibreq, sizeof(getValues) / sizeof(struct slsi_mib_get_entry), getValues); @@ -2272,7 +2272,7 @@ int slsi_get_mib(struct slsi_dev *sdev, u16 psid, int *mib_value) struct slsi_mib_data mibrsp = { 0, NULL }; int rxLength = 0; int r; - struct slsi_mib_get_entry getValues[] = { {psid, {0, 0}} }; + struct slsi_mib_get_entry getValues[] = { {psid, { 0, 0 } } }; r = slsi_mib_encode_get_list(&mibreq, sizeof(getValues) / sizeof(struct slsi_mib_get_entry), getValues); if (r != SLSI_MIB_STATUS_SUCCESS) { diff --git a/os/drivers/wireless/scsc/misc/miframman.c b/os/drivers/wireless/scsc/misc/miframman.c index ff61fc0..1549b81 100644 --- a/os/drivers/wireless/scsc/misc/miframman.c +++ b/os/drivers/wireless/scsc/misc/miframman.c @@ -89,12 +89,12 @@ exit: } #define MIFRAMMAN_ALIGN(mem, align) \ - ((void *)((((uintptr_t)(mem) + (align + sizeof(void *))) \ - & (~(uintptr_t)(align - 1))))) + ((void *)((((uintptr_t)(mem) + (align + sizeof(void *))) & \ + (~(uintptr_t)(align - 1))))) #define MIFRAMMAN_PTR(mem) \ (*(((void **)((uintptr_t)(mem) & \ - (~(uintptr_t)(sizeof(void *)-1)))) - 1)) + (~(uintptr_t)(sizeof(void *)-1)))) - 1)) bool is_power_of_2(unsigned long n) { diff --git a/os/drivers/wireless/scsc/mlme.c b/os/drivers/wireless/scsc/mlme.c index d7af053..299154a 100644 --- a/os/drivers/wireless/scsc/mlme.c +++ b/os/drivers/wireless/scsc/mlme.c @@ -2285,8 +2285,8 @@ int slsi_mlme_get_sinfo_mib(struct slsi_dev *sdev, struct netif *dev, struct wpa int data_length = 0; int r = 0; static const struct slsi_mib_get_entry getValues[] = { - {SLSI_PSID_UNIFI_TX_DATA_RATE, {0, 0}}, /* to get STATION_INFO_TX_BITRATE */ - {SLSI_PSID_UNIFI_RSSI, {0, 0}}, /* to get STATION_INFO_SIGNAL_AVG */ + { SLSI_PSID_UNIFI_TX_DATA_RATE, { 0, 0 } }, /* to get STATION_INFO_TX_BITRATE */ + { SLSI_PSID_UNIFI_RSSI, { 0, 0 } }, /* to get STATION_INFO_SIGNAL_AVG */ }; WARN_ON(!SLSI_MUTEX_IS_LOCKED(ndev_vif->vif_mutex)); diff --git a/os/drivers/wireless/scsc/netif.c b/os/drivers/wireless/scsc/netif.c index c112cb5..3d1af37 100644 --- a/os/drivers/wireless/scsc/netif.c +++ b/os/drivers/wireless/scsc/netif.c @@ -197,8 +197,8 @@ enum slsi_traffic_q slsi_frame_priority_to_ac_queue(u16 priority) { switch (priority) { case FAPI_PRIORITY_QOS_UP0: - case FAPI_PRIORITY_QOS_UP3: - return SLSI_TRAFFIC_Q_BE; + case FAPI_PRIORITY_QOS_UP3: + return SLSI_TRAFFIC_Q_BE; case FAPI_PRIORITY_QOS_UP1: case FAPI_PRIORITY_QOS_UP2: return SLSI_TRAFFIC_Q_BK; diff --git a/os/drivers/wireless/scsc/rx.c b/os/drivers/wireless/scsc/rx.c index 6bd4b64..7360e73 100644 --- a/os/drivers/wireless/scsc/rx.c +++ b/os/drivers/wireless/scsc/rx.c @@ -718,8 +718,7 @@ void slsi_rx_received_frame_ind(struct slsi_dev *sdev, struct netif *dev, struct SLSI_P2P_UNSYNC_VIF_EXTRA_MSEC); */ SLSI_P2P_STATE_CHANGE(sdev, P2P_IDLE_VIF_ACTIVE); } - } - else if ((sdev->p2p_group_exp_frame != SLSI_P2P_PA_INVALID) && (sdev->p2p_group_exp_frame == subtype)) { + } else if ((sdev->p2p_group_exp_frame != SLSI_P2P_PA_INVALID) && (sdev->p2p_group_exp_frame == subtype)) { SLSI_NET_DBG2(dev, SLSI_MLME, "Expected action frame (%s) received on Group VIF\n", slsi_p2p_pa_subtype_text(subtype)); slsi_clear_offchannel_data(sdev, (ndev_vif->ifnum != SLSI_NET_INDEX_P2PX) ? true : false); } @@ -736,8 +735,7 @@ void slsi_rx_received_frame_ind(struct slsi_dev *sdev, struct netif *dev, struct else #endif - if (data_unit_descriptor == FAPI_DATAUNITDESCRIPTOR_IEEE802_3_FRAME) - { + if (data_unit_descriptor == FAPI_DATAUNITDESCRIPTOR_IEEE802_3_FRAME) { struct slsi_peer *peer = NULL; struct ethhdr *ehdr = (struct ethhdr *)fapi_get_data(mbuf); diff --git a/os/fs/smartfs/smartfs_smart.c b/os/fs/smartfs/smartfs_smart.c index e125cde..f84926c 100644 --- a/os/fs/smartfs/smartfs_smart.c +++ b/os/fs/smartfs/smartfs_smart.c @@ -978,7 +978,7 @@ static ssize_t smartfs_write(FAR struct file *filep, const char *buffer, size_t goto errout_with_semaphore; } #endif - ret = FS_IOCTL(fs, BIOC_WRITESECT, (unsigned long ) &readwrite); + ret = FS_IOCTL(fs, BIOC_WRITESECT, (unsigned long)&readwrite); #ifdef CONFIG_SMARTFS_JOURNALING retj = smartfs_finish_journalentry(fs, 0, t_sector, t_offset, T_WRITE); if (retj != OK) { diff --git a/os/kernel/pthread/pthread_mutexdestroy.c b/os/kernel/pthread/pthread_mutexdestroy.c index 6c22e15..0b91657 100644 --- a/os/kernel/pthread/pthread_mutexdestroy.c +++ b/os/kernel/pthread/pthread_mutexdestroy.c @@ -128,15 +128,15 @@ int pthread_mutex_destroy(FAR pthread_mutex_t *mutex) /* No.. Verify that the PID still exists. We may be destroying - * the mutex after cancelling a pthread and the mutex may have - * been in a bad state owned by the dead pthread. NOTE: The - * following behavior is unspecified for pthread_mutex_destroy() - * (see pthread_mutex_consistent()). - * - * If the holding thread is still valid, then we should be able to - * map its PID to the underlying TCB. That is what sched_gettcb() - * does. - */ + * the mutex after cancelling a pthread and the mutex may have + * been in a bad state owned by the dead pthread. NOTE: The + * following behavior is unspecified for pthread_mutex_destroy() + * (see pthread_mutex_consistent()). + * + * If the holding thread is still valid, then we should be able to + * map its PID to the underlying TCB. That is what sched_gettcb() + * does. + */ if (sched_gettcb(mutex->pid) == NULL) { /* The thread associated with the PID no longer exists */ @@ -144,9 +144,9 @@ int pthread_mutex_destroy(FAR pthread_mutex_t *mutex) mutex->pid = -1; /* Reset the semaphore. If threads are were on this - * semaphore, then this will awakened them and make - * destruction of the semaphore impossible here. - */ + * semaphore, then this will awakened them and make + * destruction of the semaphore impossible here. + */ status = sem_reset((FAR sem_t *)&mutex->sem, 1); if (status < 0) { @@ -154,8 +154,8 @@ int pthread_mutex_destroy(FAR pthread_mutex_t *mutex) } /* Check if the reset caused some other thread to lock the - * mutex. - */ + * mutex. + */ else if (mutex->pid != -1) { /* Yes.. then we cannot destroy the mutex now. */ ret = EBUSY; @@ -172,10 +172,10 @@ int pthread_mutex_destroy(FAR pthread_mutex_t *mutex) } } else { /* Destroy the semaphore - * - * REVISIT: What if there are threads waiting on the semaphore? - * Perhaps this logic should all sem_reset() first? - */ + * + * REVISIT: What if there are threads waiting on the semaphore? + * Perhaps this logic should all sem_reset() first? + */ status = sem_destroy((sem_t *)&mutex->sem); ret = ((status != OK) ? get_errno() : OK); diff --git a/os/kernel/pthread/pthread_mutexlock.c b/os/kernel/pthread/pthread_mutexlock.c index d65004c..1ee4b67 100644 --- a/os/kernel/pthread/pthread_mutexlock.c +++ b/os/kernel/pthread/pthread_mutexlock.c @@ -157,9 +157,9 @@ int pthread_mutex_lock(FAR pthread_mutex_t *mutex) sched_lock(); #ifdef CONFIG_PTHREAD_MUTEX_TYPES - /* All mutex types except for NORMAL (and DEFAULT) will return - * and an error error if the caller does not hold the mutex. - */ + /* All mutex types except for NORMAL (and DEFAULT) will return + * and an error error if the caller does not hold the mutex. + */ if (mutex->type != PTHREAD_MUTEX_NORMAL && mutex->pid == mypid) { /* Yes.. Is this a recursive mutex? */ @@ -173,8 +173,7 @@ int pthread_mutex_lock(FAR pthread_mutex_t *mutex) } else { ret = EOVERFLOW; } - } else - { + } else { /* No, then we would deadlock... return an error (default behavior * is like PTHREAD_MUTEX_ERRORCHECK) */ diff --git a/os/net/lwip/src/core/ipv4/ip.c b/os/net/lwip/src/core/ipv4/ip.c index 9a968ff..80b4e93 100644 --- a/os/net/lwip/src/core/ipv4/ip.c +++ b/os/net/lwip/src/core/ipv4/ip.c @@ -111,7 +111,7 @@ * To handle DHCP packets on netutils applications, * enable IP_ACCEPT_LINK_LAYER_ADDRESSING configurations for either NETUTILS DHCPC or NETUTILS DHCPD */ -#if defined (CONFIG_NETUTILS_DHCPC) || defined (CONFIG_NETUTILS_DHCPD) +#if defined(CONFIG_NETUTILS_DHCPC) || defined(CONFIG_NETUTILS_DHCPD) #define IP_ACCEPT_LINK_LAYER_ADDRESSING 1 #define DHCP_CLIENT_PORT 68 #define IP_ACCEPT_LINK_LAYER_ADDRESSED_PORT(port) ((port) == PP_NTOHS(DHCP_CLIENT_PORT)) diff --git a/os/net/tls/dhm.c b/os/net/tls/dhm.c index 70e77d5..3821b05 100644 --- a/os/net/tls/dhm.c +++ b/os/net/tls/dhm.c @@ -74,10 +74,10 @@ #if defined(CONFIG_HW_DH_PARAM) #include "tls/see_api.h" #include "tls/see_internal.h" -#define DHM_MPI_EXPORT(X,n) \ - MBEDTLS_MPI_CHK( mbedtls_mpi_write_binary( X, p + 2, n ) ); \ - *p++ = (unsigned char)( n >> 8 ); \ - *p++ = (unsigned char)( n ); p += n; +#define DHM_MPI_EXPORT(X, n) \ + MBEDTLS_MPI_CHK(mbedtls_mpi_write_binary(X, p + 2, n)); \ + *p++ = (unsigned char)(n >> 8); \ + *p++ = (unsigned char)(n); p += n; #endif /* Implementation that should never be optimized out by the compiler */ @@ -221,10 +221,10 @@ int mbedtls_dhm_make_params(mbedtls_dhm_context *ctx, int x_size, unsigned char /* * export P, G, GX */ -#define DHM_MPI_EXPORT(X,n) \ - MBEDTLS_MPI_CHK( mbedtls_mpi_write_binary( X, p + 2, n ) ); \ - *p++ = (unsigned char)( n >> 8 ); \ - *p++ = (unsigned char)( n ); p += n; +#define DHM_MPI_EXPORT(X, n) \ + MBEDTLS_MPI_CHK(mbedtls_mpi_write_binary(X, p + 2, n)); \ + *p++ = (unsigned char)(n >> 8); \ + *p++ = (unsigned char)(n); p += n; n1 = mbedtls_mpi_size(&ctx->P); n2 = mbedtls_mpi_size(&ctx->G); n3 = mbedtls_mpi_size(&ctx->GX); diff --git a/os/net/tls/ecp_curves.c b/os/net/tls/ecp_curves.c index 7bcabad..02c17ff 100644 --- a/os/net/tls/ecp_curves.c +++ b/os/net/tls/ecp_curves.c @@ -1008,7 +1008,7 @@ static inline void sub32(uint32_t *dst, uint32_t src, signed char *carry) sub32(&cur, -cc, &c); \ else \ add32(&cur, cc, &c); \ - + #define LAST \ STORE32; i++; \ cur = c > 0 ? c : 0; STORE32; \ diff --git a/os/net/tls/ssl_ciphersuites.c b/os/net/tls/ssl_ciphersuites.c index c58d70d..25c82de 100644 --- a/os/net/tls/ssl_ciphersuites.c +++ b/os/net/tls/ssl_ciphersuites.c @@ -2076,7 +2076,7 @@ const int *mbedtls_ssl_list_ciphersuites(void) #else if (mbedtls_ssl_ciphersuite_from_id(*p) != NULL) #endif - * (q++) = *p; + *(q++) = *p; } *q = 0; -- 2.7.4