Merged in alagoutte/smartcapwap/clang (pull request #2)

Fix build with clang and warning found by Clang Analyzer
This commit is contained in:
Massimo Vellucci 2015-01-24 13:13:10 +01:00
commit 86998ce2da
11 changed files with 45 additions and 17 deletions

32
.gitignore vendored Normal file
View File

@ -0,0 +1,32 @@
# use glob syntax
syntax: glob
Makefile
Makefile.in
aclocal.m4
autom4te.cache/
config.guess
config.log
config.status
config.sub
configure
depcomp
install-sh
missing
Module.symvers
modules.order
build/
src/ac/kmod/.tmp_versions
*~
*.o
*.lo
*.la
m4
.deps
.libs
*.mod.c
*.ko
*.cmd

View File

@ -22,7 +22,7 @@ AC_PREREQ(2.63)
AC_INIT([SmartCAPWAP], [1.0.0], [https://bitbucket.org/vemax78/smartcapwap], [smartcapwap])
AC_CONFIG_AUX_DIR([build])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([1.11 -Wall -Werror])
AM_INIT_AUTOMAKE([1.11 -Wall])
AC_USE_SYSTEM_EXTENSIONS
# cross-compile macros

View File

@ -319,7 +319,7 @@ static int ac_backend_parsing_deletewlan_event(const char* idevent, struct json_
static int ac_backend_soap_update_event(const char* idevent, int status) {
int result = 0;
char buffer[256];
struct ac_soap_request* request;
struct ac_soap_request* request = NULL;
struct ac_http_soap_server* server;
ASSERT(g_ac_backend.soaprequest == NULL);
@ -376,7 +376,7 @@ static int ac_backend_soap_update_event(const char* idevent, int status) {
/* */
static int ac_backend_soap_getconfiguration(void) {
int result = -1;
struct ac_soap_request* request;
struct ac_soap_request* request = NULL;
struct ac_http_soap_server* server;
struct json_object* jsonroot = NULL;
@ -441,7 +441,7 @@ static int ac_backend_soap_getconfiguration(void) {
/* */
static int ac_backend_soap_join(int forcereset) {
struct ac_soap_request* request;
struct ac_soap_request* request = NULL;
struct ac_http_soap_server* server;
ASSERT(g_ac_backend.soaprequest == NULL);
@ -570,7 +570,7 @@ static int ac_backend_parsing_event(struct json_object* jsonitem) {
/* */
static int ac_backend_soap_waitevent(void) {
int result = -1;
struct ac_soap_request* request;
struct ac_soap_request* request = NULL;
struct ac_http_soap_server* server;
struct json_object* jsonroot = NULL;

View File

@ -456,7 +456,7 @@ static uint32_t ac_dfa_state_join_create_response(struct ac_session_t* session,
responseacipv4list->addresses = capwap_array_create(sizeof(struct in_addr), 0, 0);
for (j = 0; j < length; j++) {
struct json_object* jsonvalue = json_object_array_get_idx(jsonelement, i);
struct json_object* jsonvalue = json_object_array_get_idx(jsonelement, j);
if (jsonvalue && (json_object_get_type(jsonvalue) == json_type_object)) {
struct json_object* jsonitem;
@ -507,7 +507,7 @@ static uint32_t ac_dfa_state_join_create_response(struct ac_session_t* session,
responseacipv6list->addresses = capwap_array_create(sizeof(struct in6_addr), 0, 0);
for (j = 0; j < length; j++) {
struct json_object* jsonvalue = json_object_array_get_idx(jsonelement, i);
struct json_object* jsonvalue = json_object_array_get_idx(jsonelement, j);
if (jsonvalue && (json_object_get_type(jsonvalue) == json_type_object)) {
struct json_object* jsonitem;

View File

@ -624,7 +624,7 @@ int ieee80211_create_probe_response(uint8_t* buffer, int length, struct ieee8021
return -1;
}
pos += result;
/*pos += result;*/ /* Comment for disable Dead inscrement Clang Analyzer warning */
responselength += result;
return responselength;
@ -701,7 +701,7 @@ int ieee80211_create_associationresponse_response(uint8_t* buffer, int length, s
return -1;
}
pos += result;
/*pos += result;*/ /* Comment for disable Dead inscrement Clang Analyzer warning */
responselength += result;
return responselength;

View File

@ -3,7 +3,7 @@
#ifdef DEBUG
#define ASSERT(expr) if (!(expr)) { capwap_logging_fatal("Assertion failed \'%s\': %s(%d)", #expr, __FILE__, __LINE__); }
#define ASSERT(expr) if (!(expr)) { capwap_logging_fatal("Assertion failed \'%s\': %s(%d)", #expr, __FILE__, __LINE__); exit(1); }
/* Custom memory management */
#define capwap_alloc(x) capwap_alloc_debug(x, __FILE__, __LINE__)

View File

@ -800,8 +800,6 @@ int capwap_packet_rxmng_add_recv_packet(struct capwap_packet_rxmng* rxmngpacket,
/* Check complete only if receive last packet */
ASSERT(rxmngpacket->fragmentlist->last != NULL);
packetsearch = (struct capwap_fragment_packet_item*)rxmngpacket->fragmentlist->last->item;
headersearch = (struct capwap_header*)packetsearch->buffer;
if (IS_FLAG_L_HEADER(header)) {
unsigned short sanityfragoffset = 0;

View File

@ -1559,7 +1559,7 @@ uint16_t wifi_wlan_check_capability(struct wifi_wlan* wlan, uint16_t capability)
result &= ~IEEE80211_CAPABILITY_SHORTSLOTTIME;
}
return capability;
return result;
}
/* */

View File

@ -1663,7 +1663,7 @@ static wifi_global_handle nl80211_global_init(void) {
/* Add membership regulatory events */
result = nl80211_get_multicast_id(globalhandle, "nl80211", "regulatory");
if (result >= 0) {
result = nl_socket_add_membership(globalhandle->nl_event, result);
nl_socket_add_membership(globalhandle->nl_event, result);
}
/* Get nl80211 netlink family */

View File

@ -379,10 +379,8 @@ int wtp_dfa_running(void) {
/* Check is handshake complete */
if ((oldaction == CAPWAP_DTLS_ACTION_HANDSHAKE) && (g_wtp.dtls.action == CAPWAP_DTLS_ACTION_DATA)) {
if (g_wtp.state == CAPWAP_DTLS_CONNECT_STATE) {
check = CAPWAP_NONE_PACKET;
wtp_send_join();
} else {
check = CAPWAP_WRONG_PACKET;
wtp_teardown_connection();
}
}

View File

@ -68,7 +68,7 @@ void wtp_dfa_state_discovery_timeout(struct capwap_timeout* timeout, unsigned lo
}
/* AC with IPv6 */
if ((g_wtp.net.localaddr.ss.ss_family == AF_INET6)) {
if (g_wtp.net.localaddr.ss.ss_family == AF_INET6) {
for (w = 0; w < response->controlipv6->count; w++) {
struct capwap_controlipv6_element* controlipv6 = (struct capwap_controlipv6_element*)capwap_array_get_item_pointer(response->controlipv6, w);