mdns: defined the service slot id as unsigned rather than signed.

This commit is contained in:
Our Air Quality 2019-04-12 10:36:35 +10:00 committed by Dirk Ziegelmeier
parent 2229c51704
commit 46bbfe4ee2
3 changed files with 7 additions and 7 deletions

View File

@ -108,4 +108,4 @@ Relevant information will be sent as additional records to reduce number of
requests required from a client. requests required from a client.
To remove a service from a netif, run To remove a service from a netif, run
mdns_resp_del_service(struct netif *netif, s8_t slot) mdns_resp_del_service(struct netif *netif, u8_t slot)

View File

@ -2432,14 +2432,14 @@ mdns_resp_add_service(struct netif *netif, const char *name, const char *service
* @return ERR_OK if the service was removed from the netif, an err_t otherwise * @return ERR_OK if the service was removed from the netif, an err_t otherwise
*/ */
err_t err_t
mdns_resp_del_service(struct netif *netif, s8_t slot) mdns_resp_del_service(struct netif *netif, u8_t slot)
{ {
struct mdns_host *mdns; struct mdns_host *mdns;
struct mdns_service *srv; struct mdns_service *srv;
LWIP_ASSERT("mdns_resp_del_service: netif != NULL", netif); LWIP_ASSERT("mdns_resp_del_service: netif != NULL", netif);
mdns = NETIF_TO_HOST(netif); mdns = NETIF_TO_HOST(netif);
LWIP_ERROR("mdns_resp_del_service: Not an mdns netif", (mdns != NULL), return ERR_VAL); LWIP_ERROR("mdns_resp_del_service: Not an mdns netif", (mdns != NULL), return ERR_VAL);
LWIP_ERROR("mdns_resp_del_service: Invalid Service ID", (slot >= 0) && (slot < MDNS_MAX_SERVICES), return ERR_VAL); LWIP_ERROR("mdns_resp_del_service: Invalid Service ID", slot < MDNS_MAX_SERVICES, return ERR_VAL);
LWIP_ERROR("mdns_resp_del_service: Invalid Service ID", (mdns->services[slot] != NULL), return ERR_VAL); LWIP_ERROR("mdns_resp_del_service: Invalid Service ID", (mdns->services[slot] != NULL), return ERR_VAL);
srv = mdns->services[slot]; srv = mdns->services[slot];
@ -2457,7 +2457,7 @@ mdns_resp_del_service(struct netif *netif, s8_t slot)
* @return ERR_OK if name could be set on service, an err_t otherwise * @return ERR_OK if name could be set on service, an err_t otherwise
*/ */
err_t err_t
mdns_resp_rename_service(struct netif *netif, s8_t slot, const char *name) mdns_resp_rename_service(struct netif *netif, u8_t slot, const char *name)
{ {
struct mdns_service *srv; struct mdns_service *srv;
struct mdns_host *mdns; struct mdns_host *mdns;
@ -2469,7 +2469,7 @@ mdns_resp_rename_service(struct netif *netif, s8_t slot, const char *name)
mdns = NETIF_TO_HOST(netif); mdns = NETIF_TO_HOST(netif);
LWIP_ERROR("mdns_resp_rename_service: Not an mdns netif", (mdns != NULL), return ERR_VAL); LWIP_ERROR("mdns_resp_rename_service: Not an mdns netif", (mdns != NULL), return ERR_VAL);
LWIP_ERROR("mdns_resp_rename_service: Name too long", (len <= MDNS_LABEL_MAXLEN), return ERR_VAL); LWIP_ERROR("mdns_resp_rename_service: Name too long", (len <= MDNS_LABEL_MAXLEN), return ERR_VAL);
LWIP_ERROR("mdns_resp_rename_service: Invalid Service ID", (slot >= 0) && (slot < MDNS_MAX_SERVICES), return ERR_VAL); LWIP_ERROR("mdns_resp_rename_service: Invalid Service ID", slot < MDNS_MAX_SERVICES, return ERR_VAL);
LWIP_ERROR("mdns_resp_rename_service: Invalid Service ID", (mdns->services[slot] != NULL), return ERR_VAL); LWIP_ERROR("mdns_resp_rename_service: Invalid Service ID", (mdns->services[slot] != NULL), return ERR_VAL);
srv = mdns->services[slot]; srv = mdns->services[slot];

View File

@ -110,8 +110,8 @@ err_t mdns_resp_remove_netif(struct netif *netif);
err_t mdns_resp_rename_netif(struct netif *netif, const char *hostname); err_t mdns_resp_rename_netif(struct netif *netif, const char *hostname);
s8_t mdns_resp_add_service(struct netif *netif, const char *name, const char *service, enum mdns_sd_proto proto, u16_t port, service_get_txt_fn_t txt_fn, void *txt_userdata); s8_t mdns_resp_add_service(struct netif *netif, const char *name, const char *service, enum mdns_sd_proto proto, u16_t port, service_get_txt_fn_t txt_fn, void *txt_userdata);
err_t mdns_resp_del_service(struct netif *netif, s8_t slot); err_t mdns_resp_del_service(struct netif *netif, u8_t slot);
err_t mdns_resp_rename_service(struct netif *netif, s8_t slot, const char *name); err_t mdns_resp_rename_service(struct netif *netif, u8_t slot, const char *name);
err_t mdns_resp_add_service_txtitem(struct mdns_service *service, const char *txt, u8_t txt_len); err_t mdns_resp_add_service_txtitem(struct mdns_service *service, const char *txt, u8_t txt_len);