IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 8456


Ignore:
Timestamp:
Aug 21, 2006, 4:00:06 PM (20 years ago)
Author:
eugene
Message:

minor issues with new APIs

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

Legend:

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

    r8429 r8456  
    7575    catalog[0].catflags = 0;
    7676    catalog[0].sorted = 0;
     77    catalog[0].Nsecfilt = 0;
    7778  }
    7879
     
    8889  catalog[0].Nmeasure = 0;
    8990  catalog[0].Nmissing = 0;
    90   catalog[0].Nsecfilt = 0;
    9191
    9292  catalog[0].Nave_disk  = 0;
     
    173173  if (mode == DVO_OPEN_NONE) return (FALSE);
    174174
     175  // save the expected Nsecfilt value for testing
     176  Nsecfilt = catalog[0].Nsecfilt;
     177
     178  dvo_catalog_init (catalog, FALSE);
     179
    175180  catalog[0].lockmode  = LCK_XCLD;
    176181  if (mode == DVO_OPEN_READ) catalog[0].lockmode  = LCK_SOFT;
    177 
     182 
    178183  // XXX make a backup?  always?
    179184  if (!check_file_access (catalog[0].filename, TRUE, VERBOSE)) {
     
    182187  }
    183188
    184   if (VERBOSE) fprintf (stderr, "adding to %s\n", catalog[0].filename);
    185    
    186   // save the expected Nsecfilt value for testing
    187   Nsecfilt = catalog[0].Nsecfilt;
    188 
     189  if (VERBOSE) fprintf (stderr, "opening %s\n", catalog[0].filename);
     190 
    189191  switch (dvo_catalog_lock (catalog, catalog[0].lockmode)) {
    190192  case 0:
     
    203205    break;
    204206  case 2:
    205     if (DVO_OPEN_READ || DVO_OPEN_UPDATE) return (TRUE);
     207    if ((mode == DVO_OPEN_READ) || (mode == DVO_OPEN_UPDATE)) return (TRUE);
     208    catalog[0].Nsecfilt = Nsecfilt;
    206209    dvo_catalog_create (region, catalog); /* fills in new header info */
    207210    if (VERBOSE) fprintf (stderr, "creating new file %s\n", catalog[0].filename);
     
    256259      if (VERBOSE) fprintf (stderr, "reading catalog (mode DVO_MODE_SPLIT)\n");
    257260      dvo_catalog_load_split (catalog, VERBOSE);
    258       dvo_catalog_test (catalog, TRUE);
    259261      break;
    260262    default:
     
    326328  SecFilt *insec, *outsec;
    327329
     330  if (Nsecfilt == 0) return (TRUE); // if Nsecfilt is not set, don't do this check
    328331  if (catalog[0].Nsecfilt == Nsecfilt) return (TRUE);
    329332  if (catalog[0].Nsecfilt > Nsecfilt) return (FALSE);
  • trunk/Ohana/src/libdvo/src/dvo_catalog_raw.c

    r8328 r8456  
    3535    if (catalog[0].catformat != DVO_FORMAT_UNDEF) goto got_format;
    3636  }
     37  /* special cases: old versions of the DB tables which were poorly identified */
    3738  if (gfits_scan (&catalog[0].header, "NEWMEAS",  "%t", 1, &NewMeasure)) {
    3839    catalog[0].catformat = DVO_FORMAT_ELIXIR;
  • trunk/Ohana/src/libdvo/src/dvo_catalog_split.c

    r8386 r8456  
    33int dvo_catalog_load_split (Catalog *catalog, int VERBOSE) {
    44
    5   int Nitems, Nexpect, Naverage, Nmeasure, Nmissing, Nsecfilt;
     5  int Nitems, Nexpect, Naverage, Nmeasure, Nmissing, Nsecfilt, status;
    66  char *path, string[80];
    77  Header header;
     
    6060    gfits_free_header (&header);
    6161  }
    62   dvo_catalog_test (catalog, FALSE);
    6362
    6463  /*** Measure Table ***/
     
    111110    gfits_free_matrix (&matrix);
    112111  }
    113   dvo_catalog_test (catalog, FALSE);
    114112
    115113  /* (Meta Load) */
     
    143141  }
    144142  catalog[0].measure_catalog = measure;
    145   dvo_catalog_test (catalog, FALSE);
    146143
    147144  /*** Missing Table ***/
     
    158155
    159156    /* lock & open catalog file */
    160     if (dvo_catalog_lock (missing, catalog[0].lockmode) != 1) {
    161       fprintf (stderr, "cannot access missing file %s\n", missing[0].filename);
     157    status = dvo_catalog_lock (missing, catalog[0].lockmode);
     158    if (!status) {
     159      fprintf (stderr, "ERROR: cannot access missing file %s\n", missing[0].filename);
    162160      exit (2);
     161    }
     162    if (status == 2) {
     163        /* MISSING table is empty (this is not an error) */
     164        gfits_create_header (&missing[0].header);
     165        goto missing_empty;
    163166    }
    164167
     
    191194    gfits_free_matrix (&matrix);
    192195  }
     196missing_empty:
    193197  catalog[0].missing_catalog = missing;
    194   dvo_catalog_test (catalog, FALSE);
    195198
    196199  /*** Secfilt Table ***/
     
    241244  }
    242245  catalog[0].secfilt_catalog = secfilt;
    243   dvo_catalog_test (catalog, FALSE);
    244246
    245247  /* save the current number so we can do partial updates */
  • trunk/Ohana/src/libdvo/src/dvo_convert.c

    r7080 r8456  
    428428      return (TRUE);
    429429    case DVO_FORMAT_PANSTARRS:
     430    case DVO_FORMAT_PMTEST:
    430431      /* convert table rows from internal to external format */
    431432      for (i = 0; i < Nrow; i++) {
Note: See TracChangeset for help on using the changeset viewer.