IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 5956


Ignore:
Timestamp:
Jan 9, 2006, 6:22:57 PM (21 years ago)
Author:
eugene
Message:

skyregion bug fixes

Location:
trunk/Ohana/src/libdvo/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/libdvo/src/skyregion_io.c

    r5945 r5956  
    7272  if (f == (FILE *) NULL) {
    7373    fprintf (stderr, "cannot open %s for output\n", filename);
    74     exit (1);
     74    return (FALSE);
    7575  }
    7676 
     
    111111  if (sky == NULL) {
    112112    fprintf (stderr, "error loading sky table\n");
    113     exit (1);
     113    return (NULL);
    114114  }
    115115  /* set the depths to the default depth */
     
    119119  sprintf (filename, "%s/SkyTable.fits", catdir);
    120120  check_file_access (filename, FALSE, verbose);
    121   SkyTableSave (sky, filename);
     121  if (!SkyTableSave (sky, filename)) return NULL;
     122
    122123  fits_convert_SkyRegion (sky[0].regions, sizeof (SkyTable), sky[0].Nregions);
    123124  return (sky);
     
    128129  if (sky == NULL) {
    129130    fprintf (stderr, "error loading sky table\n");
    130     exit (1);
     131    return (NULL);
    131132  }
    132133
     
    134135  sprintf (filename, "%s/SkyTable.fits", catdir);
    135136  check_file_access (filename, FALSE, verbose);
    136   SkyTableSave (sky, filename);
     137  if (!SkyTableSave (sky, filename)) return NULL;
     138
    137139  fits_convert_SkyRegion (sky[0].regions, sizeof (SkyRegion), sky[0].Nregions);
    138140  return (sky);
  • trunk/Ohana/src/libdvo/src/skyregion_ops.c

    r5945 r5956  
    5151  ALLOCATE (list, SkyList, 1);
    5252  ALLOCATE (list[0].regions,  SkyRegion *, NREGIONS);
     53  ALLOCATE (list[0].filename,  char *, NREGIONS);
    5354  list[0].Nregions = N;
    5455
     
    7172
    7273    list[0].regions[N] = &region[No];
     74    list[0].filename[N] = table[0].filename[No];
    7375    N++;
    74     if (N == NREGIONS) {
    75       NREGIONS += 10;
    76       REALLOCATE (list[0].regions, SkyRegion *, NREGIONS);
    77     }     
     76    CHECK_REALLOCATE (list[0].regions, SkyRegion *, NREGIONS, N, 10);
     77    CHECK_REALLOCATE (list[0].filename, char *, NREGIONS, N, 10);
    7878    list[0].Nregions = N;
    7979
     
    167167    extra = SkyListChildrenByBounds (table, -1, depth, Rmin, 360.0, Dmin, Dmax);
    168168    REALLOCATE (list[0].regions, SkyRegion *, list[0].Nregions + extra[0].Nregions);
     169    REALLOCATE (list[0].filename, char *, list[0].Nregions + extra[0].Nregions);
    169170    Ns = list[0].Nregions;
    170171    for (i = 0; i < extra[0].Nregions; i++) {
    171172      list[0].regions[i + Ns] = extra[0].regions[i];
     173      list[0].filename[i + Ns] = extra[0].filename[i];
    172174    }
    173175    list[0].Nregions += extra[0].Nregions;
     
    192194  ALLOCATE (list, SkyList, 1);
    193195  ALLOCATE (list[0].regions, SkyRegion *, NNEW);
     196  ALLOCATE (list[0].filename, char *, NNEW);
    194197
    195198  region = table[0].regions;
     
    221224        NNEW = Nnew + children[0].Nregions + 50;
    222225        REALLOCATE (list[0].regions, SkyRegion *, NNEW);
     226        REALLOCATE (list[0].filename, char *, NNEW);
    223227      }
    224228      for (j = 0; j < children[0].Nregions; j++) {
    225229        list[0].regions[Nnew + j] = children[0].regions[j];
     230        list[0].filename[Nnew + j] = children[0].filename[j];
    226231      }
    227232      Nnew += children[0].Nregions;
     
    229234    } else {
    230235      list[0].regions[Nnew] = &region[i];
     236      list[0].filename[Nnew] = table[0].filename[i];
    231237      Nnew ++;
    232238      CHECK_REALLOCATE (list[0].regions, SkyRegion *, NNEW, Nnew, 50);
     239      CHECK_REALLOCATE (list[0].filename, char *, NNEW, Nnew, 50);
    233240    }
    234241  }
Note: See TracChangeset for help on using the changeset viewer.