Changeset 28534 for branches/pap/psLib/src/fits/psFitsTable.c
- Timestamp:
- Jun 28, 2010, 8:11:04 PM (16 years ago)
- Location:
- branches/pap
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
psLib/src/fits/psFitsTable.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/pap
- Property svn:mergeinfo changed
/trunk (added) merged: 28500,28502,28507,28509-28512,28514,28516-28518,28520,28522,28524-28532
- Property svn:mergeinfo changed
-
branches/pap/psLib/src/fits/psFitsTable.c
r28216 r28534 39 39 40 40 int status = 0; // CFITSIO status 41 42 // Check for empty table, which looks like an image 43 int hdutype; // Type of HDU 44 fits_get_hdu_type(fits->fd, &hdutype, &status); 45 if (psFitsError(status, true, "Could not determine the HDU type.")) { 46 return -1; 47 } 48 if (hdutype == IMAGE_HDU) { 49 // It could be an empty table 50 int naxis = 0; // Dimensions of image 51 if (fits_get_img_dim(fits->fd, &naxis, &status) != 0) { 52 psFitsError(status, true, "Unable to determine dimension for table."); 53 return -1; 54 } 55 if (naxis != 0) { 56 psFitsError(PS_ERR_BAD_FITS, true, "Current FITS HDU is not a table."); 57 return -1; 58 } 59 return 0; 60 } 61 41 62 long numRows; // Number of rows 42 63 if (fits_get_num_rows(fits->fd, &numRows, &status)) { … … 48 69 } 49 70 71 50 72 // Check the FITS file in preparation for reading a table 51 73 static bool readTableCheck(const psFits *fits // FITS file 52 74 ) 53 75 { 54 PS_ASSERT_FITS_NON_NULL(fits, NULL);76 PS_ASSERT_FITS_NON_NULL(fits, false); 55 77 56 78 if (psFitsGetExtNum(fits) == 0 && !psFitsMoveExtNum(fits, 1, false)) { … … 58 80 return false; 59 81 } 60 61 82 62 83 // check that we are positioned on a table HDU … … 67 88 return false; 68 89 } 69 if (hdutype != ASCII_TBL && hdutype != BINARY_TBL) { 70 psError(PS_ERR_IO, true, _("Current FITS HDU is not a table.")); 90 if (hdutype == IMAGE_HDU) { 91 // It could be an empty table 92 int naxis = 0; // Dimensions of image 93 if (fits_get_img_dim(fits->fd, &naxis, &status) != 0) { 94 psFitsError(status, true, "Unable to determine dimension for table."); 95 return false; 96 } 97 if (naxis != 0) { 98 psFitsError(PS_ERR_BAD_FITS, true, "Current FITS HDU is not a table."); 99 return false; 100 } 101 } else if (hdutype != ASCII_TBL && hdutype != BINARY_TBL) { 102 psError(PS_ERR_BAD_FITS, true, _("Current FITS HDU is not a table.")); 71 103 return false; 72 104 }
Note:
See TracChangeset
for help on using the changeset viewer.
