summaryrefslogtreecommitdiffstats
path: root/adb
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2014-11-22 08:01:20 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-11-22 08:01:20 +0000
commite79cd67cfdd7efce3c9790a45c166395227ef4e8 (patch)
treef32d2e6c852a117b627b4bcecc94c184e81aaa44 /adb
parent88cc0aded69e06d140a82064355509cac2c3cbfb (diff)
parent0101b06fa6f9863ee87e89757e70900c3a0e7bfc (diff)
downloadsystem_core-e79cd67cfdd7efce3c9790a45c166395227ef4e8.zip
system_core-e79cd67cfdd7efce3c9790a45c166395227ef4e8.tar.gz
system_core-e79cd67cfdd7efce3c9790a45c166395227ef4e8.tar.bz2
am 0101b06f: Merge "Kill HAVE_BIG_ENDIAN, HAVE_ENDIAN_H, and HAVE_LITTLE_ENDIAN."
* commit '0101b06fa6f9863ee87e89757e70900c3a0e7bfc': Kill HAVE_BIG_ENDIAN, HAVE_ENDIAN_H, and HAVE_LITTLE_ENDIAN.
Diffstat (limited to 'adb')
-rw-r--r--adb/adb.h1
-rw-r--r--adb/file_sync_service.h14
-rw-r--r--adb/transport_local.c27
-rw-r--r--adb/transport_usb.c27
4 files changed, 1 insertions, 68 deletions
diff --git a/adb/adb.h b/adb/adb.h
index 44e5981..f584c57 100644
--- a/adb/adb.h
+++ b/adb/adb.h
@@ -376,7 +376,6 @@ void usb_kick(usb_handle *h);
int is_adb_interface(int vid, int pid, int usb_class, int usb_subclass, int usb_protocol);
#endif
-unsigned host_to_le32(unsigned n);
int adb_commandline(int argc, char **argv);
int connection_state(atransport *t);
diff --git a/adb/file_sync_service.h b/adb/file_sync_service.h
index 5dd2e80..c3c8574 100644
--- a/adb/file_sync_service.h
+++ b/adb/file_sync_service.h
@@ -17,22 +17,10 @@
#ifndef _FILE_SYNC_SERVICE_H_
#define _FILE_SYNC_SERVICE_H_
-#ifdef HAVE_BIG_ENDIAN
-static inline unsigned __swap_uint32(unsigned x)
-{
- return (((x) & 0xFF000000) >> 24)
- | (((x) & 0x00FF0000) >> 8)
- | (((x) & 0x0000FF00) << 8)
- | (((x) & 0x000000FF) << 24);
-}
-#define htoll(x) __swap_uint32(x)
-#define ltohl(x) __swap_uint32(x)
-#define MKID(a,b,c,d) ((d) | ((c) << 8) | ((b) << 16) | ((a) << 24))
-#else
#define htoll(x) (x)
#define ltohl(x) (x)
+
#define MKID(a,b,c,d) ((a) | ((b) << 8) | ((c) << 16) | ((d) << 24))
-#endif
#define ID_STAT MKID('S','T','A','T')
#define ID_LIST MKID('L','I','S','T')
diff --git a/adb/transport_local.c b/adb/transport_local.c
index 948cc15..6c4e220 100644
--- a/adb/transport_local.c
+++ b/adb/transport_local.c
@@ -28,21 +28,6 @@
#define TRACE_TAG TRACE_TRANSPORT
#include "adb.h"
-#ifdef HAVE_BIG_ENDIAN
-#define H4(x) (((x) & 0xFF000000) >> 24) | (((x) & 0x00FF0000) >> 8) | (((x) & 0x0000FF00) << 8) | (((x) & 0x000000FF) << 24)
-static inline void fix_endians(apacket *p)
-{
- p->msg.command = H4(p->msg.command);
- p->msg.arg0 = H4(p->msg.arg0);
- p->msg.arg1 = H4(p->msg.arg1);
- p->msg.data_length = H4(p->msg.data_length);
- p->msg.data_check = H4(p->msg.data_check);
- p->msg.magic = H4(p->msg.magic);
-}
-#else
-#define fix_endians(p) do {} while (0)
-#endif
-
#if ADB_HOST
/* we keep a list of opened transports. The atransport struct knows to which
* local transport it is connected. The list is used to detect when we're
@@ -62,12 +47,6 @@ static int remote_read(apacket *p, atransport *t)
return -1;
}
- fix_endians(p);
-
-#if 0 && defined HAVE_BIG_ENDIAN
- D("read remote packet: %04x arg0=%0x arg1=%0x data_length=%0x data_check=%0x magic=%0x\n",
- p->msg.command, p->msg.arg0, p->msg.arg1, p->msg.data_length, p->msg.data_check, p->msg.magic);
-#endif
if(check_header(p)) {
D("bad header: terminated (data)\n");
return -1;
@@ -90,12 +69,6 @@ static int remote_write(apacket *p, atransport *t)
{
int length = p->msg.data_length;
- fix_endians(p);
-
-#if 0 && defined HAVE_BIG_ENDIAN
- D("write remote packet: %04x arg0=%0x arg1=%0x data_length=%0x data_check=%0x magic=%0x\n",
- p->msg.command, p->msg.arg0, p->msg.arg1, p->msg.data_length, p->msg.data_check, p->msg.magic);
-#endif
if(writex(t->sfd, &p->msg, sizeof(amessage) + length)) {
D("remote local: write terminated\n");
return -1;
diff --git a/adb/transport_usb.c b/adb/transport_usb.c
index 3d19803..1138ddd 100644
--- a/adb/transport_usb.c
+++ b/adb/transport_usb.c
@@ -23,29 +23,6 @@
#define TRACE_TAG TRACE_TRANSPORT
#include "adb.h"
-#ifdef HAVE_BIG_ENDIAN
-#define H4(x) (((x) & 0xFF000000) >> 24) | (((x) & 0x00FF0000) >> 8) | (((x) & 0x0000FF00) << 8) | (((x) & 0x000000FF) << 24)
-static inline void fix_endians(apacket *p)
-{
- p->msg.command = H4(p->msg.command);
- p->msg.arg0 = H4(p->msg.arg0);
- p->msg.arg1 = H4(p->msg.arg1);
- p->msg.data_length = H4(p->msg.data_length);
- p->msg.data_check = H4(p->msg.data_check);
- p->msg.magic = H4(p->msg.magic);
-}
-unsigned host_to_le32(unsigned n)
-{
- return H4(n);
-}
-#else
-#define fix_endians(p) do {} while (0)
-unsigned host_to_le32(unsigned n)
-{
- return n;
-}
-#endif
-
static int remote_read(apacket *p, atransport *t)
{
if(usb_read(t->usb, &p->msg, sizeof(amessage))){
@@ -53,8 +30,6 @@ static int remote_read(apacket *p, atransport *t)
return -1;
}
- fix_endians(p);
-
if(check_header(p)) {
D("remote usb: check_header failed\n");
return -1;
@@ -79,8 +54,6 @@ static int remote_write(apacket *p, atransport *t)
{
unsigned size = p->msg.data_length;
- fix_endians(p);
-
if(usb_write(t->usb, &p->msg, sizeof(amessage))) {
D("remote usb: 1 - write terminated\n");
return -1;