Bugzilla Bug 289052: added braces around nested if statements to ensure
authorwtchang%redhat.com
Wed, 29 Jun 2005 18:02:44 +0000
changeset 3412 9ea11beadaa93b71e39af360575d70495cfe77a6
parent 3411 0380cdaa4970842373dd7da2a1b3e16cfa28bd11
child 3416 282e2064f50539ff4174f28a4b40d7683d6dcf4d
push idunknown
push userunknown
push dateunknown
bugs289052
Bugzilla Bug 289052: added braces around nested if statements to ensure the intended nesting (as indicated by the indentation of the code). The patch is contributed by Shanmu <shanmus@gmail.com>. r=wtc. Modified files: server_test.c servr_kk.c servr_ku.c servr_uk.c servr_uu.c
pr/tests/server_test.c
pr/tests/servr_kk.c
pr/tests/servr_ku.c
pr/tests/servr_uk.c
pr/tests/servr_uu.c
--- a/pr/tests/server_test.c
+++ b/pr/tests/server_test.c
@@ -225,19 +225,19 @@ WorkerThreadFunc(void *_listenSock)
                                   PR_SYSTEM_THREAD,
                                   WorkerThreadFunc,
                                   listenSock,
                                   PR_PRIORITY_NORMAL,
                                   ServerScope,
                                   PR_UNJOINABLE_THREAD,
                                   THREAD_STACKSIZE);
 
-                if (!WorkerThread)
+                if (!WorkerThread) {
                     if (debug_mode) printf("Error creating client thread %d\n", workerThreads);
-                else {
+                } else {
                     PR_AtomicIncrement(&workerThreads);
                     if (debug_mode) DPRINTF("\tServer creates worker (%d)\n", workerThreads);
                 }
             }
             PR_Unlock(workerThreadsLock);
         }
  
         bytesToRead -= bytesRead;
@@ -254,21 +254,22 @@ WorkerThreadFunc(void *_listenSock)
             if (debug_mode) DPRINTF("\tServer received %d bytes\n", bytesRead);
         }
 
         bytesWritten = PR_Send(newSock,
                                sendBuf, 
                                bytesToWrite, 
                                0, 
                                PR_INTERVAL_NO_TIMEOUT);
-        if (bytesWritten != _server_data)
+        if (bytesWritten != _server_data) {
             if (debug_mode) printf("\tError sending data to client (%d, %d)\n", 
                 bytesWritten, PR_GetOSError());
-        else
+        } else {
             if (debug_mode) DPRINTF("\tServer sent %d bytes\n", bytesWritten);
+        }	
 
         PR_Close(newSock);
         PR_AtomicDecrement(&workerThreadsBusy);
     }
 }
 
 PRFileDesc *
 ServerSetup(void)
--- a/pr/tests/servr_kk.c
+++ b/pr/tests/servr_kk.c
@@ -191,19 +191,19 @@ WorkerThreadFunc(void *_listenSock)
                                   PR_SYSTEM_THREAD,
                                   WorkerThreadFunc,
                                   listenSock,
                                   PR_PRIORITY_NORMAL,
                                   ServerScope,
                                   PR_UNJOINABLE_THREAD,
                                   THREAD_STACKSIZE);
 
-                if (!WorkerThread)
+                if (!WorkerThread) {
                     if (debug_mode) printf("Error creating client thread %d\n", workerThreads);
-                else {
+                } else {
                     PR_AtomicIncrement(&workerThreads);
                     if (debug_mode) DPRINTF("\tServer creates worker (%d)\n", workerThreads);
                 }
             }
             PR_Unlock(workerThreadsLock);
         }
  
         bytesToRead -= bytesRead;
@@ -220,21 +220,22 @@ WorkerThreadFunc(void *_listenSock)
             if (debug_mode) DPRINTF("\tServer received %d bytes\n", bytesRead);
         }
 
         bytesWritten = PR_Send(newSock,
                                sendBuf, 
                                bytesToWrite, 
                                0, 
                                PR_INTERVAL_NO_TIMEOUT);
-        if (bytesWritten != _server_data)
+        if (bytesWritten != _server_data) {
             if (debug_mode) printf("\tError sending data to client (%d, %d)\n", 
                 bytesWritten, PR_GetOSError());
-        else
+        } else {
             if (debug_mode) DPRINTF("\tServer sent %d bytes\n", bytesWritten);
+        }
 
         PR_Close(newSock);
         PR_AtomicDecrement(&workerThreadsBusy);
     }
 }
 
 PRFileDesc *
 ServerSetup(void)
--- a/pr/tests/servr_ku.c
+++ b/pr/tests/servr_ku.c
@@ -192,19 +192,19 @@ WorkerThreadFunc(void *_listenSock)
                                   PR_SYSTEM_THREAD,
                                   WorkerThreadFunc,
                                   listenSock,
                                   PR_PRIORITY_NORMAL,
                                   ServerScope,
                                   PR_UNJOINABLE_THREAD,
                                   THREAD_STACKSIZE);
 
