|
23 | 23 | #include <string.h>
|
24 | 24 | #include <stdlib.h>
|
25 | 25 | #include <stdio.h>
|
| 26 | +#include <stdint.h> |
26 | 27 | #include "mbed_shared_queues.h"
|
27 | 28 | #include "events/EventQueue.h"
|
28 | 29 | #include "OnboardNetworkStack.h"
|
@@ -63,7 +64,7 @@ enum dns_state {
|
63 | 64 | };
|
64 | 65 |
|
65 | 66 | struct DNS_QUERY {
|
66 |
| - int unique_id; |
| 67 | + intptr_t unique_id; |
67 | 68 | nsapi_error_t status;
|
68 | 69 | NetworkStack *stack;
|
69 | 70 | char *host;
|
@@ -94,7 +95,7 @@ static void nsapi_dns_cache_reset();
|
94 | 95 | static nsapi_error_t nsapi_dns_get_server_addr(NetworkStack *stack, uint8_t *index, uint8_t *total_attempts, uint8_t *send_success, SocketAddress *dns_addr, const char *interface_name);
|
95 | 96 |
|
96 | 97 | static void nsapi_dns_query_async_create(void *ptr);
|
97 |
| -static nsapi_error_t nsapi_dns_query_async_delete(int unique_id); |
| 98 | +static nsapi_error_t nsapi_dns_query_async_delete(intptr_t unique_id); |
98 | 99 | static void nsapi_dns_query_async_send(void *ptr);
|
99 | 100 | static void nsapi_dns_query_async_timeout(void);
|
100 | 101 | static void nsapi_dns_query_async_resp(DNS_QUERY *query, nsapi_error_t status, SocketAddress *address);
|
@@ -122,7 +123,7 @@ static SingletonPtr<PlatformMutex> dns_cache_mutex;
|
122 | 123 | #endif
|
123 | 124 |
|
124 | 125 | static uint16_t dns_message_id = 1;
|
125 |
| -static int dns_unique_id = 1; |
| 126 | +static intptr_t dns_unique_id = 1; |
126 | 127 | static DNS_QUERY *dns_query_queue[DNS_QUERY_QUEUE_SIZE];
|
127 | 128 | // Protects from several threads running asynchronous DNS
|
128 | 129 | static SingletonPtr<PlatformMutex> dns_mutex;
|
@@ -765,7 +766,7 @@ nsapi_value_or_error_t nsapi_dns_query_multiple_async(NetworkStack *stack, const
|
765 | 766 |
|
766 | 767 | static void nsapi_dns_query_async_initiate_next(void)
|
767 | 768 | {
|
768 |
| - int id = INT32_MAX; |
| 769 | + intptr_t id = INTPTR_MAX; |
769 | 770 | DNS_QUERY *query = NULL;
|
770 | 771 |
|
771 | 772 | // Trigger next query to start, find one that has been on queue longest
|
@@ -842,7 +843,7 @@ static void nsapi_dns_query_async_timeout(void)
|
842 | 843 | dns_mutex->unlock();
|
843 | 844 | }
|
844 | 845 |
|
845 |
| -nsapi_error_t nsapi_dns_query_async_cancel(int id) |
| 846 | +nsapi_error_t nsapi_dns_query_async_cancel(intptr_t id) |
846 | 847 | {
|
847 | 848 | dns_mutex->lock();
|
848 | 849 |
|
@@ -874,7 +875,7 @@ static void nsapi_dns_query_async_create(void *ptr)
|
874 | 875 | {
|
875 | 876 | dns_mutex->lock();
|
876 | 877 |
|
877 |
| - int unique_id = reinterpret_cast<int>(ptr); |
| 878 | + intptr_t unique_id = reinterpret_cast<intptr_t>(ptr); |
878 | 879 |
|
879 | 880 | DNS_QUERY *query = NULL;
|
880 | 881 |
|
@@ -940,7 +941,7 @@ static void nsapi_dns_query_async_create(void *ptr)
|
940 | 941 |
|
941 | 942 | }
|
942 | 943 |
|
943 |
| -static nsapi_error_t nsapi_dns_query_async_delete(int unique_id) |
| 944 | +static nsapi_error_t nsapi_dns_query_async_delete(intptr_t unique_id) |
944 | 945 | {
|
945 | 946 | int index = -1;
|
946 | 947 | DNS_QUERY *query = NULL;
|
@@ -1000,7 +1001,7 @@ static void nsapi_dns_query_async_send(void *ptr)
|
1000 | 1001 | {
|
1001 | 1002 | dns_mutex->lock();
|
1002 | 1003 |
|
1003 |
| - int unique_id = reinterpret_cast<int>(ptr); |
| 1004 | + intptr_t unique_id = reinterpret_cast<intptr_t>(ptr); |
1004 | 1005 |
|
1005 | 1006 | DNS_QUERY *query = NULL;
|
1006 | 1007 |
|
@@ -1162,7 +1163,7 @@ static void nsapi_dns_query_async_response(void *ptr)
|
1162 | 1163 | {
|
1163 | 1164 | dns_mutex->lock();
|
1164 | 1165 |
|
1165 |
| - int unique_id = reinterpret_cast<int>(ptr); |
| 1166 | + intptr_t unique_id = reinterpret_cast<intptr_t>(ptr); |
1166 | 1167 |
|
1167 | 1168 | DNS_QUERY *query = NULL;
|
1168 | 1169 |
|
|
0 commit comments