IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 30, 2006, 12:08:33 PM (20 years ago)
Author:
magnier
Message:

fixed read, frees, leaks

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/objects/pmSourceIO_CMP.c

    r6872 r7012  
    33 *  @author EAM, IfA
    44 *
    5  *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
    6  *  @date $Date: 2006-04-17 18:01:05 $
     5 *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
     6 *  @date $Date: 2006-04-30 22:08:33 $
    77 *
    88 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2929#include "pmModelGroup.h"
    3030#include "pmSourceIO.h"
     31
     32// XXX make sure in and out have consistent zero-point adjustments
     33// XXX make sure the angle in correctly translated to/from degrees
     34// XXX we lose all information from the 'type' field
    3135
    3236// elixir-style pseudo FITS table (header + ascii list)
     
    121125{
    122126
     127    bool status;
    123128    int Ninstar;
    124129    psF32 *PAR, *dPAR;
    125     bool status;
    126130    psEllipseShape shape;
    127131    psEllipseAxes axes;
     
    162166
    163167    // we have fixed bytes / line : use that info
    164     char *buffer = psAlloc (BYTES_STAR*nStars);
     168    // XXX use the min of nStars and BLOCK?
     169    char *buffer = psAlloc (BYTES_STAR*PS_MIN(nStars, BLOCK));
    165170
    166171    int Nextra = 0;
     
    209214        for (int j = 0; j < Ninstar; j++) {
    210215            psString line = psStringNCopy (&buffer[j*BYTES_STAR], BYTES_STAR);
     216
     217            // XXX this is failing on lines where there are multiple spaces in a row
    211218            psList *list = psStringSplit (line, " ");
    212219            psArray *array = psListToArray (list);
    213220
     221            // XXX this is a bit cheap: I don't even attempt to interpret the
     222            // sextractor / dophot analysis to distinguish stars and galaxies
     223            // your milage may vary...
    214224            pmSource *source = pmSourceAlloc ();
    215225            pmModel *model = pmModelAlloc (modelType);
    216             source->modelPSF  = model;
    217226
    218227            PAR = model->params->data.F32;
     
    236245            PAR[6] = shape.sxy;
    237246
    238             // source->type   = atof (array->data[4]);
     247            source->modelPSF = model;
     248            source->type = PM_SOURCE_TYPE_STAR;
    239249
    240250            psArrayAdd (sources, 100, source);
     251
     252            psFree (line);
     253            psFree (list);
     254            psFree (array);
     255            psFree (source);
     256
    241257        }
    242258    }
    243259done_load:
    244260
    245     // XXX free up temp memory in this block
    246261    // XXX if sources->n != nStars, give an error?
     262    psFree (buffer);
    247263
    248264    fclose (f);
Note: See TracChangeset for help on using the changeset viewer.