diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-12-23 15:53:10 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-12-23 15:53:10 +0000 |
commit | cbfebfa092036442409ab371f1fc8b553f4c7aeb (patch) | |
tree | 78ac5c13f710a48b5b7a48ee4f92bfd2cf48d31a | |
parent | f27e5a4528bfd9f23b819664ccb9a5fe4febedda (diff) | |
download | gnunet-gtk-cbfebfa092036442409ab371f1fc8b553f4c7aeb.tar.gz gnunet-gtk-cbfebfa092036442409ab371f1fc8b553f4c7aeb.zip |
-some i's are signed, some i's are unsigned
-rw-r--r-- | src/lib/eventloop.c | 57 |
1 files changed, 29 insertions, 28 deletions
diff --git a/src/lib/eventloop.c b/src/lib/eventloop.c index 7759714e..93bfa319 100644 --- a/src/lib/eventloop.c +++ b/src/lib/eventloop.c | |||
@@ -295,7 +295,8 @@ gnunet_gtk_select (void *cls, struct GNUNET_NETWORK_FDSet *rfds, | |||
295 | int max_nfds; | 295 | int max_nfds; |
296 | gint poll_result; | 296 | gint poll_result; |
297 | gint delay; | 297 | gint delay; |
298 | guint i; | 298 | int i; |
299 | guint ui; | ||
299 | guint fd_counter; | 300 | guint fd_counter; |
300 | guint need_gfds; | 301 | guint need_gfds; |
301 | fd_set aread; | 302 | fd_set aread; |
@@ -523,21 +524,21 @@ gnunet_gtk_select (void *cls, struct GNUNET_NETWORK_FDSet *rfds, | |||
523 | #endif | 524 | #endif |
524 | ml->cached_poll_array[fd_counter].fd = (intptr_t) ml->hEventWrite; | 525 | ml->cached_poll_array[fd_counter].fd = (intptr_t) ml->hEventWrite; |
525 | ml->cached_poll_array[fd_counter].events = G_IO_OUT; | 526 | ml->cached_poll_array[fd_counter].events = G_IO_OUT; |
526 | for (i = 0; i < wfds->sds.fd_count; i++) | 527 | for (ui = 0; ui < wfds->sds.fd_count; ui++) |
527 | { | 528 | { |
528 | DWORD error; | 529 | DWORD error; |
529 | int status; | 530 | int status; |
530 | 531 | ||
531 | status = send (wfds->sds.fd_array[i], NULL, 0, 0); | 532 | status = send (wfds->sds.fd_array[ui], NULL, 0, 0); |
532 | error = GetLastError (); | 533 | error = GetLastError (); |
533 | #if DEBUG_EVENTLOOP | 534 | #if DEBUG_EVENTLOOP |
534 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 535 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
535 | "pre-send to the socket %d returned %d (%u)\n", i, status, | 536 | "pre-send to the socket %u returned %d (%u)\n", ui, status, |
536 | error); | 537 | error); |
537 | #endif | 538 | #endif |
538 | if (status == 0 || (error != WSAEWOULDBLOCK && error != WSAENOTCONN)) | 539 | if (status == 0 || (error != WSAEWOULDBLOCK && error != WSAENOTCONN)) |
539 | wakeup = 1; | 540 | wakeup = 1; |
540 | WSAEventSelect (wfds->sds.fd_array[i], ml->hEventWrite, | 541 | WSAEventSelect (wfds->sds.fd_array[ui], ml->hEventWrite, |
541 | FD_WRITE | FD_CONNECT | FD_CLOSE); | 542 | FD_WRITE | FD_CONNECT | FD_CLOSE); |
542 | } | 543 | } |
543 | if (wakeup) | 544 | if (wakeup) |
@@ -554,8 +555,8 @@ gnunet_gtk_select (void *cls, struct GNUNET_NETWORK_FDSet *rfds, | |||
554 | #endif | 555 | #endif |
555 | ml->cached_poll_array[fd_counter].fd = (intptr_t) ml->hEventException; | 556 | ml->cached_poll_array[fd_counter].fd = (intptr_t) ml->hEventException; |
556 | ml->cached_poll_array[fd_counter].events = G_IO_ERR; | 557 | ml->cached_poll_array[fd_counter].events = G_IO_ERR; |
557 | for (i = 0; i < efds->sds.fd_count; i++) | 558 | for (ui = 0; ui < efds->sds.fd_count; ui++) |
558 | WSAEventSelect (efds->sds.fd_array[i], ml->hEventException, | 559 | WSAEventSelect (efds->sds.fd_array[ui], ml->hEventException, |
559 | FD_OOB | FD_CLOSE); | 560 | FD_OOB | FD_CLOSE); |
560 | fd_counter++; | 561 | fd_counter++; |
561 | sock_err = efds->sds.fd_count; | 562 | sock_err = efds->sds.fd_count; |
@@ -635,27 +636,27 @@ gnunet_gtk_select (void *cls, struct GNUNET_NETWORK_FDSet *rfds, | |||
635 | GNUNET_NETWORK_fdset_zero (wfds); | 636 | GNUNET_NETWORK_fdset_zero (wfds); |
636 | if (NULL != efds) | 637 | if (NULL != efds) |
637 | GNUNET_NETWORK_fdset_zero (efds); | 638 | GNUNET_NETWORK_fdset_zero (efds); |
638 | for (i = 0; i < fd_counter; i++) | 639 | for (ui = 0; ui < fd_counter; ui++) |
639 | { | 640 | { |
640 | int set = 0; | 641 | int set = 0; |
641 | 642 | ||
642 | if ((NULL != rfds) && | 643 | if ((NULL != rfds) && |
643 | (set |= | 644 | (set |= |
644 | (FD_ISSET (ml->cached_poll_array[i].fd, &aread) && | 645 | (FD_ISSET (ml->cached_poll_array[ui].fd, &aread) && |
645 | (0 != | 646 | (0 != |
646 | (ml->cached_poll_array[i]. | 647 | (ml->cached_poll_array[ui]. |
647 | revents & (G_IO_IN | G_IO_HUP | G_IO_ERR)))))) | 648 | revents & (G_IO_IN | G_IO_HUP | G_IO_ERR)))))) |
648 | GNUNET_NETWORK_fdset_set_native (rfds, ml->cached_poll_array[i].fd); | 649 | GNUNET_NETWORK_fdset_set_native (rfds, ml->cached_poll_array[ui].fd); |
649 | if ((NULL != wfds) && | 650 | if ((NULL != wfds) && |
650 | (set |= | 651 | (set |= |
651 | (FD_ISSET (ml->cached_poll_array[i].fd, &awrite) && | 652 | (FD_ISSET (ml->cached_poll_array[ui].fd, &awrite) && |
652 | (0 != (ml->cached_poll_array[i].revents & (G_IO_OUT | G_IO_ERR)))))) | 653 | (0 != (ml->cached_poll_array[ui].revents & (G_IO_OUT | G_IO_ERR)))))) |
653 | GNUNET_NETWORK_fdset_set_native (wfds, ml->cached_poll_array[i].fd); | 654 | GNUNET_NETWORK_fdset_set_native (wfds, ml->cached_poll_array[ui].fd); |
654 | if ((NULL != efds) && | 655 | if ((NULL != efds) && |
655 | (set |= | 656 | (set |= |
656 | (FD_ISSET (ml->cached_poll_array[i].fd, &aexcept) && | 657 | (FD_ISSET (ml->cached_poll_array[ui].fd, &aexcept) && |
657 | (0 != (ml->cached_poll_array[i].revents & G_IO_ERR))))) | 658 | (0 != (ml->cached_poll_array[ui].revents & G_IO_ERR))))) |
658 | GNUNET_NETWORK_fdset_set_native (efds, ml->cached_poll_array[i].fd); | 659 | GNUNET_NETWORK_fdset_set_native (efds, ml->cached_poll_array[ui].fd); |
659 | if (set) | 660 | if (set) |
660 | result++; | 661 | result++; |
661 | } | 662 | } |
@@ -741,27 +742,27 @@ gnunet_gtk_select (void *cls, struct GNUNET_NETWORK_FDSet *rfds, | |||
741 | #endif | 742 | #endif |
742 | if (waitstatus == WAIT_OBJECT_0) | 743 | if (waitstatus == WAIT_OBJECT_0) |
743 | { | 744 | { |
744 | for (i = 0; i < wfds->sds.fd_count; i++) | 745 | for (ui = 0; ui < wfds->sds.fd_count; ui++) |
745 | { | 746 | { |
746 | DWORD error; | 747 | DWORD error; |
747 | int status; | 748 | int status; |
748 | int so_error = 0; | 749 | int so_error = 0; |
749 | int sizeof_so_error = sizeof (so_error); | 750 | int sizeof_so_error = sizeof (so_error); |
750 | int gso_result = getsockopt (wfds->sds.fd_array[i], | 751 | int gso_result = getsockopt (wfds->sds.fd_array[ui], |
751 | SOL_SOCKET, SO_ERROR, | 752 | SOL_SOCKET, SO_ERROR, |
752 | (char *) &so_error, &sizeof_so_error); | 753 | (char *) &so_error, &sizeof_so_error); |
753 | 754 | ||
754 | status = send (wfds->sds.fd_array[i], NULL, 0, 0); | 755 | status = send (wfds->sds.fd_array[ui], NULL, 0, 0); |
755 | error = GetLastError (); | 756 | error = GetLastError (); |
756 | #if DEBUG_EVENTLOOP | 757 | #if DEBUG_EVENTLOOP |
757 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 758 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
758 | "send to the socket %d returned %d (%u)\n", i, status, error); | 759 | "send to the socket %u returned %d (%u)\n", ui, status, error); |
759 | #endif | 760 | #endif |
760 | if (status == 0 || (error != WSAEWOULDBLOCK && error != WSAENOTCONN) || | 761 | if (status == 0 || (error != WSAEWOULDBLOCK && error != WSAENOTCONN) || |
761 | (status == -1 && gso_result == 0 && error == WSAENOTCONN && | 762 | (status == -1 && gso_result == 0 && error == WSAENOTCONN && |
762 | so_error == WSAECONNREFUSED)) | 763 | so_error == WSAECONNREFUSED)) |
763 | { | 764 | { |
764 | FD_SET (wfds->sds.fd_array[i], &awrite); | 765 | FD_SET (wfds->sds.fd_array[ui], &awrite); |
765 | result += 1; | 766 | result += 1; |
766 | } | 767 | } |
767 | } | 768 | } |
@@ -770,8 +771,8 @@ gnunet_gtk_select (void *cls, struct GNUNET_NETWORK_FDSet *rfds, | |||
770 | { | 771 | { |
771 | struct GNUNET_CONTAINER_SList_Iterator t; | 772 | struct GNUNET_CONTAINER_SList_Iterator t; |
772 | 773 | ||
773 | for (i = 0; i < rfds->sds.fd_count; i++) | 774 | for (ui = 0; ui < rfds->sds.fd_count; ui++) |
774 | WSAEventSelect (rfds->sds.fd_array[i], ml->hEventRead, 0); | 775 | WSAEventSelect (rfds->sds.fd_array[ui], ml->hEventRead, 0); |
775 | for (t = GNUNET_CONTAINER_slist_begin (rfds->handles); | 776 | for (t = GNUNET_CONTAINER_slist_begin (rfds->handles); |
776 | GNUNET_CONTAINER_slist_end (&t) != GNUNET_YES; | 777 | GNUNET_CONTAINER_slist_end (&t) != GNUNET_YES; |
777 | GNUNET_CONTAINER_slist_next (&t)) | 778 | GNUNET_CONTAINER_slist_next (&t)) |
@@ -788,8 +789,8 @@ gnunet_gtk_select (void *cls, struct GNUNET_NETWORK_FDSet *rfds, | |||
788 | } | 789 | } |
789 | if (wfds) | 790 | if (wfds) |
790 | { | 791 | { |
791 | for (i = 0; i < wfds->sds.fd_count; i++) | 792 | for (ui = 0; ui < wfds->sds.fd_count; ui++) |
792 | WSAEventSelect (wfds->sds.fd_array[i], ml->hEventWrite, 0); | 793 | WSAEventSelect (wfds->sds.fd_array[ui], ml->hEventWrite, 0); |
793 | GNUNET_NETWORK_fdset_zero (wfds); | 794 | GNUNET_NETWORK_fdset_zero (wfds); |
794 | if (select_ret != -1 && socks > 0) | 795 | if (select_ret != -1 && socks > 0) |
795 | GNUNET_NETWORK_fdset_copy_native (wfds, &awrite, select_ret); | 796 | GNUNET_NETWORK_fdset_copy_native (wfds, &awrite, select_ret); |
@@ -797,8 +798,8 @@ gnunet_gtk_select (void *cls, struct GNUNET_NETWORK_FDSet *rfds, | |||
797 | } | 798 | } |
798 | if (efds) | 799 | if (efds) |
799 | { | 800 | { |
800 | for (i = 0; i < efds->sds.fd_count; i++) | 801 | for (ui = 0; ui < efds->sds.fd_count; ui++) |
801 | WSAEventSelect (efds->sds.fd_array[i], ml->hEventException, 0); | 802 | WSAEventSelect (efds->sds.fd_array[ui], ml->hEventException, 0); |
802 | GNUNET_NETWORK_fdset_zero (efds); | 803 | GNUNET_NETWORK_fdset_zero (efds); |
803 | if (select_ret != -1 && socks > 0) | 804 | if (select_ret != -1 && socks > 0) |
804 | GNUNET_NETWORK_fdset_copy_native (efds, &aexcept, select_ret); | 805 | GNUNET_NETWORK_fdset_copy_native (efds, &aexcept, select_ret); |