• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

system/corennnnn


Commit MetaInfo

Revisionf6330a2eeb78c0971f33feee7fd1ee06472a7dba (tree)
Zeit2009-05-19 00:36:28
AutorDavid 'Digit' Turner <digit@goog...>
CommiterDavid 'Digit' Turner

Log Message

Cleaning up whitespace in adb sources. Nothing more, nothing less.

Ändern Zusammenfassung

Diff

--- a/adb/fdevent.c
+++ b/adb/fdevent.c
@@ -87,7 +87,7 @@ static void fdevent_init()
8787 {
8888 /* XXX: what's a good size for the passed in hint? */
8989 epoll_fd = epoll_create(256);
90-
90+
9191 if(epoll_fd < 0) {
9292 perror("epoll_create() failed");
9393 exit(1);
@@ -105,7 +105,7 @@ static void fdevent_connect(fdevent *fde)
105105 ev.events = 0;
106106 ev.data.ptr = fde;
107107
108-#if 0
108+#if 0
109109 if(epoll_ctl(epoll_fd, EPOLL_CTL_ADD, fde->fd, &ev)) {
110110 perror("epoll_ctl() failed\n");
111111 exit(1);
@@ -116,7 +116,7 @@ static void fdevent_connect(fdevent *fde)
116116 static void fdevent_disconnect(fdevent *fde)
117117 {
118118 struct epoll_event ev;
119-
119+
120120 memset(&ev, 0, sizeof(ev));
121121 ev.events = 0;
122122 ev.data.ptr = fde;
@@ -133,9 +133,9 @@ static void fdevent_update(fdevent *fde, unsigned events)
133133 {
134134 struct epoll_event ev;
135135 int active;
136-
136+
137137 active = (fde->state & FDE_EVENTMASK) != 0;
138-
138+
139139 memset(&ev, 0, sizeof(ev));
140140 ev.events = 0;
141141 ev.data.ptr = fde;
@@ -241,7 +241,7 @@ static void fdevent_connect(fdevent *fde)
241241 static void fdevent_disconnect(fdevent *fde)
242242 {
243243 int i, n;
244-
244+
245245 FD_CLR(fde->fd, &read_fds);
246246 FD_CLR(fde->fd, &write_fds);
247247 FD_CLR(fde->fd, &error_fds);
@@ -283,9 +283,9 @@ static void fdevent_process()
283283 memcpy(&rfd, &read_fds, sizeof(fd_set));
284284 memcpy(&wfd, &write_fds, sizeof(fd_set));
285285 memcpy(&efd, &error_fds, sizeof(fd_set));
286-
286+
287287 n = select(select_n, &rfd, &wfd, &efd, 0);
288-
288+
289289 if(n < 0) {
290290 if(errno == EINTR) return;
291291 perror("select");
@@ -300,12 +300,12 @@ static void fdevent_process()
300300
301301 if(events) {
302302 n--;
303-
303+
304304 fde = fd_table[i];
305305 if(fde == 0) FATAL("missing fde for fd %d\n", i);
306306
307307 fde->events |= events;
308-
308+
309309 if(fde->state & FDE_PENDING) continue;
310310 fde->state |= FDE_PENDING;
311311 fdevent_plist_enqueue(fde);
@@ -320,7 +320,7 @@ static void fdevent_register(fdevent *fde)
320320 if(fde->fd < 0) {
321321 FATAL("bogus negative fd (%d)\n", fde->fd);
322322 }
323-
323+
324324 if(fde->fd >= fd_table_max) {
325325 int oldmax = fd_table_max;
326326 if(fde->fd > 32000) {
@@ -383,9 +383,9 @@ static fdevent *fdevent_plist_dequeue(void)
383383 {
384384 fdevent *list = &list_pending;
385385 fdevent *node = list->next;
386-
386+
387387 if(node == list) return 0;
388-
388+
389389 list->next = node->next;
390390 list->next->prev = list;
391391 node->next = 0;
@@ -449,9 +449,9 @@ void fdevent_remove(fdevent *fde)
449449 void fdevent_set(fdevent *fde, unsigned events)
450450 {
451451 events &= FDE_EVENTMASK;
452-
452+
453453 if((fde->state & FDE_EVENTMASK) == events) return;
454-
454+
455455 if(fde->state & FDE_ACTIVE) {
456456 fdevent_update(fde, events);
457457 dump_fde(fde, "update");
@@ -487,13 +487,13 @@ void fdevent_del(fdevent *fde, unsigned events)
487487 void fdevent_loop()
488488 {
489489 fdevent *fde;
490-
490+
491491 for(;;) {
492492 #if DEBUG
493493 fprintf(stderr,"--- ---- waiting for events\n");
494494 #endif
495495 fdevent_process();
496-
496+
497497 while((fde = fdevent_plist_dequeue())) {
498498 unsigned events = fde->events;
499499 fde->events = 0;
--- a/adb/fdevent.h
+++ b/adb/fdevent.h
@@ -17,10 +17,13 @@
1717 #ifndef __FDEVENT_H
1818 #define __FDEVENT_H
1919
20+#include <stdint.h> /* for int64_t */
21+
2022 /* events that may be observed */
2123 #define FDE_READ 0x0001
2224 #define FDE_WRITE 0x0002
2325 #define FDE_ERROR 0x0004
26+#define FDE_TIMEOUT 0x0008
2427
2528 /* features that may be set (via the events set/add/del interface) */
2629 #define FDE_DONT_CLOSE 0x0080
@@ -30,6 +33,8 @@ typedef struct fdevent fdevent;
3033 typedef void (*fd_func)(int fd, unsigned events, void *userdata);
3134
3235 /* Allocate and initialize a new fdevent object
36+ * Note: use FD_TIMER as 'fd' to create a fd-less object
37+ * (used to implement timers).
3338 */
3439 fdevent *fdevent_create(int fd, fd_func func, void *arg);
3540
@@ -53,6 +58,8 @@ void fdevent_set(fdevent *fde, unsigned events);
5358 void fdevent_add(fdevent *fde, unsigned events);
5459 void fdevent_del(fdevent *fde, unsigned events);
5560
61+void fdevent_set_timeout(fdevent *fde, int64_t timeout_ms);
62+
5663 /* loop forever, handling events.
5764 */
5865 void fdevent_loop();
@@ -65,7 +72,7 @@ struct fdevent
6572 int fd;
6673 unsigned short state;
6774 unsigned short events;
68-
75+
6976 fd_func func;
7077 void *arg;
7178 };
--- a/adb/file_sync_client.c
+++ b/adb/file_sync_client.c
@@ -165,7 +165,7 @@ static int sync_start_readtime(int fd, const char *path)
165165 }
166166
167167 static int sync_finish_readtime(int fd, unsigned int *timestamp,
168- unsigned int *mode, unsigned int *size)
168+ unsigned int *mode, unsigned int *size)
169169 {
170170 syncmsg msg;
171171
@@ -908,12 +908,12 @@ static int copy_remote_dir_local(int fd, const char *rpath, const char *lpath,
908908 unsigned int timestamp, mode, size;
909909 if (sync_finish_readtime(fd, &timestamp, &mode, &size))
910910 return 1;
911- if (size == ci->size) {
911+ if (size == ci->size) {
912912 /* for links, we cannot update the atime/mtime */
913913 if ((S_ISREG(ci->mode & mode) && timestamp == ci->time) ||
914- (S_ISLNK(ci->mode & mode) && timestamp >= ci->time))
914+ (S_ISLNK(ci->mode & mode) && timestamp >= ci->time))
915915 ci->flag = 1;
916- }
916+ }
917917 }
918918 }
919919 #endif
--- a/adb/protocol.txt
+++ b/adb/protocol.txt
@@ -23,7 +23,7 @@ implementation to be much more robust.
2323
2424
2525 --- protocol overview and basics ---------------------------------------
26-
26+
2727 The transport layer deals in "messages", which consist of a 24 byte
2828 header followed (optionally) by a payload. The header consists of 6
2929 32 bit words which are sent across the wire in little endian format.
@@ -52,7 +52,7 @@ The identifiers "local-id" and "remote-id" are always relative to the
5252 reversed.
5353
5454
55-
55+
5656 --- CONNECT(version, maxdata, "system-identity-string") ----------------
5757
5858 The CONNECT message establishes the presence of a remote system.
@@ -114,7 +114,7 @@ is used to establish the connection). Nonetheless, the local-id MUST
114114 not change on later READY messages sent to the same stream.
115115
116116
117-
117+
118118 --- WRITE(0, remote-id, "data") ----------------------------------------
119119
120120 The WRITE message sends data to the recipient's stream identified by
@@ -172,7 +172,7 @@ to send across the wire.
172172 #define A_WRTE 0x45545257
173173
174174
175-
175+
176176 --- implementation details ---------------------------------------------
177177
178178 The core of the bridge program will use three threads. One thread
--- a/adb/sysdeps.h
+++ b/adb/sysdeps.h
@@ -67,16 +67,16 @@ typedef void (*win_thread_func_t)(void* arg);
6767
6868 static __inline__ int adb_thread_create( adb_thread_t *thread, adb_thread_func_t func, void* arg)
6969 {
70- thread->tid = _beginthread( (win_thread_func_t)func, 0, arg );
71- if (thread->tid == (unsigned)-1L) {
72- return -1;
73- }
74- return 0;
70+ thread->tid = _beginthread( (win_thread_func_t)func, 0, arg );
71+ if (thread->tid == (unsigned)-1L) {
72+ return -1;
73+ }
74+ return 0;
7575 }
7676
7777 static __inline__ void close_on_exec(int fd)
7878 {
79- /* nothing really */
79+ /* nothing really */
8080 }
8181
8282 extern void disable_tcp_nagle(int fd);
@@ -138,7 +138,7 @@ static __inline__ int unix_write(int fd, const void* buf, size_t len)
138138
139139 static __inline__ int adb_open_mode(const char* path, int options, int mode)
140140 {
141- return adb_open(path, options);
141+ return adb_open(path, options);
142142 }
143143
144144 static __inline__ int unix_open(const char* path, int options,...)
@@ -203,7 +203,7 @@ struct fdevent {
203203
204204 static __inline__ void adb_sleep_ms( int mseconds )
205205 {
206- Sleep( mseconds );
206+ Sleep( mseconds );
207207 }
208208
209209 extern int adb_socket_accept(int serverfd, struct sockaddr* addr, socklen_t *addrlen);
@@ -290,7 +290,7 @@ typedef pthread_mutex_t adb_mutex_t;
290290
291291 static __inline__ void close_on_exec(int fd)
292292 {
293- fcntl( fd, F_SETFD, FD_CLOEXEC );
293+ fcntl( fd, F_SETFD, FD_CLOEXEC );
294294 }
295295
296296 static __inline__ int unix_open(const char* path, int options,...)
@@ -312,7 +312,7 @@ static __inline__ int unix_open(const char* path, int options,...)
312312
313313 static __inline__ int adb_open_mode( const char* pathname, int options, int mode )
314314 {
315- return open( pathname, options, mode );
315+ return open( pathname, options, mode );
316316 }
317317
318318
@@ -368,11 +368,11 @@ static __inline__ int adb_creat(const char* path, int mode)
368368 {
369369 int fd = creat(path, mode);
370370
371- if ( fd < 0 )
372- return -1;
371+ if ( fd < 0 )
372+ return -1;
373373
374374 close_on_exec(fd);
375- return fd;
375+ return fd;
376376 }
377377 #undef creat
378378 #define creat ___xxx_creat
@@ -439,12 +439,12 @@ static __inline__ int adb_socketpair( int sv[2] )
439439
440440 static __inline__ void adb_sleep_ms( int mseconds )
441441 {
442- usleep( mseconds*1000 );
442+ usleep( mseconds*1000 );
443443 }
444444
445445 static __inline__ int adb_mkdir(const char* path, int mode)
446446 {
447- return mkdir(path, mode);
447+ return mkdir(path, mode);
448448 }
449449 #undef mkdir
450450 #define mkdir ___xxx_mkdir
--- a/adb/sysdeps_win32.c
+++ b/adb/sysdeps_win32.c
@@ -739,12 +739,12 @@ int adb_socket_accept(int serverfd, struct sockaddr* addr, socklen_t *addrle
739739 {
740740 FH serverfh = _fh_from_int(serverfd);
741741 FH fh;
742-
742+
743743 if ( !serverfh || serverfh->clazz != &_fh_socket_class ) {
744744 D( "adb_socket_accept: invalid fd %d\n", serverfd );
745745 return -1;
746746 }
747-
747+
748748 fh = _fh_alloc( &_fh_socket_class );
749749 if (!fh) {
750750 D( "adb_socket_accept: not enough memory to allocate accepted socket descriptor\n" );
@@ -757,7 +757,7 @@ int adb_socket_accept(int serverfd, struct sockaddr* addr, socklen_t *addrle
757757 D( "adb_socket_accept: accept on fd %d return error %ld\n", serverfd, GetLastError() );
758758 return -1;
759759 }
760-
760+
761761 snprintf( fh->name, sizeof(fh->name), "%d(accept:%s)", _fh_to_int(fh), serverfh->name );
762762 D( "adb_socket_accept on fd %d returns fd %d\n", serverfd, _fh_to_int(fh) );
763763 return _fh_to_int(fh);
@@ -768,7 +768,7 @@ void disable_tcp_nagle(int fd)
768768 {
769769 FH fh = _fh_from_int(fd);
770770 int on;
771-
771+
772772 if ( !fh || fh->clazz != &_fh_socket_class )
773773 return;
774774
@@ -1746,7 +1746,7 @@ void fdevent_loop()
17461746
17471747 /** FILE EVENT HOOKS
17481748 **/
1749-
1749+
17501750 static void _event_file_prepare( EventHook hook )
17511751 {
17521752 if (hook->wanted & (FDE_READ|FDE_WRITE)) {
--- a/adb/usb_windows.c
+++ b/adb/usb_windows.c
@@ -446,7 +446,7 @@ int recognized_device(usb_handle* handle) {
446446 }
447447
448448 void find_devices() {
449- usb_handle* handle = NULL;
449+ usb_handle* handle = NULL;
450450 char entry_buffer[2048];
451451 char interf_name[2048];
452452 AdbInterfaceInfo* next_interface = (AdbInterfaceInfo*)(&entry_buffer[0]);