diff options
author | Nikias Bassen | 2022-05-05 01:07:00 +0200 |
---|---|---|
committer | Nikias Bassen | 2022-05-05 01:07:00 +0200 |
commit | 36ffb7ab6e2a7e33bd1b56398a88895b7b8c615a (patch) | |
tree | 0f6082f318d19f29e2054f18409f5df395545c69 | |
parent | a9a639d0102b9bbf30fd088e633c793316dbc873 (diff) | |
download | libusbmuxd-36ffb7ab6e2a7e33bd1b56398a88895b7b8c615a.tar.gz libusbmuxd-36ffb7ab6e2a7e33bd1b56398a88895b7b8c615a.tar.bz2 |
Make conn_data member of usbmuxd_device_info struct unsigned since it's not a string
Also remove some pointless casts and update some others
-rw-r--r-- | include/usbmuxd.h | 2 | ||||
-rw-r--r-- | tools/inetcat.c | 10 | ||||
-rw-r--r-- | tools/iproxy.c | 10 |
3 files changed, 11 insertions, 11 deletions
diff --git a/include/usbmuxd.h b/include/usbmuxd.h index f08a653..6c440c1 100644 --- a/include/usbmuxd.h +++ b/include/usbmuxd.h @@ -52,7 +52,7 @@ typedef struct { uint32_t product_id; char udid[44]; enum usbmux_connection_type conn_type; - char conn_data[200]; + uint8_t conn_data[200]; } usbmuxd_device_info_t; /** diff --git a/tools/inetcat.c b/tools/inetcat.c index eb5e411..f70215b 100644 --- a/tools/inetcat.c +++ b/tools/inetcat.c @@ -216,14 +216,14 @@ int main(int argc, char **argv) unsigned char saddr_[32]; memset(saddr_, '\0', sizeof(saddr_)); struct sockaddr* saddr = (struct sockaddr*)&saddr_[0]; - if (((char*)dev->conn_data)[1] == 0x02) { // AF_INET + if (dev->conn_data[1] == 0x02) { // AF_INET saddr->sa_family = AF_INET; - memcpy(&saddr->sa_data[0], (char*)dev->conn_data+2, 14); + memcpy(&saddr->sa_data[0], (uint8_t*)dev->conn_data+2, 14); } - else if (((char*)dev->conn_data)[1] == 0x1E) { //AF_INET6 (bsd) + else if (dev->conn_data[1] == 0x1E) { //AF_INET6 (bsd) #ifdef AF_INET6 saddr->sa_family = AF_INET6; - memcpy(&saddr->sa_data[0], (char*)dev->conn_data+2, 26); + memcpy(&saddr->sa_data[0], (uint8_t*)dev->conn_data+2, 26); #else fprintf(stderr, "ERROR: Got an IPv6 address but this system doesn't support IPv6\n"); free(dev_list); @@ -231,7 +231,7 @@ int main(int argc, char **argv) #endif } else { - fprintf(stderr, "Unsupported address family 0x%02x\n", ((char*)dev->conn_data)[1]); + fprintf(stderr, "Unsupported address family 0x%02x\n", dev->conn_data[1]); free(dev_list); return 1; } diff --git a/tools/iproxy.c b/tools/iproxy.c index fd96f2d..d5f66b6 100644 --- a/tools/iproxy.c +++ b/tools/iproxy.c @@ -129,15 +129,15 @@ static void *acceptor_thread(void *arg) struct sockaddr_storage saddr_storage; struct sockaddr* saddr = (struct sockaddr*)&saddr_storage; - if (((char*)dev->conn_data)[1] == 0x02) { // AF_INET + if (dev->conn_data[1] == 0x02) { // AF_INET saddr->sa_family = AF_INET; - memcpy(&saddr->sa_data[0], (char*)dev->conn_data + 2, 14); + memcpy(&saddr->sa_data[0], (uint8_t*)dev->conn_data+2, 14); } - else if (((char*)dev->conn_data)[1] == 0x1E) { //AF_INET6 (bsd) + else if (dev->conn_data[1] == 0x1E) { //AF_INET6 (bsd) #ifdef AF_INET6 saddr->sa_family = AF_INET6; /* copy the address and the host dependent scope id */ - memcpy(&saddr->sa_data[0], (char*)dev->conn_data + 2, 26); + memcpy(&saddr->sa_data[0], (uint8_t*)dev->conn_data+2, 26); #else fprintf(stderr, "ERROR: Got an IPv6 address but this system doesn't support IPv6\n"); CDATA_FREE(cdata); @@ -145,7 +145,7 @@ static void *acceptor_thread(void *arg) #endif } else { - fprintf(stderr, "Unsupported address family 0x%02x\n", ((char*)dev->conn_data)[1]); + fprintf(stderr, "Unsupported address family 0x%02x\n", dev->conn_data[1]); CDATA_FREE(cdata); return NULL; } |