Hi there,
I have a data structure as given below
Code:
struct ap {
uint16_t ap_freq; /* MHz */
int8_t ap_noise;
int8_t ap_rssi;
int8_t ap_snr;
uint8_t ap_bssid[WLAN_BSSID_ASCII_LEN];
uint8_t ap_ssid[WLAN_SSID_LEN];
struct wlan_ap *prev;
struct wlan_ap *next;
};
The ap_ssid and ap_bssid members are of type uint8_t to be compatible with the main net80211 stack of the operating system I am using (FreeBSD).
In the library I am working on, I have several strlcpy() calls that have either ap_ssid or ap_bssid is passed as the first argument.
To compile my project, I use -Werror flag of clang, and I am getting errors like
Code:
error: passing 'uint8_t [18]' to parameter of type 'char *' converts between pointers to integer types with different sign [-Werror,-Wpointer-sign]
(void)strlcpy(s->ap_ssid ,tmp_ssid, WLAN_SSID_LEN);
I can think of two workarounds to this problem;
* type casting s->ap_ssid to (char*)
* using memcpy() instead of strlcpy()
I would like to get your opinions about those approaches I listed above, or hear any better way to get rid of error messages.
Thanks in advance...