IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 28, 2004, 1:26:49 PM (22 years ago)
Author:
desonia
Message:

changed function prototypes to match changes in the SDRS.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/image/psImage.c

    r1897 r1920  
    1010 *  @author Ross Harman, MHPCC
    1111 *
    12  *  @version $Revision: 1.46 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2004-09-25 02:06:12 $
     12 *  @version $Revision: 1.47 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2004-09-28 23:26:48 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    6868    *(psElemType* ) & image->type.type = type;
    6969    image->parent = NULL;
    70     image->nChildren = 0;
    7170    image->children = NULL;
    7271
     
    8180
    8281    if (image->type.type == PS_TYPE_PTR) {
    83         // 2-D array of pointers -- must
    84         // dereference
     82        // 2-D array of pointers -- must dereference elements
    8583        unsigned int oldNumRows = image->numRows;
    8684        unsigned int oldNumCols = image->numCols;
     
    9593    }
    9694
     95    if (image->parent != NULL) {
     96        psArrayRemove(image->parent->children,image);
     97        image->parent = NULL;
     98    }
     99
    97100    psImageFreeChildren(image);
    98101
    99102    psFree(image->rawDataBuffer);
    100103    psFree(image->data.V);
    101     image->data.V = NULL;
    102104}
    103105
     
    164166int psImageFreeChildren(psImage* image)
    165167{
    166     int i = 0;
    167     int nChildren = 0;
    168     psImage* *children = NULL;
    169168    int numFreed = 0;
    170169
     
    173172    }
    174173
    175     nChildren = image->nChildren;
    176     children = image->children;
    177 
    178     for (i = 0; i < nChildren; i++) {
    179         if (children[i] != NULL) {
    180             numFreed++;
    181             psFree(children[i]);
     174    if (image->children != NULL) {
     175        psImage** children = (psImage**)image->children->data;
     176        numFreed = image->children->n;
     177
     178        // orphan the children first
     179        // (so psFree doesn't try to modify the parent's children array while I'm using it)
     180        for (int i=0;i<numFreed;i++) {
     181            children[i]->parent = NULL;
    182182        }
    183     }
    184     psFree(children);
    185 
    186     image->nChildren = 0;
    187     image->children = NULL;
     183
     184        psFree(image->children);
     185        image->children = NULL;
     186    }
    188187
    189188    return numFreed;
Note: See TracChangeset for help on using the changeset viewer.