IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 31, 2011, 2:54:06 PM (15 years ago)
Author:
eugene
Message:

merging changes from trunk

Location:
branches/eam_branches/ipp-20101205/Ohana/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20101205/Ohana/src/libdvo/src/dvo_util.c

    r27435 r30448  
    255255      dvo_catalog_free (&catalog);
    256256  }
     257  size_t NInvalidDetID = 0;
    257258  if (Ndetect) {
    258259      dvoDetection *sorted;
     
    262263      off_t i;
    263264      for (i = 0; i < Ndetect; i++) {
    264            sorted[detections[i].meas.detID] = detections[i];
     265
     266          if (detections[i].meas.detID < 0 || detections[i].meas.detID > (*pMaxDetID + 1))
     267              NInvalidDetID++;
     268          else
     269              sorted[detections[i].meas.detID] = detections[i];
    265270      }
    266271      *results = sorted;
     
    271276  FREE(detections);
    272277
     278  if (NInvalidDetID) fprintf (stderr, "ERROR: Encountered %ld invalid detection IDs\n", NInvalidDetID);
     279
    273280  return (Ndetect);
    274281
  • branches/eam_branches/ipp-20101205/Ohana/src/tools/src/roc.c

    r30252 r30448  
    3333
    3434  usage();
    35   exit (1);
     35  exit (2);
    3636}
    3737
    3838int roc_create (int argc, char **argv) {
    3939
    40   int i, j, n, Ninput, result, Nblocks, header_size, size_off, Noff, Nbytes, Nread;
     40  int i, j, n, Ninput, result, Nblocks, header_size, size_off;
     41  int status, Noff, Nbytes, Nread, Nwrite;
    4142  off_t maxSize, *sizes, *bytes_read;
    4243  char value;
     
    124125  myAssert (target, "failed to open output");
    125126
    126   fwrite (header, 1, header_size, target);
     127  Nwrite = fwrite (header, 1, header_size, target);
     128  myAssert (Nwrite == header_size, "failed to write header");
    127129
    128130  ALLOCATE (inputData, char *, Ninput);
     
    137139      Nbytes = fread (inputData[i], 1, Nread, input[i]);
    138140      myAssert (Nbytes == Nread, "failed to read data");
     141
    139142      if (Nread < ROC_BLOCKSIZE) {
    140143        // if we have reached the end of the file, fill in the rest with NULLs
     
    152155    }
    153156
    154     fwrite (outputData, 1, ROC_BLOCKSIZE, target);
    155   }
     157    Nwrite = fwrite (outputData, 1, ROC_BLOCKSIZE, target);
     158    myAssert (Nwrite == ROC_BLOCKSIZE, "failed to write data block");
     159  }
     160
     161  status = fclose (target);
     162  myAssert (!status, "failed to close rocfile");
    156163
    157164  exit (0);
     
    160167int roc_repair (int argc, char **argv) {
    161168
    162   int i, j, n, Ninput, Nblocks, header_size, Nbytes, Nread, Nfile, Nwrite;
     169  int i, j, n, Ninput, Nblocks, header_size, Nbytes;
     170  int status, Nread, Nfile, Nwrite;
    163171  off_t *sizes, *bytes_read;
    164172  char value;
     
    204212  // read the full header
    205213  fseeko (target, 0, SEEK_SET);
    206   fread (header, 1, header_size, target);
     214  Nread = fread (header, 1, header_size, target);
     215  myAssert (Nread == header_size, "failed to read header");
    207216
    208217  ptr = header;
     
    255264      Nbytes = fread (inputData[i], 1, Nread, input[i]);
    256265      myAssert (Nbytes == Nread, "failed to read data");
     266
    257267      if (Nread < ROC_BLOCKSIZE) {
    258268        // if we have reached the end of the file, fill in the rest with NULLs
     
    261271      bytes_read[i] += Nread;
    262272    }
    263     fread (targetData, 1, ROC_BLOCKSIZE, target);
     273    Nread = fread (targetData, 1, ROC_BLOCKSIZE, target);
     274    myAssert (Nread == ROC_BLOCKSIZE, "failed to read from target");
    264275   
    265276    for (j = 0; j < ROC_BLOCKSIZE; j++) {
     
    281292  for (i = 0; i < Ninput; i++) {
    282293    if (i == Nfile) continue;
    283     fclose(input[i]);
    284   }
    285   fclose (output);
    286   fclose (target);
     294    status = fclose(input[i]);
     295    myAssert (!status, "failed to close input");
     296  }
     297  status = fclose (output);
     298  myAssert (!status, "failed to close output file");
     299
     300  status = fclose (target);
     301  myAssert (!status, "failed to close rocfile");
    287302
    288303  exit (0);
Note: See TracChangeset for help on using the changeset viewer.