add format string atrribute to logging and fix all error found by it
This commit is contained in:
parent
cadbfa3d7e
commit
dd6f6fcfe2
@ -36,7 +36,7 @@ void* capwap_alloc_debug(size_t size, const char* file, const int line) {
|
||||
|
||||
/* Request size > 0 */
|
||||
if (size <= 0) {
|
||||
capwap_logging_debug("%s(%d): Invalid memory size %d", file, line, size);
|
||||
capwap_logging_debug("%s(%d): Invalid memory size %zu", file, line, size);
|
||||
exit(CAPWAP_ASSERT_CONDITION);
|
||||
}
|
||||
|
||||
@ -119,7 +119,8 @@ void capwap_dump_memory(void) {
|
||||
|
||||
findblock = g_memoryblocks;
|
||||
while (findblock != NULL) {
|
||||
capwap_logging_debug("%s(%d): block at %p, %d bytes long", findblock->file, findblock->line, findblock->item, findblock->size);
|
||||
capwap_logging_debug("%s(%d): block at %p, %zu bytes long",
|
||||
findblock->file, findblock->line, findblock->item, findblock->size);
|
||||
|
||||
#ifdef USE_DEBUG_BACKTRACE
|
||||
backtrace_functions = backtrace_symbols(findblock->backtrace, findblock->backtrace_count);
|
||||
|
@ -20,7 +20,8 @@ void capwap_logging_disable_console(void);
|
||||
|
||||
/* */
|
||||
#ifdef ENABLE_LOGGING
|
||||
void log_printf(int level, const char *format, ...);
|
||||
void log_printf(int level, const char *format, ...)
|
||||
__attribute__ ((__format__ (__printf__, 2, 3)));
|
||||
void log_hexdump(int level, const char *title, const unsigned char *data, size_t len);
|
||||
#else
|
||||
#define log_printf(l, f, args...) do { } while (0)
|
||||
|
@ -269,7 +269,7 @@ ssize_t capwap_recvfrom(int sock, void* buffer, size_t len,
|
||||
|
||||
if (r < 0) {
|
||||
if (errno != EAGAIN)
|
||||
capwap_logging_warning("Unable to recv packet, recvmsg return %d with error %d", r, errno);
|
||||
capwap_logging_warning("Unable to recv packet, recvmsg return %zd with error %d", r, errno);
|
||||
return r;
|
||||
}
|
||||
|
||||
@ -320,7 +320,7 @@ ssize_t capwap_recvfrom(int sock, void* buffer, size_t len,
|
||||
{
|
||||
char strfromaddr[INET6_ADDRSTRLEN];
|
||||
char strtoaddr[INET6_ADDRSTRLEN];
|
||||
capwap_logging_debug("Receive packet from %s:%d to %s with size %d",
|
||||
capwap_logging_debug("Receive packet from %s:%d to %s with size %zd",
|
||||
capwap_address_to_string(fromaddr, strfromaddr, INET6_ADDRSTRLEN),
|
||||
(int)CAPWAP_GET_NETWORK_PORT(fromaddr),
|
||||
capwap_address_to_string(toaddr, strtoaddr, INET6_ADDRSTRLEN), r);
|
||||
|
@ -102,14 +102,14 @@ static void wifi_wlan_getrates(struct wifi_device* device,
|
||||
}
|
||||
#endif
|
||||
|
||||
capwap_logging_debug("getrates: Bands Count %d", capability->bands->count);
|
||||
capwap_logging_debug("getrates: Bands Count %lu", capability->bands->count);
|
||||
|
||||
/* Filter band */
|
||||
for (i = 0; i < capability->bands->count; i++) {
|
||||
struct wifi_band_capability* bandcap =
|
||||
(struct wifi_band_capability*)capwap_array_get_item_pointer(capability->bands, i);
|
||||
|
||||
capwap_logging_debug("getrates: Bandcap Band %d", bandcap->band);
|
||||
capwap_logging_debug("getrates: Bandcap Band %lu", bandcap->band);
|
||||
|
||||
if (bandcap->band != device->currentfrequency.band)
|
||||
continue;
|
||||
|
@ -562,7 +562,7 @@ struct wtp_radio_wlan *wtp_radio_get_wlan(struct wtp_radio *radio, uint8_t wlani
|
||||
}
|
||||
|
||||
if (wlanid > radio->wlan->count) {
|
||||
capwap_logging_warning("wtp_radio_get_wlan: invalid wlanid (%d > %d)",
|
||||
capwap_logging_warning("wtp_radio_get_wlan: invalid wlanid (%d > %lu)",
|
||||
wlanid, radio->wlan->count);
|
||||
return NULL;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user