diff options
author | Reyk Floeter <reyk@cvs.openbsd.org> | 2004-11-06 18:31:42 +0000 |
---|---|---|
committer | Reyk Floeter <reyk@cvs.openbsd.org> | 2004-11-06 18:31:42 +0000 |
commit | d342fa430e91c59a31ca21ada4b5f48d3793106f (patch) | |
tree | 3e9f98dc80b349e1aa665251037e091b7063e8cc | |
parent | 44e97a2693644e00c8ffb9583bb5662237d46048 (diff) |
fixed types in ieee80211_regdomain (thanks to Joerg Sonnenberger). now it
also works with gcc3 (ok naddy@).
-rw-r--r-- | sys/net80211/ieee80211_regdomain.c | 22 | ||||
-rw-r--r-- | sys/net80211/ieee80211_regdomain.h | 4 |
2 files changed, 13 insertions, 13 deletions
diff --git a/sys/net80211/ieee80211_regdomain.c b/sys/net80211/ieee80211_regdomain.c index a97473016de..c30c62e7e0e 100644 --- a/sys/net80211/ieee80211_regdomain.c +++ b/sys/net80211/ieee80211_regdomain.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211_regdomain.c,v 1.1 2004/11/02 02:15:49 reyk Exp $ */ +/* $OpenBSD: ieee80211_regdomain.c,v 1.2 2004/11/06 18:31:41 reyk Exp $ */ /* * Copyright (c) 2004 Reyk Floeter <reyk@vantronix.net>. @@ -66,10 +66,10 @@ static const struct ieee80211_countryname ieee80211_r_ctry[] = IEEE80211_REGDOMAIN_COUNTRY_NAMES; #ifndef bsearch -void *bsearch(const void *, const void *, size_t, size_t, +const void *bsearch(const void *, const void *, size_t, size_t, int (*)(const void *, const void *)); -void * +const void * bsearch(const void *key, const void *base0, size_t nmemb, size_t size, int (*compar)(const void *, const void *)) { @@ -81,9 +81,9 @@ bsearch(const void *key, const void *base0, size_t nmemb, size_t size, p = base + (lim >> 1) * size; cmp = (*compar)(key, p); if (cmp == 0) - return ((void *)p); + return ((const void *)p); if (cmp > 0) { /* key > p: move right */ - base = (char *)p + size; + base = (const char *)p + size; lim--; } /* else move left */ } @@ -94,21 +94,21 @@ bsearch(const void *key, const void *base0, size_t nmemb, size_t size, int ieee80211_regdomain_compare_cn(const void *a, const void *b) { - return(strcmp(((struct ieee80211_countryname*)a)->cn_name, - ((struct ieee80211_countryname*)b)->cn_name)); + return(strcmp(((const struct ieee80211_countryname*)a)->cn_name, + ((const struct ieee80211_countryname*)b)->cn_name)); } int ieee80211_regdomain_compare_rn(const void *a, const void *b) { - return(strcmp(((struct ieee80211_regdomainname*)a)->rn_name, - ((struct ieee80211_regdomainname*)b)->rn_name)); + return(strcmp(((const struct ieee80211_regdomainname*)a)->rn_name, + ((const struct ieee80211_regdomainname*)b)->rn_name)); } u_int16_t ieee80211_name2countrycode(const char *name) { - struct ieee80211_countryname key = { CTRY_DEFAULT, name }, *value; + const struct ieee80211_countryname key = { CTRY_DEFAULT, name }, *value; if((value = bsearch(&key, &ieee80211_r_ctry, sizeof(ieee80211_r_ctry) / sizeof(ieee80211_r_ctry[0]), @@ -122,7 +122,7 @@ ieee80211_name2countrycode(const char *name) u_int32_t ieee80211_name2regdomain(const char *name) { - struct ieee80211_regdomainname key = { DMN_DEFAULT, name }, *value; + const struct ieee80211_regdomainname key = { DMN_DEFAULT, name }, *value; if((value = bsearch(&key, &ieee80211_r_names, sizeof(ieee80211_r_names) / sizeof(ieee80211_r_names[0]), diff --git a/sys/net80211/ieee80211_regdomain.h b/sys/net80211/ieee80211_regdomain.h index 2138d7d2b08..69efcdc5f95 100644 --- a/sys/net80211/ieee80211_regdomain.h +++ b/sys/net80211/ieee80211_regdomain.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211_regdomain.h,v 1.1 2004/11/02 02:15:49 reyk Exp $ */ +/* $OpenBSD: ieee80211_regdomain.h,v 1.2 2004/11/06 18:31:41 reyk Exp $ */ /* * Copyright (c) 2004 Reyk Floeter <reyk@vantronix.net>. @@ -356,7 +356,7 @@ enum ieee80211_countrycode { struct ieee80211_countryname { u_int16_t cn_code; const char *cn_name; - u_int16_t cn_domain; + u_int32_t cn_domain; }; #define IEEE80211_REGDOMAIN_COUNTRY_NAMES { \ |