IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 23, 2004, 1:00:17 PM (22 years ago)
Author:
desonia
Message:

Changed the means of deallocation of memory. ps_Alloc now registers an optional free function to handle any additional processing of a memory object.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/test/image/tst_psImage.c

    r1033 r1073  
    66 *  @author Robert DeSonia, MHPCC
    77 *
    8  *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2004-06-14 23:03:43 $
     8 *  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2004-06-23 23:00:15 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    7575                psError(__func__,"psImageAlloc returned NULL for type %x, size %dx%d.",
    7676                        type[t], numCols[i], numRows[i]);
    77                 psImageFree(image);
     77                psFree(image);
    7878                return 1;
    7979            }
     
    8282                psError(__func__,"psImageAlloc allocated wrong dimen/type (%d/%d), should be "
    8383                        "PS_IMAGE_DIMEN/%d", image->type.dimen, image->type.type, type[t]);
    84                 psImageFree(image);
     84                psFree(image);
    8585                return 2;
    8686            }
     
    8989                psError(__func__,"psImageAlloc allocated wrong size %dx%d, should be %dx%d (type = %d)",
    9090                        image->numCols, image->numRows, numCols[i], numRows[i],type[t]);
    91                 psImageFree(image);
     91                psFree(image);
    9292                return 3;
    9393            }
     
    9696                psError(__func__,"psImageAlloc returned row0/col0 of %d/%d.  Should be 0/0.",
    9797                        image->row0, image->row0);
    98                 psImageFree(image);
     98                psFree(image);
    9999                return 4;
    100100            }
     
    102102            if (image->parent != NULL) {
    103103                psError(__func__,"psImageAlloc returned non-NULL parent");
    104                 psImageFree(image);
     104                psFree(image);
    105105                return 5;
    106106            }
     
    108108            if (image->nChildren != 0) {
    109109                psError(__func__,"psImageAlloc returned non-zero number of children");
    110                 psImageFree(image);
     110                psFree(image);
    111111                return 6;
    112112            }
     
    114114            if (image->children != NULL) {
    115115                psError(__func__,"psImageAlloc returned non-NULL children vector");
    116                 psImageFree(image);
     116                psFree(image);
    117117                return 7;
    118118            }
     
    132132                            if (image->data.U16[r][c] != 2*c+r) {
    133133                                psError(__func__,"Could not set all pixels in uint16 image at (%d,%d)",c,r);
    134                                 psImageFree(image);
     134                                psFree(image);
    135135                                return 8;
    136136                            }
     
    152152                            if (fabsf(image->data.F32[r][c] - (2.0f*c+r)) > FLT_EPSILON) {
    153153                                psError(__func__,"Could not set all pixels in float image at (%d,%d)",c,r);
    154                                 psImageFree(image);
     154                                psFree(image);
    155155                                return 8;
    156156                            }
     
    172172                            if (fabs(image->data.F64[r][c] - (2.0f*c+r)) > DBL_EPSILON) {
    173173                                psError(__func__,"Could not set all pixels in double image at (%d,%d)",c,r);
    174                                 psImageFree(image);
     174                                psFree(image);
    175175                                return 8;
    176176                            }
     
    193193                                    fabsf(cimagf(image->data.C32[r][c]) - c) > FLT_EPSILON ) {
    194194                                psError(__func__,"Could not set all pixels in complex image at (%d,%d)",c,r);
    195                                 psImageFree(image);
     195                                psFree(image);
    196196                                return 8;
    197197                            }
     
    215215                                psError(__func__,"Could not set all pixels in image (type=%d) at (%d,%d)",
    216216                                        type[t],c,r);
    217                                 psImageFree(image);
     217                                psFree(image);
    218218                                return 8;
    219219                            }
     
    225225            // #548: Verify no memory leaks or corruption are detected after a valid psImage structure with no
    226226            // children is freed.
    227             psImageFree(image);
     227            psFree(image);
    228228        }
    229229    }
    230230
    231231    // #548: Verify program execution doesn't stop, if the input psImage structure pointer is null.
    232     psImageFree(NULL);
     232    psFree(NULL);
    233233
    234234    // #548: Verify no memory leaks or corruption are detected after a valid psImage structure with multiple
     
    238238    psImageSubset(NULL,image,50,50,20,20);
    239239
    240     psImageFree(image);
     240    psFree(image);
    241241
    242242    return 0;
     
    501501    }
    502502
    503     psImageFree(original);
     503    psFree(original);
    504504
    505505    return 0;
     
    599599    }
    600600
    601     psImageFree(img);
    602     psImageFree(img2);
     601    psFree(img);
     602    psFree(img2);
    603603
    604604    return 0;
     
    678678        return 2; \
    679679    } \
    680     psImageFree(img);
     680    psFree(img);
    681681
    682682    #define testImageClipByComplexType(datatype) \
     
    718718        return 2; \
    719719    } \
    720     psImageFree(img);
     720    psFree(img);
    721721
    722722    psLogMsg(__func__,PS_LOG_INFO,"Testing clipping of F64 imagery");
     
    824824        return 2; \
    825825    } \
    826     psImageFree(img);
     826    psFree(img);
    827827
    828828    testImageClipNaNByType(F32);
     
    906906        } \
    907907    } \
    908     psImageFree(img); \
    909     psImageFree(img2);
     908    psFree(img); \
     909    psFree(img2);
    910910
    911911    #define testOverlayType(DATATYPE) \
     
    10161016    }
    10171017
    1018     psImageFree(img);
    1019     psImageFree(img2);
     1018    psFree(img);
     1019    psFree(img2);
    10201020
    10211021    return 0;
Note: See TracChangeset for help on using the changeset viewer.