P2P: Fix 32-bit compiler warnings on service discovery reference
[mech_eap.git] / wpa_supplicant / ctrl_iface.c
index 4092fe0..b9ec347 100644 (file)
@@ -2610,8 +2610,7 @@ static int p2p_ctrl_serv_disc_req(struct wpa_supplicant *wpa_s, char *cmd,
                if (*pos != ' ')
                        return -1;
                pos++;
-               ref = (unsigned long) wpas_p2p_sd_request_upnp(wpa_s, dst,
-                                                              version, pos);
+               ref = wpas_p2p_sd_request_upnp(wpa_s, dst, version, pos);
        } else {
                len = os_strlen(pos);
                if (len & 1)
@@ -2625,9 +2624,11 @@ static int p2p_ctrl_serv_disc_req(struct wpa_supplicant *wpa_s, char *cmd,
                        return -1;
                }
 
-               ref = (unsigned long) wpas_p2p_sd_request(wpa_s, dst, tlvs);
+               ref = wpas_p2p_sd_request(wpa_s, dst, tlvs);
                wpabuf_free(tlvs);
        }
+       if (ref == 0)
+               return -1;
        res = os_snprintf(buf, buflen, "%llx", (long long unsigned) ref);
        if (res < 0 || (unsigned) res >= buflen)
                return -1;
@@ -2643,7 +2644,7 @@ static int p2p_ctrl_serv_disc_cancel_req(struct wpa_supplicant *wpa_s,
        if (sscanf(cmd, "%llx", &val) != 1)
                return -1;
        req = val;
-       return wpas_p2p_sd_cancel_request(wpa_s, (void *) (unsigned long) req);
+       return wpas_p2p_sd_cancel_request(wpa_s, req);
 }