diff options
Diffstat (limited to 'nsprpub/pr/tests/zerolen.c')
-rw-r--r-- | nsprpub/pr/tests/zerolen.c | 40 |
1 files changed, 11 insertions, 29 deletions
diff --git a/nsprpub/pr/tests/zerolen.c b/nsprpub/pr/tests/zerolen.c index a31d419e5..a84bd4322 100644 --- a/nsprpub/pr/tests/zerolen.c +++ b/nsprpub/pr/tests/zerolen.c @@ -4,7 +4,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /* - * Test: zerolen.c + * Test: zerolen.c * * Description: a test for Bugzilla bug #17699. We perform * the same test for PR_Writev, PR_Write, and PR_Send. In @@ -72,7 +72,7 @@ static void ClientThread(void *arg) /* * Then start reading. */ - while ((nbytes = PR_Read(sock, buf, sizeof(buf))) > 0) { + while (nbytes = PR_Read(sock, buf, sizeof(buf)) > 0) { /* empty loop body */ } if (-1 == nbytes) { @@ -95,9 +95,6 @@ int main() char buf[1024]; PRInt32 nbytes; PRIOVec iov; -#ifdef SYMBIAN - int loopcount=0; -#endif memset(buf, 0, sizeof(buf)); /* Initialize the buffer. */ listenSock = PR_NewTCPSocket(); @@ -127,8 +124,8 @@ int main() * First test PR_Writev. */ clientThread = PR_CreateThread(PR_USER_THREAD, - ClientThread, (void *) PR_ntohs(PR_NetAddrInetPort(&addr)), - PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD, PR_JOINABLE_THREAD, 0); + ClientThread, (void *) PR_ntohs(PR_NetAddrInetPort(&addr)), + PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD, PR_JOINABLE_THREAD, 0); if (NULL == clientThread) { fprintf(stderr, "PR_CreateThread failed\n"); exit(1); @@ -139,11 +136,8 @@ int main() exit(1); } osfd = PR_FileDesc2NativeHandle(acceptSock); - while ((nbytes = write(osfd, buf, sizeof(buf))) != -1) { + while (write(osfd, buf, sizeof(buf)) != -1) { /* empty loop body */ -#ifdef SYMBIAN - if (loopcount++>64) break; -#endif } if ((errno != EAGAIN) && (errno != EWOULDBLOCK)) { fprintf(stderr, "write failed\n"); @@ -171,26 +165,20 @@ int main() * Then test PR_Write. */ clientThread = PR_CreateThread(PR_USER_THREAD, - ClientThread, (void *) PR_ntohs(PR_NetAddrInetPort(&addr)), - PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD, PR_JOINABLE_THREAD, 0); + ClientThread, (void *) PR_ntohs(PR_NetAddrInetPort(&addr)), + PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD, PR_JOINABLE_THREAD, 0); if (NULL == clientThread) { fprintf(stderr, "PR_CreateThread failed\n"); exit(1); } -#ifdef SYMBIAN - loopcount = 0; -#endif acceptSock = PR_Accept(listenSock, NULL, PR_INTERVAL_NO_TIMEOUT); if (NULL == acceptSock) { fprintf(stderr, "PR_Accept failed\n"); exit(1); } osfd = PR_FileDesc2NativeHandle(acceptSock); - while ((nbytes = write(osfd, buf, sizeof(buf))) != -1) { + while (write(osfd, buf, sizeof(buf)) != -1) { /* empty loop body */ -#ifdef SYMBIAN - if (loopcount++>64) break; -#endif } if ((errno != EAGAIN) && (errno != EWOULDBLOCK)) { fprintf(stderr, "write failed\n"); @@ -216,26 +204,20 @@ int main() * Finally test PR_Send. */ clientThread = PR_CreateThread(PR_USER_THREAD, - ClientThread, (void *) PR_ntohs(PR_NetAddrInetPort(&addr)), - PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD, PR_JOINABLE_THREAD, 0); + ClientThread, (void *) PR_ntohs(PR_NetAddrInetPort(&addr)), + PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD, PR_JOINABLE_THREAD, 0); if (NULL == clientThread) { fprintf(stderr, "PR_CreateThread failed\n"); exit(1); } -#ifdef SYMBIAN - loopcount = 0; -#endif acceptSock = PR_Accept(listenSock, NULL, PR_INTERVAL_NO_TIMEOUT); if (NULL == acceptSock) { fprintf(stderr, "PR_Accept failed\n"); exit(1); } osfd = PR_FileDesc2NativeHandle(acceptSock); - while ((nbytes = write(osfd, buf, sizeof(buf))) != -1) { + while (write(osfd, buf, sizeof(buf)) != -1) { /* empty loop body */ -#ifdef SYMBIAN - if (loopcount++>64) break; -#endif } if ((errno != EAGAIN) && (errno != EWOULDBLOCK)) { fprintf(stderr, "write failed\n"); |