Index: trunk/psLib/test/image/tst_psImageStats01.c
===================================================================
--- trunk/psLib/test/image/tst_psImageStats01.c	(revision 1234)
+++ trunk/psLib/test/image/tst_psImageStats01.c	(revision 1365)
@@ -1,8 +1,8 @@
 /*****************************************************************************
-    This routine must ensure that the psImageStats() routine can correctly
-    call the psVectorStats() routine.  Since the psVectorStats() will be
-    thouroughly tested elsewhere, we will only test psImageStats() with
-    the PS_STAT_SAMPLE_MEAN here.
- *****************************************************************************/
+   This routine must ensure that the psImageStats() routine can correctly
+   call the psVectorStats() routine.  Since the psVectorStats() will be
+   thouroughly tested elsewhere, we will only test psImageStats() with
+   the PS_STAT_SAMPLE_MEAN here.
+*****************************************************************************/
 #include <stdio.h>
 #include "pslib.h"
@@ -17,163 +17,163 @@
 int main()
 {
-    psStats *myStats    = NULL;
-    psStats *myStats2   = NULL;
-    psImage *tmpImage   = NULL;
-    psImage *tmpMask    = NULL;
-    int testStatus      = true;
-    int memLeaks        = 0;
-    int nb              = 0;
-    int i               = 0;
-    int j               = 0;
-    int IMAGE_X_SIZE    = 0;
-    int IMAGE_Y_SIZE    = 0;
-    int currentId       = 0;
-
-    currentId       = psMemGetId();
-    for (nb=0;nb<6;nb++) {
-        if (nb == 0) {
-            IMAGE_X_SIZE = 1;
-            IMAGE_Y_SIZE = 1;
+    psStats * myStats = NULL;
+    psStats *myStats2 = NULL;
+    psImage *tmpImage = NULL;
+    psImage *tmpMask = NULL;
+    int testStatus = true;
+    int memLeaks = 0;
+    int nb = 0;
+    int i = 0;
+    int j = 0;
+    int IMAGE_X_SIZE = 0;
+    int IMAGE_Y_SIZE = 0;
+    int currentId = 0;
+    
+    currentId = psMemGetId();
+    for ( nb = 0;nb < 6;nb++ ) {
+            if ( nb == 0 ) {
+                    IMAGE_X_SIZE = 1;
+                    IMAGE_Y_SIZE = 1;
+                }
+            if ( nb == 1 ) {
+                    IMAGE_X_SIZE = 1;
+                    IMAGE_Y_SIZE = N;
+                }
+            if ( nb == 2 ) {
+                    IMAGE_X_SIZE = N;
+                    IMAGE_Y_SIZE = 1;
+                }
+            if ( nb == 3 ) {
+                    IMAGE_X_SIZE = N;
+                    IMAGE_Y_SIZE = N;
+                }
+            if ( nb == 4 ) {
+                    IMAGE_X_SIZE = N;
+                    IMAGE_Y_SIZE = M;
+                }
+            if ( nb == 5 ) {
+                    IMAGE_X_SIZE = M;
+                    IMAGE_Y_SIZE = N;
+                }
+            printf( "*******************************\n" );
+            printf( "* IMAGE SIZE is (%d by %d)\n", IMAGE_X_SIZE, IMAGE_Y_SIZE );
+            printf( "*******************************\n" );
+            
+            /*************************************************************************/
+            /*  Allocate and initialize data structures                      */
+            /*************************************************************************/
+            tmpImage = psImageAlloc( IMAGE_X_SIZE, IMAGE_Y_SIZE, PS_TYPE_F32 );
+            
+            for ( i = 0;i < tmpImage->numRows;i++ ) {
+                    for ( j = 0;j < tmpImage->numCols;j++ ) {
+                            tmpImage->data.F32[ i ][ j ] = ( float ) ( i + j );
+                        }
+                }
+            tmpMask = psImageAlloc( IMAGE_X_SIZE, IMAGE_Y_SIZE, PS_TYPE_U8 );
+            for ( i = 0;i < tmpMask->numRows;i++ ) {
+                    for ( j = 0;j < tmpMask->numCols;j++ ) {
+                            if ( ( i > ( tmpMask->numRows / 2 ) ) &&
+                                    ( j > ( tmpMask->numCols / 2 ) ) ) {
+                                    tmpMask->data.U8[ i ][ j ] = 1;
+                                } else {
+                                    tmpMask->data.U8[ i ][ j ] = 0;
+                                }
+                        }
+                }
+                
+            myStats = psStatsAlloc( PS_STAT_SAMPLE_MEAN );
+            /*************************************************************************/
+            /*  Calculate Sample Mean with no mask                           */
+            /*************************************************************************/
+            printPositiveTestHeader( stdout,
+                                     "psImageStats functions",
+                                     "Calculate Sample Mean, no mask %d" );
+                                     
+            myStats = psImageStats( myStats, tmpImage, NULL, 0 );
+            printf( "The sample mean was %.2f\n", myStats->sampleMean );
+            
+            psMemCheckCorruption( 1 );
+            
+            printFooter( stdout,
+                         "psImageStats functions",
+                         "Calculate Sample Mean, no mask",
+                         testStatus );
+                         
+            /*************************************************************************/
+            /*  Calculate Sample Mean with mask                              */
+            /*************************************************************************/
+            printPositiveTestHeader( stdout,
+                                     "psImageStats functions",
+                                     "Calculate Sample Mean with mask" );
+                                     
+            myStats = psImageStats( myStats, tmpImage, tmpMask, 1 );
+            printf( "The sample mean was %.2f\n", myStats->sampleMean );
+            
+            psMemCheckCorruption( 1 );
+            
+            printFooter( stdout,
+                         "psImageStats functions",
+                         "Calculate Sample Mean with mask",
+                         testStatus );
+                         
+            /*************************************************************************/
+            /*  Deallocate data structures                                   */
+            /*************************************************************************/
+            printPositiveTestHeader( stdout,
+                                     "psImageStats functions",
+                                     "Deallocate the psStats/psImage structure." );
+            psFree( myStats );
+            psFree( tmpImage );
+            psFree( tmpMask );
+            
+            psMemCheckCorruption( 1 );
+            memLeaks = psMemCheckLeaks( currentId, NULL, NULL );
+            if ( 0 != memLeaks ) {
+                    psAbort( __func__, "Memory Leaks! (%d leaks)", memLeaks );
+                }
+                
+            printFooter( stdout,
+                         "psImageStats functions",
+                         "Deallocate the psStats/psImage structure.",
+                         testStatus );
         }
-        if (nb == 1) {
-            IMAGE_X_SIZE = 1;
-            IMAGE_Y_SIZE = N;
-        }
-        if (nb == 2) {
-            IMAGE_X_SIZE = N;
-            IMAGE_Y_SIZE = 1;
-        }
-        if (nb == 3) {
-            IMAGE_X_SIZE = N;
-            IMAGE_Y_SIZE = N;
-        }
-        if (nb == 4) {
-            IMAGE_X_SIZE = N;
-            IMAGE_Y_SIZE = M;
-        }
-        if (nb == 5) {
-            IMAGE_X_SIZE = M;
-            IMAGE_Y_SIZE = N;
-        }
-        printf("*******************************\n");
-        printf("* IMAGE SIZE is (%d by %d)\n", IMAGE_X_SIZE, IMAGE_Y_SIZE);
-        printf("*******************************\n");
-
-        /*************************************************************************/
-        /*  Allocate and initialize data structures                      */
-        /*************************************************************************/
-        tmpImage = psImageAlloc(IMAGE_X_SIZE, IMAGE_Y_SIZE, PS_TYPE_F32);
-
-        for (i=0;i<tmpImage->numRows;i++) {
-            for (j=0;j<tmpImage->numCols;j++) {
-                tmpImage->data.F32[i][j] = (float) (i + j);
-            }
-        }
-        tmpMask = psImageAlloc(IMAGE_X_SIZE, IMAGE_Y_SIZE, PS_TYPE_U8);
-        for (i=0;i<tmpMask->numRows;i++) {
-            for (j=0;j<tmpMask->numCols;j++) {
-                if ((i > (tmpMask->numRows/2)) &&
-                        (j > (tmpMask->numCols/2))) {
-                    tmpMask->data.U8[i][j] = 1;
-                } else {
-                    tmpMask->data.U8[i][j] = 0;
-                }
-            }
-        }
-
-        myStats = psStatsAlloc(PS_STAT_SAMPLE_MEAN);
-        /*************************************************************************/
-        /*  Calculate Sample Mean with no mask                           */
-        /*************************************************************************/
-        printPositiveTestHeader(stdout,
-                                "psImageStats functions",
-                                "Calculate Sample Mean, no mask %d");
-
-        myStats = psImageStats(myStats, tmpImage, NULL, 0);
-        printf("The sample mean was %f\n", myStats->sampleMean);
-
-        psMemCheckCorruption(1);
-
-        printFooter(stdout,
-                    "psImageStats functions",
-                    "Calculate Sample Mean, no mask",
-                    testStatus);
-
-        /*************************************************************************/
-        /*  Calculate Sample Mean with mask                              */
-        /*************************************************************************/
-        printPositiveTestHeader(stdout,
-                                "psImageStats functions",
-                                "Calculate Sample Mean with mask");
-
-        myStats = psImageStats(myStats, tmpImage, tmpMask, 1);
-        printf("The sample mean was %f\n", myStats->sampleMean);
-
-        psMemCheckCorruption(1);
-
-        printFooter(stdout,
-                    "psImageStats functions",
-                    "Calculate Sample Mean with mask",
-                    testStatus);
-
-        /*************************************************************************/
-        /*  Deallocate data structures                                   */
-        /*************************************************************************/
-        printPositiveTestHeader(stdout,
-                                "psImageStats functions",
-                                "Deallocate the psStats/psImage structure.");
-        psFree(myStats);
-        psFree(tmpImage);
-        psFree(tmpMask);
-
-        psMemCheckCorruption(1);
-        memLeaks = psMemCheckLeaks(currentId,NULL,NULL);
-        if (0 != memLeaks) {
-            psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks);
-        }
-
-        printFooter(stdout,
-                    "psImageStats functions",
-                    "Deallocate the psStats/psImage structure.",
-                    testStatus);
-    }
-
+        
     /*************************************************************************/
     /*  Test With Various Null Inputs                                        */
     /*************************************************************************/
-    printPositiveTestHeader(stdout,
-                            "psImageStats functions",
-                            "Test With Various Null Inputs");
-
-    tmpImage = psImageAlloc(IMAGE_X_SIZE, IMAGE_Y_SIZE, PS_TYPE_F32);
-    tmpMask = psImageAlloc(IMAGE_X_SIZE, IMAGE_Y_SIZE, PS_TYPE_U8);
-    myStats = psStatsAlloc(0);
-
-    myStats2 = psImageStats(myStats, NULL, NULL, 0);
-    if (myStats2 != NULL) {
-        printf("ERROR: myStats2 = psImageStats(myStats, NULL, NULL, 0) != NULL\n");
-    }
-
-    myStats2 = psImageStats(NULL, tmpImage, NULL, 0);
-    if (myStats2 != NULL) {
-        printf("ERROR: myStats2 = psImageStats(NULL, tmpImage, NULL, 0) != NULL\n");
-    }
-
-    myStats2 = psImageStats(myStats, tmpImage, NULL, 0);
-
-    psFree(myStats);
-    psFree(tmpImage);
-    psFree(tmpMask);
-
-    psMemCheckCorruption(1);
-    memLeaks = psMemCheckLeaks(currentId,NULL,NULL);
-    if (0 != memLeaks) {
-        psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks);
-    }
-
-    printFooter(stdout,
-                "psImageStats functions",
-                "Test With Various Null Inputs",
-                testStatus);
-    return (!testStatus);
+    printPositiveTestHeader( stdout,
+                             "psImageStats functions",
+                             "Test With Various Null Inputs" );
+                             
+    tmpImage = psImageAlloc( IMAGE_X_SIZE, IMAGE_Y_SIZE, PS_TYPE_F32 );
+    tmpMask = psImageAlloc( IMAGE_X_SIZE, IMAGE_Y_SIZE, PS_TYPE_U8 );
+    myStats = psStatsAlloc( 0 );
+    
+    myStats2 = psImageStats( myStats, NULL, NULL, 0 );
+    if ( myStats2 != NULL ) {
+            printf( "ERROR: myStats2 = psImageStats(myStats, NULL, NULL, 0) != NULL\n" );
+        }
+        
+    myStats2 = psImageStats( NULL, tmpImage, NULL, 0 );
+    if ( myStats2 != NULL ) {
+            printf( "ERROR: myStats2 = psImageStats(NULL, tmpImage, NULL, 0) != NULL\n" );
+        }
+        
+    myStats2 = psImageStats( myStats, tmpImage, NULL, 0 );
+    
+    psFree( myStats );
+    psFree( tmpImage );
+    psFree( tmpMask );
+    
+    psMemCheckCorruption( 1 );
+    memLeaks = psMemCheckLeaks( currentId, NULL, NULL );
+    if ( 0 != memLeaks ) {
+            psAbort( __func__, "Memory Leaks! (%d leaks)", memLeaks );
+        }
+        
+    printFooter( stdout,
+                 "psImageStats functions",
+                 "Test With Various Null Inputs",
+                 testStatus );
+    return ( !testStatus );
 }
