diff options
Diffstat (limited to 'pr/tests')
118 files changed, 1086 insertions, 1086 deletions
diff --git a/pr/tests/accept.c b/pr/tests/accept.c index f49bb44d..0b26ccdb 100644 --- a/pr/tests/accept.c +++ b/pr/tests/accept.c @@ -12,7 +12,7 @@ ** ** Modification History: ** 04-Jun-97 AGarcia - Reconvert test file to return a 0 for PASS and a 1 for FAIL -** 13-May-97 AGarcia- Converted the test to accomodate the debug_mode +** 13-May-97 AGarcia- Converted the test to accomodate the debug_mode ** The debug mode will print all of the printfs associated with this test. ** The regress mode will be the default mode. Since the regress tool limits ** the output to a one line status:PASS or FAIL,all of the printf statements @@ -122,7 +122,7 @@ ClientThread(void *_action) if (!sock) { if (!debug_mode) failed_already=1; - else + else PR_fprintf(output, "client: unable to create socket\n"); return; } @@ -133,8 +133,8 @@ ClientThread(void *_action) timeoutTime)) < 0) { if (!debug_mode) failed_already=1; - else - PR_fprintf(output, + else + PR_fprintf(output, "client: unable to connect to server (%ld, %ld, %ld, %ld)\n", iterations, rv, PR_GetError(), PR_GetOSError()); goto ErrorExit; @@ -172,7 +172,7 @@ ErrorExit: } -static void +static void RunTest(PRInt32 acceptType, PRInt32 clientAction) { int i; @@ -353,58 +353,58 @@ int i; void AcceptUpdatedTest(void) -{ - RunTest(ACCEPT_NORMAL, CLIENT_NORMAL); +{ + RunTest(ACCEPT_NORMAL, CLIENT_NORMAL); } void AcceptNotUpdatedTest(void) -{ - RunTest(ACCEPT_FAST, CLIENT_NORMAL); +{ + RunTest(ACCEPT_FAST, CLIENT_NORMAL); } void AcceptReadTest(void) -{ - RunTest(ACCEPT_READ, CLIENT_NORMAL); +{ + RunTest(ACCEPT_READ, CLIENT_NORMAL); } void AcceptReadNotUpdatedTest(void) -{ - RunTest(ACCEPT_READ_FAST, CLIENT_NORMAL); +{ + RunTest(ACCEPT_READ_FAST, CLIENT_NORMAL); } void AcceptReadCallbackTest(void) -{ - RunTest(ACCEPT_READ_FAST_CB, CLIENT_NORMAL); +{ + RunTest(ACCEPT_READ_FAST_CB, CLIENT_NORMAL); } void TimeoutAcceptUpdatedTest(void) -{ - RunTest(ACCEPT_NORMAL, CLIENT_TIMEOUT_ACCEPT); +{ + RunTest(ACCEPT_NORMAL, CLIENT_TIMEOUT_ACCEPT); } void TimeoutAcceptNotUpdatedTest(void) -{ - RunTest(ACCEPT_FAST, CLIENT_TIMEOUT_ACCEPT); +{ + RunTest(ACCEPT_FAST, CLIENT_TIMEOUT_ACCEPT); } void TimeoutAcceptReadCallbackTest(void) -{ - RunTest(ACCEPT_READ_FAST_CB, CLIENT_TIMEOUT_ACCEPT); +{ + RunTest(ACCEPT_READ_FAST_CB, CLIENT_TIMEOUT_ACCEPT); } void TimeoutReadUpdatedTest(void) -{ - RunTest(ACCEPT_NORMAL, CLIENT_TIMEOUT_SEND); +{ + RunTest(ACCEPT_NORMAL, CLIENT_TIMEOUT_SEND); } void TimeoutReadNotUpdatedTest(void) -{ - RunTest(ACCEPT_FAST, CLIENT_TIMEOUT_SEND); +{ + RunTest(ACCEPT_FAST, CLIENT_TIMEOUT_SEND); } void TimeoutReadReadTest(void) -{ - RunTest(ACCEPT_READ, CLIENT_TIMEOUT_SEND); +{ + RunTest(ACCEPT_READ, CLIENT_TIMEOUT_SEND); } void TimeoutReadReadNotUpdatedTest(void) -{ - RunTest(ACCEPT_READ_FAST, CLIENT_TIMEOUT_SEND); +{ + RunTest(ACCEPT_READ_FAST, CLIENT_TIMEOUT_SEND); } void TimeoutReadReadCallbackTest(void) -{ - RunTest(ACCEPT_READ_FAST_CB, CLIENT_TIMEOUT_SEND); +{ + RunTest(ACCEPT_READ_FAST_CB, CLIENT_TIMEOUT_SEND); } /************************************************************************/ diff --git a/pr/tests/acceptread.c b/pr/tests/acceptread.c index 47ba90bd..1d3dab6e 100644 --- a/pr/tests/acceptread.c +++ b/pr/tests/acceptread.c @@ -100,7 +100,7 @@ static void AcceptingThread(void *arg) if (NULL == listen_sock) { PL_FPrintError(err_out, "PR_NewTCPSocket (server) failed"); - PR_ProcessExit(1); + PR_ProcessExit(1); } sock_opt.option = PR_SockOpt_Reuseaddr; sock_opt.value.reuse_addr = PR_TRUE; @@ -108,19 +108,19 @@ static void AcceptingThread(void *arg) if (PR_FAILURE == rv) { PL_FPrintError(err_out, "PR_SetSocketOption (server) failed"); - PR_ProcessExit(1); + PR_ProcessExit(1); } rv = PR_Bind(listen_sock, listen_addr); if (PR_FAILURE == rv) { PL_FPrintError(err_out, "PR_Bind (server) failed"); - PR_ProcessExit(1); + PR_ProcessExit(1); } rv = PR_Listen(listen_sock, 10); if (PR_FAILURE == rv) { PL_FPrintError(err_out, "PR_Listen (server) failed"); - PR_ProcessExit(1); + PR_ProcessExit(1); } bytes = PR_AcceptRead( listen_sock, &accept_sock, &accept_addr, buf, buf_size, accept_timeout); diff --git a/pr/tests/acceptreademu.c b/pr/tests/acceptreademu.c index efe28cb9..bc5f6daf 100644 --- a/pr/tests/acceptreademu.c +++ b/pr/tests/acceptreademu.c @@ -116,18 +116,18 @@ static void AcceptingThread(void *arg) if (NULL == listen_sock) { PL_FPrintError(err_out, "PR_NewTCPSocket (server) failed"); - PR_ProcessExit(1); + PR_ProcessExit(1); } layer = PR_CreateIOLayerStub(emu_layer_ident, &emu_layer_methods); if (NULL == layer) { PL_FPrintError(err_out, "PR_CreateIOLayerStub (server) failed"); - PR_ProcessExit(1); + PR_ProcessExit(1); } if (PR_PushIOLayer(listen_sock, PR_TOP_IO_LAYER, layer) == PR_FAILURE) { PL_FPrintError(err_out, "PR_PushIOLayer (server) failed"); - PR_ProcessExit(1); + PR_ProcessExit(1); } sock_opt.option = PR_SockOpt_Reuseaddr; sock_opt.value.reuse_addr = PR_TRUE; @@ -135,19 +135,19 @@ static void AcceptingThread(void *arg) if (PR_FAILURE == rv) { PL_FPrintError(err_out, "PR_SetSocketOption (server) failed"); - PR_ProcessExit(1); + PR_ProcessExit(1); } rv = PR_Bind(listen_sock, listen_addr); if (PR_FAILURE == rv) { PL_FPrintError(err_out, "PR_Bind (server) failed"); - PR_ProcessExit(1); + PR_ProcessExit(1); } rv = PR_Listen(listen_sock, 10); if (PR_FAILURE == rv) { PL_FPrintError(err_out, "PR_Listen (server) failed"); - PR_ProcessExit(1); + PR_ProcessExit(1); } bytes = PR_AcceptRead( listen_sock, &accept_sock, &accept_addr, buf, buf_size, accept_timeout); diff --git a/pr/tests/addrstr.c b/pr/tests/addrstr.c index 4e830a71..6c84b55f 100644 --- a/pr/tests/addrstr.c +++ b/pr/tests/addrstr.c @@ -19,12 +19,12 @@ const char *testaddrs[] = { "::FFFE:9504:3501", "::fffe:9504:3501", "0:0:1:0:35c:0:0:0", "0:0:1:0:35c::", "0:0:3f4c:0:0:4552:0:0", "::3f4c:0:0:4552:0:0", - "0:0:1245:0:0:0:0567:0", "0:0:1245::567:0", - "0:1:2:3:4:5:6:7", "0:1:2:3:4:5:6:7", - "1:2:3:0:4:5:6:7", "1:2:3:0:4:5:6:7", - "1:2:3:4:5:6:7:0", "1:2:3:4:5:6:7:0", - "1:2:3:4:5:6:7:8", "1:2:3:4:5:6:7:8", - "1:2:3:4:5:6::7", "1:2:3:4:5:6:0:7", + "0:0:1245:0:0:0:0567:0", "0:0:1245::567:0", + "0:1:2:3:4:5:6:7", "0:1:2:3:4:5:6:7", + "1:2:3:0:4:5:6:7", "1:2:3:0:4:5:6:7", + "1:2:3:4:5:6:7:0", "1:2:3:4:5:6:7:0", + "1:2:3:4:5:6:7:8", "1:2:3:4:5:6:7:8", + "1:2:3:4:5:6::7", "1:2:3:4:5:6:0:7", 0 }; diff --git a/pr/tests/affinity.c b/pr/tests/affinity.c index cfc20e63..52a9b28f 100644 --- a/pr/tests/affinity.c +++ b/pr/tests/affinity.c @@ -21,7 +21,7 @@ static void PR_CALLBACK thread_start(void *arg) { PRUint32 mask = 0; - if (PR_GetThreadAffinityMask(PR_GetCurrentThread(), &mask)) + if (PR_GetThreadAffinityMask(PR_GetCurrentThread(), &mask)) printf("\tthread_start: PR_GetCurrentThreadAffinityMask failed\n"); else printf("\tthread_start: AffinityMask = 0x%x\n",mask); @@ -35,7 +35,7 @@ int main(int argc, char **argv) printf("main: creating local thread\n"); t = PR_CreateThread(PR_USER_THREAD, - thread_start, 0, + thread_start, 0, PR_PRIORITY_NORMAL, PR_LOCAL_THREAD, PR_JOINABLE_THREAD, @@ -50,7 +50,7 @@ int main(int argc, char **argv) printf("main: creating global thread\n"); t = PR_CreateThread(PR_USER_THREAD, - thread_start, 0, + thread_start, 0, PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD, PR_JOINABLE_THREAD, @@ -65,7 +65,7 @@ int main(int argc, char **argv) printf("main: creating global bound thread\n"); t = PR_CreateThread(PR_USER_THREAD, - thread_start, 0, + thread_start, 0, PR_PRIORITY_NORMAL, PR_GLOBAL_BOUND_THREAD, PR_JOINABLE_THREAD, diff --git a/pr/tests/alarm.c b/pr/tests/alarm.c index e3dedb67..3a2ff35e 100644 --- a/pr/tests/alarm.c +++ b/pr/tests/alarm.c @@ -71,17 +71,17 @@ static void Notifier(void *arg) /*********************************************************************** ** PRIVATE FUNCTION: ConditionNotify ** DESCRIPTION: -** +** ** INPUTS: loops ** OUTPUTS: None ** RETURN: overhead ** SIDE EFFECTS: -** +** ** RESTRICTIONS: ** None ** MEMORY: NA ** ALGORITHM: -** +** ***********************************************************************/ @@ -90,7 +90,7 @@ static PRIntervalTime ConditionNotify(PRUint32 loops) PRThread *thread; NotifyData notifyData; PRIntervalTime timein, overhead; - + timein = PR_IntervalNow(); notifyData.counter = loops; @@ -120,7 +120,7 @@ static PRIntervalTime ConditionNotify(PRUint32 loops) PR_DestroyCondVar(notifyData.child); PR_DestroyCondVar(notifyData.parent); PR_DestroyLock(notifyData.ml); - + overhead += (PR_IntervalNow() - timein); /* more overhead */ return overhead; @@ -175,14 +175,14 @@ static PRBool AlarmFn1(PRAlarmID *id, void *clientData, PRUint32 late) if (!keepGoing) rv = PR_NotifyCondVar(ad->cv); resetAlarm = ((ad->times % 31) == 0) ? PR_TRUE : PR_FALSE; - + interval = (ad->period + ad->rate - 1) / ad->rate; if (!late && (interval > 10)) { interval &= (now & 0x03) + 1; PR_WaitCondVar(ad->cv, interval); } - + PR_Unlock(ad->ml); if (rv != PR_SUCCESS) @@ -190,18 +190,18 @@ static PRBool AlarmFn1(PRAlarmID *id, void *clientData, PRUint32 late) if (!debug_mode) failed_already=1; else printf("AlarmFn: notify status: FAIL\n"); - + } if (resetAlarm) - { + { ad->rate += 3; ad->late = ad->times = 0; if (PR_ResetAlarm(id, ad->period, ad->rate) != PR_SUCCESS) { if (!debug_mode) failed_already=1; - else + else printf("AlarmFn: Resetting alarm status: FAIL\n"); keepGoing = PR_FALSE; @@ -235,7 +235,7 @@ static PRIntervalTime Alarms1(PRUint32 loops) (void)PR_SetAlarm( alarm, ad.period, ad.rate, AlarmFn1, &ad); - + overhead = PR_IntervalNow() - timein; PR_Lock(ml); @@ -248,7 +248,7 @@ static PRIntervalTime Alarms1(PRUint32 loops) PR_DestroyCondVar(cv); PR_DestroyLock(ml); overhead += (PR_IntervalNow() - timein); - + return duration + overhead; } /* Alarms1 */ @@ -306,14 +306,14 @@ static PRIntervalTime Alarms2(PRUint32 loops) (void)PR_SetAlarm( alarm, ad.period, ad.rate, AlarmFn2, &ad); - + overhead = PR_IntervalNow() - timein; PR_Lock(ml); while ((PRIntervalTime)(PR_IntervalNow() - ad.timein) < duration) PR_WaitCondVar(cv, PR_INTERVAL_NO_TIMEOUT); PR_Unlock(ml); - + timein = PR_IntervalNow(); rv = PR_DestroyAlarm(alarm); @@ -321,16 +321,16 @@ static PRIntervalTime Alarms2(PRUint32 loops) { if (!debug_mode) failed_already=1; - else + else printf("***Destroying alarm status: FAIL\n"); } - + PR_DestroyCondVar(cv); PR_DestroyLock(ml); - + overhead += (PR_IntervalNow() - timein); - + return duration + overhead; } /* Alarms2 */ @@ -370,7 +370,7 @@ static PRIntervalTime Alarms3(PRUint32 loops) alarm, ad[i].period, ad[i].rate, AlarmFn2, &ad[i]); } - + overhead = PR_IntervalNow() - timein; PR_Lock(ml); @@ -387,18 +387,18 @@ static PRIntervalTime Alarms3(PRUint32 loops) printf ("Alarms3 finished at %u, %u, %u\n", ad[0].timein, ad[1].timein, ad[2].timein); - + rv = PR_DestroyAlarm(alarm); if (rv != PR_SUCCESS) { - if (!debug_mode) + if (!debug_mode) failed_already=1; - else + else printf("***Destroying alarm status: FAIL\n"); } PR_DestroyCondVar(cv); PR_DestroyLock(ml); - + overhead += (duration / 3); overhead += (PR_IntervalNow() - timein); @@ -435,7 +435,7 @@ static PRUint32 TimeThis( } else { - if (debug_mode) + if (debug_mode) printf( "\ttotal: %d usecs\n\toverhead: %d usecs\n\tcost: %6.3f usecs\n\n", usecs, overhead, ((double)(usecs - overhead) / (double)loops)); @@ -486,7 +486,7 @@ int prmain(int argc, char** argv) if (debug_mode) printf("Alarm: Using %d loops\n", loops); - if (debug_mode) + if (debug_mode) printf("Alarm: Using %d cpu(s)\n", cpus); for (cpu = 1; cpu <= cpus; ++cpu) diff --git a/pr/tests/anonfm.c b/pr/tests/anonfm.c index 85e29024..1c3468f3 100644 --- a/pr/tests/anonfm.c +++ b/pr/tests/anonfm.c @@ -5,7 +5,7 @@ /* ** File: anonfm.c -** Description: Test anonymous file map +** Description: Test anonymous file map ** ** Synopsis: anonfm [options] [dirName] ** @@ -13,7 +13,7 @@ ** -d enable debug mode ** -h display a help message ** -s <n> size of the anonymous memory map, in KBytes. default: 100KBytes. -** -C 1 Operate this process as ClientOne() +** -C 1 Operate this process as ClientOne() ** -C 2 Operate this process as ClientTwo() ** ** anonfn.c contains two tests, corresponding to the two protocols for @@ -28,8 +28,8 @@ ** PRProcessAttr structure. ** */ -#include <plgetopt.h> -#include <nspr.h> +#include <plgetopt.h> +#include <nspr.h> #include <private/primpl.h> #include <stdio.h> #include <stdlib.h> @@ -74,10 +74,10 @@ static void ClientOne( void ) PR_LOG(lm, msgLevel, ("ClientOne() starting")); - + fmString = PR_GetEnv( fmEnvName ); if ( NULL == fmString ) { - failed_already = 1; + failed_already = 1; PR_LOG(lm, msgLevel, ("ClientOne(): PR_Getenv() failed")); return; @@ -87,7 +87,7 @@ static void ClientOne( void ) fm = PR_ImportFileMapFromString( fmString ); if ( NULL == fm ) { - failed_already = 1; + failed_already = 1; PR_LOG(lm, msgLevel, ("ClientOne(): PR_ImportFileMapFromString() failed")); return; @@ -97,7 +97,7 @@ static void ClientOne( void ) addr = PR_MemMap( fm, LL_ZERO, fmSize ); if ( NULL == addr ) { - failed_already = 1; + failed_already = 1; PR_LOG(lm, msgLevel, ("ClientOne(): PR_MemMap() failed, OSError: %d", PR_GetOSError() )); return; @@ -115,7 +115,7 @@ static void ClientOne( void ) rc = PR_CloseFileMap( fm ); if ( PR_FAILURE == rc ) { - failed_already = 1; + failed_already = 1; PR_LOG(lm, msgLevel, ("ClientOne(): PR_MemUnap() failed, OSError: %d", PR_GetOSError() )); return; @@ -151,20 +151,20 @@ static void ServerOne( void ) PR_LOG(lm, msgLevel, ("ServerOne() starting")); - + fm = PR_OpenAnonFileMap( dirName, fmSize, fmProt ); if ( NULL == fm ) { - failed_already = 1; + failed_already = 1; PR_LOG(lm, msgLevel, ("PR_OpenAnonFileMap() failed")); return; } PR_LOG(lm, msgLevel, ("ServerOne(): FileMap: %p", fm )); - + rc = PR_ExportFileMapAsString( fm, sizeof(fmString), fmString ); if ( PR_FAILURE == rc ) { - failed_already = 1; + failed_already = 1; PR_LOG(lm, msgLevel, ("PR_ExportFileMap() failed")); return; @@ -175,10 +175,10 @@ static void ServerOne( void ) */ PR_snprintf( envBuf, sizeof(envBuf), "%s=%s", fmEnvName, fmString); putenv( envBuf ); - + addr = PR_MemMap( fm, LL_ZERO, fmSize ); if ( NULL == addr ) { - failed_already = 1; + failed_already = 1; PR_LOG(lm, msgLevel, ("PR_MemMap() failed")); return; @@ -186,11 +186,11 @@ static void ServerOne( void ) /* set initial value for client */ for (i = 0; i < (PRIntn)fmSize ; i++ ) - *(addr+i) = 0x00; + *(addr+i) = 0x00; PR_LOG(lm, msgLevel, ("ServerOne(): PR_MemMap(): addr: %p", addr )); - + /* ** set arguments for child process */ @@ -224,7 +224,7 @@ static void ServerOne( void ) rc = PR_MemUnmap( addr, fmSize); if ( PR_FAILURE == rc ) { - failed_already = 1; + failed_already = 1; PR_LOG(lm, msgLevel, ("PR_MemUnmap() failed")); return; @@ -234,7 +234,7 @@ static void ServerOne( void ) rc = PR_CloseFileMap(fm); if ( PR_FAILURE == rc ) { - failed_already = 1; + failed_already = 1; PR_LOG(lm, msgLevel, ("PR_CloseFileMap() failed")); return; diff --git a/pr/tests/atomic.c b/pr/tests/atomic.c index eb9df949..42d25da8 100644 --- a/pr/tests/atomic.c +++ b/pr/tests/atomic.c @@ -2,7 +2,7 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - + #include "prio.h" #include "prprf.h" #include "pratom.h" diff --git a/pr/tests/attach.c b/pr/tests/attach.c index 0b935fff..5d09680f 100644 --- a/pr/tests/attach.c +++ b/pr/tests/attach.c @@ -57,17 +57,17 @@ PRIntn debug_mode; int count; -static void +static void AttachDetach(void) { PRThread *me; PRInt32 index; for (index=0;index<count; index++) { - me = PR_AttachThread(PR_USER_THREAD, + me = PR_AttachThread(PR_USER_THREAD, PR_PRIORITY_NORMAL, NULL); - + if (!me) { fprintf(stderr, "Error attaching thread %d: PR_AttachThread failed\n", count); @@ -153,7 +153,7 @@ int main(int argc, char **argv) goto exit_now; #endif - if(0 == count) count = DEFAULT_COUNT; + if(0 == count) count = DEFAULT_COUNT; /* * To force the implicit initialization of nspr20 @@ -175,7 +175,7 @@ int main(int argc, char **argv) failed_already=1; goto exit_now; } - + rv = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); if (debug_mode) PR_ASSERT(0 == rv); else if (0 != rv) { @@ -213,7 +213,7 @@ int main(int argc, char **argv) if(!debug_mode) { failed_already=1; goto exit_now; - } else + } else fprintf(stderr, "thread creation failed: error code %d\n", rv); } rv = thr_join(threadID, NULL, NULL); @@ -245,7 +245,7 @@ int main(int argc, char **argv) #elif defined(OS2) threadID = (TID) _beginthread((void *)threadStartFunc, NULL, - 32768, NULL); + 32768, NULL); if (threadID == -1) { fprintf(stderr, "thread creation failed: error code %d\n", errno); failed_already=1; @@ -262,7 +262,7 @@ int main(int argc, char **argv) #else if (!debug_mode) failed_already=1; - else + else printf("The attach test does not apply to this platform because\n" "either this platform does not have native threads or the\n" "test needs to be written for this platform.\n"); @@ -270,7 +270,7 @@ int main(int argc, char **argv) #endif exit_now: - if(failed_already) + if(failed_already) return 1; else return 0; diff --git a/pr/tests/bigfile.c b/pr/tests/bigfile.c index 35bf1570..6780d64f 100644 --- a/pr/tests/bigfile.c +++ b/pr/tests/bigfile.c @@ -165,14 +165,14 @@ int main(int argc, char **argv) LL_I2L(filesize64, filesize); buffer = (char*)PR_MALLOC(BUFFER_SIZE); LL_I2L(big_fragment, BUFFER_SIZE); - LL_MUL(filesize64, filesize64, one_meg); + LL_MUL(filesize64, filesize64, one_meg); for (loop = 0; loop < BUFFER_SIZE; ++loop) buffer[loop] = (char)loop; VERBOSE(v_whisper, "Creating big file"); file = PR_Open(filename, PR_CREATE_FILE | PR_WRONLY, 0666); if (NULL == file) return Error("PR_Open()", filename); - + VERBOSE(v_whisper, "Testing available space in empty file"); big_answer = file->methods->available64(file); if (!LL_IS_ZERO(big_answer)) return Error("empty available64()", filename); diff --git a/pr/tests/bug1test.c b/pr/tests/bug1test.c index a8df97f7..f26c0b89 100644 --- a/pr/tests/bug1test.c +++ b/pr/tests/bug1test.c @@ -48,7 +48,7 @@ void spin (PRInt32 aDelay) for (index = 0; index < delay * 10; index++) // consume a bunch of cpu cycles ; - PR_Sleep(0); + PR_Sleep(0); } void doWriteThread (void* arg) @@ -83,7 +83,7 @@ void doWriteThread (void* arg) PR_ASSERT (gCounter == (last + 1)); // test invariance - // -- exit write lock + // -- exit write lock // if (0 < gReadWaiting) // notify waiting reads (do it anyway to show off the CondWait bug) PR_NotifyAll (gMonitor); @@ -104,7 +104,7 @@ void doReadThread (void* arg) while (1) { // -- enter read lock - PR_EnterMonitor (gMonitor); + PR_EnterMonitor (gMonitor); if (0 < gWriteWaiting) // give up the monitor to waiting writes { @@ -186,7 +186,7 @@ int pseudoMain (int argc, char** argv, char *pad) fireThread ("W4", doWriteThread, &a5); fireThread ("W5", doWriteThread, &a6); fireThread ("W6", doWriteThread, &a7); - + while (1) { PRInt32 writeCount, readCount; @@ -196,9 +196,9 @@ int pseudoMain (int argc, char** argv, char *pad) // print some stats, not threadsafe, informative only writeCount = gCounter; readCount = gReads; - printf ("\ntick %d writes (+%d), %d reads (+%d) [max %d, %d, %d]", + printf ("\ntick %d writes (+%d), %d reads (+%d) [max %d, %d, %d]", writeCount, writeCount - lastWriteCount, - readCount, readCount - lastReadCount, + readCount, readCount - lastReadCount, gMaxReads, gMaxWriteWaits, gMaxReadWaits); lastWriteCount = writeCount; lastReadCount = readCount; diff --git a/pr/tests/cleanup.c b/pr/tests/cleanup.c index 4079aae1..d5803a52 100644 --- a/pr/tests/cleanup.c +++ b/pr/tests/cleanup.c @@ -81,8 +81,8 @@ int main(int argc, char **argv) PR_fprintf(err, "\tConcurrency: %d\n", concurrency); PR_fprintf(err, "\tNumber of threads: %d\n", threads); PR_fprintf(err, "\tThread sleep: %d\n", child_sleep); - PR_fprintf(err, "\tMain sleep: %d\n", main_sleep); - PR_fprintf(err, "\tCleanup will %sbe called\n\n", (cleanup) ? "" : "NOT "); + PR_fprintf(err, "\tMain sleep: %d\n", main_sleep); + PR_fprintf(err, "\tCleanup will %sbe called\n\n", (cleanup) ? "" : "NOT "); PR_SetConcurrency(concurrency); diff --git a/pr/tests/cltsrv.c b/pr/tests/cltsrv.c index 1941687e..17ca7caa 100644 --- a/pr/tests/cltsrv.c +++ b/pr/tests/cltsrv.c @@ -23,7 +23,7 @@ * The debug mode will print all of the printfs associated with this test. * The regress mode will be the default mode. Since the regress tool limits * the output to a one line status:PASS or FAIL,all of the printf statements - * have been handled with an if (debug_mode) statement. + * have been handled with an if (debug_mode) statement. */ #include "prclist.h" @@ -228,7 +228,7 @@ static void PR_CALLBACK Client(void *arg) PRInt32 bytes, descbytes, filebytes, netbytes; (void)PR_NetAddrToString(&client->serverAddress, buffer, sizeof(buffer)); - TEST_LOG(cltsrv_log_file, TEST_LOG_INFO, + TEST_LOG(cltsrv_log_file, TEST_LOG_INFO, ("\tClient(0x%p): connecting to server at %s\n", me, buffer)); fd = PR_Socket(domain, SOCK_STREAM, protocol); @@ -405,7 +405,7 @@ static PRStatus ProcessRequest(PRFileDesc *fd, CSServer_t *server) TEST_ASSERT(sizeof(*descriptor) == bytes); TEST_LOG( - cltsrv_log_file, TEST_LOG_VERBOSE, + cltsrv_log_file, TEST_LOG_VERBOSE, ("\t\tProcessRequest(0x%p): read descriptor {%d, %s}\n", me, descbytes, descriptor->filename)); @@ -569,7 +569,7 @@ static PRStatus ProcessRequest(PRFileDesc *fd, CSServer_t *server) } TEST_ASSERT(bytes > 0); } - + PR_Lock(server->ml); server->bytesTransferred += filebytes; PR_Unlock(server->ml); @@ -615,7 +615,7 @@ static PRStatus CreateWorker(CSServer_t *server, CSPool_t *pool) return PR_FAILURE; } - TEST_LOG(cltsrv_log_file, TEST_LOG_STATUS, + TEST_LOG(cltsrv_log_file, TEST_LOG_STATUS, ("\tCreateWorker(0x%p): create new worker (0x%p)\n", PR_GetCurrentThread(), worker->thread)); @@ -657,7 +657,7 @@ static void PR_CALLBACK Worker(void *arg) me, (Aborted(rv) ? "interrupted" : "stopped"))); goto exit; } - } + } pool->accepting += 1; /* how many are really in accept */ PR_Unlock(server->ml); @@ -666,7 +666,7 @@ static void PR_CALLBACK Worker(void *arg) ("\t\tWorker(0x%p): calling accept\n", me)); fd = PR_Accept(server->listener, &from, PR_INTERVAL_NO_TIMEOUT); - PR_Lock(server->ml); + PR_Lock(server->ml); pool->accepting -= 1; PR_NotifyCondVar(pool->acceptComplete); @@ -713,7 +713,7 @@ static void PR_CALLBACK Worker(void *arg) } exit: - PR_ClearInterrupt(); + PR_ClearInterrupt(); PR_Unlock(server->ml); if (NULL != fd) @@ -848,7 +848,7 @@ static void PR_CALLBACK Server(void *arg) static void WaitForCompletion(PRIntn execution) { while (execution > 0) - { + { PRIntn dally = (execution > 30) ? 30 : execution; PR_Sleep(PR_SecondsToInterval(dally)); if (pthread_stats) PT_FPrintStats(debug_out, "\nPThread Statistics\n"); @@ -1053,7 +1053,7 @@ int main(int argc, char** argv) cltsrv_log_file, TEST_LOG_VERBOSE, ("main(0x%p): creating %d client threads\n", PR_GetCurrentThread(), clients)); - + if (!serverIsLocal) { rv = PR_GetHostByName(serverName, buffer, BUFFER_SIZE, &host); @@ -1112,7 +1112,7 @@ int main(int argc, char** argv) { for (index = 0; index < clients; ++index) { - TEST_LOG(cltsrv_log_file, TEST_LOG_STATUS, + TEST_LOG(cltsrv_log_file, TEST_LOG_STATUS, ("main(0x%p): notifying client(0x%p) to stop\n", PR_GetCurrentThread(), client[index].thread)); @@ -1127,7 +1127,7 @@ int main(int argc, char** argv) } PR_Unlock(client[index].ml); - TEST_LOG(cltsrv_log_file, TEST_LOG_VERBOSE, + TEST_LOG(cltsrv_log_file, TEST_LOG_VERBOSE, ("main(0x%p): joining client(0x%p)\n", PR_GetCurrentThread(), client[index].thread)); @@ -1143,7 +1143,7 @@ int main(int argc, char** argv) { /* All clients joined - retrieve the server */ TEST_LOG( - cltsrv_log_file, TEST_LOG_NOTICE, + cltsrv_log_file, TEST_LOG_NOTICE, ("main(0x%p): notifying server(0x%p) to stop\n", PR_GetCurrentThread(), server->thread)); @@ -1155,7 +1155,7 @@ int main(int argc, char** argv) PR_Unlock(server->ml); TEST_LOG( - cltsrv_log_file, TEST_LOG_NOTICE, + cltsrv_log_file, TEST_LOG_NOTICE, ("main(0x%p): joining server(0x%p)\n", PR_GetCurrentThread(), server->thread)); joinStatus = PR_JoinThread(server->thread); @@ -1169,7 +1169,7 @@ int main(int argc, char** argv) } TEST_LOG( - cltsrv_log_file, TEST_LOG_ALWAYS, + cltsrv_log_file, TEST_LOG_ALWAYS, ("main(0x%p): test complete\n", PR_GetCurrentThread())); PT_FPrintStats(debug_out, "\nPThread Statistics\n"); diff --git a/pr/tests/concur.c b/pr/tests/concur.c index 108f9066..1b8f001b 100644 --- a/pr/tests/concur.c +++ b/pr/tests/concur.c @@ -4,7 +4,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /* -** File: concur.c +** File: concur.c ** Description: test of adding and removing concurrency options */ @@ -127,7 +127,7 @@ PRIntn PR_CALLBACK Concur(PRIntn argc, char **argv) } } - + if (debug) PR_fprintf( PR_STDERR, "Waiting for %d thread(s) to exit\n", context.have); diff --git a/pr/tests/cvar.c b/pr/tests/cvar.c index e2be526e..bbb94225 100644 --- a/pr/tests/cvar.c +++ b/pr/tests/cvar.c @@ -8,7 +8,7 @@ ** ** Name: cvar.c ** -** Description: Tests Condition Variable Operations +** Description: Tests Condition Variable Operations ** ** Modification History: ** 13-May-97 AGarcia- Converted the test to accomodate the debug_mode flag. @@ -58,17 +58,17 @@ static PRBool failed = PR_FALSE; static CircBuf* NewCB(void) { CircBuf *cbp; - + cbp = PR_NEW(CircBuf); if (cbp == NULL) return (NULL); - + cbp->bufLock = PR_NewLock(); cbp->startIdx = 0; cbp->numFull = 0; cbp->notFull = PR_NewCondVar(cbp->bufLock); cbp->notEmpty = PR_NewCondVar(cbp->bufLock); - + return (cbp); } @@ -85,7 +85,7 @@ static void DeleteCB(CircBuf *cbp) /* -** PutCBData puts new data on the queue. If the queue is full, it waits +** PutCBData puts new data on the queue. If the queue is full, it waits ** until there is room. */ static void PutCBData(CircBuf *cbp, void *data) @@ -96,7 +96,7 @@ static void PutCBData(CircBuf *cbp, void *data) PR_WaitCondVar(cbp->notFull,PR_INTERVAL_NO_TIMEOUT); cbp->data[(cbp->startIdx + cbp->numFull) % kQSIZE] = data; cbp->numFull += 1; - + /* let a waiting reader know that there is data */ PR_NotifyCondVar(cbp->notEmpty); PR_Unlock(cbp->bufLock); @@ -105,13 +105,13 @@ static void PutCBData(CircBuf *cbp, void *data) /* -** GetCBData gets the oldest data on the queue. If the queue is empty, it waits +** GetCBData gets the oldest data on the queue. If the queue is empty, it waits ** until new data appears. */ static void* GetCBData(CircBuf *cbp) { void *data; - + PR_Lock(cbp->bufLock); /* wait while the buffer is empty */ while (cbp->numFull == 0) @@ -119,11 +119,11 @@ static void* GetCBData(CircBuf *cbp) data = cbp->data[cbp->startIdx]; cbp->startIdx =(cbp->startIdx + 1) % kQSIZE; cbp->numFull -= 1; - + /* let a waiting writer know that there is room */ PR_NotifyCondVar(cbp->notFull); PR_Unlock(cbp->bufLock); - + return (data); } @@ -144,7 +144,7 @@ static void PR_CALLBACK CXReader(void *arg) if ((int)data != i) if (debug_mode) printf("data mismatch at for i = %d usec\n", i); } - + PR_EnterMonitor(mon); --alive; PR_Notify(mon); @@ -178,14 +178,14 @@ static void CondWaitContextSwitch(PRThreadScope scope1, PRThreadScope scope2) cbp = NewCB(); t1 = PR_CreateThread(PR_USER_THREAD, - CXReader, cbp, + CXReader, cbp, PR_PRIORITY_NORMAL, scope1, PR_UNJOINABLE_THREAD, 0); PR_ASSERT(t1); t2 = PR_CreateThread(PR_USER_THREAD, - CXWriter, cbp, + CXWriter, cbp, PR_PRIORITY_NORMAL, scope2, PR_UNJOINABLE_THREAD, @@ -284,7 +284,7 @@ static PRIntn PR_CALLBACK RealMain(int argc, char **argv) int main(int argc, char *argv[]) { PRIntn rv; - + PR_STDIO_INIT(); rv = PR_Initialize(RealMain, argc, argv, 0); return rv; diff --git a/pr/tests/cvar2.c b/pr/tests/cvar2.c index c61405e2..c2efbe85 100644 --- a/pr/tests/cvar2.c +++ b/pr/tests/cvar2.c @@ -11,14 +11,14 @@ ** Description: Simple test creates several local and global threads; ** half use a single,shared condvar, and the ** other half have their own condvar. The main thread then loops -** notifying them to wakeup. +** notifying them to wakeup. ** ** Modification History: ** 14-May-97 AGarcia- Converted the test to accomodate the debug_mode flag. ** The debug mode will print all of the printfs associated with this test. ** The regress mode will be the default mode. Since the regress tool limits ** the output to a one line status:PASS or FAIL,all of the printf statements -** have been handled with an if (debug_mode) statement. +** have been handled with an if (debug_mode) statement. ***********************************************************************/ #include "nspr.h" @@ -117,8 +117,8 @@ DPRINTF(("PrivateCondVarThread: thread 0x%lx notified exitcvar = 0x%lx cnt = %ld #endif } -void -CreateTestThread(threadinfo *info, +void +CreateTestThread(threadinfo *info, PRInt32 id, PRLock *lock, PRCondVar *cvar, @@ -128,7 +128,7 @@ CreateTestThread(threadinfo *info, PRLock *exitlock, PRCondVar *exitcvar, PRInt32 *exitcount, - PRBool shared, + PRBool shared, PRThreadScope scope) { info->id = id; @@ -154,7 +154,7 @@ CreateTestThread(threadinfo *info, } -void +void CondVarTestSUU(void *_arg) { PRInt32 arg = (PRInt32)_arg; @@ -164,7 +164,7 @@ CondVarTestSUU(void *_arg) PRCondVar *sharedcvar; PRLock *exitlock; PRCondVar *exitcvar; - + exitcount=0; tcount=0; list = (threadinfo *)PR_MALLOC(sizeof(threadinfo) * (arg * 4)); @@ -213,7 +213,7 @@ CondVarTestSUU(void *_arg) } /* Join all the threads */ - for(index=0; index<(arg); index++) + for(index=0; index<(arg); index++) PR_JoinThread(list[index].thread); PR_DestroyCondVar(sharedcvar); @@ -224,7 +224,7 @@ CondVarTestSUU(void *_arg) PR_DELETE(list); } -void +void CondVarTestSUK(void *_arg) { PRInt32 arg = (PRInt32)_arg; @@ -287,7 +287,7 @@ CondVarTestSUK(void *_arg) } /* Join all the threads */ - for(index=0; index<(arg); index++) + for(index=0; index<(arg); index++) PR_JoinThread(list[index].thread); PR_DestroyCondVar(sharedcvar); @@ -298,7 +298,7 @@ CondVarTestSUK(void *_arg) PR_DELETE(list); } -void +void CondVarTestPUU(void *_arg) { PRInt32 arg = (PRInt32)_arg; @@ -384,7 +384,7 @@ DPRINTF(("CondVarTestPUU: thread 0x%lx waiting on exitcvar = 0x%lx cnt = %ld\n", PR_DELETE(saved_tcount); } -void +void CondVarTestPUK(void *_arg) { PRInt32 arg = (PRInt32)_arg; @@ -465,7 +465,7 @@ CondVarTestPUK(void *_arg) PR_DELETE(saved_tcount); } -void +void CondVarTest(void *_arg) { PRInt32 arg = (PRInt32)_arg; @@ -598,7 +598,7 @@ CondVarTest(void *_arg) PR_DELETE(saved_ptcount); } -void +void CondVarTimeoutTest(void *_arg) { PRInt32 arg = (PRInt32)_arg; @@ -709,7 +709,7 @@ CondVarTimeoutTest(void *_arg) PR_DELETE(list); } -void +void CondVarMixedTest(void *_arg) { PRInt32 arg = (PRInt32)_arg; @@ -833,7 +833,7 @@ CondVarMixedTest(void *_arg) PR_DELETE(list); } -void +void CondVarCombinedTest(void *arg) { PRThread *threads[3]; @@ -953,7 +953,7 @@ default_threads, default_threads*2, default_threads*3, default_threads*4); int main(int argc, char **argv) { PRIntn rv; - + PR_STDIO_INIT(); rv = PR_Initialize(RealMain, argc, argv, 0); return rv; diff --git a/pr/tests/dbmalloc.c b/pr/tests/dbmalloc.c index 67173fe6..fa96c964 100644 --- a/pr/tests/dbmalloc.c +++ b/pr/tests/dbmalloc.c @@ -14,7 +14,7 @@ ** The debug mode will print all of the printfs associated with this test. ** The regress mode will be the default mode. Since the regress tool limits ** the output to a one line status:PASS or FAIL,all of the printf statements -** have been handled with an if (debug_mode) statement. +** have been handled with an if (debug_mode) statement. ***********************************************************************/ #include <stdio.h> #include <stdlib.h> @@ -135,7 +135,7 @@ t2 l++; n = get_node(buffer); - if( (node_pt)0 == n ) + if( (node_pt)0 == n ) { printf("[%s]: Line %d: malloc failure!\n", name, l); continue; @@ -268,15 +268,15 @@ int main(int argc, char **argv) struct threadlist *n; n = (struct threadlist *)malloc(sizeof(struct threadlist)); - if( (struct threadlist *)0 == n ) + if( (struct threadlist *)0 == n ) { fprintf(stderr, "This is getting tedious. \"%s\"\n", *argv); continue; } n->next = threadhead; - n->thread = PR_CreateThread(PR_USER_THREAD, (void (*)(void *))test, - *argv, PR_PRIORITY_NORMAL, + n->thread = PR_CreateThread(PR_USER_THREAD, (void (*)(void *))test, + *argv, PR_PRIORITY_NORMAL, PR_LOCAL_THREAD, PR_JOINABLE_THREAD, 0); if( (PRThread *)0 == n->thread ) diff --git a/pr/tests/dbmalloc1.c b/pr/tests/dbmalloc1.c index 4069afd3..cb13ecf7 100644 --- a/pr/tests/dbmalloc1.c +++ b/pr/tests/dbmalloc1.c @@ -89,16 +89,16 @@ int main(int argc, char **argv) { /* main test */ - + PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0); PR_STDIO_INIT(); r2(); - if(failed_already) + if(failed_already) return 1; else return 0; - + } diff --git a/pr/tests/dceemu.c b/pr/tests/dceemu.c index 99fd6cb7..5a1eb78d 100644 --- a/pr/tests/dceemu.c +++ b/pr/tests/dceemu.c @@ -41,33 +41,33 @@ static PRIntn prmain(PRIntn argc, char **argv) rv = PRP_TryLock(ml); PR_ASSERT(PR_SUCCESS == rv); - if ((rv != PR_SUCCESS) & (!debug_mode)) failed_already=1; - + if ((rv != PR_SUCCESS) & (!debug_mode)) failed_already=1; + rv = PRP_TryLock(ml); PR_ASSERT(PR_FAILURE == rv); - if ((rv != PR_FAILURE) & (!debug_mode)) failed_already=1; + if ((rv != PR_FAILURE) & (!debug_mode)) failed_already=1; rv = PRP_NakedNotify(cv); PR_ASSERT(PR_SUCCESS == rv); - if ((rv != PR_SUCCESS) & (!debug_mode)) failed_already=1; + if ((rv != PR_SUCCESS) & (!debug_mode)) failed_already=1; rv = PRP_NakedBroadcast(cv); PR_ASSERT(PR_SUCCESS == rv); - if ((rv != PR_SUCCESS) & (!debug_mode)) failed_already=1; + if ((rv != PR_SUCCESS) & (!debug_mode)) failed_already=1; rv = PRP_NakedWait(cv, ml, tenmsecs); PR_ASSERT(PR_SUCCESS == rv); - if ((rv != PR_SUCCESS) & (!debug_mode)) failed_already=1; + if ((rv != PR_SUCCESS) & (!debug_mode)) failed_already=1; + + PR_Unlock(ml); - PR_Unlock(ml); - rv = PRP_NakedNotify(cv); PR_ASSERT(PR_SUCCESS == rv); - if ((rv != PR_SUCCESS) & (!debug_mode)) failed_already=1; + if ((rv != PR_SUCCESS) & (!debug_mode)) failed_already=1; rv = PRP_NakedBroadcast(cv); PR_ASSERT(PR_SUCCESS == rv); - if ((rv != PR_SUCCESS) & (!debug_mode)) failed_already=1; + if ((rv != PR_SUCCESS) & (!debug_mode)) failed_already=1; PRP_DestroyNakedCondVar(cv); PR_DestroyLock(ml); @@ -81,7 +81,7 @@ static PRIntn prmain(PRIntn argc, char **argv) int main(int argc, char **argv) { PR_Initialize(prmain, argc, argv, 0); - if(failed_already) + if(failed_already) return 1; else return 0; diff --git a/pr/tests/depend.c b/pr/tests/depend.c index 6df38c11..98ce245e 100644 --- a/pr/tests/depend.c +++ b/pr/tests/depend.c @@ -15,7 +15,7 @@ ** The debug mode will print all of the printfs associated with this test. ** The regress mode will be the default mode. Since the regress tool limits ** the output to a one line status:PASS or FAIL,all of the printf statements -** have been handled with an if (debug_mode) statement. +** have been handled with an if (debug_mode) statement. ***********************************************************************/ #include "prinit.h" @@ -112,7 +112,7 @@ int main(int argc, char **argv) const char *buildDate = __DATE__, *buildTime = __TIME__; printf("Depend.c build time is %s %s\n", buildDate, buildTime); - + if (NULL != info) ChaseDependents(info, tab); return 0; diff --git a/pr/tests/dll/mygetval.c b/pr/tests/dll/mygetval.c index 53a6408e..7fb70024 100644 --- a/pr/tests/dll/mygetval.c +++ b/pr/tests/dll/mygetval.c @@ -17,7 +17,7 @@ PR_IMPLEMENT(PRIntn) My_GetValue() } #if defined(WIN16) -int CALLBACK LibMain( HINSTANCE hInst, WORD wDataSeg, +int CALLBACK LibMain( HINSTANCE hInst, WORD wDataSeg, WORD cbHeapSize, LPSTR lpszCmdLine ) { return TRUE; diff --git a/pr/tests/dlltest.c b/pr/tests/dlltest.c index 1cf82bc8..aec632ff 100644 --- a/pr/tests/dlltest.c +++ b/pr/tests/dlltest.c @@ -163,7 +163,7 @@ int main(int argc, char** argv) { PRStaticLinkTable slt[10]; PRLibrary *lib; - + lib = PR_LoadStaticLibrary( "my.dll", slt ); if ( lib == NULL ) { @@ -177,7 +177,7 @@ int main(int argc, char** argv) } goto exit_now; -exit_now: +exit_now: PR_Cleanup(); if (failed_already) { diff --git a/pr/tests/dtoa.c b/pr/tests/dtoa.c index 59c6db98..a33c5c56 100644 --- a/pr/tests/dtoa.c +++ b/pr/tests/dtoa.c @@ -31,7 +31,7 @@ int main(int argc, char **argv) double zero = 0.0; char cnvt[50]; char *thousands; - + num = 1e24; num1 = PR_strtod("1e24",NULL); if(num1 != num){ diff --git a/pr/tests/env.c b/pr/tests/env.c index c11588d6..5da05b60 100644 --- a/pr/tests/env.c +++ b/pr/tests/env.c @@ -73,7 +73,7 @@ int main(int argc, char **argv) PL_DestroyOptState(opt); } /* end block "Get command line options" */ -#if 0 +#if 0 { /* ** This uses Windows native environment manipulation @@ -88,7 +88,7 @@ int main(int argc, char **argv) } if (verbose) printf("env: SetEnvironmentVariable() worked\n"); - size = GetEnvironmentVariable( ENVNAME, envBuf, ENVBUFSIZE ); + size = GetEnvironmentVariable( ENVNAME, envBuf, ENVBUFSIZE ); if ( size == 0 ) { if (debug) printf("env: Shit! GetEnvironmentVariable() failed. Found: %s\n", envBuf ); failedAlready = PR_TRUE; @@ -245,7 +245,7 @@ int main(int argc, char **argv) } else { if (verbose) printf( "env: PR_GetEnv() after RAW un-set found: %s\n", value ); } - + /* ---------------------------------------------------------------------- */ /* set it again ... */ envBuf = NewBuffer( ENVBUFSIZE ); diff --git a/pr/tests/exit.c b/pr/tests/exit.c index 258868dd..fe6fc31e 100644 --- a/pr/tests/exit.c +++ b/pr/tests/exit.c @@ -91,14 +91,14 @@ static PRIntn PR_CALLBACK RealMain(PRIntn argc, char **argv) } } return 0; - + } int main(int argc, char **argv) { PRIntn rv; - + PR_STDIO_INIT(); rv = PR_Initialize(RealMain, argc, argv, 0); return rv; diff --git a/pr/tests/fdcach.c b/pr/tests/fdcach.c index 37bec0d8..2fb2e5b8 100644 --- a/pr/tests/fdcach.c +++ b/pr/tests/fdcach.c @@ -55,7 +55,7 @@ int main(int argc, char **argv) if (PR_Close(savefds[i]) == PR_FAILURE) { fprintf(stderr, "PR_Close failed\n"); exit(1); - } + } } /* @@ -79,7 +79,7 @@ int main(int argc, char **argv) if (PR_Close(savefds[i]) == PR_FAILURE) { fprintf(stderr, "PR_Close failed\n"); exit(1); - } + } } /* Switch to the fd stack. */ @@ -109,7 +109,7 @@ int main(int argc, char **argv) if (PR_Close(savefds[i]) == PR_FAILURE) { fprintf(stderr, "PR_Close failed\n"); exit(1); - } + } } /* @@ -132,7 +132,7 @@ int main(int argc, char **argv) if (PR_Close(savefds[i]) == PR_FAILURE) { fprintf(stderr, "PR_Close failed\n"); exit(1); - } + } } /* Switch to the fd cache. */ @@ -157,7 +157,7 @@ int main(int argc, char **argv) if (PR_Close(savefds[i]) == PR_FAILURE) { fprintf(stderr, "PR_Close failed\n"); exit(1); - } + } } for (i = 0; i < numfds; i++) { @@ -175,7 +175,7 @@ int main(int argc, char **argv) if (PR_Close(savefds[i]) == PR_FAILURE) { fprintf(stderr, "PR_Close failed\n"); exit(1); - } + } } /* Switch to the fd stack. */ @@ -200,7 +200,7 @@ int main(int argc, char **argv) if (PR_Close(savefds[i]) == PR_FAILURE) { fprintf(stderr, "PR_Close failed\n"); exit(1); - } + } } for (i = 0; i < numfds; i++) { @@ -218,7 +218,7 @@ int main(int argc, char **argv) if (PR_Close(savefds[i]) == PR_FAILURE) { fprintf(stderr, "PR_Close failed\n"); exit(1); - } + } } PR_Cleanup(); diff --git a/pr/tests/fileio.c b/pr/tests/fileio.c index be611a35..ac1fdb1a 100644 --- a/pr/tests/fileio.c +++ b/pr/tests/fileio.c @@ -7,7 +7,7 @@ ** ** Name: fileio.c ** -** Description: Program to copy one file to another. +** Description: Program to copy one file to another. ** ** Modification History: ** 14-May-97 AGarcia- Converted the test to accomodate the debug_mode flag. @@ -49,21 +49,21 @@ static void InitialSetup(void) { PRUintn i; PRInt32 nWritten, rv; - + t1 = PR_Open("t1.tmp", PR_CREATE_FILE | PR_RDWR, 0); - PR_ASSERT(t1 != NULL); - + PR_ASSERT(t1 != NULL); + for (i=0; i<TBSIZE; i++) tbuf[i] = i; - + nWritten = PR_Write((PRFileDesc*)t1, tbuf, TBSIZE); - PR_ASSERT(nWritten == TBSIZE); - + PR_ASSERT(nWritten == TBSIZE); + rv = PR_Seek(t1,0,PR_SEEK_SET); - PR_ASSERT(rv == 0); + PR_ASSERT(rv == 0); t2 = PR_Open("t2.tmp", PR_CREATE_FILE | PR_RDWR, 0); - PR_ASSERT(t2 != NULL); + PR_ASSERT(t2 != NULL); } @@ -71,16 +71,16 @@ static void VerifyAndCleanup(void) { PRUintn i; PRInt32 nRead, rv; - + for (i=0; i<TBSIZE; i++) tbuf[i] = 0; - + rv = PR_Seek(t2,0,PR_SEEK_SET); - PR_ASSERT(rv == 0); + PR_ASSERT(rv == 0); nRead = PR_Read((PRFileDesc*)t2, tbuf, TBSIZE); - PR_ASSERT(nRead == TBSIZE); - + PR_ASSERT(nRead == TBSIZE); + for (i=0; i<TBSIZE; i++) if (tbuf[i] != (PRUint8)i) { if (debug_mode) printf("data mismatch for index= %d \n", i); @@ -120,7 +120,7 @@ static void PR_CALLBACK reader(void *arg) { PRUintn i = 0; PRInt32 nbytes; - + do { (void) PR_WaitSem(emptyBufs); nbytes = PR_Read((PRFileDesc*)arg, buf[i].data, BSIZE); @@ -136,7 +136,7 @@ static void PR_CALLBACK writer(void *arg) { PRUintn i = 0; PRInt32 nbytes; - + do { (void) PR_WaitSem(fullBufs); nbytes = buf[i].nbytes; @@ -162,18 +162,18 @@ int main(int argc, char **argv) /* Create initial temp file setup */ InitialSetup(); - + /* create the reader thread */ - + r = PR_CreateThread(PR_USER_THREAD, - reader, t1, + reader, t1, PR_PRIORITY_NORMAL, PR_LOCAL_THREAD, PR_JOINABLE_THREAD, 0); w = PR_CreateThread(PR_USER_THREAD, - writer, t2, + writer, t2, PR_PRIORITY_NORMAL, PR_LOCAL_THREAD, PR_JOINABLE_THREAD, diff --git a/pr/tests/foreign.c b/pr/tests/foreign.c index 167d7601..6c682f30 100644 --- a/pr/tests/foreign.c +++ b/pr/tests/foreign.c @@ -13,7 +13,7 @@ ** in. ** ** The goal: try to survive. -** +** */ #include "prcvar.h" @@ -134,14 +134,14 @@ static PRStatus NSPRPUB_TESTS_CreateThread(StartFn start, void *arg) #if defined(WIN32) { void *th; - PRUintn id; + PRUintn id; StartObject *start_object; start_object = PR_NEW(StartObject); PR_ASSERT(NULL != start_object); start_object->start = start; start_object->arg = arg; th = (void*)_beginthreadex( - NULL, /* LPSECURITY_ATTRIBUTES - pointer to thread security attributes */ + NULL, /* LPSECURITY_ATTRIBUTES - pointer to thread security attributes */ 0U, /* DWORD - initial thread stack size, in bytes */ windows_start, /* LPTHREAD_START_ROUTINE - pointer to thread function */ start_object, /* LPVOID - argument for new thread */ @@ -182,46 +182,46 @@ static void OneShot(void *arg) switch (test) { case 0: - lock = PR_NewLock(); + lock = PR_NewLock(); DPRINTF((output,"Thread[0x%x] called PR_NewLock\n", PR_GetCurrentThread())); PR_DestroyLock(lock); break; - + case 1: (void)PR_SecondsToInterval(1); DPRINTF((output,"Thread[0x%x] called PR_SecondsToInterval\n", PR_GetCurrentThread())); break; - + case 2: (void)PR_CreateThread( PR_USER_THREAD, lazyEntry, NULL, PR_PRIORITY_NORMAL, - PR_LOCAL_THREAD, PR_UNJOINABLE_THREAD, 0); + PR_LOCAL_THREAD, PR_UNJOINABLE_THREAD, 0); DPRINTF((output,"Thread[0x%x] called PR_CreateThread\n", PR_GetCurrentThread())); break; - + case 3: - fd = PR_Open("foreign.tmp", PR_CREATE_FILE | PR_RDWR, 0666); + fd = PR_Open("foreign.tmp", PR_CREATE_FILE | PR_RDWR, 0666); DPRINTF((output,"Thread[0x%x] called PR_Open\n", PR_GetCurrentThread())); PR_Close(fd); break; - + case 4: - fd = PR_NewUDPSocket(); + fd = PR_NewUDPSocket(); DPRINTF((output,"Thread[0x%x] called PR_NewUDPSocket\n", PR_GetCurrentThread())); PR_Close(fd); break; - + case 5: - fd = PR_NewTCPSocket(); + fd = PR_NewTCPSocket(); DPRINTF((output,"Thread[0x%x] called PR_NewTCPSocket\n", PR_GetCurrentThread())); PR_Close(fd); break; - + case 6: #define TEMP_DIR "/tmp/" dir = PR_OpenDir(TEMP_DIR); @@ -229,19 +229,19 @@ static void OneShot(void *arg) PR_GetCurrentThread())); PR_CloseDir(dir); break; - + case 7: (void)PR_NewThreadPrivateIndex(&pdkey, NULL); DPRINTF((output,"Thread[0x%x] called PR_NewThreadPrivateIndex\n", PR_GetCurrentThread())); break; - + case 8: (void)PR_GetEnv("PATH"); DPRINTF((output,"Thread[0x%x] called PR_GetEnv\n", PR_GetCurrentThread())); break; - + case 9: (void)PR_NewTCPSocketPair(pair); DPRINTF((output,"Thread[0x%x] called PR_NewTCPSocketPair\n", @@ -249,7 +249,7 @@ static void OneShot(void *arg) PR_Close(pair[0]); PR_Close(pair[1]); break; - + case 10: PR_SetConcurrency(2); DPRINTF((output,"Thread[0x%x] called PR_SetConcurrency\n", @@ -261,8 +261,8 @@ static void OneShot(void *arg) DPRINTF((output,"Thread[0x%x] called PR_SetThreadPriority\n", PR_GetCurrentThread())); break; - - default: + + default: break; } /* switch() */ } diff --git a/pr/tests/forktest.c b/pr/tests/forktest.c index aeb22d50..a7385baf 100644 --- a/pr/tests/forktest.c +++ b/pr/tests/forktest.c @@ -169,7 +169,7 @@ DoIO(void) } /* - * Make sure it has proper null byte to mark end of string + * Make sure it has proper null byte to mark end of string */ buf[sizeof(buf) - 1] = '\0'; diff --git a/pr/tests/gethost.c b/pr/tests/gethost.c index 779bce45..e2226416 100644 --- a/pr/tests/gethost.c +++ b/pr/tests/gethost.c @@ -131,7 +131,7 @@ int main(int argc, char **argv) PrintHostent(&reversehe); } printf("PR_GetHostByAddr with PR_AF_INET6 done\n"); - + PR_StringToNetAddr("::1", &addr); if (PR_IsNetAddrType(&addr, PR_IpAddrV4Mapped) == PR_TRUE) { fprintf(stderr, "addr should not be ipv4 mapped address\n"); diff --git a/pr/tests/i2l.c b/pr/tests/i2l.c index cd96edef..8f41fa34 100644 --- a/pr/tests/i2l.c +++ b/pr/tests/i2l.c @@ -92,7 +92,7 @@ static PRIntn PR_CALLBACK RealMain(PRIntn argc, char **argv) int main(int argc, char **argv) { PRIntn rv; - + PR_STDIO_INIT(); rv = PR_Initialize(RealMain, argc, argv, 0); return rv; diff --git a/pr/tests/inrval.c b/pr/tests/inrval.c index e8eadaa3..c9192221 100644 --- a/pr/tests/inrval.c +++ b/pr/tests/inrval.c @@ -123,7 +123,7 @@ static void TestIntervals(void) LL_I2L(thousand, 1000); LL_DIV(elapsed, elapsed, thousand); LL_L2UI(delta, elapsed); - if (debug_mode) PR_fprintf(output, + if (debug_mode) PR_fprintf(output, "TestIntervals: %swaiting %ld seconds took %ld msecs\n", ((rv == PR_SUCCESS) ? "" : "FAILED "), seconds, delta); } @@ -144,7 +144,7 @@ static PRIntn PR_CALLBACK RealMain(int argc, char** argv) */ /* main test */ - + PLOptStatus os; PLOptState *opt = PL_CreateOptState(argc, argv, "dl:c:"); while (PL_OPT_EOL != (os = PL_GetNextOpt(opt))) @@ -166,7 +166,7 @@ static PRIntn PR_CALLBACK RealMain(int argc, char** argv) } } PL_DestroyOptState(opt); - + output = PR_GetSpecialFD(PR_StandardOutput); PR_fprintf(output, "inrval: Examine stdout to determine results.\n"); @@ -190,7 +190,7 @@ static PRIntn PR_CALLBACK RealMain(int argc, char** argv) TestConversions(); TestIntervals(); } - + return 0; } @@ -198,7 +198,7 @@ static PRIntn PR_CALLBACK RealMain(int argc, char** argv) int main(int argc, char **argv) { PRIntn rv; - + PR_STDIO_INIT(); rv = PR_Initialize(RealMain, argc, argv, 0); return rv; diff --git a/pr/tests/instrumt.c b/pr/tests/instrumt.c index 5094e5db..f8e42e9b 100644 --- a/pr/tests/instrumt.c +++ b/pr/tests/instrumt.c @@ -39,19 +39,19 @@ #include <plstr.h> #include <prclist.h> #include <prmem.h> -#include <plgetopt.h> -#include <prlog.h> -#include <prmon.h> -#include <pratom.h> -#include <prtrace.h> -#include <prcountr.h> -#include <prolock.h> +#include <plgetopt.h> +#include <prlog.h> +#include <prmon.h> +#include <pratom.h> +#include <prtrace.h> +#include <prcountr.h> +#include <prolock.h> #define COUNT_LIMIT (10 * ( 1024)) #define SMALL_TRACE_BUFSIZE ( 60 * 1024 ) -typedef enum +typedef enum { CountLoop = 1, TraceLoop = 2, @@ -74,7 +74,7 @@ PR_DEFINE_TRACE( hTrace ); static void Help(void) { printf("Help? ... Ha!\n"); -} +} static void ListCounters(void) { @@ -95,13 +95,13 @@ static void ListCounters(void) PR_GET_COUNTER_NAME_FROM_HANDLE( rh, qname, rname, desc ); PR_GET_COUNTER(tCtr, rh); PR_LOG( lm, msgLevel, - ( "QName: %s RName: %s Desc: %s Value: %ld\n", + ( "QName: %s RName: %s Desc: %s Value: %ld\n", qn, rn, dn, tCtr )); PR_FIND_NEXT_COUNTER_RNAME(rh, rh, qh ); - } + } PR_FIND_NEXT_COUNTER_QNAME(qh, qh); } - return; + return; } /* end ListCounters() */ static void ListTraces(void) @@ -121,13 +121,13 @@ static void ListTraces(void) { PR_GET_TRACE_NAME_FROM_HANDLE( rh, qname, rname, desc ); PR_LOG( lm, msgLevel, - ( "QName: %s RName: %s Desc: %s", + ( "QName: %s RName: %s Desc: %s", qn, rn, dn )); PR_FIND_NEXT_TRACE_RNAME(rh, rh, qh ); - } + } PR_FIND_NEXT_TRACE_QNAME(qh, qh); } - return; + return; } /* end ListCounters() */ @@ -146,7 +146,7 @@ static void PR_CALLBACK CountSomething( void *arg ) PR_LOG( lm, msgLevel, ("CountSomething: begin thread %ld", switchVar )); - + for ( i = 0; i < COUNT_LIMIT ; i++) { switch ( switchVar ) @@ -172,13 +172,13 @@ static void PR_CALLBACK CountSomething( void *arg ) PR_LOG( lm, msgLevel, ("CounterSomething: end thread %ld", switchVar )); - + PR_EnterMonitor(mon); --activeThreads; PR_Notify( mon ); PR_ExitMonitor(mon); - return; + return; } /* end CountSomething() */ /* @@ -193,7 +193,7 @@ static void CounterTest( void ) PR_LOG( lm, msgLevel, ("Begin CounterTest")); - + /* ** Test Get and Set of a counter. ** @@ -215,7 +215,7 @@ static void CounterTest( void ) PR_ASSERT( tc == hCounter ); t1 = PR_CreateThread(PR_USER_THREAD, - CountSomething, &one, + CountSomething, &one, PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD, PR_UNJOINABLE_THREAD, @@ -223,23 +223,23 @@ static void CounterTest( void ) PR_ASSERT(t1); t2 = PR_CreateThread(PR_USER_THREAD, - CountSomething, &two, + CountSomething, &two, PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD, PR_UNJOINABLE_THREAD, 0); PR_ASSERT(t2); - + t3 = PR_CreateThread(PR_USER_THREAD, - CountSomething, &three, + CountSomething, &three, PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD, PR_UNJOINABLE_THREAD, 0); PR_ASSERT(t3); - + t4 = PR_CreateThread(PR_USER_THREAD, - CountSomething, &four, + CountSomething, &four, PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD, PR_UNJOINABLE_THREAD, @@ -265,7 +265,7 @@ static void PR_CALLBACK RecordTrace(void *arg ) PR_Notify( mon ); PR_ExitMonitor(mon); - return; + return; } /* end RecordTrace() */ @@ -280,7 +280,7 @@ static void PR_CALLBACK SampleTrace( void *arg ) PRInt32 found, rc; PRTraceEntry *foundEntries; PRInt32 i; - + foundEntries = (PRTraceEntry *)PR_Malloc( NUM_TRACE_RECORDS * sizeof(PRTraceEntry)); PR_ASSERT(foundEntries != NULL ); @@ -298,9 +298,9 @@ static void PR_CALLBACK SampleTrace( void *arg ) ("SampleTrace, detail: Thread: %p, Time: %llX, UD0: %ld, UD1: %ld, UD2: %8.8ld", (foundEntries +i)->thread, (foundEntries +i)->time, - (foundEntries +i)->userData[0], - (foundEntries +i)->userData[1], - (foundEntries +i)->userData[2] )); + (foundEntries +i)->userData[0], + (foundEntries +i)->userData[1], + (foundEntries +i)->userData[2] )); } } PR_Sleep(PR_MillisecondsToInterval(50)); @@ -318,7 +318,7 @@ static void PR_CALLBACK SampleTrace( void *arg ) ("SampleTrace(): exiting")); #endif - return; + return; } /* end RecordTrace() */ /* @@ -330,14 +330,14 @@ static void TraceTest( void ) PRInt32 size; PR_DEFINE_TRACE( th ); PRThread *t1, *t2; - + PR_LOG( lm, msgLevel, - ("Begin TraceTest")); + ("Begin TraceTest")); size = SMALL_TRACE_BUFSIZE; PR_SET_TRACE_OPTION( PRTraceBufSize, &size ); PR_GET_TRACE_OPTION( PRTraceBufSize, &i ); - + PR_CREATE_TRACE( th, "TraceTest", "tt2", "A description for the trace test" ); PR_CREATE_TRACE( th, "TraceTest", "tt3", "A description for the trace test" ); PR_CREATE_TRACE( th, "TraceTest", "tt4", "A description for the trace test" ); @@ -362,7 +362,7 @@ static void TraceTest( void ) activeThreads += 2; t1 = PR_CreateThread(PR_USER_THREAD, - RecordTrace, NULL, + RecordTrace, NULL, PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD, PR_UNJOINABLE_THREAD, @@ -370,20 +370,20 @@ static void TraceTest( void ) PR_ASSERT(t1); t2 = PR_CreateThread(PR_USER_THREAD, - SampleTrace, 0, + SampleTrace, 0, PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD, PR_UNJOINABLE_THREAD, 0); PR_ASSERT(t2); - + ListTraces(); PR_GET_TRACE_HANDLE_FROM_NAME( th, "TraceTest","tt1" ); PR_ASSERT( th == hTrace ); PR_LOG( lm, msgLevel, - ("End TraceTest")); + ("End TraceTest")); return; } /* end TraceTest() */ @@ -394,9 +394,9 @@ static void TraceTest( void ) static void OrderedLockTest( void ) { PR_LOG( lm, msgLevel, - ("Begin OrderedLockTest")); + ("Begin OrderedLockTest")); + - } /* end OrderedLockTest() */ diff --git a/pr/tests/intrupt.c b/pr/tests/intrupt.c index b5970808..ce5e06d7 100644 --- a/pr/tests/intrupt.c +++ b/pr/tests/intrupt.c @@ -289,7 +289,7 @@ void PR_CALLBACK Intrupt(void *arg) PR_ASSERT(PR_SUCCESS == rv); PR_DestroyCondVar(cv); - PR_DestroyLock(ml); + PR_DestroyLock(ml); } /* Intrupt */ int main(int argc, char **argv) diff --git a/pr/tests/io_timeout.c b/pr/tests/io_timeout.c index fa6399c1..0ac4eef6 100644 --- a/pr/tests/io_timeout.c +++ b/pr/tests/io_timeout.c @@ -14,7 +14,7 @@ ** The debug mode will print all of the printfs associated with this test. ** The regress mode will be the default mode. Since the regress tool limits ** the output to a one line status:PASS or FAIL,all of the printf statements -** have been handled with an if (debug_mode) statement. +** have been handled with an if (debug_mode) statement. ***********************************************************************/ /*********************************************************************** ** Includes @@ -44,7 +44,7 @@ PRIntn debug_mode = 0; #define GLOBAL_SCOPE_STRING "GLOBAL scope" #define GLOBAL_BOUND_SCOPE_STRING "GLOBAL_BOUND scope" -void +void thread_main(void *_info) { threadInfo *info = (threadInfo *)_info; @@ -56,7 +56,7 @@ thread_main(void *_info) PRThreadScope tscope; char *scope_str; - + if (debug_mode) printf("thread %d is alive\n", info->id); tscope = PR_GetThreadScope(PR_GetCurrentThread()); @@ -84,7 +84,7 @@ thread_main(void *_info) failed_already=1; goto dead; } - + listenAddr.inet.family = PR_AF_INET; listenAddr.inet.port = PR_htons(BASE_PORT + info->id); listenAddr.inet.ip = PR_htonl(PR_INADDR_ANY); @@ -105,15 +105,15 @@ thread_main(void *_info) } if (debug_mode) - printf("thread %d going into accept for %d seconds\n", + printf("thread %d going into accept for %d seconds\n", info->id, info->accept_timeout + info->id); clientSock = PR_Accept(listenSock, &clientAddr, PR_SecondsToInterval(info->accept_timeout +info->id)); if (clientSock == NULL) { if (PR_GetError() == PR_IO_TIMEOUT_ERROR) { - if (debug_mode) { - printf("PR_Accept() timeout worked!\n"); + if (debug_mode) { + printf("PR_Accept() timeout worked!\n"); printf("TEST PASSED! PR_Accept() returned error %d\n", PR_IO_TIMEOUT_ERROR); } @@ -160,7 +160,7 @@ thread_test(PRThreadScope scope, PRInt32 num_threads) dead_lock = PR_NewLock(); dead_cv = PR_NewCondVar(dead_lock); alive = num_threads; - + for (index = 0; index < num_threads; index++) { threadInfo *info = (threadInfo *)PR_Malloc(sizeof(threadInfo)); @@ -169,7 +169,7 @@ thread_test(PRThreadScope scope, PRInt32 num_threads) info->dead_cv = dead_cv; info->alive = &alive; info->accept_timeout = DEFAULT_ACCEPT_TIMEOUT; - + thr = PR_CreateThread( PR_USER_THREAD, thread_main, (void *)info, @@ -231,7 +231,7 @@ int main(int argc, char **argv) PL_DestroyOptState(opt); /* main test */ - + if (0 == num_threads) num_threads = NUM_THREADS; diff --git a/pr/tests/io_timeoutk.c b/pr/tests/io_timeoutk.c index cf6cb491..0d22a03b 100644 --- a/pr/tests/io_timeoutk.c +++ b/pr/tests/io_timeoutk.c @@ -41,7 +41,7 @@ PRIntn failed_already=0; PRIntn debug_mode; -void +void thread_main(void *_info) { threadInfo *info = (threadInfo *)_info; @@ -50,7 +50,7 @@ thread_main(void *_info) PRFileDesc *listenSock = NULL; PRFileDesc *clientSock; PRStatus rv; - + if (debug_mode) printf("thread %d is alive\n", info->id); listenSock = PR_NewTCPSocket(); @@ -58,7 +58,7 @@ thread_main(void *_info) if (debug_mode) printf("unable to create listen socket\n"); goto dead; } - + listenAddr.inet.family = AF_INET; listenAddr.inet.port = PR_htons(BASE_PORT + info->id); listenAddr.inet.ip = PR_htonl(INADDR_ANY); @@ -74,13 +74,13 @@ thread_main(void *_info) goto dead; } - if (debug_mode) printf("thread %d going into accept for %d seconds\n", + if (debug_mode) printf("thread %d going into accept for %d seconds\n", info->id, info->accept_timeout + info->id); clientSock = PR_Accept(listenSock, &clientAddr, PR_SecondsToInterval(info->accept_timeout +info->id)); if (clientSock == NULL) { - if (PR_GetError() == PR_IO_TIMEOUT_ERROR) + if (PR_GetError() == PR_IO_TIMEOUT_ERROR) if (debug_mode) { printf("PR_Accept() timeout worked!\n"); printf("TEST FAILED! PR_Accept() returned error %d\n", @@ -119,7 +119,7 @@ thread_test(PRInt32 scope, PRInt32 num_threads) dead_lock = PR_NewLock(); dead_cv = PR_NewCondVar(dead_lock); alive = num_threads; - + for (index = 0; index < num_threads; index++) { threadInfo *info = (threadInfo *)malloc(sizeof(threadInfo)); @@ -128,7 +128,7 @@ thread_test(PRInt32 scope, PRInt32 num_threads) info->dead_cv = dead_cv; info->alive = &alive; info->accept_timeout = DEFAULT_ACCEPT_TIMEOUT; - + thr = PR_CreateThread( PR_USER_THREAD, thread_main, (void *)info, @@ -179,7 +179,7 @@ int main(int argc, char **argv) PL_DestroyOptState(opt); /* main test */ - + if (argc > 2) num_threads = atoi(argv[2]); else @@ -192,8 +192,8 @@ int main(int argc, char **argv) thread_test(PR_GLOBAL_THREAD, num_threads); PR_Cleanup(); - - if(failed_already) + + if(failed_already) return 1; else return 0; diff --git a/pr/tests/io_timeoutu.c b/pr/tests/io_timeoutu.c index 7b3ba7c9..9a24457a 100644 --- a/pr/tests/io_timeoutu.c +++ b/pr/tests/io_timeoutu.c @@ -40,7 +40,7 @@ typedef struct threadInfo { PRIntn failed_already=0; PRIntn debug_mode; -void +void thread_main(void *_info) { threadInfo *info = (threadInfo *)_info; @@ -49,7 +49,7 @@ thread_main(void *_info) PRFileDesc *listenSock = NULL; PRFileDesc *clientSock; PRStatus rv; - + if (debug_mode) printf("thread %d is alive\n", info->id); listenSock = PR_NewTCPSocket(); @@ -57,7 +57,7 @@ thread_main(void *_info) if (debug_mode) printf("unable to create listen socket\n"); goto dead; } - + listenAddr.inet.family = AF_INET; listenAddr.inet.port = PR_htons(BASE_PORT + info->id); listenAddr.inet.ip = PR_htonl(INADDR_ANY); @@ -73,7 +73,7 @@ thread_main(void *_info) goto dead; } - if (debug_mode) printf("thread %d going into accept for %d seconds\n", + if (debug_mode) printf("thread %d going into accept for %d seconds\n", info->id, info->accept_timeout + info->id); clientSock = PR_Accept( @@ -81,7 +81,7 @@ thread_main(void *_info) info->accept_timeout + info->id)); if (clientSock == NULL) { - if (PR_GetError() == PR_IO_TIMEOUT_ERROR) + if (PR_GetError() == PR_IO_TIMEOUT_ERROR) if (debug_mode) { printf("PR_Accept() timeout worked!\n"); printf("TEST FAILED! PR_Accept() returned error %d\n", @@ -120,7 +120,7 @@ thread_test(PRInt32 scope, PRInt32 num_threads) dead_lock = PR_NewLock(); dead_cv = PR_NewCondVar(dead_lock); alive = num_threads; - + for (index = 0; index < num_threads; index++) { threadInfo *info = (threadInfo *)malloc(sizeof(threadInfo)); @@ -129,7 +129,7 @@ thread_test(PRInt32 scope, PRInt32 num_threads) info->dead_cv = dead_cv; info->alive = &alive; info->accept_timeout = DEFAULT_ACCEPT_TIMEOUT; - + thr = PR_CreateThread( PR_USER_THREAD, thread_main, (void *)info, @@ -180,7 +180,7 @@ int main(int argc, char **argv) PL_DestroyOptState(opt); /* main test */ - + if (argc > 2) num_threads = atoi(argv[2]); else @@ -193,10 +193,10 @@ int main(int argc, char **argv) thread_test(PR_LOCAL_THREAD, num_threads); PR_Cleanup(); - if(failed_already) + if(failed_already) return 1; else return 0; - + } diff --git a/pr/tests/ioconthr.c b/pr/tests/ioconthr.c index 0a1dda87..6b6a5523 100644 --- a/pr/tests/ioconthr.c +++ b/pr/tests/ioconthr.c @@ -92,7 +92,7 @@ int main(int argc, char **argv) printf("Threads terminated in %d milliseconds\n", PR_IntervalToMilliseconds(elapsed)); fflush(stdout); - + /* We are being very generous and allow 10 seconds. */ if (elapsed >= PR_SecondsToInterval(10)) { fprintf(stderr, "Interrupting threads took longer than 10 seconds!!\n"); diff --git a/pr/tests/join.c b/pr/tests/join.c index ae3873fa..bd399017 100644 --- a/pr/tests/join.c +++ b/pr/tests/join.c @@ -10,13 +10,13 @@ ** Description: Tests PR_SetMallocCountdown PR_ClearMallocCountdown functions. ** ** Modification History: -** +** ** 19-May-97 AGarcia - separate the four join tests into different unit test modules. ** AGarcia- Converted the test to accomodate the debug_mode flag. ** The debug mode will print all of the printfs associated with this test. ** The regress mode will be the default mode. Since the regress tool limits ** the output to a one line status:PASS or FAIL,all of the printf statements -** have been handled with an if (debug_mode) statement. +** have been handled with an if (debug_mode) statement. ***********************************************************************/ /*********************************************************************** @@ -40,12 +40,12 @@ ** OUTPUTS: None ** RETURN: None ** SIDE EFFECTS: -** +** ** RESTRICTIONS: ** None ** MEMORY: NA ** ALGORITHM: Determine what the status is and print accordingly. -** +** ***********************************************************************/ @@ -84,9 +84,9 @@ void runTest(PRThreadScope scope1, PRThreadScope scope2) PRThread *low,*high; /* create the low and high priority threads */ - + low = PR_CreateThread(PR_USER_THREAD, - lowPriority, 0, + lowPriority, 0, PR_PRIORITY_LOW, scope1, PR_JOINABLE_THREAD, @@ -98,7 +98,7 @@ void runTest(PRThreadScope scope1, PRThreadScope scope2) } high = PR_CreateThread(PR_USER_THREAD, - highPriority, 0, + highPriority, 0, PR_PRIORITY_HIGH, scope2, PR_JOINABLE_THREAD, @@ -131,9 +131,9 @@ void joinWithUnjoinable(void) PRThread *thread; /* create the unjoinable thread */ - + thread = PR_CreateThread(PR_USER_THREAD, - unjoinable, 0, + unjoinable, 0, PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD, PR_UNJOINABLE_THREAD, @@ -173,7 +173,7 @@ static PRIntn PR_CALLBACK RealMain(int argc, char **argv) test. Usage: test_name -d */ - + PLOptStatus os; PLOptState *opt = PL_CreateOptState(argc, argv, "d:"); while (PL_OPT_EOL != (os = PL_GetNextOpt(opt))) @@ -213,7 +213,7 @@ static PRIntn PR_CALLBACK RealMain(int argc, char **argv) int main(int argc, char **argv) { PRIntn rv; - + PR_STDIO_INIT(); rv = PR_Initialize(RealMain, argc, argv, 0); return rv; diff --git a/pr/tests/joinkk.c b/pr/tests/joinkk.c index dde5d62b..433fc48e 100644 --- a/pr/tests/joinkk.c +++ b/pr/tests/joinkk.c @@ -10,7 +10,7 @@ ** Description: Tests PR_SetMallocCountdown PR_ClearMallocCountdown functions. ** ** Modification History: -** +** ** 19-May-97 AGarcia - separate the four join tests into different unit test modules. ** AGarcia- Converted the test to accomodate the debug_mode flag. ** The debug mode will print all of the printfs associated with this test. @@ -55,9 +55,9 @@ void runTest(PRThreadScope scope1, PRThreadScope scope2) PRThread *low,*high; /* create the low and high priority threads */ - + low = PR_CreateThread(PR_USER_THREAD, - lowPriority, 0, + lowPriority, 0, PR_PRIORITY_LOW, scope1, PR_JOINABLE_THREAD, @@ -69,7 +69,7 @@ void runTest(PRThreadScope scope1, PRThreadScope scope2) } high = PR_CreateThread(PR_USER_THREAD, - highPriority, 0, + highPriority, 0, PR_PRIORITY_HIGH, scope2, PR_JOINABLE_THREAD, @@ -105,7 +105,7 @@ static PRIntn PR_CALLBACK RealMain( PRIntn argc, char **argv ) test. Usage: test_name -d */ - + PLOptStatus os; PLOptState *opt = PL_CreateOptState(argc, argv, "d:"); while (PL_OPT_EOL != (os = PL_GetNextOpt(opt))) @@ -127,7 +127,7 @@ static PRIntn PR_CALLBACK RealMain( PRIntn argc, char **argv ) if (debug_mode) printf("Kernel-Kernel test\n"); runTest(PR_GLOBAL_THREAD, PR_GLOBAL_THREAD); - if(failed_already) + if(failed_already) { printf("FAIL\n"); return 1; @@ -143,7 +143,7 @@ static PRIntn PR_CALLBACK RealMain( PRIntn argc, char **argv ) int main(int argc, char **argv) { PRIntn rv; - + PR_STDIO_INIT(); rv = PR_Initialize(RealMain, argc, argv, 0); return rv; diff --git a/pr/tests/joinku.c b/pr/tests/joinku.c index f18894cd..8278303b 100644 --- a/pr/tests/joinku.c +++ b/pr/tests/joinku.c @@ -10,7 +10,7 @@ ** Description: Tests PR_SetMallocCountdown PR_ClearMallocCountdown functions. ** ** Modification History: -** +** ** 19-May-97 AGarcia - separate the four join tests into different unit test modules. ** AGarcia- Converted the test to accomodate the debug_mode flag. ** The debug mode will print all of the printfs associated with this test. @@ -57,9 +57,9 @@ void runTest(PRThreadScope scope1, PRThreadScope scope2) PRThread *low,*high; /* create the low and high priority threads */ - + low = PR_CreateThread(PR_USER_THREAD, - lowPriority, 0, + lowPriority, 0, PR_PRIORITY_LOW, scope1, PR_JOINABLE_THREAD, @@ -71,7 +71,7 @@ void runTest(PRThreadScope scope1, PRThreadScope scope2) } high = PR_CreateThread(PR_USER_THREAD, - highPriority, 0, + highPriority, 0, PR_PRIORITY_HIGH, scope2, PR_JOINABLE_THREAD, @@ -107,7 +107,7 @@ static PRIntn PR_CALLBACK RealMain( PRIntn argc, char **argv ) test. Usage: test_name -d */ - + PLOptStatus os; PLOptState *opt = PL_CreateOptState(argc, argv, "d:"); while (PL_OPT_EOL != (os = PL_GetNextOpt(opt))) @@ -133,14 +133,14 @@ static PRIntn PR_CALLBACK RealMain( PRIntn argc, char **argv ) runTest(PR_GLOBAL_THREAD, PR_LOCAL_THREAD); - if(failed_already) + if(failed_already) { - printf("FAIL\n"); + printf("FAIL\n"); return 1; } else { - printf("PASS\n"); + printf("PASS\n"); return 0; } @@ -150,7 +150,7 @@ static PRIntn PR_CALLBACK RealMain( PRIntn argc, char **argv ) int main(int argc, char **argv) { PRIntn rv; - + PR_STDIO_INIT(); rv = PR_Initialize(RealMain, argc, argv, 0); return rv; diff --git a/pr/tests/joinuk.c b/pr/tests/joinuk.c index 3b496fcd..1b6fe9b2 100644 --- a/pr/tests/joinuk.c +++ b/pr/tests/joinuk.c @@ -10,7 +10,7 @@ ** Description: Join kernel - user ** ** Modification History: -** +** ** 19-May-97 AGarcia - separate the four join tests into different unit test modules. ** AGarcia- Converted the test to accomodate the debug_mode flag. ** The debug mode will print all of the printfs associated with this test. @@ -55,9 +55,9 @@ void runTest(PRThreadScope scope1, PRThreadScope scope2) PRThread *low,*high; /* create the low and high priority threads */ - + low = PR_CreateThread(PR_USER_THREAD, - lowPriority, 0, + lowPriority, 0, PR_PRIORITY_LOW, scope1, PR_JOINABLE_THREAD, @@ -69,7 +69,7 @@ void runTest(PRThreadScope scope1, PRThreadScope scope2) } high = PR_CreateThread(PR_USER_THREAD, - highPriority, 0, + highPriority, 0, PR_PRIORITY_HIGH, scope2, PR_JOINABLE_THREAD, @@ -105,7 +105,7 @@ static PRIntn PR_CALLBACK RealMain( PRIntn argc, char **argv ) test. Usage: test_name -d */ - + PLOptStatus os; PLOptState *opt = PL_CreateOptState(argc, argv, "d:"); while (PL_OPT_EOL != (os = PL_GetNextOpt(opt))) @@ -131,11 +131,11 @@ static PRIntn PR_CALLBACK RealMain( PRIntn argc, char **argv ) runTest(PR_LOCAL_THREAD, PR_GLOBAL_THREAD); - if(failed_already) + if(failed_already) { printf("FAIL\n"); return 1; - } else + } else { printf("PASS\n"); return 0; @@ -146,7 +146,7 @@ static PRIntn PR_CALLBACK RealMain( PRIntn argc, char **argv ) int main(int argc, char **argv) { PRIntn rv; - + PR_STDIO_INIT(); rv = PR_Initialize(RealMain, argc, argv, 0); return rv; diff --git a/pr/tests/joinuu.c b/pr/tests/joinuu.c index 9b7d8c21..b03b6fff 100644 --- a/pr/tests/joinuu.c +++ b/pr/tests/joinuu.c @@ -10,7 +10,7 @@ ** Description: Join tests user - user ** ** Modification History: -** +** ** 19-May-97 AGarcia - separate the four join tests into different unit test modules. ** AGarcia- Converted the test to accomodate the debug_mode flag. ** The debug mode will print all of the printfs associated with this test. @@ -57,9 +57,9 @@ void runTest(PRThreadScope scope1, PRThreadScope scope2) PRThread *low,*high; /* create the low and high priority threads */ - + low = PR_CreateThread(PR_USER_THREAD, - lowPriority, 0, + lowPriority, 0, PR_PRIORITY_LOW, scope1, PR_JOINABLE_THREAD, @@ -71,7 +71,7 @@ void runTest(PRThreadScope scope1, PRThreadScope scope2) } high = PR_CreateThread(PR_USER_THREAD, - highPriority, 0, + highPriority, 0, PR_PRIORITY_HIGH, scope2, PR_JOINABLE_THREAD, @@ -107,7 +107,7 @@ static PRIntn PR_CALLBACK RealMain( PRIntn argc, char **argv ) test. Usage: test_name -d */ - + PLOptStatus os; PLOptState *opt = PL_CreateOptState(argc, argv, "d:"); while (PL_OPT_EOL != (os = PL_GetNextOpt(opt))) @@ -131,11 +131,11 @@ static PRIntn PR_CALLBACK RealMain( PRIntn argc, char **argv ) if (debug_mode) printf("User-User test\n"); runTest(PR_LOCAL_THREAD, PR_LOCAL_THREAD); - if(failed_already) + if(failed_already) { printf("FAIL\n"); return 1; - } else + } else { printf("PASS\n"); return 0; @@ -148,7 +148,7 @@ static PRIntn PR_CALLBACK RealMain( PRIntn argc, char **argv ) int main(int argc, char **argv) { PRIntn rv; - + PR_STDIO_INIT(); rv = PR_Initialize(RealMain, argc, argv, 0); return rv; diff --git a/pr/tests/layer.c b/pr/tests/layer.c index b64a5331..0272f0ea 100644 --- a/pr/tests/layer.c +++ b/pr/tests/layer.c @@ -93,7 +93,7 @@ static PRFileDesc *PopLayer(PRFileDesc *stack) if (verbosity > quiet) PR_fprintf(logFile, "Popped layer(0x%x) from stack(0x%x)\n", popped, stack); popped->dtor(popped); - + return stack; } /* PopLayer */ #endif @@ -127,7 +127,7 @@ static void PR_CALLBACK Client(void *arg) if (verbosity > quiet) PR_fprintf(logFile, "Client shutting down stack\n"); - + rv = PR_Shutdown(stack, PR_SHUTDOWN_BOTH); PR_ASSERT(PR_SUCCESS == rv); } /* Client */ diff --git a/pr/tests/lazyinit.c b/pr/tests/lazyinit.c index 4b9a910c..35b8a3a8 100644 --- a/pr/tests/lazyinit.c +++ b/pr/tests/lazyinit.c @@ -55,47 +55,47 @@ int main(int argc, char **argv) } else test = atoi(argv[1]); - + switch (test) { - case 0: ml = PR_NewLock(); + case 0: ml = PR_NewLock(); break; - + case 1: interval = PR_SecondsToInterval(1); break; - + case 2: thread = PR_CreateThread( PR_USER_THREAD, lazyEntry, NULL, PR_PRIORITY_NORMAL, - PR_LOCAL_THREAD, PR_JOINABLE_THREAD, 0); + PR_LOCAL_THREAD, PR_JOINABLE_THREAD, 0); break; - - case 3: file = PR_Open("/usr/tmp/", PR_RDONLY, 0); + + case 3: file = PR_Open("/usr/tmp/", PR_RDONLY, 0); break; - - case 4: udp = PR_NewUDPSocket(); + + case 4: udp = PR_NewUDPSocket(); break; - - case 5: tcp = PR_NewTCPSocket(); + + case 5: tcp = PR_NewTCPSocket(); break; - - case 6: dir = PR_OpenDir("/usr/tmp/"); + + case 6: dir = PR_OpenDir("/usr/tmp/"); break; - + case 7: (void)PR_NewThreadPrivateIndex(&pdkey, NULL); break; - + case 8: path = PR_GetEnv("PATH"); break; - + case 9: status = PR_NewTCPSocketPair(pair); break; - + case 10: PR_SetConcurrency(2); break; - - default: + + default: printf( - "lazyinit: unrecognized command line argument: %s\n", + "lazyinit: unrecognized command line argument: %s\n", argv[1] ); printf( "FAIL\n" ); exit( 1 ); diff --git a/pr/tests/lltest.c b/pr/tests/lltest.c index 7e21e76f..36e67984 100644 --- a/pr/tests/lltest.c +++ b/pr/tests/lltest.c @@ -2,7 +2,7 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - + /* ** testll.c -- test suite for 64bit integer (longlong) operations ** @@ -15,11 +15,11 @@ ** ** Description: ** lltest.c tests the functions defined in NSPR 2.0's prlong.h. -** +** ** Successive tests begin to depend on other LL functions working ** correctly. So, ... Do not change the order of the tests as run ** from main(). -** +** ** Caveats: ** Do not even begin to think that this is an exhaustive test! ** @@ -54,8 +54,8 @@ static PRBool verboseMode = PR_FALSE; const PRInt64 bigZero = LL_INIT( 0, 0 ); const PRInt64 bigOne = LL_INIT( 0, 1 ); const PRInt64 bigTwo = LL_INIT( 0, 2 ); -const PRInt64 bigSixTeen = LL_INIT( 0, 16 ); -const PRInt64 bigThirtyTwo = LL_INIT( 0, 32 ); +const PRInt64 bigSixTeen = LL_INIT( 0, 16 ); +const PRInt64 bigThirtyTwo = LL_INIT( 0, 32 ); const PRInt64 bigMinusOne = LL_INIT( 0xffffffff, 0xffffffff ); const PRInt64 bigMinusTwo = LL_INIT( 0xffffffff, 0xfffffffe ); const PRInt64 bigNumber = LL_INIT( 0x7fffffff, 0xffffffff ); @@ -107,7 +107,7 @@ ResultFailed( char *what, char *how, PRInt64 expected, PRInt64 got) PR_fprintf(output, "Expected: 0x%llx Got: 0x%llx\n", expected, got ); } return; -} +} /* @@ -127,106 +127,106 @@ static void TestAssignment( void ) /* ** TestComparisons() -- Test the longlong comparison operations */ -static void +static void TestComparisons( void ) { ReportProgress("Testing Comparisons Operations\n"); - - /* test for zero */ + + /* test for zero */ if ( !LL_IS_ZERO( bigZero )) SetFailed( "LL_IS_ZERO", "Zero is not zero" ); - + if ( LL_IS_ZERO( bigOne )) SetFailed( "LL_IS_ZERO", "One tests as zero" ); - + if ( LL_IS_ZERO( bigMinusOne )) SetFailed( "LL_IS_ZERO", "Minus One tests as zero" ); - + /* test equal */ if ( !LL_EQ( bigZero, bigZero )) SetFailed( "LL_EQ", "zero EQ zero"); - + if ( !LL_EQ( bigOne, bigOne )) SetFailed( "LL_EQ", "one EQ one" ); - + if ( !LL_EQ( bigNumber, bigNumber )) SetFailed( "LL_EQ", "bigNumber EQ bigNumber" ); - + if ( !LL_EQ( bigMinusOne, bigMinusOne )) SetFailed( "LL_EQ", "minus one EQ minus one"); - + if ( LL_EQ( bigZero, bigOne )) SetFailed( "LL_EQ", "zero EQ one"); - + if ( LL_EQ( bigOne, bigZero )) SetFailed( "LL_EQ", "one EQ zero" ); - + if ( LL_EQ( bigMinusOne, bigOne )) SetFailed( "LL_EQ", "minus one EQ one"); - + if ( LL_EQ( bigNumber, bigOne )) SetFailed( "LL_EQ", "bigNumber EQ one"); - + /* test not equal */ if ( LL_NE( bigZero, bigZero )) SetFailed( "LL_NE", "0 NE 0"); - + if ( LL_NE( bigOne, bigOne )) SetFailed( "LL_NE", "1 NE 1"); - + if ( LL_NE( bigMinusOne, bigMinusOne )) SetFailed( "LL_NE", "-1 NE -1"); - + if ( LL_NE( bigNumber, bigNumber )) SetFailed( "LL_NE", "n NE n"); - + if ( LL_NE( bigMinusNumber, bigMinusNumber )) SetFailed( "LL_NE", "-n NE -n"); - + if ( !LL_NE( bigZero, bigOne)) SetFailed( "LL_NE", "0 NE 1"); - + if ( !LL_NE( bigOne, bigMinusNumber)) SetFailed( "LL_NE", "1 NE -n"); - + /* Greater than or equal to zero */ if ( !LL_GE_ZERO( bigZero )) SetFailed( "LL_GE_ZERO", "0"); - + if ( !LL_GE_ZERO( bigOne )) SetFailed( "LL_GE_ZERO", "1"); - + if ( !LL_GE_ZERO( bigNumber )) SetFailed( "LL_GE_ZERO", "n"); - + if ( LL_GE_ZERO( bigMinusOne )) SetFailed( "LL_GE_ZERO", "-1"); - + if ( LL_GE_ZERO( bigMinusNumber )) SetFailed( "LL_GE_ZERO", "-n"); - + /* Algebraic Compare two values */ if ( !LL_CMP( bigZero, ==, bigZero )) SetFailed( "LL_CMP", "0 == 0"); - + if ( LL_CMP( bigZero, >, bigZero )) SetFailed( "LL_CMP", "0 > 0"); - + if ( LL_CMP( bigZero, <, bigZero )) SetFailed( "LL_CMP", "0 < 0"); - + if ( LL_CMP( bigNumber, <, bigOne )) SetFailed( "LL_CMP", "n < 1"); - + if ( !LL_CMP( bigNumber, >, bigOne )) SetFailed( "LL_CMP", "n <= 1"); - + if ( LL_CMP( bigOne, >, bigNumber )) SetFailed( "LL_CMP", "1 > n"); - + if ( LL_CMP( bigMinusNumber, >, bigNumber )) SetFailed( "LL_CMP", "-n > n"); - + if ( LL_CMP( bigNumber, !=, bigNumber)) SetFailed( "LL_CMP", "n != n"); @@ -287,22 +287,22 @@ TestComparisons( void ) /* Bitwise Compare two numbers */ if ( !LL_UCMP( bigZero, ==, bigZero )) SetFailed( "LL_UCMP", "0 == 0"); - + if ( LL_UCMP( bigZero, >, bigZero )) SetFailed( "LL_UCMP", "0 > 0"); - + if ( LL_UCMP( bigZero, <, bigZero )) SetFailed( "LL_UCMP", "0 < 0"); - + if ( LL_UCMP( bigNumber, <, bigOne )) SetFailed( "LL_UCMP", "n < 1"); - + if ( !LL_UCMP( bigNumber, >, bigOne )) SetFailed( "LL_UCMP", "n < 1"); - + if ( LL_UCMP( bigOne, >, bigNumber )) SetFailed( "LL_UCMP", "1 > n"); - + if ( LL_UCMP( bigMinusNumber, <, bigNumber )) SetFailed( "LL_UCMP", "-n < n"); @@ -365,14 +365,14 @@ static void TestLogicalOperations( void ) { PRUint64 result, result2; - + ReportProgress("Testing Logical Operations\n"); - + /* Test AND */ LL_AND( result, bigZero, bigZero ); if ( !LL_IS_ZERO( result )) ResultFailed( "LL_AND", "0 & 0", bigZero, result ); - + LL_AND( result, bigOne, bigOne ); if ( LL_IS_ZERO( result )) ResultFailed( "LL_AND", "1 & 1", bigOne, result ); @@ -384,47 +384,47 @@ TestLogicalOperations( void ) LL_AND( result, bigMinusOne, bigMinusOne ); if ( !LL_UCMP( result, ==, bigMinusOne )) ResultFailed( "LL_AND", "-1 & -1", bigMinusOne, result ); - + /* test OR */ LL_OR( result, bigZero, bigZero ); if ( !LL_IS_ZERO( result )) ResultFailed( "LL_OR", "0 | 1", bigZero, result); - + LL_OR( result, bigZero, bigOne ); if ( LL_IS_ZERO( result )) ResultFailed( "LL_OR", "0 | 1", bigOne, result ); - + LL_OR( result, bigZero, bigMinusNumber ); if ( !LL_UCMP( result, ==, bigMinusNumber )) ResultFailed( "LL_OR", "0 | -n", bigMinusNumber, result); - + LL_OR( result, bigMinusNumber, bigZero ); if ( !LL_UCMP( result, ==, bigMinusNumber )) ResultFailed( "LL_OR", "-n | 0", bigMinusNumber, result ); - + /* test XOR */ LL_XOR( result, bigZero, bigZero ); if ( LL_UCMP( result, !=, bigZero )) ResultFailed( "LL_XOR", "0 ^ 0", bigZero, result); - + LL_XOR( result, bigOne, bigZero ); if ( LL_UCMP( result, !=, bigOne )) ResultFailed( "LL_XOR", "1 ^ 0", bigZero, result ); - + LL_XOR( result, bigMinusNumber, bigZero ); if ( LL_UCMP( result, !=, bigMinusNumber )) ResultFailed( "LL_XOR", "-n ^ 0", bigMinusNumber, result ); - + LL_XOR( result, bigMinusNumber, bigMinusNumber ); if ( LL_UCMP( result, !=, bigZero )) ResultFailed( "LL_XOR", "-n ^ -n", bigMinusNumber, result); - + /* test OR2. */ result = bigZero; LL_OR2( result, bigOne ); if ( LL_UCMP( result, !=, bigOne )) ResultFailed( "LL_OR2", "(r=0) |= 1", bigOne, result); - + result = bigOne; LL_OR2( result, bigNumber ); if ( LL_UCMP( result, !=, bigNumber )) @@ -440,7 +440,7 @@ TestLogicalOperations( void ) LL_NOT( result2, result); if ( LL_UCMP( result2, !=, bigMinusNumber )) ResultFailed( "LL_NOT", "r != ~(~-n)", bigMinusNumber, result); - + /* test Negation */ LL_NEG( result, bigMinusNumber ); LL_NEG( result2, result ); @@ -465,79 +465,79 @@ TestConversion( void ) PRUint32 resultU32; float resultF; PRFloat64 resultD; - + ReportProgress("Testing Conversion Operations\n"); - + /* LL_L2I -- Convert to signed 32bit */ LL_L2I(result32, bigOne ); - if ( result32 != one ) + if ( result32 != one ) SetFailed( "LL_L2I", "r != 1"); - + LL_L2I(result32, bigMinusOne ); - if ( result32 != minusOne ) + if ( result32 != minusOne ) SetFailed( "LL_L2I", "r != -1"); - + /* LL_L2UI -- Convert 64bit to unsigned 32bit */ LL_L2UI( resultU32, bigMinusOne ); if ( resultU32 != (PRUint32) minusOne ) SetFailed( "LL_L2UI", "r != -1"); - + LL_L2UI( resultU32, bigOne ); if ( resultU32 != (PRUint32) one ) SetFailed( "LL_L2UI", "r != 1"); - + /* LL_L2F -- Convert to 32bit floating point */ LL_L2F( resultF, bigOne ); if ( resultF != 1.0 ) SetFailed( "LL_L2F", "r != 1.0"); - + LL_L2F( resultF, bigMinusOne ); if ( resultF != -1.0 ) SetFailed( "LL_L2F", "r != 1.0"); - + /* LL_L2D -- Convert to 64bit floating point */ LL_L2D( resultD, bigOne ); if ( resultD != 1.0L ) SetFailed( "LL_L2D", "r != 1.0"); - + LL_L2D( resultD, bigMinusOne ); if ( resultD != -1.0L ) SetFailed( "LL_L2D", "r != -1.0"); - + /* LL_I2L -- Convert 32bit signed to 64bit signed */ LL_I2L( result, one ); if ( LL_CMP(result, !=, bigOne )) SetFailed( "LL_I2L", "r != 1"); - + LL_I2L( result, minusOne ); if ( LL_CMP(result, !=, bigMinusOne )) SetFailed( "LL_I2L", "r != -1"); - + /* LL_UI2L -- Convert 32bit unsigned to 64bit unsigned */ LL_UI2L( resultU, (PRUint32) one ); if ( LL_CMP(resultU, !=, bigOne )) SetFailed( "LL_UI2L", "r != 1"); - - /* [lth.] This did not behave as expected, but it is correct + + /* [lth.] This did not behave as expected, but it is correct */ LL_UI2L( resultU, (PRUint32) minusOne ); if ( LL_CMP(resultU, !=, bigZeroFox )) ResultFailed( "LL_UI2L", "r != -1", bigZeroFox, resultU); - + /* LL_F2L -- Convert 32bit float to 64bit signed */ LL_F2L( result, 1.0 ); if ( LL_CMP(result, !=, bigOne )) SetFailed( "LL_F2L", "r != 1"); - + LL_F2L( result, -1.0 ); if ( LL_CMP(result, !=, bigMinusOne )) SetFailed( "LL_F2L", "r != -1"); - + /* LL_D2L -- Convert 64bit Float to 64bit signed */ LL_D2L( result, 1.0L ); if ( LL_CMP(result, !=, bigOne )) SetFailed( "LL_D2L", "r != 1"); - + LL_D2L( result, -1.0L ); if ( LL_CMP(result, !=, bigMinusOne )) SetFailed( "LL_D2L", "r != -1"); @@ -561,7 +561,7 @@ static void ShiftCompileOnly() LL_ISHL(ia, 49, 32); } /* ShiftCompileOnly */ - + /* ** TestShift() -- Test Shifting Operations @@ -575,21 +575,21 @@ TestShift( void ) PRUint64 resultU; ReportProgress("Testing Shifting Operations\n"); - + /* LL_SHL -- Shift left algebraic */ LL_SHL( result, bigOne, one ); if ( LL_CMP( result, !=, bigTwo )) ResultFailed( "LL_SHL", "r != 2", bigOne, result ); - + LL_SHL( result, bigTwo, thirtyTwo ); if ( LL_CMP( result, !=, largeTwoZero )) ResultFailed( "LL_SHL", "r != twoZero", largeTwoZero, result); - + /* LL_SHR -- Shift right algebraic */ LL_SHR( result, bigFoxZero, thirtyTwo ); if ( LL_CMP( result, !=, bigMinusOne )) ResultFailed( "LL_SHR", "r != -1", bigMinusOne, result); - + LL_SHR( result, bigTwo, one ); if ( LL_CMP( result, !=, bigOne )) ResultFailed( "LL_SHR", "r != 1", bigOne, result); @@ -597,31 +597,31 @@ TestShift( void ) LL_SHR( result, bigFoxFox, thirtyTwo ); if ( LL_CMP( result, !=, bigMinusOne )) ResultFailed( "LL_SHR", "r != -1 (was ff,ff)", bigMinusOne, result); - + /* LL_USHR -- Logical shift right */ LL_USHR( resultU, bigZeroFox, thirtyTwo ); if ( LL_UCMP( resultU, !=, bigZero )) ResultFailed( "LL_USHR", "r != 0 ", bigZero, result); - + LL_USHR( resultU, bigFoxFox, thirtyTwo ); if ( LL_UCMP( resultU, !=, bigZeroFox )) ResultFailed( "LL_USHR", "r != 0 ", bigZeroFox, result); - + /* LL_ISHL -- Shift a 32bit integer into a 64bit result */ LL_ISHL( resultU, minusOne, thirtyTwo ); if ( LL_UCMP( resultU, !=, bigFoxZero )) ResultFailed( "LL_ISHL", "r != ff,00 ", bigFoxZero, result); - + LL_ISHL( resultU, one, sixtyThree ); if ( LL_UCMP( resultU, !=, bigEightZero )) ResultFailed( "LL_ISHL", "r != 80,00 ", bigEightZero, result); - + LL_ISHL( resultU, one, sixteen ); if ( LL_UCMP( resultU, !=, big64K )) ResultFailed( "LL_ISHL", "r != 64K ", big64K, resultU); - + return; -} +} /* @@ -637,10 +637,10 @@ TestArithmetic( void ) PRInt64 largeMultCand = LL_INIT( 0x00000000, 0x7fffffff ); PRInt64 largeMinusMultCand = LL_INIT( 0xffffffff, 0x10000001 ); PRInt64 largeMultCandx64K = LL_INIT( 0x00007fff, 0xffff0000 ); - PRInt64 largeNumSHL5 = LL_INIT( 0x0000001f, 0xffffffe0 ); + PRInt64 largeNumSHL5 = LL_INIT( 0x0000001f, 0xffffffe0 ); PRInt64 result, result2; - /* Addition */ + /* Addition */ LL_ADD( result, bigOne, bigOne ); if ( LL_CMP( result, !=, bigTwo )) ResultFailed( "LL_ADD", "r != 1 + 1", bigTwo, result); @@ -652,30 +652,30 @@ TestArithmetic( void ) LL_ADD( result, largeVal, bigOne ); if ( LL_CMP( result, !=, largeValPlusOne )) ResultFailed( "LL_ADD", "lVP1 != lV + 1", largeValPlusOne, result); - + /* Subtraction */ LL_SUB( result, bigOne, bigOne ); if ( LL_CMP( result, !=, bigZero )) ResultFailed( "LL_SUB", "r != 1 - 1", bigZero, result); - + LL_SUB( result, bigTwo, bigOne ); if ( LL_CMP( result, !=, bigOne )) ResultFailed( "LL_SUB", "r != 2 - 1", bigOne, result); - + LL_SUB( result, largeValPlusOne, bigOne ); if ( LL_CMP( result, !=, largeVal )) ResultFailed( "LL_SUB", "r != lVP1 - 1", largeVal, result); - - + + /* Multiply */ LL_MUL( result, largeVal, bigTwo ); if ( LL_CMP( result, !=, largeValTimesTwo )) ResultFailed( "LL_MUL", "r != lV*2", largeValTimesTwo, result); - + LL_MUL( result, largeMultCand, big64K ); if ( LL_CMP( result, !=, largeMultCandx64K )) ResultFailed( "LL_MUL", "r != lV*64K", largeMultCandx64K, result); - + LL_NEG( result2, largeMultCand ); LL_MUL( result, largeMultCand, bigMinusOne ); if ( LL_CMP( result, !=, result2 )) @@ -686,13 +686,13 @@ TestArithmetic( void ) if ( LL_CMP( result, !=, largeNumSHL5 )) ResultFailed( "LL_MUL", "r != 0f<<5", largeNumSHL5, result ); - + /* LL_DIV() Division */ LL_DIV( result, bigOne, bigOne); if ( LL_CMP( result, !=, bigOne )) ResultFailed( "LL_DIV", "1 != 1", bigOne, result); - + LL_DIV( result, bigNumber, bigOne ); if ( LL_CMP( result, !=, bigNumber )) ResultFailed( "LL_DIV", "r != n / 1", bigNumber, result); @@ -704,32 +704,32 @@ TestArithmetic( void ) LL_DIV( result, bigMinusNumber, bigMinusOne ); if ( LL_CMP( result, !=, bigNumber )) ResultFailed( "LL_DIV", "r != -n / -1", bigNumber, result); - + LL_SHL( result2, bigZeroFox, 5 ); LL_DIV( result, result2, bigOne ); if ( LL_CMP( result, !=, result2 )) ResultFailed( "LL_DIV", "0f<<5 != 0f<<5", result2, result); - + LL_SHL( result2, bigZeroFox, 5 ); LL_NEG( result2, result2 ); LL_DIV( result, result2, bigOne ); if ( LL_CMP( result, !=, result2 )) ResultFailed( "LL_DIV", "-0f<<5 != -0f<<5", result2, result); - + LL_SHL( result2, bigZeroFox, 17 ); LL_DIV( result, result2, bigMinusOne ); LL_NEG( result2, result2 ); if ( LL_CMP( result, !=, result2 )) ResultFailed( "LL_DIV", "-0f<<17 != -0f<<17", result2, result); - - + + /* LL_MOD() Modulo Division */ LL_ADD( result2, bigThirtyTwo, bigOne ); LL_MOD( result, result2, bigSixTeen ); if ( LL_CMP( result, !=, bigOne )) ResultFailed( "LL_MOD", "r != 1", bigSixTeen, result); - - + + LL_MUL( result2, bigZeroFox, bigThirtyTwo ); LL_ADD( result2, result2, bigSixTeen); LL_MOD( result, result2, bigThirtyTwo ); @@ -740,10 +740,10 @@ TestArithmetic( void ) LL_DIV( result, bigOne, bigOne); if ( LL_CMP( result, !=, bigOne )) ResultFailed( "LL_DIV", "r != 16", bigSixTeen, result); - + return; -} +} static void TestWellknowns(void) { @@ -755,7 +755,7 @@ static void TestWellknowns(void) ResultFailed( "min, mmin", "min != mmin", max, mmin); if (LL_NE(zero, mzero)) ResultFailed( "zero, mzero", "zero != mzero", zero, mzero); -} /* TestWellknowns */ +} /* TestWellknowns */ /* ** Initialize() -- Initialize the test case @@ -771,7 +771,7 @@ Initialize( PRIntn argc, char **argv ) /* ** Parse command line options - */ + */ while (PL_OPT_EOL != (os = PL_GetNextOpt(opt))) { if (PL_OPT_BAD == os) continue; @@ -780,12 +780,12 @@ Initialize( PRIntn argc, char **argv ) case 'd': /* set debug mode */ debugMode = PR_TRUE; break; - + case 'v': /* set verbose mode */ verboseMode = PR_TRUE; debugMode = PR_TRUE; break; - + case 'h': /* user wants some guidance */ default: PR_fprintf(output, "You get help.\n"); @@ -794,7 +794,7 @@ Initialize( PRIntn argc, char **argv ) } PL_DestroyOptState(opt); return(0); -} +} int main(int argc, char **argv) { @@ -811,14 +811,14 @@ int main(int argc, char **argv) TestShift(); TestArithmetic(); TestWellknowns(); - + /* ** That's all folks! */ if ( failedAlready ) { PR_fprintf(output, "FAIL\n");\ - } + } else { PR_fprintf(output, "PASS\n");\ diff --git a/pr/tests/lock.c b/pr/tests/lock.c index 178315ae..f10f80fd 100644 --- a/pr/tests/lock.c +++ b/pr/tests/lock.c @@ -25,7 +25,7 @@ ** - l <num> to control the number of loops ** - c <num> to control the number of CPUs. ** (was positional argv). -** +** ** ***********************************************************************/ @@ -247,7 +247,7 @@ static PRIntervalTime ReentrantMonitor(PRUint32 loops) if (debug_mode) PR_fprintf(std_err, "Monitor released second time\n"); status = PR_JoinThread(thread); - if (debug_mode) PR_fprintf(std_err, + if (debug_mode) PR_fprintf(std_err, "Reentrant thread joined %s\n", (status == PR_SUCCESS) ? "successfully" : "in error"); @@ -382,17 +382,17 @@ static PRIntervalTime ContentiousCMonitor(PRUint32 loops) static PRIntervalTime Test( const char* msg, PRUint32 (*test)(PRUint32 loops), PRUint32 loops, PRIntervalTime overhead) -{ +{ /* * overhead - overhead not measured by the test. * duration - wall clock time it took to perform test. - * predicted - extra time test says should not be counted + * predicted - extra time test says should not be counted * * Time accountable to the test is duration - overhead - predicted * All times are Intervals and accumulated for all iterations. */ PRFloat64 elapsed; - PRIntervalTime accountable, duration; + PRIntervalTime accountable, duration; PRUintn spaces = PL_strlen(msg); PRIntervalTime timeout, timein = PR_IntervalNow(); PRIntervalTime predicted = test(loops); @@ -420,7 +420,7 @@ int main(int argc, char **argv) PRIntervalTime duration; PRUint32 cpu, cpus = 2, loops = 100; - + PR_STDIO_INIT(); PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0); { @@ -503,14 +503,14 @@ int main(int argc, char **argv) failed_already=1; } - if(failed_already) + if(failed_already) { - PR_fprintf(PR_STDOUT, "FAIL\n"); + PR_fprintf(PR_STDOUT, "FAIL\n"); return 1; - } + } else { - PR_fprintf(PR_STDOUT, "PASS\n"); + PR_fprintf(PR_STDOUT, "PASS\n"); return 0; } diff --git a/pr/tests/lockfile.c b/pr/tests/lockfile.c index 9c2de8c8..903b5035 100644 --- a/pr/tests/lockfile.c +++ b/pr/tests/lockfile.c @@ -136,17 +136,17 @@ static PRIntervalTime ContentiousLock(PRInt32 loops) static PRIntervalTime Test( const char* msg, PRIntervalTime (*test)(PRInt32 loops), PRInt32 loops, PRIntervalTime overhead) -{ +{ /* * overhead - overhead not measured by the test. * duration - wall clock time it took to perform test. - * predicted - extra time test says should not be counted + * predicted - extra time test says should not be counted * * Time accountable to the test is duration - overhead - predicted * All times are Intervals and accumulated for all iterations. */ PRFloat64 elapsed; - PRIntervalTime accountable, duration; + PRIntervalTime accountable, duration; PRUintn spaces = strlen(msg); PRIntervalTime timeout, timein = PR_IntervalNow(); PRIntervalTime predicted = test(loops); @@ -171,7 +171,7 @@ int main(int argc, char **argv) PRUint32 cpu, cpus = 2; PRInt32 loops = 100; - + /* The command line argument: -d is used to determine if the test is being run in debug mode. The regress tool requires only one line output:PASS or FAIL. All of the printfs associated with this test has been handled with a if (debug_mode) @@ -195,7 +195,7 @@ int main(int argc, char **argv) PL_DestroyOptState(opt); /* main test */ - + PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0); PR_STDIO_INIT(); @@ -212,7 +212,7 @@ int main(int argc, char **argv) { if (debug_mode) printf("\nLockFile: Using %d CPU(s)\n", cpu); PR_SetConcurrency(cpu); - + duration = Test("LockFile non-contentious locking/unlocking", NonContentiousLock, loops, 0); (void)Test("LockFile contentious locking/unlocking", ContentiousLock, loops, duration); } @@ -220,7 +220,7 @@ int main(int argc, char **argv) PR_Delete(LOCKFILE); /* try to get rid of evidence */ if (debug_mode) printf("%s: test %s\n", "Lock(mutex) test", ((failed_already) ? "failed" : "passed")); - if(failed_already) + if(failed_already) return 1; else return 0; diff --git a/pr/tests/logger.c b/pr/tests/logger.c index a44ef4ee..2ba0b394 100644 --- a/pr/tests/logger.c +++ b/pr/tests/logger.c @@ -40,7 +40,7 @@ static void PR_CALLBACK forked(void *arg) PRIntn i; PRLock *ml; PRCondVar *cv; - + PR_LogPrint("%s logging creating mutex\n", (const char*)arg); ml = PR_NewLock(); PR_LogPrint("%s logging creating condition variable\n", (const char*)arg); @@ -53,7 +53,7 @@ static void PR_CALLBACK forked(void *arg) PR_WaitCondVar(cv, PR_SecondsToInterval(1)); PR_Unlock(ml); } - + PR_LogPrint("%s logging destroying condition variable\n", (const char*)arg); PR_DestroyCondVar(cv); PR_LogPrint("%s logging destroying mutex\n", (const char*)arg); @@ -107,7 +107,7 @@ int main(int argc, char **argv) /* ** Now change buffering. */ - PR_SetLogBuffering( 65500 ); + PR_SetLogBuffering( 65500 ); thread = PR_CreateThread( PR_USER_THREAD, forked, (void*)argv[0], PR_PRIORITY_NORMAL, PR_LOCAL_THREAD, PR_JOINABLE_THREAD, 0); diff --git a/pr/tests/many_cv.c b/pr/tests/many_cv.c index 8bddd786..1a408596 100644 --- a/pr/tests/many_cv.c +++ b/pr/tests/many_cv.c @@ -100,7 +100,7 @@ static PRIntn PR_CALLBACK RealMain( PRIntn argc, char **argv ) PR_DELETE(cv); PR_DestroyLock(ml); - + printf("PASS\n"); PT_FPrintStats(err, "\nPThread Statistics\n"); @@ -111,7 +111,7 @@ static PRIntn PR_CALLBACK RealMain( PRIntn argc, char **argv ) int main(int argc, char **argv) { PRIntn rv; - + PR_STDIO_INIT(); rv = PR_Initialize(RealMain, argc, argv, 0); return rv; diff --git a/pr/tests/mbcs.c b/pr/tests/mbcs.c index 50d5dd00..c5760939 100644 --- a/pr/tests/mbcs.c +++ b/pr/tests/mbcs.c @@ -10,9 +10,9 @@ ** ** where dirName is the directory to be traversed. dirName is required. ** -** Description: +** Description: ** mbcs.c tests use of multi-byte characters, as would be passed to -** NSPR funtions by internationalized applications. +** NSPR funtions by internationalized applications. ** ** mbcs.c, when run on any single-byte platform, should run correctly. ** In truth, running the mbcs test on a single-byte platform is @@ -31,11 +31,11 @@ ** named such that when represented in the local multi-byte character ** set, one or more characters of the name is longer than a single ** byte. -** +** */ -#include <plgetopt.h> -#include <nspr.h> +#include <plgetopt.h> +#include <nspr.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -68,7 +68,7 @@ static void TraverseDirectory( unsigned char *dir ) printf("Directory: %s\n", dir ); cwd = PR_OpenDir( dir ); if ( NULL == cwd ) { - printf("PR_OpenDir() failed on directory: %s, with error: %d, %d\n", + printf("PR_OpenDir() failed on directory: %s, with error: %d, %d\n", dir, PR_GetError(), PR_GetOSError()); exit(1); } @@ -76,7 +76,7 @@ static void TraverseDirectory( unsigned char *dir ) sprintf( file, "%s/%s", dir, dirEntry->name ); rc = PR_GetFileInfo( file, &info ); if ( PR_FAILURE == rc ) { - printf("PR_GetFileInfo() failed on file: %s, with error: %d, %d\n", + printf("PR_GetFileInfo() failed on file: %s, with error: %d, %d\n", dirEntry->name, PR_GetError(), PR_GetOSError()); exit(1); } @@ -84,12 +84,12 @@ static void TraverseDirectory( unsigned char *dir ) printf("File: %s \tsize: %ld\n", dirEntry->name, info.size ); fd = PR_Open( file, PR_RDONLY, 0 ); if ( NULL == fd ) { - printf("PR_Open() failed. Error: %ld, OSError: %ld\n", + printf("PR_Open() failed. Error: %ld, OSError: %ld\n", PR_GetError(), PR_GetOSError()); } rc = PR_Close( fd ); if ( PR_FAILURE == rc ) { - printf("PR_Close() failed. Error: %ld, OSError: %ld\n", + printf("PR_Close() failed. Error: %ld, OSError: %ld\n", PR_GetError(), PR_GetOSError()); } } else if ( PR_FILE_DIRECTORY == info.type ) { @@ -104,7 +104,7 @@ static void TraverseDirectory( unsigned char *dir ) rc = PR_CloseDir( cwd ); if ( PR_FAILURE == rc ) { - printf("PR_CloseDir() failed on directory: %s, with error: %d, %d\n", + printf("PR_CloseDir() failed on directory: %s, with error: %d, %d\n", dir, PR_GetError(), PR_GetOSError()); } @@ -132,8 +132,8 @@ int main(int argc, char **argv) msgLevel = PR_LOG_DEBUG; break; default: - dirName = strdup(opt->value); - break; + dirName = strdup(opt->value); + break; } } PL_DestroyOptState(opt); @@ -141,7 +141,7 @@ int main(int argc, char **argv) lm = PR_NewLogModule("Test"); /* Initialize logging */ - + if ( dirName == NULL ) { printf("you gotta specify a directory as an operand!\n"); exit(1); diff --git a/pr/tests/nameshm1.c b/pr/tests/nameshm1.c index 490ecb5d..beadb98d 100644 --- a/pr/tests/nameshm1.c +++ b/pr/tests/nameshm1.c @@ -6,10 +6,10 @@ /* ** File: nameshm1.c -- Test Named Shared Memory ** -** Description: +** Description: ** nameshm1 tests Named Shared Memory. nameshm1 performs two tests of -** named shared memory. -** +** named shared memory. +** ** The first test is a basic test. The basic test operates as a single ** process. The process exercises all the API elements of the facility. ** This test also attempts to write to all locations in the shared @@ -31,7 +31,7 @@ ** order. ** ** Synopsis: nameshm1 [options] [name] -** +** ** Options: ** -d Enables debug trace via PR_LOG() ** -v Enables verbose mode debug trace via PR_LOG() @@ -39,7 +39,7 @@ ** mapped as read-only. When this option is specified, the ** test should crash with a seg-fault; this is a destructive ** test and is considered successful when it seg-faults. -** +** ** -C Causes nameshm1 to start as the client-side of a ** client-server pair of processes. Only the instance ** of nameshm1 operating as the server-side process should @@ -48,7 +48,7 @@ ** The client-side uses the shared memory segment created by ** the server-side to communicate with the server-side ** process. -** +** ** -p <n> Specify the number of iterations the client-server tests ** should perform. Default: 1000. ** @@ -66,7 +66,7 @@ ** /lth. Aug-1999. */ -#include <plgetopt.h> +#include <plgetopt.h> #include <nspr.h> #include <stdlib.h> #include <string.h> @@ -104,7 +104,7 @@ char optName[NameSize] = OPT_NAME; char buf[1024] = ""; -static void BasicTest( void ) +static void BasicTest( void ) { PRSharedMemory *shm; char *addr; /* address of shared memory segment */ @@ -134,7 +134,7 @@ static void BasicTest( void ) ( "nameshm1: RW Create: success: %p", shm )); addr = PR_AttachSharedMemory( shm , 0 ); - if ( NULL == addr ) + if ( NULL == addr ) { PR_LOG( lm, msgLevel, ( "nameshm1: RW Attach: Error: %ld. OSError: %ld", PR_GetError(), PR_GetOSError())); @@ -211,7 +211,7 @@ static void ReadOnlyTest( void ) roAddr = PR_AttachSharedMemory( shm , PR_SHM_READONLY ); - if ( NULL == roAddr ) + if ( NULL == roAddr ) { PR_LOG( lm, msgLevel, ( "nameshm1: RO Attach: Error: %ld. OSError: %ld", PR_GetError(), PR_GetOSError())); @@ -273,7 +273,7 @@ static void DoClient( void ) PRStatus rc; PRSem *sem1, *sem2; PRSharedMemory *shm; - PRUint32 *addr; + PRUint32 *addr; PRInt32 i; PR_LOG( lm, msgLevel, @@ -289,7 +289,7 @@ static void DoClient( void ) if ( NULL == shm ) { PR_LOG( lm, msgLevel, - ( "nameshm1: DoClient(): Create: Error: %ld. OSError: %ld", + ( "nameshm1: DoClient(): Create: Error: %ld. OSError: %ld", PR_GetError(), PR_GetOSError())); failed_already = 1; return; @@ -298,10 +298,10 @@ static void DoClient( void ) ( "nameshm1: DoClient(): Create: success: %p", shm )); addr = PR_AttachSharedMemory( shm , 0 ); - if ( NULL == addr ) + if ( NULL == addr ) { PR_LOG( lm, msgLevel, - ( "nameshm1: DoClient(): Attach: Error: %ld. OSError: %ld", + ( "nameshm1: DoClient(): Attach: Error: %ld. OSError: %ld", PR_GetError(), PR_GetOSError())); failed_already = 1; return; @@ -317,9 +317,9 @@ static void DoClient( void ) { rc = PR_WaitSemaphore( sem2 ); PR_ASSERT( PR_FAILURE != rc ); - + (*addr)++; - PR_ASSERT( (*addr % 2) == 0 ); + PR_ASSERT( (*addr % 2) == 0 ); if ( optVerbose ) PR_LOG( lm, msgLevel, ( "nameshm1: Client ping: %d, i: %d", *addr, i)); @@ -338,7 +338,7 @@ static void DoClient( void ) if ( PR_FAILURE == rc ) { PR_LOG( lm, msgLevel, - ( "nameshm1: DoClient(): Detach: Error: %ld. OSError: %ld", + ( "nameshm1: DoClient(): Detach: Error: %ld. OSError: %ld", PR_GetError(), PR_GetOSError())); failed_already = 1; return; @@ -350,7 +350,7 @@ static void DoClient( void ) if ( PR_FAILURE == rc ) { PR_LOG( lm, msgLevel, - ( "nameshm1: DoClient(): Close: Error: %ld. OSError: %ld", + ( "nameshm1: DoClient(): Close: Error: %ld. OSError: %ld", PR_GetError(), PR_GetOSError())); failed_already = 1; return; @@ -368,7 +368,7 @@ static void ClientServerTest( void ) PRProcess *proc; PRInt32 exit_status; PRSharedMemory *shm; - PRUint32 *addr; + PRUint32 *addr; PRInt32 i; char *child_argv[8]; char buf[24]; @@ -398,7 +398,7 @@ static void ClientServerTest( void ) ( "nameshm1: Server: Create: success: %p", shm )); addr = PR_AttachSharedMemory( shm , 0 ); - if ( NULL == addr ) + if ( NULL == addr ) { PR_LOG( lm, msgLevel, ( "nameshm1: Server: Attach: Error: %ld. OSError: %ld", PR_GetError(), PR_GetOSError())); @@ -431,7 +431,7 @@ static void ClientServerTest( void ) *addr = 1; for ( i = 0 ; i < optPing ; i++ ) - { + { rc = PR_WaitSemaphore( sem1 ); PR_ASSERT( PR_FAILURE != rc ); @@ -441,7 +441,7 @@ static void ClientServerTest( void ) PR_LOG( lm, msgLevel, ( "nameshm1: Server pong: %d, i: %d", *addr, i)); - + rc = PR_PostSemaphore( sem2 ); PR_ASSERT( PR_FAILURE != rc ); } @@ -465,7 +465,7 @@ static void ClientServerTest( void ) if ( PR_FAILURE == rc ) { PR_LOG( lm, msgLevel, - ( "nameshm1: Server: Detach: Error: %ld. OSError: %ld", + ( "nameshm1: Server: Detach: Error: %ld. OSError: %ld", PR_GetError(), PR_GetOSError())); failed_already = 1; return; @@ -477,7 +477,7 @@ static void ClientServerTest( void ) if ( PR_FAILURE == rc ) { PR_LOG( lm, msgLevel, - ( "nameshm1: Server: Close: Error: %ld. OSError: %ld", + ( "nameshm1: Server: Close: Error: %ld. OSError: %ld", PR_GetError(), PR_GetOSError())); failed_already = 1; return; @@ -489,7 +489,7 @@ static void ClientServerTest( void ) if ( PR_FAILURE == rc ) { PR_LOG( lm, msgLevel, - ( "nameshm1: Server: Destroy: Error: %ld. OSError: %ld", + ( "nameshm1: Server: Destroy: Error: %ld. OSError: %ld", PR_GetError(), PR_GetOSError())); failed_already = 1; return; @@ -545,7 +545,7 @@ int main(int argc, char **argv) } lm = PR_NewLogModule("Test"); /* Initialize logging */ - + PR_LOG( lm, msgLevel, ( "nameshm1: Starting" )); diff --git a/pr/tests/nbconn.c b/pr/tests/nbconn.c index e113a7e1..8ff01efa 100644 --- a/pr/tests/nbconn.c +++ b/pr/tests/nbconn.c @@ -303,7 +303,7 @@ connection_success_test() * Now create a thread to accept a connection */ sp.sp_fd = sockfd; - thr = PR_CreateThread(PR_USER_THREAD, TCP_Server, (void *)&sp, + thr = PR_CreateThread(PR_USER_THREAD, TCP_Server, (void *)&sp, PR_PRIORITY_NORMAL, PR_LOCAL_THREAD, PR_JOINABLE_THREAD, 0); if (thr == NULL) { fprintf(stderr,"Error - PR_CreateThread failed: (%d,%d)\n", diff --git a/pr/tests/nblayer.c b/pr/tests/nblayer.c index 0d9aec42..1b4064bd 100644 --- a/pr/tests/nblayer.c +++ b/pr/tests/nblayer.c @@ -182,7 +182,7 @@ static void PR_CALLBACK Client(void *arg) if (verbosity > quiet) PR_fprintf(logFile, "Client shutting down stack\n"); - + rv = PR_Shutdown(stack, PR_SHUTDOWN_BOTH); PR_ASSERT(PR_SUCCESS == rv); } /* Client */ @@ -217,7 +217,7 @@ static void PR_CALLBACK Server(void *arg) } } while (NULL == service); PR_ASSERT(NULL != service); - + if (verbosity > quiet) PR_fprintf(logFile, "Server accepting connection\n"); diff --git a/pr/tests/nonblock.c b/pr/tests/nonblock.c index ed447a2c..e9d19d18 100644 --- a/pr/tests/nonblock.c +++ b/pr/tests/nonblock.c @@ -198,7 +198,7 @@ static PRIntn PR_CALLBACK RealMain( PRIntn argc, char **argv ) retVal = PR_Recv(sock, buf, sizeof(buf), 0, PR_INTERVAL_NO_TIMEOUT); if (retVal != CHUNK_SIZE) { PL_PrintError("Second Receive:\n"); - fprintf(stderr, "Second PR_Recv: retVal: %ld, Error: %ld\n", + fprintf(stderr, "Second PR_Recv: retVal: %ld, Error: %ld\n", retVal, PR_GetError()); exit(1); } @@ -215,7 +215,7 @@ static PRIntn PR_CALLBACK RealMain( PRIntn argc, char **argv ) int main(int argc, char **argv) { PRIntn rv; - + PR_STDIO_INIT(); rv = PR_Initialize(RealMain, argc, argv, 0); return rv; diff --git a/pr/tests/ntioto.c b/pr/tests/ntioto.c index 7af65944..0686241b 100644 --- a/pr/tests/ntioto.c +++ b/pr/tests/ntioto.c @@ -5,7 +5,7 @@ /* ** File: ntioto.c -** Description: +** Description: ** This test, ntioto.c, was designed to reproduce a bug reported by NES ** on WindowsNT (fibers implementation). NSPR was asserting in ntio.c ** after PR_AcceptRead() had timed out. I/O performed subsequent to the @@ -16,12 +16,12 @@ ** Design: ** This test will fail with an assert in ntio.c if the problem it was ** designed to catch occurs. It returns 0 otherwise. -** +** ** The main() thread initializes and tears things down. A file is ** opened for writing; this file will be written to by AcceptThread() ** and JitterThread(). Main() creates a socket for reading, listens ** and binds the socket. -** +** ** ConnectThread() connects to the socket created by main, then polls ** the "state" variable. When state is AllDone, ConnectThread() exits. ** @@ -36,11 +36,11 @@ ** AcceptThread() and JitterThread() or may take a while. The default ** iteration count, jitter, is set by DEFAULT_JITTER. This may be ** modified at the command line with the -j option. -** +** */ -#include <plgetopt.h> -#include <nspr.h> +#include <plgetopt.h> +#include <nspr.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -97,7 +97,7 @@ static void AcceptThread(void *arg) PRFileDesc *arSock; PRNetAddr *arAddr; - bytesRead = PR_AcceptRead( listenSock, + bytesRead = PR_AcceptRead( listenSock, &arSock, &arAddr, dataBuf, @@ -160,8 +160,8 @@ static void ConnectThread( void *arg ) memset(&serverAddress, 0, sizeof(serverAddress)); rv = PR_InitializeNetAddr(PR_IpAddrLoopback, BASE_PORT, &serverAddress); PR_ASSERT( PR_SUCCESS == rv ); - rv = PR_Connect( clientSock, - &serverAddress, + rv = PR_Connect( clientSock, + &serverAddress, PR_SecondsToInterval(1)); PR_ASSERT( PR_SUCCESS == rv ); diff --git a/pr/tests/obsints.c b/pr/tests/obsints.c index e7a15d9c..30501ad7 100644 --- a/pr/tests/obsints.c +++ b/pr/tests/obsints.c @@ -4,7 +4,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /* - * Test: obsints.c + * Test: obsints.c * * Description: make sure that protypes.h defines the obsolete integer * types intn, uintn, uint, int8, uint8, int16, uint16, int32, uint32, diff --git a/pr/tests/op_2long.c b/pr/tests/op_2long.c index deecf79e..8a6e1c3a 100644 --- a/pr/tests/op_2long.c +++ b/pr/tests/op_2long.c @@ -31,7 +31,7 @@ PRIntn error_code; /* * should exceed any system's maximum file name length * Note: was set at 4096. This is legal on some unix (Linux 2.1+) platforms. - * + * */ #define TOO_LONG 5000 @@ -64,12 +64,12 @@ int main(int argc, char **argv) return 1; } } - + else { printf ("Test passed\n"); return 0; } - -} + +} diff --git a/pr/tests/op_excl.c b/pr/tests/op_excl.c index 4b46891f..630b7637 100644 --- a/pr/tests/op_excl.c +++ b/pr/tests/op_excl.c @@ -13,8 +13,8 @@ ** 27-Oct-1999 lth. Initial version ***********************************************************************/ -#include <plgetopt.h> -#include <nspr.h> +#include <plgetopt.h> +#include <nspr.h> #include <stdio.h> #include <stdlib.h> diff --git a/pr/tests/op_filnf.c b/pr/tests/op_filnf.c index da66a7ac..61c4d497 100644 --- a/pr/tests/op_filnf.c +++ b/pr/tests/op_filnf.c @@ -48,4 +48,4 @@ int main(int argc, char **argv) printf ("opened a file that should not exist\n"); printf ("FAIL\n"); return 1; -} +} diff --git a/pr/tests/op_filok.c b/pr/tests/op_filok.c index 035765a8..f8110cc4 100644 --- a/pr/tests/op_filok.c +++ b/pr/tests/op_filok.c @@ -45,4 +45,4 @@ int main(int argc, char **argv) return 1; } } -} +} diff --git a/pr/tests/op_nofil.c b/pr/tests/op_nofil.c index 0e51c741..2b809672 100644 --- a/pr/tests/op_nofil.c +++ b/pr/tests/op_nofil.c @@ -53,4 +53,4 @@ int main(int argc, char **argv) } printf ("FAIL\n"); return 1; -} +} diff --git a/pr/tests/openfile.c b/pr/tests/openfile.c index d0b664f3..265e0418 100644 --- a/pr/tests/openfile.c +++ b/pr/tests/openfile.c @@ -24,7 +24,7 @@ int main(int argc, char **argv) PRInt32 nbytes; PRFileDesc *fd; - + /* Write in text mode. Let stdio deal with line endings. */ template = fopen(TEMPLATE_FILE_NAME, "w"); fputs("line 1\nline 2\n", template); diff --git a/pr/tests/parent.c b/pr/tests/parent.c index e49af2a9..f1bfc415 100644 --- a/pr/tests/parent.c +++ b/pr/tests/parent.c @@ -118,7 +118,7 @@ int main(int argc, char **argv) PR_DELETE(child); PR_Cleanup(); return test_status; - + } /* main */ /* parent.c */ diff --git a/pr/tests/parsetm.c b/pr/tests/parsetm.c index be1fc491..d4629dd4 100644 --- a/pr/tests/parsetm.c +++ b/pr/tests/parsetm.c @@ -46,7 +46,7 @@ static void PrintExplodedTime(const PRExplodedTime *et) { } hourOffset = totalOffset / 3600; minOffset = (totalOffset % 3600) / 60; - if (debug_mode) + if (debug_mode) printf("%s%02ld%02ld ", sign, hourOffset, minOffset); } diff --git a/pr/tests/perf.c b/pr/tests/perf.c index 91248eb2..8247eaf8 100644 --- a/pr/tests/perf.c +++ b/pr/tests/perf.c @@ -116,7 +116,7 @@ static void CDThread(void) for (i = 0; i < num_threads; i++) { PRThread *t = PR_CreateThread(PR_USER_THREAD, - dull, 0, + dull, 0, PR_PRIORITY_NORMAL, PR_LOCAL_THREAD, PR_UNJOINABLE_THREAD, @@ -190,7 +190,7 @@ static void ContextSwitch(PRThreadScope scope1, PRThreadScope scope2) cxq = 0; t1 = PR_CreateThread(PR_USER_THREAD, - CXReader, 0, + CXReader, 0, PR_PRIORITY_NORMAL, scope1, PR_UNJOINABLE_THREAD, @@ -204,7 +204,7 @@ static void ContextSwitch(PRThreadScope scope1, PRThreadScope scope2) t1)); } t2 = PR_CreateThread(PR_USER_THREAD, - CXWriter, 0, + CXWriter, 0, PR_PRIORITY_NORMAL, scope2, PR_UNJOINABLE_THREAD, @@ -285,8 +285,8 @@ static void SemaContextSwitch(PRThreadScope scope1, PRThreadScope scope2) cxq = 0; t1 = PR_CreateThread(PR_USER_THREAD, - SemaThread, - sem_set1, + SemaThread, + sem_set1, PR_PRIORITY_NORMAL, scope1, PR_UNJOINABLE_THREAD, @@ -300,8 +300,8 @@ static void SemaContextSwitch(PRThreadScope scope1, PRThreadScope scope2) t1)); } t2 = PR_CreateThread(PR_USER_THREAD, - SemaThread, - sem_set2, + SemaThread, + sem_set2, PR_PRIORITY_NORMAL, scope2, PR_UNJOINABLE_THREAD, @@ -383,7 +383,7 @@ int main(int argc, char **argv) PL_DestroyOptState(opt); if (0 == count) count = DEFAULT_COUNT; - + PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0); PR_BlockClockInterrupts(); PR_UnblockClockInterrupts(); diff --git a/pr/tests/poll_er.c b/pr/tests/poll_er.c index 5f7ec2e5..7c204dc8 100755 --- a/pr/tests/poll_er.c +++ b/pr/tests/poll_er.c @@ -87,7 +87,7 @@ int main(int argc, char **argv) PL_DestroyOptState(opt); /* main test */ - + PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0); PR_STDIO_INIT(); @@ -124,7 +124,7 @@ int main(int argc, char **argv) if ((listenSock2 = PR_NewTCPSocket()) == NULL) { fprintf(stderr, "Can't create a new TCP socket\n"); - failed_already=1; + failed_already=1; goto exit_now; } addr.inet.family = AF_INET; @@ -132,18 +132,18 @@ int main(int argc, char **argv) addr.inet.port = PR_htons(0); if (PR_Bind(listenSock2, &addr) == PR_FAILURE) { fprintf(stderr, "Can't bind socket\n"); - failed_already=1; + failed_already=1; goto exit_now; } if (PR_GetSockName(listenSock2, &addr) == PR_FAILURE) { fprintf(stderr, "PR_GetSockName failed\n"); - failed_already=1; + failed_already=1; goto exit_now; } listenPort2 = PR_ntohs(addr.inet.port); if (PR_Listen(listenSock2, 5) == PR_FAILURE) { fprintf(stderr, "Can't listen on a socket\n"); - failed_already=1; + failed_already=1; goto exit_now; } PR_snprintf(buf, sizeof(buf), @@ -185,14 +185,14 @@ int main(int argc, char **argv) fprintf(stderr, "Failed to detect the bad fd: " "PR_Poll returns %d, out_flags is 0x%hx\n", retVal, pds[2].out_flags); - failed_already=1; + failed_already=1; goto exit_now; } if (debug_mode) printf("PR_Poll detected the bad fd. Test passed.\n\n"); PR_Cleanup(); goto exit_now; exit_now: - if(failed_already) + if(failed_already) return 1; else return 0; diff --git a/pr/tests/poll_nm.c b/pr/tests/poll_nm.c index 4842606f..59a24864 100644 --- a/pr/tests/poll_nm.c +++ b/pr/tests/poll_nm.c @@ -64,7 +64,7 @@ clientThreadFunc(void *arg) for (i = 0; i < NUM_ITERATIONS; i++) { sock = PR_NewTCPSocket(); PR_ASSERT(sock != NULL); - + sts = PR_Connect(sock, &addr, PR_INTERVAL_NO_TIMEOUT); PR_ASSERT(sts == PR_SUCCESS); @@ -112,7 +112,7 @@ int main(int argc, char **argv) PL_DestroyOptState(opt); /* main test */ - + PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0); PR_STDIO_INIT(); @@ -153,7 +153,7 @@ int main(int argc, char **argv) if ((listenSock2 = PR_NewTCPSocket()) == NULL) { fprintf(stderr, "Can't create a new TCP socket\n"); - failed_already=1; + failed_already=1; goto exit_now; } addr.inet.family = PR_AF_INET; @@ -161,19 +161,19 @@ int main(int argc, char **argv) addr.inet.port = PR_htons(0); if (PR_Bind(listenSock2, &addr) == PR_FAILURE) { fprintf(stderr, "Can't bind socket\n"); - failed_already=1; + failed_already=1; goto exit_now; } if (PR_GetSockName(listenSock2, &addr) == PR_FAILURE) { fprintf(stderr, "PR_GetSockName failed\n"); - failed_already=1; + failed_already=1; goto exit_now; } listenPort2 = PR_ntohs(addr.inet.port); PR_SetSocketOption(listenSock2, &optval); if (PR_Listen(listenSock2, 5) == PR_FAILURE) { fprintf(stderr, "Can't listen on a socket\n"); - failed_already=1; + failed_already=1; goto exit_now; } PR_snprintf(buf, sizeof(buf), @@ -201,7 +201,7 @@ int main(int argc, char **argv) PR_UNJOINABLE_THREAD, 0); if (clientThread == NULL) { fprintf(stderr, "can't create thread\n"); - failed_already=1; + failed_already=1; goto exit_now; } @@ -211,7 +211,7 @@ int main(int argc, char **argv) PR_UNJOINABLE_THREAD, 0); if (clientThread == NULL) { fprintf(stderr, "can't create thread\n"); - failed_already=1; + failed_already=1; goto exit_now; } @@ -234,7 +234,7 @@ int main(int argc, char **argv) PR_ASSERT(retVal != 0); /* no timeout */ if (retVal == -1) { fprintf(stderr, "PR_Poll failed\n"); - failed_already=1; + failed_already=1; goto exit_now; } @@ -251,7 +251,7 @@ int main(int argc, char **argv) sock = PR_Accept(pds[j].fd, NULL, PR_INTERVAL_NO_TIMEOUT); if (sock == NULL) { fprintf(stderr, "PR_Accept() failed\n"); - failed_already=1; + failed_already=1; goto exit_now; } other_pds[nextIndex].fd = sock; @@ -259,12 +259,12 @@ int main(int argc, char **argv) nextIndex++; } else if (pds[j].out_flags & PR_POLL_ERR) { fprintf(stderr, "PR_Poll() indicates that an fd has error\n"); - failed_already=1; + failed_already=1; goto exit_now; } else if (pds[j].out_flags & PR_POLL_NVAL) { fprintf(stderr, "PR_Poll() indicates that fd %d is invalid\n", PR_FileDesc2NativeHandle(pds[j].fd)); - failed_already=1; + failed_already=1; goto exit_now; } } @@ -292,7 +292,7 @@ int main(int argc, char **argv) PR_ASSERT(nAvail == nRead); if (nRead == -1) { fprintf(stderr, "PR_Read() failed\n"); - failed_already=1; + failed_already=1; goto exit_now; } else if (nRead == 0) { PR_Close(pds[j].fd); @@ -304,11 +304,11 @@ int main(int argc, char **argv) } } else if (pds[j].out_flags & PR_POLL_ERR) { fprintf(stderr, "PR_Poll() indicates that an fd has error\n"); - failed_already=1; + failed_already=1; goto exit_now; } else if (pds[j].out_flags & PR_POLL_NVAL) { fprintf(stderr, "PR_Poll() indicates that an fd is invalid\n"); - failed_already=1; + failed_already=1; goto exit_now; } other_pds[nextIndex] = pds[j]; @@ -336,8 +336,8 @@ exit_now: } PR_Cleanup(); - - if(failed_already) + + if(failed_already) return 1; else return 0; diff --git a/pr/tests/poll_to.c b/pr/tests/poll_to.c index 40d1a261..b1af515d 100644 --- a/pr/tests/poll_to.c +++ b/pr/tests/poll_to.c @@ -74,7 +74,7 @@ int main(int argc, char **argv) PL_DestroyOptState(opt); /* main test */ - + PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0); PR_STDIO_INIT(); @@ -112,7 +112,7 @@ int main(int argc, char **argv) if ((listenSock2 = PR_NewTCPSocket()) == NULL) { fprintf(stderr, "Can't create a new TCP socket\n"); - if (!debug_mode) failed_already=1; + if (!debug_mode) failed_already=1; goto exit_now; } addr.inet.family = PR_AF_INET; @@ -120,18 +120,18 @@ int main(int argc, char **argv) addr.inet.port = PR_htons(0); if (PR_Bind(listenSock2, &addr) == PR_FAILURE) { fprintf(stderr, "Can't bind socket\n"); - if (!debug_mode) failed_already=1; + if (!debug_mode) failed_already=1; goto exit_now; } if (PR_GetSockName(listenSock2, &addr) == PR_FAILURE) { fprintf(stderr, "PR_GetSockName failed\n"); - if (!debug_mode) failed_already=1; + if (!debug_mode) failed_already=1; goto exit_now; } listenPort2 = PR_ntohs(addr.inet.port); if (PR_Listen(listenSock2, 5) == PR_FAILURE) { fprintf(stderr, "Can't listen on a socket\n"); - if (!debug_mode) failed_already=1; + if (!debug_mode) failed_already=1; goto exit_now; } PR_snprintf(buf, sizeof(buf), @@ -157,7 +157,7 @@ int main(int argc, char **argv) "PR_Poll should time out and return 0, but it returns %ld\n", retVal); fprintf(stderr, "%s", buf); - if (!debug_mode) failed_already=1; + if (!debug_mode) failed_already=1; goto exit_now; } if (debug_mode) printf("PR_Poll timed out. Test passed.\n\n"); @@ -173,7 +173,7 @@ exit_now: PR_Cleanup(); - if(failed_already) + if(failed_already) return 1; else return 0; diff --git a/pr/tests/prftest1.c b/pr/tests/prftest1.c index 0e9ca49f..83e7c103 100644 --- a/pr/tests/prftest1.c +++ b/pr/tests/prftest1.c @@ -14,7 +14,7 @@ ** The debug mode will print all of the printfs associated with this test. ** The regress mode will be the default mode. Since the regress tool limits ** the output to a one line status:PASS or FAIL,all of the printf statements -** have been handled with an if (debug_mode) statement. +** have been handled with an if (debug_mode) statement. ***********************************************************************/ /*********************************************************************** ** Includes @@ -39,12 +39,12 @@ ** OUTPUTS: None ** RETURN: None ** SIDE EFFECTS: -** +** ** RESTRICTIONS: ** None ** MEMORY: NA ** ALGORITHM: Determine what the status is and print accordingly. -** +** ***********************************************************************/ @@ -90,7 +90,7 @@ int main(int argc, char **argv) /* main test */ PR_STDIO_INIT(); - + i16 = -1; n = -1; i32 = -1; diff --git a/pr/tests/prftest2.c b/pr/tests/prftest2.c index 6a62a260..4ab7eb32 100644 --- a/pr/tests/prftest2.c +++ b/pr/tests/prftest2.c @@ -66,7 +66,7 @@ int main(int argc, char **argv) PL_DestroyOptState(opt); /* main test */ - + PR_STDIO_INIT(); i16 = -32; diff --git a/pr/tests/provider.c b/pr/tests/provider.c index 75c7168a..bb5dd329 100644 --- a/pr/tests/provider.c +++ b/pr/tests/provider.c @@ -23,7 +23,7 @@ * The debug mode will print all of the printfs associated with this test. * The regress mode will be the default mode. Since the regress tool limits * the output to a one line status:PASS or FAIL,all of the printf statements - * have been handled with an if (debug_mode) statement. + * have been handled with an if (debug_mode) statement. */ #include "prclist.h" @@ -230,7 +230,7 @@ static void PR_CALLBACK Client(void *arg) PRInt32 bytes, descbytes, filebytes, netbytes; (void)PR_NetAddrToString(&client->serverAddress, buffer, sizeof(buffer)); - TEST_LOG(cltsrv_log_file, TEST_LOG_INFO, + TEST_LOG(cltsrv_log_file, TEST_LOG_INFO, ("\tClient(0x%p): connecting to server at %s\n", me, buffer)); fd = PR_Socket(domain, SOCK_STREAM, protocol); @@ -406,7 +406,7 @@ static PRStatus ProcessRequest(PRFileDesc *fd, CSServer_t *server) TEST_ASSERT(sizeof(*descriptor) == bytes); TEST_LOG( - cltsrv_log_file, TEST_LOG_VERBOSE, + cltsrv_log_file, TEST_LOG_VERBOSE, ("\t\tProcessRequest(0x%p): read descriptor {%d, %s}\n", me, descbytes, descriptor->filename)); @@ -569,7 +569,7 @@ static PRStatus ProcessRequest(PRFileDesc *fd, CSServer_t *server) } TEST_ASSERT(bytes > 0); } - + PR_Lock(server->ml); server->bytesTransferred += filebytes; PR_Unlock(server->ml); @@ -657,7 +657,7 @@ static PRStatus JoinThread(PRThread *thread) rv = PR_FAILURE; break; } - return rv; + return rv; } /* JoinThread */ static PRStatus NewThread( @@ -715,14 +715,14 @@ static PRStatus NewThread( #if defined(WIN32) { void *th; - PRUintn id; + PRUintn id; StartObject *start_object; start_object = PR_NEW(StartObject); PR_ASSERT(NULL != start_object); start_object->start = start; start_object->arg = arg; th = (void*)_beginthreadex( - NULL, /* LPSECURITY_ATTRIBUTES - pointer to thread security attributes */ + NULL, /* LPSECURITY_ATTRIBUTES - pointer to thread security attributes */ 0U, /* DWORD - initial thread stack size, in bytes */ windows_start, /* LPTHREAD_START_ROUTINE - pointer to thread function */ start_object, /* LPVOID - argument for new thread */ @@ -753,7 +753,7 @@ static PRStatus CreateWorker(CSServer_t *server, CSPool_t *pool) Worker, worker, DEFAULT_SERVER_PRIORITY, PR_UNJOINABLE_THREAD); if (PR_FAILURE == rv) PR_DELETE(worker); - TEST_LOG(cltsrv_log_file, TEST_LOG_STATUS, + TEST_LOG(cltsrv_log_file, TEST_LOG_STATUS, ("\tCreateWorker(0x%p): create new worker (0x%p)\n", PR_GetCurrentThread(), worker->thread)); @@ -796,7 +796,7 @@ static void PR_CALLBACK Worker(void *arg) me, (Aborted(rv) ? "interrupted" : "stopped"))); goto exit; } - } + } pool->accepting += 1; /* how many are really in accept */ PR_Unlock(server->ml); @@ -805,7 +805,7 @@ static void PR_CALLBACK Worker(void *arg) ("\t\tWorker(0x%p): calling accept\n", me)); fd = PR_Accept(server->listener, &from, PR_INTERVAL_NO_TIMEOUT); - PR_Lock(server->ml); + PR_Lock(server->ml); pool->accepting -= 1; PR_NotifyCondVar(pool->acceptComplete); @@ -852,7 +852,7 @@ static void PR_CALLBACK Worker(void *arg) } exit: - PR_ClearInterrupt(); + PR_ClearInterrupt(); PR_Unlock(server->ml); if (NULL != fd) @@ -984,7 +984,7 @@ static void PR_CALLBACK Server(void *arg) static void WaitForCompletion(PRIntn execution) { while (execution > 0) - { + { PRIntn dally = (execution > 30) ? 30 : execution; PR_Sleep(PR_SecondsToInterval(dally)); if (pthread_stats) PT_FPrintStats(debug_out, "\nPThread Statistics\n"); @@ -1190,7 +1190,7 @@ int main(int argc, char **argv) cltsrv_log_file, TEST_LOG_VERBOSE, ("main(0x%p): creating %d client threads\n", PR_GetCurrentThread(), clients)); - + if (!serverIsLocal) { rv = PR_GetHostByName(serverName, buffer, BUFFER_SIZE, &host); @@ -1244,7 +1244,7 @@ int main(int argc, char **argv) { for (index = 0; index < clients; ++index) { - TEST_LOG(cltsrv_log_file, TEST_LOG_STATUS, + TEST_LOG(cltsrv_log_file, TEST_LOG_STATUS, ("main(0x%p): notifying client(0x%p) to stop\n", PR_GetCurrentThread(), client[index].thread)); @@ -1259,7 +1259,7 @@ int main(int argc, char **argv) } PR_Unlock(client[index].ml); - TEST_LOG(cltsrv_log_file, TEST_LOG_VERBOSE, + TEST_LOG(cltsrv_log_file, TEST_LOG_VERBOSE, ("main(0x%p): joining client(0x%p)\n", PR_GetCurrentThread(), client[index].thread)); @@ -1275,7 +1275,7 @@ int main(int argc, char **argv) { /* All clients joined - retrieve the server */ TEST_LOG( - cltsrv_log_file, TEST_LOG_NOTICE, + cltsrv_log_file, TEST_LOG_NOTICE, ("main(0x%p): notifying server(0x%p) to stop\n", PR_GetCurrentThread(), server->thread)); @@ -1287,7 +1287,7 @@ int main(int argc, char **argv) PR_Unlock(server->ml); TEST_LOG( - cltsrv_log_file, TEST_LOG_NOTICE, + cltsrv_log_file, TEST_LOG_NOTICE, ("main(0x%p): joining server(0x%p)\n", PR_GetCurrentThread(), server->thread)); joinStatus = JoinThread(server->thread); @@ -1301,7 +1301,7 @@ int main(int argc, char **argv) } TEST_LOG( - cltsrv_log_file, TEST_LOG_ALWAYS, + cltsrv_log_file, TEST_LOG_ALWAYS, ("main(0x%p): test complete\n", PR_GetCurrentThread())); if (thread_provider == thread_win32) diff --git a/pr/tests/prpollml.c b/pr/tests/prpollml.c index cef22052..82194f5f 100644 --- a/pr/tests/prpollml.c +++ b/pr/tests/prpollml.c @@ -43,7 +43,7 @@ static void Test(void) for (i = POLL_DESC_COUNT; i >= 1; i--) { rv = PR_Poll(pd, i, timeout); if (rv != 0) { - fprintf(stderr, "PR_Poll should time out but returns %d\n", + fprintf(stderr, "PR_Poll should time out but returns %d\n", (int) rv); exit(1); } @@ -85,7 +85,7 @@ int main(int argc, char **argv) (int) PR_GetError(), (int) PR_GetOSError()); exit(1); } - + pd[i].fd = sock; pd[i].in_flags = PR_POLL_READ; } diff --git a/pr/tests/prselect.c b/pr/tests/prselect.c index 15aa8558..9006fe4c 100644 --- a/pr/tests/prselect.c +++ b/pr/tests/prselect.c @@ -15,7 +15,7 @@ ** The debug mode will print all of the printfs associated with this test. ** The regress mode will be the default mode. Since the regress tool limits ** the output to a one line status:PASS or FAIL,all of the printf statements -** have been handled with an if (debug_mode) statement. +** have been handled with an if (debug_mode) statement. ***********************************************************************/ /*********************************************************************** @@ -45,12 +45,12 @@ ** OUTPUTS: None ** RETURN: None ** SIDE EFFECTS: -** +** ** RESTRICTIONS: ** None ** MEMORY: NA ** ALGORITHM: Determine what the status is and print accordingly. -** +** ***********************************************************************/ @@ -121,7 +121,7 @@ int main(int argc, char **argv) PL_DestroyOptState(opt); /* main test */ - + PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0); PR_STDIO_INIT(); diff --git a/pr/tests/randseed.c b/pr/tests/randseed.c index 45871777..1b655eab 100644 --- a/pr/tests/randseed.c +++ b/pr/tests/randseed.c @@ -5,17 +5,17 @@ /* ** File: rngseed.c -** Description: +** Description: ** Test NSPR's Random Number Seed generator ** ** Initial test: Just make sure it outputs some data. -** +** ** ... more? ... check some iterations to ensure it is random (no dupes) ** ... more? ... histogram distribution of random numbers */ #include "plgetopt.h" -#include "nspr.h" +#include "nspr.h" #include "prrng.h" #include <stdio.h> #include <stdlib.h> @@ -55,22 +55,22 @@ static void PrintRand( void *buf, PRIntn size ) switch( size ) { case 1 : printf("%2.2X\n", *(rp++) ); - size -= 4; + size -= 4; break; case 2 : printf("%4.4X\n", *(rp++) ); - size -= 4; + size -= 4; break; case 3 : printf("%6.6X\n", *(rp++) ); - size -= 4; + size -= 4; break; default: while ( size >= 4) { PRIntn i = 3; do { printf("%8.8X ", *(rp++) ); - size -= 4; + size -= 4; } while( i-- ); i = 3; printf("\n"); diff --git a/pr/tests/ranfile.c b/pr/tests/ranfile.c index 08a4a98b..a62fc1a5 100644 --- a/pr/tests/ranfile.c +++ b/pr/tests/ranfile.c @@ -284,7 +284,7 @@ int main(int argc, char **argv) PL_DestroyOptState(opt); /* main test */ - + PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0); PR_STDIO_INIT(); @@ -355,9 +355,9 @@ int main(int argc, char **argv) duration = PR_IntervalToMilliseconds( PR_IntervalNow() - hammer[poll].timein); writes = hammer[poll].writes * 1000 / duration; - if (writes < writesMin) + if (writes < writesMin) writesMin = writes; - if (writes > writesMax) + if (writes > writesMax) writesMax = writes; writesTot += hammer[poll].writes; durationTot += duration; @@ -377,7 +377,7 @@ int main(int argc, char **argv) PR_DestroyCondVar(cv); PR_DestroyLock(ml); - if (failed_already) + if (failed_already) { printf("FAIL\n"); return 1; diff --git a/pr/tests/rmdir.c b/pr/tests/rmdir.c index e0c1eac8..3e6feda9 100644 --- a/pr/tests/rmdir.c +++ b/pr/tests/rmdir.c @@ -5,9 +5,9 @@ /* ** File: rmdir.c -** Description: Demonstrate bugzilla 80884. +** Description: Demonstrate bugzilla 80884. ** -** after fix to unix_errors.c, message should report correct +** after fix to unix_errors.c, message should report correct ** failure of PR_Rmdir(). ** ** @@ -70,7 +70,7 @@ int main(int argc, char **argv) failed_already = PR_TRUE; goto Finished; } - + PR_Close(fd); if (PR_RmDir( DIRNAME ) == PR_SUCCESS) { @@ -78,7 +78,7 @@ int main(int argc, char **argv) failed_already = PR_TRUE; goto Finished; } - + err = PR_GetError(); fprintf(stderr, "remove directory fails with: %d: %s\n", err, PR_ErrorToString(err, PR_LANGUAGE_I_DEFAULT)); diff --git a/pr/tests/rwlocktest.c b/pr/tests/rwlocktest.c index d9368a4c..7b312ad9 100644 --- a/pr/tests/rwlocktest.c +++ b/pr/tests/rwlocktest.c @@ -15,9 +15,9 @@ * Each one of the threads acquires a read lock to verify that the sum of * the arrays A and B is equal to array C, and acquires a write lock to * consistently update arrays A and B so that their is equal to array C. - * + * */ - + #include "nspr.h" #include "plgetopt.h" #include "prrwlock.h" @@ -145,13 +145,13 @@ int main(int argc, char **argv) PR_DELETE(threads); PR_DELETE(params); - PR_DELETE(array_A); - PR_DELETE(array_B); - PR_DELETE(array_C); + PR_DELETE(array_A); + PR_DELETE(array_B); + PR_DELETE(array_C); PR_DestroyRWLock(rwlock1); - + printf("PASS\n"); return 0; } diff --git a/pr/tests/sel_spd.c b/pr/tests/sel_spd.c index 10d49786..c0210ad2 100644 --- a/pr/tests/sel_spd.c +++ b/pr/tests/sel_spd.c @@ -99,7 +99,7 @@ _server_thread(void *arg_id) read_done, write_done, close_done; - + #ifdef DEBUG fprintf(stdout, "server thread %d alive\n", *id); @@ -141,12 +141,12 @@ _server_thread(void *arg_id) } /* Tell the client to start */ - if ( (thread = PR_CreateThread(PR_USER_THREAD, - _client_thread, - id, - PR_PRIORITY_NORMAL, - scope2, - PR_UNJOINABLE_THREAD, + if ( (thread = PR_CreateThread(PR_USER_THREAD, + _client_thread, + id, + PR_PRIORITY_NORMAL, + scope2, + PR_UNJOINABLE_THREAD, 0)) == NULL) fprintf(stderr, "Error creating client thread %d\n", *id); @@ -170,7 +170,7 @@ _server_thread(void *arg_id) connect_done = PR_IntervalNow(); - + if ( _readn(newsock, data_buffer, _client_data) < _client_data) { fprintf(stderr, "Error reading client data for iteration %d in server thread %d\n", index, *id ); goto done; @@ -251,7 +251,7 @@ _client_thread(void *arg_id) memset(&sa, 0 , sizeof(sa)); rv = PR_InitializeNetAddr(PR_IpAddrLoopback, PORT_BASE + *id, &sa); PR_ASSERT(PR_SUCCESS == rv); - + for (index = 0; index< _iterations; index++) { #ifdef DEBUG @@ -331,16 +331,16 @@ void do_work(void) *id = index; - if ( (thread = PR_CreateThread(PR_USER_THREAD, - _server_thread, - id, - PR_PRIORITY_NORMAL, - scope1, - PR_UNJOINABLE_THREAD, + if ( (thread = PR_CreateThread(PR_USER_THREAD, + _server_thread, + id, + PR_PRIORITY_NORMAL, + scope1, + PR_UNJOINABLE_THREAD, 0)) == NULL) fprintf(stderr, "Error creating server thread %d\n", index); } - + PR_EnterMonitor(exit_cv); while (_thread_exit_count > 0) PR_Wait(exit_cv, PR_INTERVAL_NO_TIMEOUT); @@ -422,7 +422,7 @@ int main(int argc, char **argv) case 'v': verbose = 1; break; - default: + default: break; } } @@ -431,14 +431,14 @@ int main(int argc, char **argv) PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0); PR_STDIO_INIT(); - fprintf(stdout, "Running test for %d iterations with %d simultaneous threads.\n", + fprintf(stdout, "Running test for %d iterations with %d simultaneous threads.\n", _iterations, _threads); - fprintf(stdout, "\tWill send %d bytes of client data and %d bytes of server data\n", + fprintf(stdout, "\tWill send %d bytes of client data and %d bytes of server data\n", _client_data, _server_data); - if ( (exit_cv = PR_NewMonitor()) == NULL) + if ( (exit_cv = PR_NewMonitor()) == NULL) fprintf(stderr, "Error creating monitor for exit cv\n"); - if ( (timer_data = (timer_slot_t *)PR_Malloc(2*_threads * sizeof(timer_slot_t))) == NULL) + if ( (timer_data = (timer_slot_t *)PR_Malloc(2*_threads * sizeof(timer_slot_t))) == NULL) fprintf(stderr, "error allocating thread time results array\n"); memset(timer_data, 0 , 2*_threads*sizeof(timer_slot_t)); diff --git a/pr/tests/selct_er.c b/pr/tests/selct_er.c index 8df259fd..70007f1e 100755 --- a/pr/tests/selct_er.c +++ b/pr/tests/selct_er.c @@ -71,7 +71,7 @@ int main(int argc, char **argv) PL_DestroyOptState(opt); /* main test */ - + PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0); PR_STDIO_INIT(); @@ -181,7 +181,7 @@ int main(int argc, char **argv) PR_Cleanup(); goto exit_now; exit_now: - if(failed_already) + if(failed_already) return 1; else return 0; diff --git a/pr/tests/selct_nm.c b/pr/tests/selct_nm.c index 1b54c2af..663f3b8c 100644 --- a/pr/tests/selct_nm.c +++ b/pr/tests/selct_nm.c @@ -100,7 +100,7 @@ int main(int argc, char **argv) PL_DestroyOptState(opt); /* main test */ - + PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0); PR_STDIO_INIT(); @@ -277,7 +277,7 @@ failed_already=1; PR_Cleanup(); goto exit_now; exit_now: - if(failed_already) + if(failed_already) return 1; else return 0; diff --git a/pr/tests/selct_to.c b/pr/tests/selct_to.c index be0fb9e0..950579ed 100644 --- a/pr/tests/selct_to.c +++ b/pr/tests/selct_to.c @@ -75,7 +75,7 @@ int main(int argc, char **argv) PL_DestroyOptState(opt); /* main test */ - + PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0); PR_STDIO_INIT(); @@ -165,7 +165,7 @@ int main(int argc, char **argv) PR_Cleanup(); exit_now: - if(failed_already) + if(failed_already) return 1; else return 0; diff --git a/pr/tests/select2.c b/pr/tests/select2.c index d82bb1ef..d20f94ef 100644 --- a/pr/tests/select2.c +++ b/pr/tests/select2.c @@ -14,7 +14,7 @@ ** The debug mode will print all of the printfs associated with this test. ** The regress mode will be the default mode. Since the regress tool limits ** the output to a one line status:PASS or FAIL,all of the printf statements -** have been handled with an if (debug_mode) statement. +** have been handled with an if (debug_mode) statement. ***********************************************************************/ /*********************************************************************** @@ -45,12 +45,12 @@ PRInt32 count; ** OUTPUTS: None ** RETURN: None ** SIDE EFFECTS: -** +** ** RESTRICTIONS: ** None ** MEMORY: NA ** ALGORITHM: Determine what the status is and print accordingly. -** +** ***********************************************************************/ @@ -129,9 +129,9 @@ static void PRSelectTest(void) loops++; - if (debug_mode) printf("Going into accept\n"); + if (debug_mode) printf("Going into accept\n"); - newSock = PR_Accept(listenSocket, + newSock = PR_Accept(listenSocket, &rAddr, PR_INTERVAL_NO_TIMEOUT); @@ -210,7 +210,7 @@ static void NativeSelectTest(void) loops++; - if (debug_mode) printf("Going into accept\n"); + if (debug_mode) printf("Going into accept\n"); newSock = PR_Accept(listenSocket, &rAddr, PR_INTERVAL_NO_TIMEOUT); @@ -274,7 +274,7 @@ static void Measure(void (*func)(void), const char *msg) int main(int argc, char **argv) { - + /* The command line argument: -d is used to determine if the test is being run in debug mode. The regress tool requires only one line output:PASS or FAIL. All of the printfs associated with this test has been handled with a if (debug_mode) @@ -298,7 +298,7 @@ int main(int argc, char **argv) PL_DestroyOptState(opt); /* main test */ - + PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0); PR_STDIO_INIT(); diff --git a/pr/tests/sem.c b/pr/tests/sem.c index ec7bb6e2..7610b740 100644 --- a/pr/tests/sem.c +++ b/pr/tests/sem.c @@ -35,8 +35,8 @@ PRIntn failed_already=0; PRIntn debug_mode; -/* - Since we don't have stdin, stdout everywhere, we will fake +/* + Since we don't have stdin, stdout everywhere, we will fake it with our in-memory buffers called stdin and stdout. */ @@ -55,7 +55,7 @@ static PRStatus finalResult = PR_SUCCESS; static size_t dread (PRUintn device, char *buf, size_t bufSize) { PRUintn i; - + /* during first read call, initialize the stdinBuf buffer*/ if (stdinBufIdx == 0) { for (i=0; i<SBSIZE; i++) @@ -75,7 +75,7 @@ static size_t dread (PRUintn device, char *buf, size_t bufSize) static size_t dwrite (PRUintn device, char *buf, size_t bufSize) { PRUintn i, j; - + /* copy data from the given buffer upto bufSize to stdoutBuf */ for (i=0; i<bufSize; i++) { if (stdoutBufIdx == SBSIZE) @@ -97,8 +97,8 @@ static size_t dwrite (PRUintn device, char *buf, size_t bufSize) /*------------------ Following is the real test program ---------*/ /* Program to copy standard input to standard output. The program - uses two threads. One reads the input and puts the data in a - double buffer. The other reads the buffer contents and writes + uses two threads. One reads the input and puts the data in a + double buffer. The other reads the buffer contents and writes it to standard output. */ @@ -116,7 +116,7 @@ static void PR_CALLBACK reader(void *arg) { PRUintn i = 0; size_t nbytes; - + do { (void) PR_WaitSem(emptyBufs); nbytes = dread(0, buf[i].data, BSIZE); @@ -130,7 +130,7 @@ static void writer(void) { PRUintn i = 0; size_t nbytes; - + do { (void) PR_WaitSem(fullBufs); nbytes = buf[i].nbytes; @@ -171,7 +171,7 @@ int main(int argc, char **argv) } } PL_DestroyOptState(opt); - } + } /* main test */ @@ -180,9 +180,9 @@ int main(int argc, char **argv) fullBufs = PR_NewSem(0); /* zero full buffers */ /* create the reader thread */ - + r = PR_CreateThread(PR_USER_THREAD, - reader, 0, + reader, 0, PR_PRIORITY_NORMAL, PR_LOCAL_THREAD, PR_UNJOINABLE_THREAD, @@ -202,7 +202,7 @@ int main(int argc, char **argv) failed_already=1; } PR_Cleanup(); - if(failed_already) + if(failed_already) return 1; else return 0; diff --git a/pr/tests/semaerr1.c b/pr/tests/semaerr1.c index f56a97ee..0d839371 100644 --- a/pr/tests/semaerr1.c +++ b/pr/tests/semaerr1.c @@ -59,7 +59,7 @@ int main(int argc, char **argv) fprintf(stderr, "PR_DeleteSemaphore failed\n"); exit(1); } - + /* * Opening an existing semaphore with PR_SEM_CREATE|PR_SEM_EXCL. * should fail with PR_FILE_EXISTS_ERROR. diff --git a/pr/tests/sendzlf.c b/pr/tests/sendzlf.c index 0f3df3f7..8b4b5680 100644 --- a/pr/tests/sendzlf.c +++ b/pr/tests/sendzlf.c @@ -4,7 +4,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /* - * Test: sendzlf.c + * Test: sendzlf.c * * Description: send a zero-length file with PR_SendFile and * PR_TransmitFile. diff --git a/pr/tests/server_test.c b/pr/tests/server_test.c index b1750ec2..3840c828 100644 --- a/pr/tests/server_test.c +++ b/pr/tests/server_test.c @@ -8,7 +8,7 @@ ** This server simulates a server running in loopback mode. ** ** The idea is that a single server is created. The server initially creates -** a number of worker threads. Then, with the server running, a number of +** a number of worker threads. Then, with the server running, a number of ** clients are created which start requesting service from the server. ** ** @@ -17,7 +17,7 @@ ** The debug mode will print all of the printfs associated with this test. ** The regress mode will be the default mode. Since the regress tool limits ** the output to a one line status:PASS or FAIL,all of the printf statements -** have been handled with an if (debug_mode) statement. +** have been handled with an if (debug_mode) statement. ***********************************************************************/ /*********************************************************************** @@ -73,12 +73,12 @@ PRCondVar *ServerStateCV; ** OUTPUTS: None ** RETURN: None ** SIDE EFFECTS: -** +** ** RESTRICTIONS: ** None ** MEMORY: NA ** ALGORITHM: Determine what the status is and print accordingly. -** +** ***********************************************************************/ @@ -126,7 +126,7 @@ WaitServerState(char *waiter, PRInt32 state) PR_WaitCondVar(ServerStateCV, PR_INTERVAL_NO_TIMEOUT); rv = ServerState; - if (debug_mode) DPRINTF("\t%s resuming from wait for state %d; state now %d\n", + if (debug_mode) DPRINTF("\t%s resuming from wait for state %d; state now %d\n", waiter, state, ServerState); PR_Unlock(ServerStateCVLock); @@ -170,7 +170,7 @@ WorkerThreadFunc(void *_listenSock) if (debug_mode) DPRINTF("\tServer thread going into accept\n"); - bytesRead = PR_AcceptRead(listenSock, + bytesRead = PR_AcceptRead(listenSock, &newSock, &rAddr, dataBuf, @@ -183,7 +183,7 @@ WorkerThreadFunc(void *_listenSock) } if (debug_mode) DPRINTF("\tServer accepted connection (%d bytes)\n", bytesRead); - + PR_AtomicIncrement(&workerThreadsBusy); if (workerThreadsBusy == workerThreads) { PR_Lock(workerThreadsLock); @@ -208,13 +208,13 @@ WorkerThreadFunc(void *_listenSock) } PR_Unlock(workerThreadsLock); } - + bytesToRead -= bytesRead; while (bytesToRead) { - bytesRead = PR_Recv(newSock, - dataBuf, - bytesToRead, - 0, + bytesRead = PR_Recv(newSock, + dataBuf, + bytesToRead, + 0, PR_INTERVAL_NO_TIMEOUT); if (bytesRead < 0) { if (debug_mode) printf("\tServer error receiving data (%d)\n", bytesRead); @@ -224,16 +224,16 @@ WorkerThreadFunc(void *_listenSock) } bytesWritten = PR_Send(newSock, - sendBuf, - bytesToWrite, - 0, + sendBuf, + bytesToWrite, + 0, PR_INTERVAL_NO_TIMEOUT); if (bytesWritten != _server_data) { - if (debug_mode) printf("\tError sending data to client (%d, %d)\n", + if (debug_mode) printf("\tError sending data to client (%d, %d)\n", bytesWritten, PR_GetOSError()); } else { if (debug_mode) DPRINTF("\tServer sent %d bytes\n", bytesWritten); - } + } PR_Close(newSock); PR_AtomicDecrement(&workerThreadsBusy); @@ -380,7 +380,7 @@ ClientThreadFunc(void *unused) if (debug_mode) DPRINTF("\tClient connecting\n"); - rv = PR_Connect(clientSocket, + rv = PR_Connect(clientSocket, &serverAddr, PR_INTERVAL_NO_TIMEOUT); if (!clientSocket) { @@ -390,10 +390,10 @@ ClientThreadFunc(void *unused) if (debug_mode) DPRINTF("\tClient connected\n"); - rv = PR_Send(clientSocket, - sendBuf, - _client_data, - 0, + rv = PR_Send(clientSocket, + sendBuf, + _client_data, + 0, PR_INTERVAL_NO_TIMEOUT); if (rv != _client_data) { if (debug_mode) printf("Client error sending data (%d)\n", rv); @@ -405,13 +405,13 @@ ClientThreadFunc(void *unused) bytesNeeded = _server_data; while(bytesNeeded) { - rv = PR_Recv(clientSocket, - recvBuf, - bytesNeeded, - 0, + rv = PR_Recv(clientSocket, + recvBuf, + bytesNeeded, + 0, PR_INTERVAL_NO_TIMEOUT); if (rv <= 0) { - if (debug_mode) printf("Client error receiving data (%d) (%d/%d)\n", + if (debug_mode) printf("Client error receiving data (%d) (%d/%d)\n", rv, (_server_data - bytesNeeded), _server_data); break; } @@ -420,7 +420,7 @@ ClientThreadFunc(void *unused) } PR_Close(clientSocket); - + PR_AtomicDecrement(&numRequests); } @@ -445,7 +445,7 @@ RunClients(void) for (index=0; index<_clients; index++) { PRThread *clientThread; - + clientThread = PR_CreateThread( PR_USER_THREAD, ClientThreadFunc, @@ -583,7 +583,7 @@ int main(int argc, char **argv) printf("Enter size of server data : \n"); scanf("%d", &_server_data); } - else + else { _iterations = 10; @@ -591,11 +591,11 @@ int main(int argc, char **argv) _client_data = 10; _server_data = 10; } - + if (debug_mode) { - printf("\n\n%d iterations with %d client threads.\n", + printf("\n\n%d iterations with %d client threads.\n", _iterations, _clients); - printf("Sending %d bytes of client data and %d bytes of server data\n", + printf("Sending %d bytes of client data and %d bytes of server data\n", _client_data, _server_data); } PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0); @@ -605,11 +605,11 @@ int main(int argc, char **argv) ServerStateCV = PR_NewCondVar(ServerStateCVLock); Measure(do_workUU, "server loop user/user"); - #if 0 + #if 0 Measure(do_workUK, "server loop user/kernel"); Measure(do_workKU, "server loop kernel/user"); Measure(do_workKK, "server loop kernel/kernel"); - #endif + #endif PR_Cleanup(); diff --git a/pr/tests/servr_kk.c b/pr/tests/servr_kk.c index 836c1484..8fd59b26 100644 --- a/pr/tests/servr_kk.c +++ b/pr/tests/servr_kk.c @@ -8,7 +8,7 @@ ** This server simulates a server running in loopback mode. ** ** The idea is that a single server is created. The server initially creates -** a number of worker threads. Then, with the server running, a number of +** a number of worker threads. Then, with the server running, a number of ** clients are created which start requesting service from the server. ** ** @@ -90,7 +90,7 @@ WaitServerState(char *waiter, PRInt32 state) PR_WaitCondVar(ServerStateCV, PR_INTERVAL_NO_TIMEOUT); rv = ServerState; - if (debug_mode) DPRINTF("\t%s resuming from wait for state %d; state now %d\n", + if (debug_mode) DPRINTF("\t%s resuming from wait for state %d; state now %d\n", waiter, state, ServerState); PR_Unlock(ServerStateCVLock); @@ -134,7 +134,7 @@ WorkerThreadFunc(void *_listenSock) if (debug_mode) DPRINTF("\tServer thread going into accept\n"); - bytesRead = PR_AcceptRead(listenSock, + bytesRead = PR_AcceptRead(listenSock, &newSock, &rAddr, dataBuf, @@ -147,7 +147,7 @@ WorkerThreadFunc(void *_listenSock) } if (debug_mode) DPRINTF("\tServer accepted connection (%d bytes)\n", bytesRead); - + PR_AtomicIncrement(&workerThreadsBusy); if (workerThreadsBusy == workerThreads) { PR_Lock(workerThreadsLock); @@ -172,13 +172,13 @@ WorkerThreadFunc(void *_listenSock) } PR_Unlock(workerThreadsLock); } - + bytesToRead -= bytesRead; while (bytesToRead) { - bytesRead = PR_Recv(newSock, - dataBuf, - bytesToRead, - 0, + bytesRead = PR_Recv(newSock, + dataBuf, + bytesToRead, + 0, PR_INTERVAL_NO_TIMEOUT); if (bytesRead < 0) { if (debug_mode) printf("\tServer error receiving data (%d)\n", bytesRead); @@ -188,12 +188,12 @@ WorkerThreadFunc(void *_listenSock) } bytesWritten = PR_Send(newSock, - sendBuf, - bytesToWrite, - 0, + sendBuf, + bytesToWrite, + 0, PR_INTERVAL_NO_TIMEOUT); if (bytesWritten != _server_data) { - if (debug_mode) printf("\tError sending data to client (%d, %d)\n", + if (debug_mode) printf("\tError sending data to client (%d, %d)\n", bytesWritten, PR_GetOSError()); } else { if (debug_mode) DPRINTF("\tServer sent %d bytes\n", bytesWritten); @@ -344,7 +344,7 @@ ClientThreadFunc(void *unused) if (debug_mode) DPRINTF("\tClient connecting\n"); - rv = PR_Connect(clientSocket, + rv = PR_Connect(clientSocket, &serverAddr, PR_INTERVAL_NO_TIMEOUT); if (!clientSocket) { @@ -354,10 +354,10 @@ ClientThreadFunc(void *unused) if (debug_mode) DPRINTF("\tClient connected\n"); - rv = PR_Send(clientSocket, - sendBuf, - _client_data, - 0, + rv = PR_Send(clientSocket, + sendBuf, + _client_data, + 0, PR_INTERVAL_NO_TIMEOUT); if (rv != _client_data) { if (debug_mode) printf("Client error sending data (%d)\n", rv); @@ -369,13 +369,13 @@ ClientThreadFunc(void *unused) bytesNeeded = _server_data; while(bytesNeeded) { - rv = PR_Recv(clientSocket, - recvBuf, - bytesNeeded, - 0, + rv = PR_Recv(clientSocket, + recvBuf, + bytesNeeded, + 0, PR_INTERVAL_NO_TIMEOUT); if (rv <= 0) { - if (debug_mode) printf("Client error receiving data (%d) (%d/%d)\n", + if (debug_mode) printf("Client error receiving data (%d) (%d/%d)\n", rv, (_server_data - bytesNeeded), _server_data); break; } @@ -384,7 +384,7 @@ ClientThreadFunc(void *unused) } PR_Close(clientSocket); - + PR_AtomicDecrement(&numRequests); } @@ -409,7 +409,7 @@ RunClients(void) for (index=0; index<_clients; index++) { PRThread *clientThread; - + clientThread = PR_CreateThread( PR_USER_THREAD, ClientThreadFunc, @@ -547,7 +547,7 @@ int main(int argc, char **argv) printf("Enter size of server data : \n"); scanf("%d", &_server_data); } - else + else { _iterations = 7; _clients = 7; @@ -556,9 +556,9 @@ int main(int argc, char **argv) } if (debug_mode) { - printf("\n\n%d iterations with %d client threads.\n", + printf("\n\n%d iterations with %d client threads.\n", _iterations, _clients); - printf("Sending %d bytes of client data and %d bytes of server data\n", + printf("Sending %d bytes of client data and %d bytes of server data\n", _client_data, _server_data); } PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0); @@ -574,9 +574,9 @@ int main(int argc, char **argv) PR_Cleanup(); - if(failed_already) + if(failed_already) return 1; else return 0; - + } diff --git a/pr/tests/servr_ku.c b/pr/tests/servr_ku.c index c120ad01..13e8ee15 100644 --- a/pr/tests/servr_ku.c +++ b/pr/tests/servr_ku.c @@ -8,7 +8,7 @@ ** This server simulates a server running in loopback mode. ** ** The idea is that a single server is created. The server initially creates -** a number of worker threads. Then, with the server running, a number of +** a number of worker threads. Then, with the server running, a number of ** clients are created which start requesting service from the server. ** ** @@ -91,7 +91,7 @@ WaitServerState(char *waiter, PRInt32 state) PR_WaitCondVar(ServerStateCV, PR_INTERVAL_NO_TIMEOUT); rv = ServerState; - if (debug_mode) DPRINTF("\t%s resuming from wait for state %d; state now %d\n", + if (debug_mode) DPRINTF("\t%s resuming from wait for state %d; state now %d\n", waiter, state, ServerState); PR_Unlock(ServerStateCVLock); @@ -135,7 +135,7 @@ WorkerThreadFunc(void *_listenSock) if (debug_mode) DPRINTF("\tServer thread going into accept\n"); - bytesRead = PR_AcceptRead(listenSock, + bytesRead = PR_AcceptRead(listenSock, &newSock, &rAddr, dataBuf, @@ -148,7 +148,7 @@ WorkerThreadFunc(void *_listenSock) } if (debug_mode) DPRINTF("\tServer accepted connection (%d bytes)\n", bytesRead); - + PR_AtomicIncrement(&workerThreadsBusy); if (workerThreadsBusy == workerThreads) { PR_Lock(workerThreadsLock); @@ -173,13 +173,13 @@ WorkerThreadFunc(void *_listenSock) } PR_Unlock(workerThreadsLock); } - + bytesToRead -= bytesRead; while (bytesToRead) { - bytesRead = PR_Recv(newSock, - dataBuf, - bytesToRead, - 0, + bytesRead = PR_Recv(newSock, + dataBuf, + bytesToRead, + 0, PR_INTERVAL_NO_TIMEOUT); if (bytesRead < 0) { if (debug_mode) printf("\tServer error receiving data (%d)\n", bytesRead); @@ -189,12 +189,12 @@ WorkerThreadFunc(void *_listenSock) } bytesWritten = PR_Send(newSock, - sendBuf, - bytesToWrite, - 0, + sendBuf, + bytesToWrite, + 0, PR_INTERVAL_NO_TIMEOUT); if (bytesWritten != _server_data) { - if (debug_mode) printf("\tError sending data to client (%d, %d)\n", + if (debug_mode) printf("\tError sending data to client (%d, %d)\n", bytesWritten, PR_GetOSError()); } else { if (debug_mode) DPRINTF("\tServer sent %d bytes\n", bytesWritten); @@ -345,7 +345,7 @@ ClientThreadFunc(void *unused) if (debug_mode) DPRINTF("\tClient connecting\n"); - rv = PR_Connect(clientSocket, + rv = PR_Connect(clientSocket, &serverAddr, PR_INTERVAL_NO_TIMEOUT); if (!clientSocket) { @@ -355,10 +355,10 @@ ClientThreadFunc(void *unused) if (debug_mode) DPRINTF("\tClient connected\n"); - rv = PR_Send(clientSocket, - sendBuf, - _client_data, - 0, + rv = PR_Send(clientSocket, + sendBuf, + _client_data, + 0, PR_INTERVAL_NO_TIMEOUT); if (rv != _client_data) { if (debug_mode) printf("Client error sending data (%d)\n", rv); @@ -370,13 +370,13 @@ ClientThreadFunc(void *unused) bytesNeeded = _server_data; while(bytesNeeded) { - rv = PR_Recv(clientSocket, - recvBuf, - bytesNeeded, - 0, + rv = PR_Recv(clientSocket, + recvBuf, + bytesNeeded, + 0, PR_INTERVAL_NO_TIMEOUT); if (rv <= 0) { - if (debug_mode) printf("Client error receiving data (%d) (%d/%d)\n", + if (debug_mode) printf("Client error receiving data (%d) (%d/%d)\n", rv, (_server_data - bytesNeeded), _server_data); break; } @@ -385,7 +385,7 @@ ClientThreadFunc(void *unused) } PR_Close(clientSocket); - + PR_AtomicDecrement(&numRequests); } @@ -410,7 +410,7 @@ RunClients(void) for (index=0; index<_clients; index++) { PRThread *clientThread; - + clientThread = PR_CreateThread( PR_USER_THREAD, ClientThreadFunc, @@ -529,7 +529,7 @@ int main(int argc, char **argv) printf("Enter size of server data : \n"); scanf("%d", &_server_data); } - else + else { _iterations = 7; _clients = 7; @@ -538,9 +538,9 @@ int main(int argc, char **argv) } if (debug_mode) { - printf("\n\n%d iterations with %d client threads.\n", + printf("\n\n%d iterations with %d client threads.\n", _iterations, _clients); - printf("Sending %d bytes of client data and %d bytes of server data\n", + printf("Sending %d bytes of client data and %d bytes of server data\n", _client_data, _server_data); } PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0); @@ -554,7 +554,7 @@ int main(int argc, char **argv) Measure(do_workKU, "server loop kernel/user"); PR_Cleanup(); - if(failed_already) + if(failed_already) return 1; else return 0; diff --git a/pr/tests/servr_uk.c b/pr/tests/servr_uk.c index 896309e7..79074e83 100644 --- a/pr/tests/servr_uk.c +++ b/pr/tests/servr_uk.c @@ -8,7 +8,7 @@ ** This server simulates a server running in loopback mode. ** ** The idea is that a single server is created. The server initially creates -** a number of worker threads. Then, with the server running, a number of +** a number of worker threads. Then, with the server running, a number of ** clients are created which start requesting service from the server. ** ** @@ -93,7 +93,7 @@ WaitServerState(char *waiter, PRInt32 state) PR_WaitCondVar(ServerStateCV, PR_INTERVAL_NO_TIMEOUT); rv = ServerState; - if (debug_mode) DPRINTF("\t%s resuming from wait for state %d; state now %d\n", + if (debug_mode) DPRINTF("\t%s resuming from wait for state %d; state now %d\n", waiter, state, ServerState); PR_Unlock(ServerStateCVLock); @@ -137,7 +137,7 @@ WorkerThreadFunc(void *_listenSock) if (debug_mode) DPRINTF("\tServer thread going into accept\n"); - bytesRead = PR_AcceptRead(listenSock, + bytesRead = PR_AcceptRead(listenSock, &newSock, &rAddr, dataBuf, @@ -150,7 +150,7 @@ WorkerThreadFunc(void *_listenSock) } if (debug_mode) DPRINTF("\tServer accepted connection (%d bytes)\n", bytesRead); - + PR_AtomicIncrement(&workerThreadsBusy); if (workerThreadsBusy == workerThreads) { PR_Lock(workerThreadsLock); @@ -175,13 +175,13 @@ WorkerThreadFunc(void *_listenSock) } PR_Unlock(workerThreadsLock); } - + bytesToRead -= bytesRead; while (bytesToRead) { - bytesRead = PR_Recv(newSock, - dataBuf, - bytesToRead, - 0, + bytesRead = PR_Recv(newSock, + dataBuf, + bytesToRead, + 0, PR_INTERVAL_NO_TIMEOUT); if (bytesRead < 0) { if (debug_mode) printf("\tServer error receiving data (%d)\n", bytesRead); @@ -191,12 +191,12 @@ WorkerThreadFunc(void *_listenSock) } bytesWritten = PR_Send(newSock, - sendBuf, - bytesToWrite, - 0, + sendBuf, + bytesToWrite, + 0, PR_INTERVAL_NO_TIMEOUT); if (bytesWritten != _server_data) { - if (debug_mode) printf("\tError sending data to client (%d, %d)\n", + if (debug_mode) printf("\tError sending data to client (%d, %d)\n", bytesWritten, PR_GetOSError()); } else { if (debug_mode) DPRINTF("\tServer sent %d bytes\n", bytesWritten); @@ -217,7 +217,7 @@ ServerSetup(void) if ( (listenSocket = PR_NewTCPSocket()) == NULL) { if (debug_mode) printf("\tServer error creating listen socket\n"); - else + else return NULL; } @@ -347,7 +347,7 @@ ClientThreadFunc(void *unused) if (debug_mode) DPRINTF("\tClient connecting\n"); - rv = PR_Connect(clientSocket, + rv = PR_Connect(clientSocket, &serverAddr, PR_INTERVAL_NO_TIMEOUT); if (!clientSocket) { @@ -357,10 +357,10 @@ ClientThreadFunc(void *unused) if (debug_mode) DPRINTF("\tClient connected\n"); - rv = PR_Send(clientSocket, - sendBuf, - _client_data, - 0, + rv = PR_Send(clientSocket, + sendBuf, + _client_data, + 0, PR_INTERVAL_NO_TIMEOUT); if (rv != _client_data) { if (debug_mode) printf("Client error sending data (%d)\n", rv); @@ -372,13 +372,13 @@ ClientThreadFunc(void *unused) bytesNeeded = _server_data; while(bytesNeeded) { - rv = PR_Recv(clientSocket, - recvBuf, - bytesNeeded, - 0, + rv = PR_Recv(clientSocket, + recvBuf, + bytesNeeded, + 0, PR_INTERVAL_NO_TIMEOUT); if (rv <= 0) { - if (debug_mode) printf("Client error receiving data (%d) (%d/%d)\n", + if (debug_mode) printf("Client error receiving data (%d) (%d/%d)\n", rv, (_server_data - bytesNeeded), _server_data); break; } @@ -387,7 +387,7 @@ ClientThreadFunc(void *unused) } PR_Close(clientSocket); - + PR_AtomicDecrement(&numRequests); } @@ -412,7 +412,7 @@ RunClients(void) for (index=0; index<_clients; index++) { PRThread *clientThread; - + clientThread = PR_CreateThread( PR_USER_THREAD, ClientThreadFunc, @@ -531,7 +531,7 @@ int main(int argc, char **argv) printf("Enter size of server data : \n"); scanf("%d", &_server_data); } - else + else { _iterations = 7; _clients = 7; @@ -540,9 +540,9 @@ int main(int argc, char **argv) } if (debug_mode) { - printf("\n\n%d iterations with %d client threads.\n", + printf("\n\n%d iterations with %d client threads.\n", _iterations, _clients); - printf("Sending %d bytes of client data and %d bytes of server data\n", + printf("Sending %d bytes of client data and %d bytes of server data\n", _client_data, _server_data); } PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0); @@ -557,7 +557,7 @@ int main(int argc, char **argv) PR_Cleanup(); - if(failed_already) + if(failed_already) return 1; else return 0; diff --git a/pr/tests/servr_uu.c b/pr/tests/servr_uu.c index a9638feb..0b7d5e4d 100644 --- a/pr/tests/servr_uu.c +++ b/pr/tests/servr_uu.c @@ -8,7 +8,7 @@ ** This server simulates a server running in loopback mode. ** ** The idea is that a single server is created. The server initially creates -** a number of worker threads. Then, with the server running, a number of +** a number of worker threads. Then, with the server running, a number of ** clients are created which start requesting service from the server. ** ** @@ -91,7 +91,7 @@ WaitServerState(char *waiter, PRInt32 state) PR_WaitCondVar(ServerStateCV, PR_INTERVAL_NO_TIMEOUT); rv = ServerState; - if (debug_mode) DPRINTF("\t%s resuming from wait for state %d; state now %d\n", + if (debug_mode) DPRINTF("\t%s resuming from wait for state %d; state now %d\n", waiter, state, ServerState); PR_Unlock(ServerStateCVLock); @@ -135,7 +135,7 @@ WorkerThreadFunc(void *_listenSock) if (debug_mode) DPRINTF("\tServer thread going into accept\n"); - bytesRead = PR_AcceptRead(listenSock, + bytesRead = PR_AcceptRead(listenSock, &newSock, &rAddr, dataBuf, @@ -148,7 +148,7 @@ WorkerThreadFunc(void *_listenSock) } if (debug_mode) DPRINTF("\tServer accepted connection (%d bytes)\n", bytesRead); - + PR_AtomicIncrement(&workerThreadsBusy); if (workerThreadsBusy == workerThreads) { @@ -174,13 +174,13 @@ WorkerThreadFunc(void *_listenSock) } PR_Unlock(workerThreadsLock); } - + bytesToRead -= bytesRead; while (bytesToRead) { - bytesRead = PR_Recv(newSock, - dataBuf, - bytesToRead, - 0, + bytesRead = PR_Recv(newSock, + dataBuf, + bytesToRead, + 0, PR_INTERVAL_NO_TIMEOUT); if (bytesRead < 0) { if (debug_mode) printf("\tServer error receiving data (%d)\n", bytesRead); @@ -190,16 +190,16 @@ WorkerThreadFunc(void *_listenSock) } bytesWritten = PR_Send(newSock, - sendBuf, - bytesToWrite, - 0, + sendBuf, + bytesToWrite, + 0, PR_INTERVAL_NO_TIMEOUT); if (bytesWritten != _server_data) { - if (debug_mode) printf("\tError sending data to client (%d, %d)\n", + if (debug_mode) printf("\tError sending data to client (%d, %d)\n", bytesWritten, PR_GetOSError()); } else { if (debug_mode) DPRINTF("\tServer sent %d bytes\n", bytesWritten); - } + } PR_Close(newSock); PR_AtomicDecrement(&workerThreadsBusy); @@ -346,7 +346,7 @@ ClientThreadFunc(void *unused) if (debug_mode) DPRINTF("\tClient connecting\n"); - rv = PR_Connect(clientSocket, + rv = PR_Connect(clientSocket, &serverAddr, PR_INTERVAL_NO_TIMEOUT); if (!clientSocket) { @@ -356,10 +356,10 @@ ClientThreadFunc(void *unused) if (debug_mode) DPRINTF("\tClient connected\n"); - rv = PR_Send(clientSocket, - sendBuf, - _client_data, - 0, + rv = PR_Send(clientSocket, + sendBuf, + _client_data, + 0, PR_INTERVAL_NO_TIMEOUT); if (rv != _client_data) { if (debug_mode) printf("Client error sending data (%d)\n", rv); @@ -371,13 +371,13 @@ ClientThreadFunc(void *unused) bytesNeeded = _server_data; while(bytesNeeded) { - rv = PR_Recv(clientSocket, - recvBuf, - bytesNeeded, - 0, + rv = PR_Recv(clientSocket, + recvBuf, + bytesNeeded, + 0, PR_INTERVAL_NO_TIMEOUT); if (rv <= 0) { - if (debug_mode) printf("Client error receiving data (%d) (%d/%d)\n", + if (debug_mode) printf("Client error receiving data (%d) (%d/%d)\n", rv, (_server_data - bytesNeeded), _server_data); break; } @@ -386,7 +386,7 @@ ClientThreadFunc(void *unused) } PR_Close(clientSocket); - + PR_AtomicDecrement(&numRequests); } @@ -411,7 +411,7 @@ RunClients(void) for (index=0; index<_clients; index++) { PRThread *clientThread; - + clientThread = PR_CreateThread( PR_USER_THREAD, ClientThreadFunc, @@ -529,7 +529,7 @@ int main(int argc, char **argv) printf("Enter size of server data : \n"); scanf("%d", &_server_data); } - else + else { _iterations = 7; _clients = 7; @@ -538,9 +538,9 @@ int main(int argc, char **argv) } if (debug_mode) { - printf("\n\n%d iterations with %d client threads.\n", + printf("\n\n%d iterations with %d client threads.\n", _iterations, _clients); - printf("Sending %d bytes of client data and %d bytes of server data\n", + printf("Sending %d bytes of client data and %d bytes of server data\n", _client_data, _server_data); } PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0); @@ -554,10 +554,10 @@ int main(int argc, char **argv) Measure(do_workUU, "server loop user/user"); PR_Cleanup(); - - if(failed_already) + + if(failed_already) return 1; else return 0; - + } diff --git a/pr/tests/short_thread.c b/pr/tests/short_thread.c index 87294014..e39c3809 100644 --- a/pr/tests/short_thread.c +++ b/pr/tests/short_thread.c @@ -38,9 +38,9 @@ int main (int argc, char **argv) } PL_DestroyOptState(opt); - if (( housekeeping_tid = + if (( housekeeping_tid = PR_CreateThread (PR_USER_THREAD, housecleaning, (void*)&thread_start_time, - PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD, PR_UNJOINABLE_THREAD, 0)) + PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD, PR_UNJOINABLE_THREAD, 0)) == NULL ) { fprintf(stderr, "simple_test: Error - PR_CreateThread failed: (%ld, %ld)\n", @@ -52,7 +52,7 @@ int main (int argc, char **argv) } static void -housecleaning (void *cur_time) +housecleaning (void *cur_time) { DPRINTF(("Child Thread exiting\n")); } diff --git a/pr/tests/socket.c b/pr/tests/socket.c index 00c7341c..9a9470c8 100644 --- a/pr/tests/socket.c +++ b/pr/tests/socket.c @@ -199,7 +199,7 @@ retry: } #endif return -1; - } + } } return len; } @@ -331,14 +331,14 @@ PRInt32 native_thread = 0; #else HANDLE thandle; unsigned tid; - + thandle = (HANDLE) _beginthreadex( NULL, stackSize, (unsigned (__stdcall *)(void *))start, arg, STACK_SIZE_PARAM_IS_A_RESERVATION, - &tid); + &tid); return((PRThread *) thandle); #endif } else { @@ -372,7 +372,7 @@ TCP_Server(void *arg) goto exit; } memset(&netaddr, 0 , sizeof(netaddr)); - + if (PR_SetNetAddr(PR_IpAddrAny, server_domain, TCP_SERVER_PORT, &netaddr) == PR_FAILURE) { fprintf(stderr,"prsocket_test: PR_SetNetAddr failed\n"); @@ -383,7 +383,7 @@ TCP_Server(void *arg) * use */ i = 0; - + while (PR_Bind(sockfd, &netaddr) < 0) { if (PR_GetError() == PR_ADDRESS_IN_USE_ERROR) { netaddr.inet.port += 2; @@ -450,7 +450,7 @@ TCP_Server(void *arg) scp->datalen = sp->datalen; t = create_new_thread(PR_USER_THREAD, - Serve_Client, (void *)scp, + Serve_Client, (void *)scp, PR_PRIORITY_NORMAL, PR_LOCAL_THREAD, PR_UNJOINABLE_THREAD, @@ -552,7 +552,7 @@ UDP_Server(void *arg) if ((client_domain == PR_AF_INET6) && (server_domain == PR_AF_INET)) PR_ConvertIPv4AddrToIPv6(PR_htonl(INADDR_LOOPBACK), &udp_server_addr.ipv6.ip); - + /* * Wake up parent thread because server address is bound and made * available in the global variable 'udp_server_addr' @@ -709,7 +709,7 @@ TCP_Client(void *arg) /* * UDP_Client * Client Thread - * Create a socket and bind an address + * Create a socket and bind an address * Communicate with the server at the address specified in the argument. * Fill in a buffer, write data to server, read it back and check * for data corruption. @@ -840,7 +840,7 @@ UDP_Client(void *arg) /* * TCP_Socket_Client_Server_Test - concurrent server test - * + * * One server and several clients are started * Each client connects to the server and sends a chunk of data * For each connection, server starts another thread to read the data @@ -892,7 +892,7 @@ TCP_Socket_Client_Server_Test(void) sparamp->exit_counter = &thread_count; sparamp->datalen = datalen; t = PR_CreateThread(PR_USER_THREAD, - TCP_Server, (void *)sparamp, + TCP_Server, (void *)sparamp, PR_PRIORITY_NORMAL, PR_LOCAL_THREAD, PR_UNJOINABLE_THREAD, @@ -956,7 +956,7 @@ TCP_Socket_Client_Server_Test(void) /* * UDP_Socket_Client_Server_Test - iterative server test - * + * * One server and several clients are started * Each client connects to the server and sends a chunk of data * For each connection, server starts another thread to read the data @@ -1010,7 +1010,7 @@ UDP_Socket_Client_Server_Test(void) sparamp->datalen = datalen; DPRINTF(("Creating UDP server")); t = PR_CreateThread(PR_USER_THREAD, - UDP_Server, (void *)sparamp, + UDP_Server, (void *)sparamp, PR_PRIORITY_NORMAL, PR_LOCAL_THREAD, PR_UNJOINABLE_THREAD, @@ -1794,7 +1794,7 @@ TransmitFile_Server(void *arg) scp->datalen = sp->datalen; t[i] = PR_CreateThread(PR_USER_THREAD, - Serve_TransmitFile_Client, (void *)scp, + Serve_TransmitFile_Client, (void *)scp, PR_PRIORITY_NORMAL, PR_LOCAL_THREAD, PR_JOINABLE_THREAD, @@ -1837,8 +1837,8 @@ exit: } /* - * Socket_Misc_Test - test miscellaneous functions - * + * Socket_Misc_Test - test miscellaneous functions + * */ static PRInt32 Socket_Misc_Test(void) @@ -2052,7 +2052,7 @@ Socket_Misc_Test(void) sparamp->exit_counter = &thread_count; sparamp->datalen = datalen; t = PR_CreateThread(PR_USER_THREAD, - TransmitFile_Server, (void *)sparamp, + TransmitFile_Server, (void *)sparamp, PR_PRIORITY_NORMAL, PR_LOCAL_THREAD, PR_UNJOINABLE_THREAD, @@ -2223,12 +2223,12 @@ int main(int argc, char **argv) } else printf("TCP_Socket_Client_Server_Test Passed\n"); test_cancelio = 0; - + /* * Misc socket tests - including transmitfile, etc. */ - /* File transmission test can not be done in Symbian OS because of + /* File transmission test can not be done in Symbian OS because of * large file's size and the incomplete mmap() implementation. */ #if !defined(WIN16) /* diff --git a/pr/tests/sockopt.c b/pr/tests/sockopt.c index c83ecea0..1f85d2a2 100644 --- a/pr/tests/sockopt.c +++ b/pr/tests/sockopt.c @@ -86,49 +86,49 @@ int main(int argc, char **argv) { case PR_SockOpt_Nonblocking: data.value.non_blocking = PR_TRUE; - break; + break; case PR_SockOpt_Linger: data.value.linger.polarity = PR_TRUE; - data.value.linger.linger = PR_SecondsToInterval(2); - break; + data.value.linger.linger = PR_SecondsToInterval(2); + break; case PR_SockOpt_Reuseaddr: - data.value.reuse_addr = PR_TRUE; - break; - case PR_SockOpt_Keepalive: - data.value.keep_alive = PR_TRUE; - break; + data.value.reuse_addr = PR_TRUE; + break; + case PR_SockOpt_Keepalive: + data.value.keep_alive = PR_TRUE; + break; case PR_SockOpt_RecvBufferSize: - data.value.recv_buffer_size = segment; - break; - case PR_SockOpt_SendBufferSize: - data.value.send_buffer_size = segment; - break; + data.value.recv_buffer_size = segment; + break; + case PR_SockOpt_SendBufferSize: + data.value.send_buffer_size = segment; + break; case PR_SockOpt_IpTimeToLive: - data.value.ip_ttl = 64; - break; + data.value.ip_ttl = 64; + break; case PR_SockOpt_IpTypeOfService: - data.value.tos = 0; - break; + data.value.tos = 0; + break; case PR_SockOpt_McastTimeToLive: - fd = udp; - data.value.mcast_ttl = 4; - break; + fd = udp; + data.value.mcast_ttl = 4; + break; case PR_SockOpt_McastLoopback: - fd = udp; - data.value.mcast_loopback = PR_TRUE; - break; + fd = udp; + data.value.mcast_loopback = PR_TRUE; + break; case PR_SockOpt_NoDelay: - data.value.no_delay = PR_TRUE; - break; + data.value.no_delay = PR_TRUE; + break; #ifndef WIN32 case PR_SockOpt_MaxSegment: - data.value.max_segment = segment; - break; + data.value.max_segment = segment; + break; #endif case PR_SockOpt_Broadcast: - fd = udp; - data.value.broadcast = PR_TRUE; - break; + fd = udp; + data.value.broadcast = PR_TRUE; + break; #ifdef SO_REUSEPORT case PR_SockOpt_Reuseport: data.value.reuse_port = PR_TRUE; diff --git a/pr/tests/stack.c b/pr/tests/stack.c index c09bf4a2..8da1894e 100644 --- a/pr/tests/stack.c +++ b/pr/tests/stack.c @@ -7,7 +7,7 @@ /* * * Test atomic stack operations - * + * * Two stacks are created and threads add data items (each containing * one of the first n integers) to the first stack, remove data items * from the first stack and add them to the second stack. The primordial @@ -15,7 +15,7 @@ * integers in the data items in the second stack. The test succeeds if * they are equal. */ - + #include "nspr.h" #include "plgetopt.h" @@ -122,7 +122,7 @@ int main(int argc, char **argv) thread_args[cnt].list1 = list1; thread_args[cnt].list2 = list2; thread_args[cnt].loops = loops; - thread_args[cnt].data_cnt = data_cnt; + thread_args[cnt].data_cnt = data_cnt; thread_args[cnt].initial_data_value = 1 + cnt * data_cnt; if (cnt & 1) diff --git a/pr/tests/stat.c b/pr/tests/stat.c index c570056f..c3c869f2 100644 --- a/pr/tests/stat.c +++ b/pr/tests/stat.c @@ -4,7 +4,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /* - * Program to test different ways to get file info; right now it + * Program to test different ways to get file info; right now it * only works for solaris and OS/2. * */ @@ -35,7 +35,7 @@ static void statPRStat(void) { PRFileInfo finfo; PRInt32 index = count; - + for (;index--;) { PR_GetFileInfo(filename, &finfo); } @@ -45,7 +45,7 @@ static void statStat(void) { struct stat finfo; PRInt32 index = count; - + for (;index--;) { stat(filename, &finfo); } diff --git a/pr/tests/strod.c b/pr/tests/strod.c index 3d1503e0..7a148923 100644 --- a/pr/tests/strod.c +++ b/pr/tests/strod.c @@ -67,7 +67,7 @@ static PRIntn PR_CALLBACK RealMain(PRIntn argc, char **argv) int main(int argc, char **argv) { PRIntn rv; - + PR_STDIO_INIT(); rv = PR_Initialize(RealMain, argc, argv, 0); return rv; diff --git a/pr/tests/suspend.c b/pr/tests/suspend.c index 7a4f83fd..8afb5a33 100644 --- a/pr/tests/suspend.c +++ b/pr/tests/suspend.c @@ -63,7 +63,7 @@ static PRStatus PR_CALLBACK print_thread(PRThread *thread, int i, void *arg) PRWord *registers; printf( - "\nprint_thread[0x%lx]: %-20s - i = %ld\n",thread, + "\nprint_thread[0x%lx]: %-20s - i = %ld\n",thread, (PR_GLOBAL_THREAD == PR_GetThreadScope(thread)) ? "PR_GLOBAL_THREAD" : "PR_LOCAL_THREAD", i); registers = PR_GetGCRegisters(thread, 0, (int *)&words); @@ -88,8 +88,8 @@ static void Level_0_Thread(PRThreadScope scope1, PRThreadScope scope2) alive = count; for (n=0; n<count; n++) { thr = PR_CreateThreadGCAble(PR_USER_THREAD, - Level_1_Thread, - (void *)scope2, + Level_1_Thread, + (void *)scope2, PR_PRIORITY_NORMAL, scope1, PR_UNJOINABLE_THREAD, diff --git a/pr/tests/switch.c b/pr/tests/switch.c index 43c5ce56..b79e30c4 100644 --- a/pr/tests/switch.c +++ b/pr/tests/switch.c @@ -201,7 +201,7 @@ PRIntn PR_CALLBACK Switch(PRIntn argc, char **argv) if (debug_mode) PL_FPrintError(debug_out, "Failed to interrupt"); } - link = link->next; + link = link->next; } for (thread_count = 1; thread_count <= thread_limit; ++thread_count) diff --git a/pr/tests/testfile.c b/pr/tests/testfile.c index 8a89b92f..360ef1f7 100644 --- a/pr/tests/testfile.c +++ b/pr/tests/testfile.c @@ -137,14 +137,14 @@ PRInt32 native_thread = 0; #else HANDLE thandle; unsigned tid; - + thandle = (HANDLE) _beginthreadex( NULL, stackSize, (unsigned (__stdcall *)(void *))start, arg, STACK_SIZE_PARAM_IS_A_RESERVATION, - &tid); + &tid); return((PRThread *) thandle); #endif } else { @@ -167,7 +167,7 @@ int offset, len; buf = fp->buf; offset = fp->offset; len = fp->len; - + fd_file = PR_Open(name, PR_RDWR | PR_CREATE_FILE, 0777); if (fd_file == NULL) { printf("testfile failed to create/open file %s\n",name); @@ -176,11 +176,11 @@ int offset, len; if (PR_Seek(fd_file, offset, PR_SEEK_SET) < 0) { printf("testfile failed to seek in file %s\n",name); return; - } + } if ((PR_Write(fd_file, buf, len)) < 0) { printf("testfile failed to write to file %s\n",name); return; - } + } DPRINTF(("Write out_buf[0] = 0x%x\n",(*((int *) buf)))); PR_Close(fd_file); PR_DELETE(fp); @@ -203,7 +203,7 @@ int offset, len; buf = fp->buf; offset = fp->offset; len = fp->len; - + fd_file = PR_Open(name, PR_RDONLY, 0); if (fd_file == NULL) { printf("testfile failed to open file %s\n",name); @@ -212,11 +212,11 @@ int offset, len; if (PR_Seek(fd_file, offset, PR_SEEK_SET) < 0) { printf("testfile failed to seek in file %s\n",name); return; - } + } if ((PR_Read(fd_file, buf, len)) < 0) { printf("testfile failed to read to file %s\n",name); return; - } + } DPRINTF(("Read in_buf[0] = 0x%x\n",(*((int *) buf)))); PR_Close(fd_file); PR_DELETE(fp); @@ -353,7 +353,7 @@ char tmpname[1024]; rv = -1; goto cleanup; } - + PR_Seek(fd_file, 0, PR_SEEK_SET); len = PR_Available(fd_file); if (len < 0) { @@ -417,7 +417,7 @@ File_Rdwr_Param *fparamp; if (fd_dir == NULL) { printf("testfile failed to open dir %s\n",TEST_DIR); rv = -1; - goto cleanup; + goto cleanup; } PR_CloseDir(fd_dir); @@ -431,14 +431,14 @@ File_Rdwr_Param *fparamp; printf( "testfile failed to alloc buffer struct\n"); rv = -1; - goto cleanup; + goto cleanup; } out_buf = PR_NEW(buffer); if (out_buf == NULL) { printf( "testfile failed to alloc buffer struct\n"); rv = -1; - goto cleanup; + goto cleanup; } /* @@ -453,7 +453,7 @@ File_Rdwr_Param *fparamp; printf( "testfile failed to alloc File_Rdwr_Param struct\n"); rv = -1; - goto cleanup; + goto cleanup; } fparamp->pathname = pathname; fparamp->buf = out_buf->data + offset; @@ -462,7 +462,7 @@ File_Rdwr_Param *fparamp; memset(fparamp->buf, i, len); t = create_new_thread(PR_USER_THREAD, - File_Write, (void *)fparamp, + File_Write, (void *)fparamp, PR_PRIORITY_NORMAL, scope, PR_UNJOINABLE_THREAD, @@ -489,7 +489,7 @@ File_Rdwr_Param *fparamp; printf( "testfile failed to alloc File_Rdwr_Param struct\n"); rv = -1; - goto cleanup; + goto cleanup; } fparamp->pathname = pathname; fparamp->buf = in_buf->data + offset; @@ -497,7 +497,7 @@ File_Rdwr_Param *fparamp; fparamp->len = len; t = create_new_thread(PR_USER_THREAD, - File_Read, (void *)fparamp, + File_Read, (void *)fparamp, PR_PRIORITY_NORMAL, scope, PR_UNJOINABLE_THREAD, @@ -517,13 +517,13 @@ File_Rdwr_Param *fparamp; if (memcmp(in_buf->data, out_buf->data, offset) != 0) { printf("File Test failed: file data corrupted\n"); rv = -1; - goto cleanup; + goto cleanup; } if ((PR_Delete(pathname)) < 0) { printf("testfile failed to unlink file %s\n",pathname); rv = -1; - goto cleanup; + goto cleanup; } /* @@ -565,7 +565,7 @@ struct dirtest_arg thrarg; thrarg.done= 0; t = create_new_thread(PR_USER_THREAD, - DirTest, &thrarg, + DirTest, &thrarg, PR_PRIORITY_NORMAL, PR_LOCAL_THREAD, PR_UNJOINABLE_THREAD, @@ -623,7 +623,7 @@ HANDLE hfile; strcat(pathname, "/"); strcat(pathname, FILE_NAME); path_len = strlen(pathname); - + for (i = 0; i < FILES_IN_DIR; i++) { sprintf(pathname + path_len,"%d%s",i,""); @@ -662,7 +662,7 @@ HANDLE hfile; #elif defined(WINCE) DPRINTF(("Creating hidden test file %s\n",pathname)); - MultiByteToWideChar(CP_ACP, 0, pathname, -1, wPathname, 256); + MultiByteToWideChar(CP_ACP, 0, pathname, -1, wPathname, 256); hfile = CreateFile(wPathname, GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, @@ -675,7 +675,7 @@ HANDLE hfile; return -1; } CloseHandle(hfile); - + #elif defined(XP_PC) && defined(WIN32) DPRINTF(("Creating hidden test file %s\n",pathname)); hfile = CreateFile(pathname, GENERIC_READ, @@ -690,7 +690,7 @@ HANDLE hfile; return -1; } CloseHandle(hfile); - + #elif defined(OS2) DPRINTF(("Creating hidden test file %s\n",pathname)); fd_file = PR_Open(pathname, PR_RDWR | PR_CREATE_FILE, (int)FILE_HIDDEN); @@ -720,7 +720,7 @@ HANDLE hfile; TEST_DIR, PR_GetError(), PR_GetOSError()); return -1; } - + /* * List all files, including hidden files */ @@ -743,7 +743,7 @@ HANDLE hfile; pathname, PR_GetError(), PR_GetOSError()); return -1; } - + if (info.type != PR_FILE_FILE) { printf( "testfile incorrect fileinfo for file %s [%d, %d]\n", @@ -774,7 +774,7 @@ HANDLE hfile; TEST_DIR, PR_GetError(), PR_GetOSError()); return -1; } - + DPRINTF(("Listing non-hidden files in directory %s\n",TEST_DIR)); while ((dirEntry = PR_ReadDir(fd_dir, PR_SKIP_HIDDEN)) != NULL) { DPRINTF(("\t%s\n",dirEntry->name)); @@ -808,7 +808,7 @@ HANDLE hfile; TEST_DIR, PR_GetError(), PR_GetOSError()); return -1; } - + if (PR_FAILURE == PR_MkDir(TEST_DIR, 0777)) { printf( "testfile failed to recreate dir %s [%d, %d]\n", @@ -847,7 +847,7 @@ HANDLE hfile; strcat(pathname, "/"); strcat(pathname, FILE_NAME); path_len = strlen(pathname); - + for (i = 0; i < FILES_IN_DIR; i++) { sprintf(pathname + path_len,"%d%s",i,""); @@ -920,7 +920,7 @@ int main(int argc, char **argv) /* * enough space for prdir */ - WideCharToMultiByte(CP_ACP, 0, tdir, -1, testdir, TMPDIR_LEN, 0, 0); + WideCharToMultiByte(CP_ACP, 0, tdir, -1, testdir, TMPDIR_LEN, 0, 0); } } #else diff --git a/pr/tests/threads.c b/pr/tests/threads.c index 1b9b133d..09b5963a 100644 --- a/pr/tests/threads.c +++ b/pr/tests/threads.c @@ -16,7 +16,7 @@ PRInt32 count, iterations, alive; PRBool debug_mode = PR_FALSE, passed = PR_TRUE; -void +void PR_CALLBACK ReallyDumbThread(void *arg) { @@ -65,8 +65,8 @@ static void CreateThreads(PRThreadScope scope1, PRThreadScope scope2) alive = count; for (n=0; n<count; n++) { thr = PR_CreateThread(PR_USER_THREAD, - DumbThread, - (void *)scope2, + DumbThread, + (void *)scope2, PR_PRIORITY_NORMAL, scope1, PR_UNJOINABLE_THREAD, @@ -79,7 +79,7 @@ static void CreateThreads(PRThreadScope scope1, PRThreadScope scope2) passed = PR_FALSE; alive--; } - + PR_Sleep(0); } @@ -137,7 +137,7 @@ int main(int argc, char **argv) PR_STDIO_INIT(); PR_Init(PR_USER_THREAD, PR_PRIORITY_HIGH, 0); - + { PLOptStatus os; PLOptState *opt = PL_CreateOptState(argc, argv, "dc:i:"); diff --git a/pr/tests/thrpool_client.c b/pr/tests/thrpool_client.c index 7f3df327..1ad3527a 100644 --- a/pr/tests/thrpool_client.c +++ b/pr/tests/thrpool_client.c @@ -90,7 +90,7 @@ readn(PRFileDesc *sockfd, char *buf, int len) PR_GetCurrentThread(), bytes)); if (bytes < 0) { return -1; - } + } } return len; } @@ -226,7 +226,7 @@ TCP_Client(void *arg) /* * TCP_Socket_Client_Server_Test - concurrent server test - * + * * Each client connects to the server and sends a chunk of data * For each connection, server reads the data * from the client and sends it back to the client, unmodified. diff --git a/pr/tests/thrpool_server.c b/pr/tests/thrpool_server.c index 0b77004b..ce2acb41 100644 --- a/pr/tests/thrpool_server.c +++ b/pr/tests/thrpool_server.c @@ -66,7 +66,7 @@ char *getcwd(char *buf, size_t size) _wgetcwd(wpath, MAX_PATH); WideCharToMultiByte(CP_ACP, 0, wpath, -1, buf, size, 0, 0); } - + #define perror(s) #endif @@ -384,7 +384,7 @@ TCP_Server(void *arg) argv[index++] = NULL; } PR_ASSERT(MAX_ARGS >= (index - 1)); - + DPRINTF(("creating client process %s ...\n", path)); if (PR_FAILURE == PR_CreateProcessDetached(path, argv, NULL, NULL)) { fprintf(stderr, @@ -557,7 +557,7 @@ int main(int argc, char **argv) goto done; } jobp = PR_QueueJob(tp, TCP_Server, tp, PR_TRUE); - rv = PR_JoinJob(jobp); + rv = PR_JoinJob(jobp); PR_ASSERT(PR_SUCCESS == rv); DPRINTF(("%s: calling PR_JoinThreadPool\n", program_name)); diff --git a/pr/tests/thruput.c b/pr/tests/thruput.c index fd7ecf2e..09ffde7c 100644 --- a/pr/tests/thruput.c +++ b/pr/tests/thruput.c @@ -363,11 +363,11 @@ int main(int argc, char **argv) (PR_GLOBAL_THREAD == thread_scope) ? "GLOBAL" : "LOCAL"); PR_fprintf(err, "Client buffer size will be %u\n", buffer_size); - + if (-1 != xport_buffer) PR_fprintf( err, "Transport send & receive buffer size will be %u\n", xport_buffer); - + if (NULL == server_name) Server(); else Client(server_name); diff --git a/pr/tests/time.c b/pr/tests/time.c index ed0bff8e..be00231f 100644 --- a/pr/tests/time.c +++ b/pr/tests/time.c @@ -53,7 +53,7 @@ static void timeTime(void) { PRInt32 index = count; time_t rv; - + for (;index--;) rv = time(NULL); } @@ -62,7 +62,7 @@ static void timeGethrtime(void) { PRInt32 index = count; time_t rv; - + for (;index--;) rv = ftime(); } @@ -72,7 +72,7 @@ static void timeGettimeofday(void) PRInt32 index = count; time_t rv; struct timeval tp; - + for (;index--;) rv = gettimeofday(&tp, NULL); } @@ -85,7 +85,7 @@ static void timePRTime32(void) PRTime rv; LL_I2L(q, 1000000); - + for (;index--;) { rv = PR_Now(); LL_DIV(rv, rv, q); @@ -97,7 +97,7 @@ static void timePRTime64(void) { PRInt32 index = count; PRTime rv; - + for (;index--;) rv = PR_Now(); } diff --git a/pr/tests/timemac.c b/pr/tests/timemac.c index f714aeb4..a12a2aa1 100644 --- a/pr/tests/timemac.c +++ b/pr/tests/timemac.c @@ -52,7 +52,7 @@ int main(int argc, char** argv) PR_STDIO_INIT(); PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0); - + /* ************************************************************* ** diff --git a/pr/tests/timetest.c b/pr/tests/timetest.c index c9bdf9c2..8dec86ef 100644 --- a/pr/tests/timetest.c +++ b/pr/tests/timetest.c @@ -52,7 +52,7 @@ static void PrintExplodedTime(const PRExplodedTime *et) { } hourOffset = totalOffset / 3600; minOffset = (totalOffset % 3600) / 60; - if (debug_mode) + if (debug_mode) printf("%s%02ld%02ld ", sign, hourOffset, minOffset); } @@ -107,7 +107,7 @@ testParseTimeString(PRTime t) totalOffset = et.tm_params.tp_gmt_offset + et.tm_params.tp_dst_offset; if (totalOffset == 0) { strcat(timeString, "GMT "); /* I wanted to use "UTC" here, but - * PR_ParseTimeString doesn't + * PR_ParseTimeString doesn't * understand "UTC". */ } else { sign = "+"; @@ -147,7 +147,7 @@ int main(int argc, char** argv) */ PLOptStatus os; PLOptState *opt; - + PR_STDIO_INIT(); opt = PL_CreateOptState(argc, argv, "d"); while (PL_OPT_EOL != (os = PL_GetNextOpt(opt))) @@ -165,7 +165,7 @@ int main(int argc, char** argv) PL_DestroyOptState(opt); /* main test */ - + PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0); /* Testing zero PRTime (the epoch) */ @@ -349,7 +349,7 @@ int main(int argc, char** argv) et.tm_sec = 23; et.tm_usec = 0; et.tm_params.tp_gmt_offset = -8 * 3600; /* PDT */ - et.tm_params.tp_dst_offset = 3600; + et.tm_params.tp_dst_offset = 3600; PR_NormalizeTime(&et, PR_LocalTimeParameters); if (debug_mode) printf("Nov 7 18:29:23 PDT 1996 is "); @@ -519,7 +519,7 @@ int main(int argc, char** argv) return 1; } - if (LL_NE(usecs, PR_ImplodeTime(&et1))) { + if (LL_NE(usecs, PR_ImplodeTime(&et1))) { printf("ERROR: PR_ExplodeTime and PR_ImplodeTime are not inverse\n"); PrintExplodedTime(&et1); printf("\n"); @@ -575,7 +575,7 @@ int main(int argc, char** argv) printf("** **\n"); printf("*******************************************************\n\n"); } - + LL_I2L(usecPer10Min, 600000000L); /* 00:00:00 PST Jan. 1, 2005 */ diff --git a/pr/tests/tmoacc.c b/pr/tests/tmoacc.c index 12c39c91..9bd3a4e0 100644 --- a/pr/tests/tmoacc.c +++ b/pr/tests/tmoacc.c @@ -148,7 +148,7 @@ static void Accept(void *arg) if (NULL != shared->debug) PL_PrintError("Accept"); shared->passed = PR_FALSE; } - } + } } while (running == shared->status); if (NULL != buffer) PR_DELETE(buffer); } /* Accept */ @@ -210,7 +210,7 @@ PRIntn Tmoacc(PRIntn argc, char **argv) if (0 == threads) threads = DEFAULT_THREADS; if (0 == backlog) backlog = DEFAULT_BACKLOG; if (0 == timeout) timeout = DEFAULT_TIMEOUT; - + PR_STDIO_INIT(); memset(&listenAddr, 0, sizeof(listenAddr)); rv = PR_InitializeNetAddr(PR_IpAddrAny, BASE_PORT, &listenAddr); diff --git a/pr/tests/tmocon.c b/pr/tests/tmocon.c index 24cb05f3..c1e2f675 100644 --- a/pr/tests/tmocon.c +++ b/pr/tests/tmocon.c @@ -14,7 +14,7 @@ ** The debug mode will print all of the printfs associated with this test. ** The regress mode will be the default mode. Since the regress tool limits ** the output to a one line status:PASS or FAIL,all of the printf statements -** have been handled with an if (debug_mode) statement. +** have been handled with an if (debug_mode) statement. ***********************************************************************/ /*********************************************************************** @@ -285,7 +285,7 @@ int Tmocon(int argc, char **argv) memset(&shared->serverAddress, 0, sizeof(shared->serverAddress)); rv = PR_InitializeNetAddr(PR_IpAddrLoopback, BASE_PORT, &shared->serverAddress); PR_ASSERT(PR_SUCCESS == rv); - + while (PL_OPT_EOL != (os = PL_GetNextOpt(opt))) { if (PL_OPT_BAD == os) continue; diff --git a/pr/tests/tpd.c b/pr/tests/tpd.c index eef1a1d8..e1486fab 100644 --- a/pr/tests/tpd.c +++ b/pr/tests/tpd.c @@ -36,7 +36,7 @@ static void PrintProgress(PRIntn line) printf( "@ line %d destructor should%s have been called and was%s\n", line, ((should) ? "" : " NOT"), ((did) ? "" : " NOT")); -#else +#else PR_fprintf( fout, "@ line %d destructor should%s have been called and was%s\n", line, ((should) ? "" : " NOT"), ((did) ? "" : " NOT")); @@ -75,7 +75,7 @@ static void PR_CALLBACK Thread(void *null) char *key_string[] = { "Key #0", "Key #1", "Key #2", "Key #3", "Bogus #5", "Bogus #6", "Bogus #7", "Bogus #8"}; - + did = should = PR_FALSE; for (keys = 0; keys < 8; ++keys) { @@ -99,7 +99,7 @@ static void PR_CALLBACK Thread(void *null) MY_ASSERT(PR_FAILURE == rv); } PrintProgress(__LINE__); - + did = PR_FALSE; should = PR_TRUE; for (keys = 0; keys < 4; ++keys) { @@ -168,7 +168,7 @@ static PRIntn PR_CALLBACK Tpd(PRIntn argc, char **argv) char *key_string[] = { "Key #0", "Key #1", "Key #2", "Key #3", "Bogus #5", "Bogus #6", "Bogus #7", "Bogus #8"}; - + fout = PR_STDOUT; did = should = PR_FALSE; @@ -204,7 +204,7 @@ static PRIntn PR_CALLBACK Tpd(PRIntn argc, char **argv) MY_ASSERT(PR_FAILURE == rv); } PrintProgress(__LINE__); - + did = PR_FALSE; should = PR_TRUE; for (keys = 0; keys < 4; ++keys) { @@ -268,7 +268,7 @@ static PRIntn PR_CALLBACK Tpd(PRIntn argc, char **argv) #else (void)PR_fprintf( fout, "%s\n",((PR_TRUE == failed) ? "FAILED" : "PASSED")); -#endif +#endif return 0; diff --git a/pr/tests/udpsrv.c b/pr/tests/udpsrv.c index 805bccbb..d8aa208f 100644 --- a/pr/tests/udpsrv.c +++ b/pr/tests/udpsrv.c @@ -22,21 +22,21 @@ ** He detects an EOF condition set by UDP_Client(). For each ** packet received by UDP_Server(), he checks its content for ** expected content, then sends the packet back to UDP_Client(). -** +** ** UDP_Client() sends packets to UDP_Server() using sendto() ** he recieves packets back from the server via recvfrom(). ** After he sends enough packets containing UDP_AMOUNT_TO_WRITE ** bytes of data, he sends an EOF message. -** +** ** The test issues a pass/fail message at end. -** +** ** Notes: ** The variable "_debug_on" can be set to 1 to cause diagnostic ** messages related to client/server synchronization. Useful when ** the test hangs. -** +** ** Error messages are written to stdout. -** +** ******************************************************************** */ /* --- include files --- */ @@ -96,11 +96,11 @@ static PRFileDesc *output = NULL; void ListNetAddr( char *msg, PRNetAddr *na ) { char mbuf[256]; - + sprintf( mbuf, "ListNetAddr: %s family: %d, port: %d, ip: %8.8X\n", msg, na->inet.family, PR_ntohs( na->inet.port), PR_ntohl(na->inet.ip) ); -#if 0 - DPRINTF( mbuf ); +#if 0 + DPRINTF( mbuf ); #endif } /* --- end ListNetAddr() --- */ @@ -127,7 +127,7 @@ static void PR_CALLBACK UDP_Server( void *arg ) PRBool bound = PR_FALSE; PRBool endOfInput = PR_FALSE; PRInt32 numBytes = UDP_DGRAM_SIZE; - + DPRINTF("udpsrv: UDP_Server(): starting\n" ); /* --- Create the socket --- */ @@ -141,13 +141,13 @@ static void PR_CALLBACK UDP_Server( void *arg ) "udpsrv: UDP_Server(): PR_NewUDPSocket() returned NULL\n" ); return; } - + /* --- Initialize the sockaddr_in structure --- */ - memset( &netaddr, 0, sizeof( netaddr )); + memset( &netaddr, 0, sizeof( netaddr )); netaddr.inet.family = PR_AF_INET; netaddr.inet.port = PR_htons( UDP_SERVER_PORT ); netaddr.inet.ip = PR_htonl( MY_INADDR ); - + /* --- Bind the socket --- */ while ( !bound ) { @@ -176,7 +176,7 @@ static void PR_CALLBACK UDP_Server( void *arg ) bound = PR_TRUE; } ListNetAddr( "UDP_Server: after bind", &netaddr ); - + /* --- Recv the socket --- */ while( !endOfInput ) { @@ -193,15 +193,15 @@ static void PR_CALLBACK UDP_Server( void *arg ) return; } ListNetAddr( "UDP_Server after RecvFrom", &netaddr ); - + srvBytesRead += rv; - + if ( svrBuf[0] == 'E' ) { DPRINTF("udpsrv: UDP_Server(): EOF on input detected\n" ); endOfInput = PR_TRUE; } - + /* --- Send the socket --- */ DPRINTF("udpsrv: UDP_Server(): SendTo(): socket\n" ); rv = PR_SendTo( svrSock, svrBuf, rv, 0, &netaddr, PR_INTERVAL_NO_TIMEOUT ); @@ -217,7 +217,7 @@ static void PR_CALLBACK UDP_Server( void *arg ) } ListNetAddr( "UDP_Server after SendTo", &netaddr ); } - + /* --- Close the socket --- */ DPRINTF("udpsrv: UDP_Server(): Closing socket\n" ); rv = PR_Close( svrSock ); @@ -229,7 +229,7 @@ static void PR_CALLBACK UDP_Server( void *arg ) "udpsrv: UDP_Server(): PR_Close(): failed to close socket\n" ); return; } - + DPRINTF("udpsrv: UDP_Server(): Normal end\n" ); } /* --- end UDP_Server() --- */ @@ -264,10 +264,10 @@ static void PR_CALLBACK UDP_Client( void *arg ) PRInt32 numBytes = UDP_DGRAM_SIZE; PRInt32 writeThisMany = UDP_AMOUNT_TO_WRITE; int i; - - + + DPRINTF("udpsrv: UDP_Client(): starting\n" ); - + /* --- Create the socket --- */ cltSock = PR_NewUDPSocket(); if ( cltSock == NULL ) @@ -278,17 +278,17 @@ static void PR_CALLBACK UDP_Client( void *arg ) "udpsrv: UDP_Client(): PR_NewUDPSocket() returned NULL\n" ); return; } - + /* --- Initialize the sockaddr_in structure --- */ - memset( &netaddr, 0, sizeof( netaddr )); + memset( &netaddr, 0, sizeof( netaddr )); netaddr.inet.family = PR_AF_INET; netaddr.inet.ip = PR_htonl( MY_INADDR ); netaddr.inet.port = PR_htons( UDP_CLIENT_PORT ); - - /* --- Initialize the write buffer --- */ + + /* --- Initialize the write buffer --- */ for ( i = 0; i < UDP_BUF_SIZE ; i++ ) cltBuf[i] = i; - + /* --- Bind the socket --- */ while ( !bound ) { @@ -319,26 +319,26 @@ static void PR_CALLBACK UDP_Client( void *arg ) bound = PR_TRUE; } ListNetAddr( "UDP_Client after Bind", &netaddr ); - + /* --- Initialize the sockaddr_in structure --- */ - memset( &netaddr, 0, sizeof( netaddr )); + memset( &netaddr, 0, sizeof( netaddr )); netaddr.inet.family = PR_AF_INET; netaddr.inet.ip = PR_htonl( PEER_INADDR ); netaddr.inet.port = PR_htons( UDP_SERVER_PORT ); - - /* --- send and receive packets until no more data left */ + + /* --- send and receive packets until no more data left */ while( !endOfInput ) { /* ** Signal EOF in the data stream on the last packet - */ + */ if ( writeThisMany <= UDP_DGRAM_SIZE ) { DPRINTF("udpsrv: UDP_Client(): Send EOF packet\n" ); cltBuf[0] = 'E'; endOfInput = PR_TRUE; } - + /* --- SendTo the socket --- */ if ( writeThisMany > UDP_DGRAM_SIZE ) numBytes = UDP_DGRAM_SIZE; @@ -347,11 +347,11 @@ static void PR_CALLBACK UDP_Client( void *arg ) writeThisMany -= numBytes; { char mbuf[256]; - sprintf( mbuf, "udpsrv: UDP_Client(): write_this_many: %d, numbytes: %d\n", + sprintf( mbuf, "udpsrv: UDP_Client(): write_this_many: %d, numbytes: %d\n", writeThisMany, numBytes ); DPRINTF( mbuf ); } - + DPRINTF("udpsrv: UDP_Client(): SendTo(): socket\n" ); rv = PR_SendTo( cltSock, cltBuf, numBytes, 0, &netaddr, UDP_TIMEOUT ); if ( rv == -1 ) @@ -381,7 +381,7 @@ static void PR_CALLBACK UDP_Client( void *arg ) } ListNetAddr( "UDP_Client after RecvFrom()", &netaddr ); cltBytesRead += rv; - + /* --- verify buffer --- */ for ( i = 0; i < rv ; i++ ) { @@ -399,7 +399,7 @@ static void PR_CALLBACK UDP_Client( void *arg ) } if (debug_mode) PR_fprintf(output, "."); } - + /* --- Close the socket --- */ DPRINTF("udpsrv: UDP_Server(): Closing socket\n" ); rv = PR_Close( cltSock ); @@ -458,16 +458,16 @@ int main(int argc, char **argv) } } PL_DestroyOptState(opt); - + PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0); PR_STDIO_INIT(); output = PR_STDERR; PR_SetConcurrency(4); - + /* ** Create the Server thread - */ + */ DPRINTF( "udpsrv: Creating Server Thread\n" ); srv = PR_CreateThread( PR_USER_THREAD, UDP_Server, @@ -481,16 +481,16 @@ int main(int argc, char **argv) if (debug_mode) PR_fprintf(output, "udpsrv: Cannot create server thread\n" ); passed = PR_FALSE; } - + /* ** Give the Server time to Start - */ + */ DPRINTF( "udpsrv: Pausing to allow Server to start\n" ); PR_Sleep( PR_MillisecondsToInterval(200) ); - + /* ** Create the Client thread - */ + */ DPRINTF( "udpsrv: Creating Client Thread\n" ); clt = PR_CreateThread( PR_USER_THREAD, UDP_Client, @@ -504,14 +504,14 @@ int main(int argc, char **argv) if (debug_mode) PR_fprintf(output, "udpsrv: Cannot create server thread\n" ); passed = PR_FALSE; } - + /* ** */ DPRINTF("udpsrv: Waiting to join Server & Client Threads\n" ); PR_JoinThread( srv ); - PR_JoinThread( clt ); - + PR_JoinThread( clt ); + /* ** Evaluate test results */ diff --git a/pr/tests/version.c b/pr/tests/version.c index a026de94..a1d4d962 100644 --- a/pr/tests/version.c +++ b/pr/tests/version.c @@ -57,7 +57,7 @@ int main(int argc, char **argv) if (NULL == versionPoint) { PL_FPrintError(err, "PR_FindSymbol"); return 4; - } + } version_info = versionPoint(); } } else diff --git a/pr/tests/writev.c b/pr/tests/writev.c index 24544a46..df76ff6d 100644 --- a/pr/tests/writev.c +++ b/pr/tests/writev.c @@ -89,7 +89,7 @@ int PR_CALLBACK Writev(int argc, char **argv) fragment_length = message_length / (IOV_MAX - 2); number_fragments = (message_length + fragment_length - 1) / fragment_length + 1; - if (NULL != debug) PR_fprintf(debug, + if (NULL != debug) PR_fprintf(debug, "Too many fragments - reset fragment length to %ld\n", fragment_length); } iov = (PRIOVec*)malloc(number_fragments * sizeof(PRIOVec)); diff --git a/pr/tests/xnotify.c b/pr/tests/xnotify.c index 97096cc6..00d35210 100644 --- a/pr/tests/xnotify.c +++ b/pr/tests/xnotify.c @@ -341,7 +341,7 @@ static PRIntn PR_CALLBACK RealMain( PRIntn argc, char **argv ) PR_DestroyLock(ml); - PR_fprintf(err, "Done!\n"); + PR_fprintf(err, "Done!\n"); return 0; } /* main */ @@ -349,7 +349,7 @@ static PRIntn PR_CALLBACK RealMain( PRIntn argc, char **argv ) int main(int argc, char **argv) { PRIntn rv; - + PR_STDIO_INIT(); rv = PR_Initialize(RealMain, argc, argv, 0); return rv; diff --git a/pr/tests/y2k.c b/pr/tests/y2k.c index 12cc16f4..80934142 100644 --- a/pr/tests/y2k.c +++ b/pr/tests/y2k.c @@ -115,14 +115,14 @@ static int ExplodedTimeIsEqual(const PRExplodedTime *et1, * * Call PR_ImplodeTime for each of the exploded values and compare * the resulting PRTime values with the original input. - * + * * This test is run for the values of time T corresponding to the * following dates: - * - 12/31/99 - before 2000 - * - 01/01/00 - after 2000 - * - Leap year - Feb 29, 2000 - * - March 1st, 2001 (after 1 year) - * - March 1st, 2005 (after second leap year) + * - 12/31/99 - before 2000 + * - 01/01/00 - after 2000 + * - Leap year - Feb 29, 2000 + * - March 1st, 2001 (after 1 year) + * - March 1st, 2005 (after second leap year) * - 09/09/99 (used by some programs as an end of file marker) * * Call PR_Now, convert to calendar time using PR_ExplodeTime and @@ -130,7 +130,7 @@ static int ExplodedTimeIsEqual(const PRExplodedTime *et1, * the system clock. * * Tested functions: PR_Now, PR_ExplodeTime, PR_ImplodeTime, - * PR_LocalTimeParameters, PR_GMTParameters. + * PR_LocalTimeParameters, PR_GMTParameters. */ static PRTime prt[] = { @@ -228,7 +228,7 @@ static PRStatus TestExplodeImplodeTime(void) for (idx = 0; idx < array_size; idx++) { PR_snprintf(buf, sizeof(buf), "%lld", prt[idx]); - if (debug_mode) printf("Time stamp %s\n", buf); + if (debug_mode) printf("Time stamp %s\n", buf); PR_ExplodeTime(prt[idx], PR_GMTParameters, &et_tmp); if (!ExplodedTimeIsEqual(&et_tmp, &gmt[idx])) { fprintf(stderr, "GMT not equal\n"); @@ -339,7 +339,7 @@ typedef struct time_increment { * Time zone. */ typedef struct normalize_test_data { - PRExplodedTime base_time; + PRExplodedTime base_time; time_increment_t increment; PRExplodedTime expected_gmt_time; PRExplodedTime expected_uspt_time; @@ -410,7 +410,7 @@ normalize_test_data_t normalize_test_array[] = { /* 2004-04-26 12:00 GMT */ {{0, 0, 0, 20, 3, 0, 2001, 3, 2, { 0, 0}}, {0, 0, 30,0}, - {0, 0, 30, 20, 3, 0, 2001, 3, 2, { 0, 0}},/*Wed Jan 3 20:30:00 2001 UTC*/ + {0, 0, 30, 20, 3, 0, 2001, 3, 2, { 0, 0}},/*Wed Jan 3 20:30:00 2001 UTC*/ {0, 0, 30, 12, 3, 0, 2001, 3, 2, { -28800, 0}}/*Wed Jan 3 12:30:00 2001 -0800*/ }, @@ -499,7 +499,7 @@ typedef struct ParseTest PRExplodedTime et; /* expected result of the conversion */ } ParseTest; -static ParseTest parseArray[] = +static ParseTest parseArray[] = { /* |<----- expected result ------------------------------------------->| */ /* "string to test" usec sec min hour day mo year wday julian {gmtoff, dstoff }*/ @@ -533,7 +533,7 @@ static ParseTest parseArray[] = { "69-12-31 00:00:00", { 000000, 00, 00, 00, 31, 11, 2069, 2, 364, {-28800, 0 }}}, { "69/12/31 00:00:00", { 000000, 00, 00, 00, 31, 11, 2069, 2, 364, {-28800, 0 }}}, - /* "Sun". 31-Dec-1998 (?) */ + /* "Sun". 31-Dec-1998 (?) */ { "Thu 31 Dec 1998 00:00:00", { 00000, 00, 00, 00, 31, 11, 1998, 4, 364, {-28800, 0 }}}, { "12/31/98 00:00:00", { 00000, 00, 00, 00, 31, 11, 1998, 4, 364, {-28800, 0 }}}, { "12/31/1998 00:00:00", { 00000, 00, 00, 00, 31, 11, 1998, 4, 364, {-28800, 0 }}}, @@ -551,7 +551,7 @@ static ParseTest parseArray[] = { "09-09-99 00:00:00", { 000000, 00, 00, 00, 9, 8, 1999, 4, 251, {-28800, 3600 }}}, { "09-09-1999 00:00:00", { 000000, 00, 00, 00, 9, 8, 1999, 4, 251, {-28800, 3600 }}}, { "99-09-09 00:00:00", { 000000, 00, 00, 00, 9, 8, 1999, 4, 251, {-28800, 3600 }}}, - + /* "Sun". 10-Sep-1999. Because Sun said so. */ { "10 Sep 1999 00:00:00", { 000000, 00, 00, 00, 10, 8, 1999, 5, 252, {-28800, 3600 }}}, { "9/10/99 00:00:00", { 000000, 00, 00, 00, 10, 8, 1999, 5, 252, {-28800, 3600 }}}, @@ -659,7 +659,7 @@ static ParseTest parseArray[] = { "03-01-2005 00:00:00", { 000000, 00, 00, 00, 1, 2, 2005, 2, 59, {-28800, 0 }}}, /* last element. string must be null */ - { NULL } + { NULL } }; /* end array of ParseTest */ /* @@ -708,12 +708,12 @@ static PRStatus TestParseTime( void ) PrintExplodedTime( &ptp->et ); printf("\n"); } - + rv = PR_FAILURE; failed_already = 1; } } - + /* point to next element in array, keep going */ ptp++; sp = ptp->sDate; @@ -732,7 +732,7 @@ int main(int argc, char** argv) */ PLOptStatus os; PLOptState *opt; - + PR_STDIO_INIT(); opt = PL_CreateOptState(argc, argv, "d"); while (PL_OPT_EOL != (os = PL_GetNextOpt(opt))) @@ -750,7 +750,7 @@ int main(int argc, char** argv) PL_DestroyOptState(opt); /* main test */ - + PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0); lm = PR_NewLogModule("test"); @@ -778,9 +778,9 @@ int main(int argc, char** argv) else printf("Test 3: Parse Time Test passed\n"); - if (failed_already) + if (failed_already) return 1; - else + else return 0; } /* end main() y2k.c */ diff --git a/pr/tests/y2ktmo.c b/pr/tests/y2ktmo.c index e55cf997..e7ceb436 100644 --- a/pr/tests/y2ktmo.c +++ b/pr/tests/y2ktmo.c @@ -28,7 +28,7 @@ * time again, to rule out the possibility that PR_IntervalNow() * is broken. We allow the actual elapsed time to deviate from * the specified timeout by a certain tolerance (in milliseconds). - */ + */ #include "nspr.h" #include "plgetopt.h" @@ -525,7 +525,7 @@ int main(int argc, char **argv) /* start to time out 5 seconds after a rollover date */ secs = lead_time_secs + 5; idx = 0; - for (i = 0; i < num_thread_scopes; i++) { + for (i = 0; i < num_thread_scopes; i++) { for (j = 0; j < num_thread_funcs; j++) { threads[idx] = PR_CreateThread(PR_USER_THREAD, threadFuncs[j], (void*)PR_SecondsToInterval(secs), PR_PRIORITY_NORMAL, diff --git a/pr/tests/yield.c b/pr/tests/yield.c index c68166e1..1e4b6b89 100644 --- a/pr/tests/yield.c +++ b/pr/tests/yield.c @@ -17,7 +17,7 @@ #define THREADS 10 -void +void threadmain(void *_id) { int id = (int)_id; diff --git a/pr/tests/zerolen.c b/pr/tests/zerolen.c index 339d35a9..730be79d 100644 --- a/pr/tests/zerolen.c +++ b/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 |