IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 12, 2015, 6:18:23 PM (11 years ago)
Author:
eugene
Message:

merge changes from EAM dev branch ohana.20150429

Location:
trunk/Ohana
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana

  • trunk/Ohana/src/libfits/table/F_write_T.c

    r37807 r38441  
    1414 
    1515  status = fseeko (f, 0LL, SEEK_END);  /* write table to end of file! */
     16  if (status) { perror ("fseeko: "); return (FALSE);  }
    1617  status = gfits_fwrite_table (f, table);
    1718
     
    2627 
    2728  Nbytes = fwrite (table[0].buffer, sizeof(char), table[0].datasize, f);
    28  
    29   if (Nbytes != table[0].datasize) return (FALSE);
     29  if (Nbytes != table[0].datasize) { perror ("fwrite: "); return (FALSE);  }
    3030  return (TRUE);
    3131}       
     
    4545  /* file pointer is at beginning of desired table data */
    4646  start = ftello (f);
     47  if (start < 0) { perror ("ftello: "); return FALSE; }
    4748 
    4849  for (i = 0; i < Nrow; i++) {
     
    5051    fseeko (f, offset, SEEK_SET);
    5152    Nbytes = fwrite (table[0].buffer[i], sizeof (char), Nx, f);
    52     if (Nbytes != Nx) { return (FALSE); }
     53    if (Nbytes != Nx) { perror ("fwrite: "); return (FALSE); }
    5354  }
    5455 
     
    5859
    5960  offset = start + Nx*Ny;
    60   fseeko (f, offset, SEEK_SET);
     61  int status = fseeko (f, offset, SEEK_SET);
     62  if (status) { perror ("fseeko: "); return FALSE; }
     63
    6164  Nbytes = fwrite (pad, sizeof (char), Npad, f);
    62   if (Nbytes != Npad) { return (FALSE); }
     65  if (Nbytes != Npad) { perror ("fwrite: "); return (FALSE); }
    6366  free (pad);
    6467
     
    8487  Nx = ftable[0].header[0].Naxis[0]; // final output table size on disk
    8588  ftable[0].datasize = gfits_data_size (ftable[0].header);
     89  ftable[0].heap_start = gfits_heap_start (ftable[0].header);
    8690
    8791  Nskip = start * Nx;
     
    96100  // cursor must be at start of the table (after table header)
    97101  if (fseeko (f, Nskip, SEEK_CUR)) {
     102    perror ("fseeko: ");
    98103    fprintf (stderr, "can't seek table start\n");
    99104    return (FALSE);
     
    101106
    102107  Nwrite = fwrite (ftable[0].buffer, sizeof (char), Nbytes, f);
    103   if (Nwrite != Nbytes) {
    104     return (FALSE);
    105   }
     108  if (Nwrite != Nbytes) { perror ("fwrite: "); return (FALSE); }
    106109
    107110  if (Ntotal >= Ndisk) {
     
    112115    free (pad);
    113116
    114     if (Nbytes != Npad) return (FALSE);
     117    if (Nbytes != Npad) { perror ("fwrite: "); return (FALSE);  }
    115118  }
    116119
Note: See TracChangeset for help on using the changeset viewer.