summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Martin Szulecki2010-03-24 14:56:02 +0100
committerGravatar Martin Szulecki2010-03-24 14:56:02 +0100
commit6f07a0bb701d6236dda7b19bd04df6414708dc78 (patch)
tree5fe616a32f5d6f658107d2302f9681fa55c961a1
parentc39f08af9aca0f8b86c713345e2055e408b560dd (diff)
downloadlibimobiledevice-6f07a0bb701d6236dda7b19bd04df6414708dc78.tar.gz
libimobiledevice-6f07a0bb701d6236dda7b19bd04df6414708dc78.tar.bz2
Use glib GUINT32_TO/FROM_BE macros instead of htonl/ntohl
-rw-r--r--configure.ac2
-rw-r--r--src/property_list_service.c6
-rw-r--r--tools/idevicesyslog.c4
3 files changed, 6 insertions, 6 deletions
diff --git a/configure.ac b/configure.ac
index aaad326..6ead879 100644
--- a/configure.ac
+++ b/configure.ac
@@ -41,7 +41,7 @@ AC_CHECK_LIB(gcrypt, gcry_control, [AC_SUBST(libgcrypt_LIBS,[-lgcrypt])], ["libg
# Checks for header files.
AC_HEADER_STDC
-AC_CHECK_HEADERS([netinet/in.h stdint.h stdlib.h string.h gcrypt.h])
+AC_CHECK_HEADERS([stdint.h stdlib.h string.h gcrypt.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
diff --git a/src/property_list_service.c b/src/property_list_service.c
index eaf0b30..80b5f52 100644
--- a/src/property_list_service.c
+++ b/src/property_list_service.c
@@ -20,7 +20,7 @@
*/
#include <stdlib.h>
#include <string.h>
-#include <netinet/in.h>
+#include <glib.h>
#include "property_list_service.h"
#include "idevice.h"
@@ -138,7 +138,7 @@ static property_list_service_error_t internal_plist_send(property_list_service_c
return PROPERTY_LIST_SERVICE_E_PLIST_ERROR;
}
- nlen = htonl(length);
+ nlen = GUINT32_TO_BE(length);
debug_info("sending %d bytes", length);
idevice_connection_send(client->connection, (const char*)&nlen, sizeof(nlen), (uint32_t*)&bytes);
if (bytes == sizeof(nlen)) {
@@ -229,7 +229,7 @@ static property_list_service_error_t internal_plist_receive_timeout(property_lis
if ((char)pktlen == 0) { /* prevent huge buffers */
uint32_t curlen = 0;
char *content = NULL;
- pktlen = ntohl(pktlen);
+ pktlen = GUINT32_FROM_BE(pktlen);
debug_info("%d bytes following", pktlen);
content = (char*)malloc(pktlen);
diff --git a/tools/idevicesyslog.c b/tools/idevicesyslog.c
index 32b9711..dcd8df6 100644
--- a/tools/idevicesyslog.c
+++ b/tools/idevicesyslog.c
@@ -22,9 +22,9 @@
#include <stdio.h>
#include <string.h>
#include <errno.h>
-#include <netinet/in.h>
#include <signal.h>
#include <stdlib.h>
+#include <glib.h>
#include <libimobiledevice/libimobiledevice.h>
#include <libimobiledevice/lockdown.h>
@@ -118,7 +118,7 @@ int main(int argc, char *argv[])
uint32_t datalen = 0, bytes = 0, recv_bytes = 0;
ret = idevice_connection_receive(conn, (char *) &datalen, sizeof(datalen), &bytes);
- datalen = ntohl(datalen);
+ datalen = GUINT32_FROM_BE(datalen);
if (datalen == 0)
continue;