aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Cabral <bcabral@uw.edu>2011-11-10 10:33:36 +0000
committerBruno Cabral <bcabral@uw.edu>2011-11-10 10:33:36 +0000
commitfc2cab876814ed6d568adcadf294d968fb132045 (patch)
treea8ca5f76d11dfc1dd0b8daf836c1ef4a0ea105aa
parent280bef41be9f06f7d0854817e8dc564932bed992 (diff)
downloadgnunet-gtk-fc2cab876814ed6d568adcadf294d968fb132045.tar.gz
gnunet-gtk-fc2cab876814ed6d568adcadf294d968fb132045.zip
Fix Iterators
-rw-r--r--src/lib/eventloop.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/lib/eventloop.c b/src/lib/eventloop.c
index 2ba01101..bf212b29 100644
--- a/src/lib/eventloop.c
+++ b/src/lib/eventloop.c
@@ -376,7 +376,7 @@ gnunet_gtk_select (void *cls, struct GNUNET_NETWORK_FDSet *rfds,
376 /* FIXME: why while(1) here!? */ 376 /* FIXME: why while(1) here!? */
377 while (1) 377 while (1)
378 { 378 {
379 struct GNUNET_CONTAINER_SList_Iterator *t; 379 struct GNUNET_CONTAINER_SList_Iterator t;
380 380
381 fd_counter = 0; 381 fd_counter = 0;
382 /* We might overshoot a little, but that won't hurt very much */ 382 /* We might overshoot a little, but that won't hurt very much */
@@ -402,11 +402,11 @@ gnunet_gtk_select (void *cls, struct GNUNET_NETWORK_FDSet *rfds,
402 if (rfds != NULL) 402 if (rfds != NULL)
403 { 403 {
404 for (t = GNUNET_CONTAINER_slist_begin (rfds->handles), i = 0; 404 for (t = GNUNET_CONTAINER_slist_begin (rfds->handles), i = 0;
405 GNUNET_CONTAINER_slist_end (t) != GNUNET_YES; 405 GNUNET_CONTAINER_slist_end (&t) != GNUNET_YES;
406 GNUNET_CONTAINER_slist_next (t), i += 1) 406 GNUNET_CONTAINER_slist_next (&t), i += 1)
407 { 407 {
408 struct GNUNET_DISK_FileHandle *fh = 408 struct GNUNET_DISK_FileHandle *fh =
409 GNUNET_CONTAINER_slist_get (t, NULL); 409 GNUNET_CONTAINER_slist_get (&t, NULL);
410 if (fh->type == GNUNET_PIPE) 410 if (fh->type == GNUNET_PIPE)
411 { 411 {
412 if (!ReadFile (fh->h, NULL, 0, NULL, fh->oOverlapRead)) 412 if (!ReadFile (fh->h, NULL, 0, NULL, fh->oOverlapRead))
@@ -476,11 +476,11 @@ gnunet_gtk_select (void *cls, struct GNUNET_NETWORK_FDSet *rfds,
476 if (efds != NULL) 476 if (efds != NULL)
477 { 477 {
478 for (t = GNUNET_CONTAINER_slist_begin (efds->handles), i = 0; 478 for (t = GNUNET_CONTAINER_slist_begin (efds->handles), i = 0;
479 GNUNET_CONTAINER_slist_end (t) != GNUNET_YES; 479 GNUNET_CONTAINER_slist_end (&t) != GNUNET_YES;
480 GNUNET_CONTAINER_slist_next (t), i += 1) 480 GNUNET_CONTAINER_slist_next (&t), i += 1)
481 { 481 {
482 struct GNUNET_DISK_FileHandle *fh = 482 struct GNUNET_DISK_FileHandle *fh =
483 GNUNET_CONTAINER_slist_get (t, NULL); 483 GNUNET_CONTAINER_slist_get (&t, NULL);
484 484
485 DWORD dwBytes; 485 DWORD dwBytes;
486 486
@@ -497,7 +497,7 @@ gnunet_gtk_select (void *cls, struct GNUNET_NETWORK_FDSet *rfds,
497 } 497 }
498 } 498 }
499 } 499 }
500 GNUNET_CONTAINER_slist_iter_destroy (t); 500 GNUNET_CONTAINER_slist_iter_destroy (&t);
501 501
502 if ((rfds != NULL) && (rfds->sds.fd_count > 0)) 502 if ((rfds != NULL) && (rfds->sds.fd_count > 0))
503 { 503 {
@@ -705,14 +705,14 @@ gnunet_gtk_select (void *cls, struct GNUNET_NETWORK_FDSet *rfds,
705 { 705 {
706 if (efds != NULL) 706 if (efds != NULL)
707 { 707 {
708 struct GNUNET_CONTAINER_SList_Iterator *t; 708 struct GNUNET_CONTAINER_SList_Iterator t;
709 709
710 for (t = GNUNET_CONTAINER_slist_begin (efds->handles), i = 0; 710 for (t = GNUNET_CONTAINER_slist_begin (efds->handles), i = 0;
711 GNUNET_CONTAINER_slist_end (t) != GNUNET_YES; 711 GNUNET_CONTAINER_slist_end (&t) != GNUNET_YES;
712 GNUNET_CONTAINER_slist_next (t), i += 1) 712 GNUNET_CONTAINER_slist_next (&t), i += 1)
713 { 713 {
714 struct GNUNET_DISK_FileHandle *fh = 714 struct GNUNET_DISK_FileHandle *fh =
715 GNUNET_CONTAINER_slist_get (t, NULL); 715 GNUNET_CONTAINER_slist_get (&t, NULL);
716 if (fh == ml->read_array[i]) 716 if (fh == ml->read_array[i])
717 { 717 {
718 GNUNET_CONTAINER_slist_add (ml->handles_except, 718 GNUNET_CONTAINER_slist_add (ml->handles_except,
@@ -722,7 +722,7 @@ gnunet_gtk_select (void *cls, struct GNUNET_NETWORK_FDSet *rfds,
722 break; 722 break;
723 } 723 }
724 } 724 }
725 GNUNET_CONTAINER_slist_iter_destroy (t); 725 GNUNET_CONTAINER_slist_iter_destroy (&t);
726 } 726 }
727 } 727 }
728 else if (waitstatus <= 0) 728 else if (waitstatus <= 0)
@@ -771,20 +771,20 @@ gnunet_gtk_select (void *cls, struct GNUNET_NETWORK_FDSet *rfds,
771 } 771 }
772 if (rfds) 772 if (rfds)
773 { 773 {
774 struct GNUNET_CONTAINER_SList_Iterator *t; 774 struct GNUNET_CONTAINER_SList_Iterator t;
775 775
776 for (i = 0; i < rfds->sds.fd_count; i++) 776 for (i = 0; i < rfds->sds.fd_count; i++)
777 WSAEventSelect (rfds->sds.fd_array[i], ml->hEventRead, 0); 777 WSAEventSelect (rfds->sds.fd_array[i], ml->hEventRead, 0);
778 for (t = GNUNET_CONTAINER_slist_begin (rfds->handles); 778 for (t = GNUNET_CONTAINER_slist_begin (rfds->handles);
779 GNUNET_CONTAINER_slist_end (t) != GNUNET_YES; 779 GNUNET_CONTAINER_slist_end (&t) != GNUNET_YES;
780 GNUNET_CONTAINER_slist_next (t)) 780 GNUNET_CONTAINER_slist_next (&t))
781 { 781 {
782 struct GNUNET_DISK_FileHandle *fh = GNUNET_CONTAINER_slist_get (t, NULL); 782 struct GNUNET_DISK_FileHandle *fh = GNUNET_CONTAINER_slist_get (&t, NULL);
783 783
784 if (fh->type == GNUNET_PIPE) 784 if (fh->type == GNUNET_PIPE)
785 CancelIo (fh->h); 785 CancelIo (fh->h);
786 } 786 }
787 GNUNET_CONTAINER_slist_iter_destroy (t); 787 GNUNET_CONTAINER_slist_iter_destroy (&t);
788 GNUNET_NETWORK_fdset_zero (rfds); 788 GNUNET_NETWORK_fdset_zero (rfds);
789 if (select_ret != -1 && socks > 0) 789 if (select_ret != -1 && socks > 0)
790 GNUNET_NETWORK_fdset_copy_native (rfds, &aread, select_ret); 790 GNUNET_NETWORK_fdset_copy_native (rfds, &aread, select_ret);