diff -rup a/select.h b/select.h --- a/select.h 2007-04-24 19:13:37.000000000 -0300 +++ b/select.h 2007-04-24 19:13:42.000000000 -0300 @@ -65,6 +65,8 @@ struct Client { struct httpd; +#define NULL_ITERATOR static_cast(0) + class Clients { protected: std::list clientList; @@ -78,7 +80,7 @@ protected: c++; } - return 0; + return NULL_ITERATOR; } @@ -151,7 +153,7 @@ public: void erase( const int fDesc ) { ClientIterator c; - if ((c = locateFDesc(fDesc)) != 0) { + if ((c = locateFDesc(fDesc)) != NULL_ITERATOR) { clientList.erase(c); close(fDesc); } @@ -159,14 +161,14 @@ public: void finish( const int fDesc ) { ClientIterator c; - if ((c = locateFDesc(fDesc)) != 0) { + if ((c = locateFDesc(fDesc)) != NULL_ITERATOR) { c->finished = true; } } void address( const int fDesc, char address[HTTP_IP_ADDR_LEN] ) { ClientIterator c; - if ((c = locateFDesc(fDesc)) != 0) { + if ((c = locateFDesc(fDesc)) != NULL_ITERATOR) { strncpy(address, c->address, HTTP_IP_ADDR_LEN); } } @@ -177,7 +179,7 @@ public: int readBuf(const int fDesc, char *destBuf, const uint len) { ClientIterator c; - if ((c = locateFDesc(fDesc)) == 0) { + if ((c = locateFDesc(fDesc)) == NULL_ITERATOR) { // printf("unknown client id %d\n", fDesc); return 0; } @@ -189,7 +191,7 @@ public: int readLine(const int fDesc, char *destBuf, const uint len) { ClientIterator c; - if ((c = locateFDesc(fDesc)) == 0) { + if ((c = locateFDesc(fDesc)) == NULL_ITERATOR) { // printf("unknown client id %d\n", fDesc); return 0; } @@ -214,7 +216,7 @@ public: int handleWrite(int socket) { int bytesWritten; ClientIterator c; - if ((c = locateFDesc(socket)) == 0) { + if ((c = locateFDesc(socket)) == NULL_ITERATOR) { // printf("unknown client id %d\n", socket); return 2; } @@ -257,7 +259,7 @@ public: return 1; } else { ClientIterator c; - if ((c = locateFDesc(fDesc)) == 0) { + if ((c = locateFDesc(fDesc)) == NULL_ITERATOR) { // printf("unknown client id %d\n", fDesc); return 2; } @@ -301,7 +303,7 @@ public: void doWrite(const int fDesc, const char* string, const uint len) { ClientIterator c; - if ((c = locateFDesc(fDesc)) == 0) { + if ((c = locateFDesc(fDesc)) == NULL_ITERATOR) { //printf("unknown client id %d\n", fDesc); return; } @@ -315,7 +317,7 @@ public: void doWrite(const int fDesc, const char* string) { ClientIterator c; - if ((c = locateFDesc(fDesc)) == 0) { + if ((c = locateFDesc(fDesc)) == NULL_ITERATOR) { //printf("unknown client id %d\n", fDesc); return; } @@ -348,7 +350,7 @@ public: void queueFile(const int socket, const int pendingFile ) { ClientIterator c; - if ((c = locateFDesc(socket)) == 0) { + if ((c = locateFDesc(socket)) == NULL_ITERATOR) { // printf("unknown client id %d\n", socket); return; } @@ -357,7 +359,7 @@ public: void subscribe(const int fDesc) { ClientIterator c; - if ((c = locateFDesc(fDesc)) == 0) { + if ((c = locateFDesc(fDesc)) == NULL_ITERATOR) { //printf("unknown client id %d\n", fDesc); return; }