-                if (!WorkerThread)
+                if (!WorkerThread) {
                     if (debug_mode) printf("Error creating client thread %d\n", workerThreads);
-                else {
+                } else {
                     PR_AtomicIncrement(&workerThreads);
                     if (debug_mode) DPRINTF("\tServer creates worker (%d)\n", workerThreads);
                 }
             }
             PR_Unlock(workerThreadsLock);
         }
  
         bytesToRead -= bytesRead;
@@ -221,21 +221,22 @@ WorkerThreadFunc(void *_listenSock)
             if (debug_mode) DPRINTF("\tServer received %d bytes\n", bytesRead);
         }
 
         bytesWritten = PR_Send(newSock,
                                sendBuf, 
                                bytesToWrite, 
                                0, 
                                PR_INTERVAL_NO_TIMEOUT);
-        if (bytesWritten != _server_data)
+        if (bytesWritten != _server_data) {
             if (debug_mode) printf("\tError sending data to client (%d, %d)\n", 
                 bytesWritten, PR_GetOSError());
-        else
+        } else {
             if (debug_mode) DPRINTF("\tServer sent %d bytes\n", bytesWritten);
+        }
 
         PR_Close(newSock);
         PR_AtomicDecrement(&workerThreadsBusy);
     }
 }
 
 PRFileDesc *
 ServerSetup(void)
--- a/pr/tests/servr_uk.c
+++ b/pr/tests/servr_uk.c
@@ -194,19 +194,19 @@ WorkerThreadFunc(void *_listenSock)
                                   PR_SYSTEM_THREAD,
                                   WorkerThreadFunc,
                                   listenSock,
                                   PR_PRIORITY_NORMAL,
                                   ServerScope,
                                   PR_UNJOINABLE_THREAD,
                                   THREAD_STACKSIZE);
 
-                if (!WorkerThread)
+                if (!WorkerThread) {
                     if (debug_mode) printf("Error creating client thread %d\n", workerThreads);
-                else {
+                } else {
                     PR_AtomicIncrement(&workerThreads);
                     if (debug_mode) DPRINTF("\tServer creates worker (%d)\n", workerThreads);
                 }
             }
             PR_Unlock(workerThreadsLock);
         }
  
         bytesToRead -= bytesRead;
@@ -223,21 +223,22 @@ WorkerThreadFunc(void *_listenSock)
             if (debug_mode) DPRINTF("\tServer received %d bytes\n", bytesRead);
         }
 
         bytesWritten = PR_Send(newSock,
                                sendBuf, 
                                bytesToWrite, 
                                0, 
                                PR_INTERVAL_NO_TIMEOUT);
-        if (bytesWritten != _server_data)
+        if (bytesWritten != _server_data) {
             if (debug_mode) printf("\tError sending data to client (%d, %d)\n", 
                 bytesWritten, PR_GetOSError());
-        else
+        } else {
             if (debug_mode) DPRINTF("\tServer sent %d bytes\n", bytesWritten);
+        }
 
         PR_Close(newSock);
         PR_AtomicDecrement(&workerThreadsBusy);
     }
 }
 
 PRFileDesc *
 ServerSetup(void)
--- a/pr/tests/servr_uu.c
+++ b/pr/tests/servr_uu.c
@@ -192,19 +192,19 @@ WorkerThreadFunc(void *_listenSock)
                                   PR_SYSTEM_THREAD,
                                   WorkerThreadFunc,
                                   listenSock,
                                   PR_PRIORITY_NORMAL,
                                   ServerScope,
                                   PR_UNJOINABLE_THREAD,
                                   THREAD_STACKSIZE);
 
-                if (!WorkerThread)
+                if (!WorkerThread) {
                     if (debug_mode) printf("Error creating client thread %d\n", workerThreads);
-                else {
+                } else {
                     PR_AtomicIncrement(&workerThreads);
                     if (debug_mode) DPRINTF("\tServer creates worker (%d)\n", workerThreads);
                 }
             }
             PR_Unlock(workerThreadsLock);
         }
  
         bytesToRead -= bytesRead;
@@ -221,21 +221,22 @@ WorkerThreadFunc(void *_listenSock)
             if (debug_mode) DPRINTF("\tServer received %d bytes\n", bytesRead);
         }
 
         bytesWritten = PR_Send(newSock,
                                sendBuf, 
                                bytesToWrite, 
                                0, 
                                PR_INTERVAL_NO_TIMEOUT);
-        if (bytesWritten != _server_data)
+        if (bytesWritten != _server_data) {
             if (debug_mode) printf("\tError sending data to client (%d, %d)\n", 
                 bytesWritten, PR_GetOSError());
-        else
+        } else {
             if (debug_mode) DPRINTF("\tServer sent %d bytes\n", bytesWritten);
+        } 
 
         PR_Close(newSock);
         PR_AtomicDecrement(&workerThreadsBusy);
     }
 }
 
 PRFileDesc *
 ServerSetup(void)