rtl8195am - fix rtw_emac.cpp warnings

Fix the following warnings:

[Warning] rtw_emac.cpp@62,104: format '%x' expects argument of type 'unsigned int*', but argument 3 has type 'uint8_t* {aka unsigned char*}' [-Wformat=]
[Warning] rtw_emac.cpp@62,104: format '%x' expects argument of type 'unsigned int*', but argument 4 has type 'uint8_t* {aka unsigned char*}' [-Wformat=]
[Warning] rtw_emac.cpp@62,104: format '%x' expects argument of type 'unsigned int*', but argument 5 has type 'uint8_t* {aka unsigned char*}' [-Wformat=]
[Warning] rtw_emac.cpp@62,104: format '%x' expects argument of type 'unsigned int*', but argument 6 has type 'uint8_t* {aka unsigned char*}' [-Wformat=]
[Warning] rtw_emac.cpp@62,104: format '%x' expects argument of type 'unsigned int*', but argument 7 has type 'uint8_t* {aka unsigned char*}' [-Wformat=]
[Warning] rtw_emac.cpp@62,104: format '%x' expects argument of type 'unsigned int*', but argument 8 has type 'uint8_t* {aka unsigned char*}' [-Wformat=]
[Warning] rtw_emac.cpp@201,101: format '%x' expects argument of type 'unsigned int*', but argument 3 has type 'char*' [-Wformat=]
[Warning] rtw_emac.cpp@201,101: format '%x' expects argument of type 'unsigned int*', but argument 4 has type 'char*' [-Wformat=]
[Warning] rtw_emac.cpp@201,101: format '%x' expects argument of type 'unsigned int*', but argument 5 has type 'char*' [-Wformat=]
[Warning] rtw_emac.cpp@201,101: format '%x' expects argument of type 'unsigned int*', but argument 6 has type 'char*' [-Wformat=]
[Warning] rtw_emac.cpp@201,101: format '%x' expects argument of type 'unsigned int*', but argument 7 has type 'char*' [-Wformat=]
[Warning] rtw_emac.cpp@201,101: format '%x' expects argument of type 'unsigned int*', but argument 8 has type 'char*' [-Wformat=]

Signed-off-by: Tony Wu <tonywu@realtek.com>
pull/6697/head
Tony Wu 2018-04-17 16:18:01 +08:00 committed by adbridge
parent 2873f2cba0
commit c6279e2420
1 changed files with 24 additions and 10 deletions

View File

@ -57,12 +57,19 @@ static uint8_t wlan_get_hwaddr_size(emac_interface_t *emac)
static void wlan_get_hwaddr(emac_interface_t *emac, uint8_t *addr) static void wlan_get_hwaddr(emac_interface_t *emac, uint8_t *addr)
{ {
char mac[20]; char mac[20];
if(RTW_SUCCESS == wifi_get_mac_address(mac)) int val[6];
{ int i;
if (sscanf(mac, "%x:%x:%x:%x:%x:%x", &addr[0], &addr[1], &addr[2], &addr[3], &addr[4], &addr[5]) != 6)
printf("Get HW address failed\r\n"); if (RTW_SUCCESS == wifi_get_mac_address(mac)) {
}else{ if (sscanf(mac, "%x:%x:%x:%x:%x:%x",
&val[0], &val[1], &val[2], &val[3], &val[4], &val[5]) != 6)
printf("Get HW address failed\r\n"); printf("Get HW address failed\r\n");
for (i = 0; i < 6; i++) {
addr[i] = (unsigned char) val[i];
}
} else {
printf("Get HW address failed\r\n");
} }
} }
@ -196,11 +203,18 @@ void mbed_default_mac_address(char *mac) {
void mbed_mac_address(char *mac) void mbed_mac_address(char *mac)
{ {
char hwaddr[20]; char hwaddr[20];
if(RTW_SUCCESS == wifi_get_mac_address(hwaddr)) int val[6];
{ int i;
if (sscanf(hwaddr, "%x:%x:%x:%x:%x:%x", &mac[0], &mac[1], &mac[2], &mac[3], &mac[4], &mac[5]) != 6)
if (RTW_SUCCESS == wifi_get_mac_address(hwaddr)) {
if (sscanf(hwaddr, "%x:%x:%x:%x:%x:%x",
&val[0], &val[1], &val[2], &val[3], &val[4], &val[5]) != 6)
printf("Get HW address failed\r\n"); printf("Get HW address failed\r\n");
}else{
for (i = 0; i < 6; i++) {
mac[i] = (unsigned char) val[i];
}
} else {
printf("Get HW address failed\r\n"); printf("Get HW address failed\r\n");
mbed_default_mac_address(mac); mbed_default_mac_address(mac);
} }