Index: trunk/psModules/src/objects/pmSourceIO_CMP.c
===================================================================
--- trunk/psModules/src/objects/pmSourceIO_CMP.c	(revision 6872)
+++ trunk/psModules/src/objects/pmSourceIO_CMP.c	(revision 7012)
@@ -3,6 +3,6 @@
  *  @author EAM, IfA
  *
- *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2006-04-17 18:01:05 $
+ *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2006-04-30 22:08:33 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -29,4 +29,8 @@
 #include "pmModelGroup.h"
 #include "pmSourceIO.h"
+
+// XXX make sure in and out have consistent zero-point adjustments
+// XXX make sure the angle in correctly translated to/from degrees
+// XXX we lose all information from the 'type' field
 
 // elixir-style pseudo FITS table (header + ascii list)
@@ -121,7 +125,7 @@
 {
 
+    bool status;
     int Ninstar;
     psF32 *PAR, *dPAR;
-    bool status;
     psEllipseShape shape;
     psEllipseAxes axes;
@@ -162,5 +166,6 @@
 
     // we have fixed bytes / line : use that info
-    char *buffer = psAlloc (BYTES_STAR*nStars);
+    // XXX use the min of nStars and BLOCK?
+    char *buffer = psAlloc (BYTES_STAR*PS_MIN(nStars, BLOCK));
 
     int Nextra = 0;
@@ -209,10 +214,14 @@
         for (int j = 0; j < Ninstar; j++) {
             psString line = psStringNCopy (&buffer[j*BYTES_STAR], BYTES_STAR);
+
+            // XXX this is failing on lines where there are multiple spaces in a row
             psList *list = psStringSplit (line, " ");
             psArray *array = psListToArray (list);
 
+            // XXX this is a bit cheap: I don't even attempt to interpret the
+            // sextractor / dophot analysis to distinguish stars and galaxies
+            // your milage may vary...
             pmSource *source = pmSourceAlloc ();
             pmModel *model = pmModelAlloc (modelType);
-            source->modelPSF  = model;
 
             PAR = model->params->data.F32;
@@ -236,13 +245,20 @@
             PAR[6] = shape.sxy;
 
-            // source->type   = atof (array->data[4]);
+            source->modelPSF = model;
+            source->type = PM_SOURCE_TYPE_STAR;
 
             psArrayAdd (sources, 100, source);
+
+            psFree (line);
+            psFree (list);
+            psFree (array);
+            psFree (source);
+
         }
     }
 done_load:
 
-    // XXX free up temp memory in this block
     // XXX if sources->n != nStars, give an error?
+    psFree (buffer);
 
     fclose (f);
