Changeset 2967
- Timestamp:
- Jan 12, 2005, 4:08:30 PM (22 years ago)
- Location:
- trunk/psLib
- Files:
-
- 5 edited
-
src/dataIO/psFits.c (modified) (3 diffs)
-
src/fileUtils/psFits.c (modified) (3 diffs)
-
src/fits/psFits.c (modified) (3 diffs)
-
test/dataIO/tst_psFits.c (modified) (8 diffs)
-
test/fileUtils/tst_psFits.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/dataIO/psFits.c
r2965 r2967 7 7 * @author Robert DeSonia, MHPCC 8 8 * 9 * @version $Revision: 1. 5$ $Name: not supported by cvs2svn $10 * @date $Date: 2005-01-13 0 1:54:25$9 * @version $Revision: 1.6 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2005-01-13 02:08:30 $ 11 11 * 12 12 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 313 313 int psFitsGetExtNum(psFits* fits) 314 314 { 315 int hdunum; 316 315 317 if (fits == NULL) { 316 318 psError(PS_ERR_BAD_PARAMETER_NULL, true, … … 319 321 } 320 322 321 int hdutype = ANY_HDU; 322 int status = 0; 323 324 if (fits_get_hdu_type(fits->p_fd, &hdutype, &status) != 0) { 325 char fitsErr[MAX_STRING_LENGTH]; 326 fits_get_errstatus(status, fitsErr); 327 psError(PS_ERR_LOCATION_INVALID, true, 328 PS_ERRORTEXT_psFits_GET_EXTNUM_FAILED, 329 fits->filename, fitsErr); 330 return -1; 331 } 332 333 return hdutype; 323 324 return fits_get_hdu_num(fits->p_fd,&hdunum) - 1; 334 325 } 335 326 -
trunk/psLib/src/fileUtils/psFits.c
r2965 r2967 7 7 * @author Robert DeSonia, MHPCC 8 8 * 9 * @version $Revision: 1. 5$ $Name: not supported by cvs2svn $10 * @date $Date: 2005-01-13 0 1:54:25$9 * @version $Revision: 1.6 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2005-01-13 02:08:30 $ 11 11 * 12 12 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 313 313 int psFitsGetExtNum(psFits* fits) 314 314 { 315 int hdunum; 316 315 317 if (fits == NULL) { 316 318 psError(PS_ERR_BAD_PARAMETER_NULL, true, … … 319 321 } 320 322 321 int hdutype = ANY_HDU; 322 int status = 0; 323 324 if (fits_get_hdu_type(fits->p_fd, &hdutype, &status) != 0) { 325 char fitsErr[MAX_STRING_LENGTH]; 326 fits_get_errstatus(status, fitsErr); 327 psError(PS_ERR_LOCATION_INVALID, true, 328 PS_ERRORTEXT_psFits_GET_EXTNUM_FAILED, 329 fits->filename, fitsErr); 330 return -1; 331 } 332 333 return hdutype; 323 324 return fits_get_hdu_num(fits->p_fd,&hdunum) - 1; 334 325 } 335 326 -
trunk/psLib/src/fits/psFits.c
r2965 r2967 7 7 * @author Robert DeSonia, MHPCC 8 8 * 9 * @version $Revision: 1. 5$ $Name: not supported by cvs2svn $10 * @date $Date: 2005-01-13 0 1:54:25$9 * @version $Revision: 1.6 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2005-01-13 02:08:30 $ 11 11 * 12 12 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 313 313 int psFitsGetExtNum(psFits* fits) 314 314 { 315 int hdunum; 316 315 317 if (fits == NULL) { 316 318 psError(PS_ERR_BAD_PARAMETER_NULL, true, … … 319 321 } 320 322 321 int hdutype = ANY_HDU; 322 int status = 0; 323 324 if (fits_get_hdu_type(fits->p_fd, &hdutype, &status) != 0) { 325 char fitsErr[MAX_STRING_LENGTH]; 326 fits_get_errstatus(status, fitsErr); 327 psError(PS_ERR_LOCATION_INVALID, true, 328 PS_ERRORTEXT_psFits_GET_EXTNUM_FAILED, 329 fits->filename, fitsErr); 330 return -1; 331 } 332 333 return hdutype; 323 324 return fits_get_hdu_num(fits->p_fd,&hdunum) - 1; 334 325 } 335 326 -
trunk/psLib/test/dataIO/tst_psFits.c
r2965 r2967 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1. 2$ $Name: not supported by cvs2svn $9 * @date $Date: 2005-01-13 0 1:54:26$8 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2005-01-13 02:08:30 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 16 16 17 17 #include <unistd.h> 18 #include <string.h> 18 19 19 20 static bool makeMulti(void); … … 21 22 22 23 static psS32 tst_psFitsAlloc( void ); 23 static psS32 tst_psFitsMoveExtName( void ); 24 static psS32 tst_psFitsMoveExtNum( void ); 24 static psS32 tst_psFitsMoveExtName( void ); // also tests psFitsGetExtName 25 static psS32 tst_psFitsMoveExtNum( void ); // also tests psFitsGetExtNum 25 26 26 27 testDescription tests[] = { … … 125 126 } 126 127 128 // check to see if I can retrieve the name back from the psFits object. 129 char* nameFromFile = psFitsGetExtName(fits); 130 if (strcmp(nameFromFile,extName) != 0) { // hey, it didn't move? 131 psError(PS_ERR_UNKNOWN, false, 132 "Failed to retrieve the extension name back ('%s' vs '%s'", 133 nameFromFile, extName); 134 return 3; 135 } 136 psFree(nameFromFile); 137 127 138 // check that the image is associated to the extension moved, i.e., 128 139 // did we really move to the proper extension? … … 148 159 } 149 160 161 // check to see if I can retrieve the name back from the psFits object. 162 char* nameFromFile = psFitsGetExtName(fits); 163 if (strcmp(nameFromFile,extName) != 0) { // hey, it didn't move? 164 psError(PS_ERR_UNKNOWN, false, 165 "Failed to retrieve the extension name back ('%s' vs '%s'", 166 nameFromFile, extName); 167 return 5; 168 } 169 psFree(nameFromFile); 170 150 171 // check that the image is associated to the extension moved, i.e., 151 172 // did we really move to the proper extension? … … 217 238 lcv); 218 239 return 3; 240 } 241 242 // check to see if I can retrieve the number back from the psFits object. 243 if (psFitsGetExtNum(fits) != lcv) { // hey, it didn't move? 244 psError(PS_ERR_UNKNOWN, false, 245 "Failed to retrieve the extension number back (%d vs %d)", 246 psFitsGetExtNum(fits), lcv); 247 return 5; 219 248 } 220 249 … … 265 294 } 266 295 296 // check to see if I can retrieve the number back from the psFits object. 297 if (psFitsGetExtNum(fits) != lcv) { // hey, it didn't move? 298 psError(PS_ERR_UNKNOWN, false, 299 "Failed to retrieve the extension number back (%d vs %d)", 300 psFitsGetExtNum(fits), lcv); 301 return 13; 302 } 303 267 304 // check that the image is associated to the extension moved, i.e., 268 305 // did we really move to the proper extension? … … 284 321 "Failed to move to extension %d.", 285 322 lcv); 323 return 15; 324 } 325 326 // check to see if I can retrieve the number back from the psFits object. 327 if (psFitsGetExtNum(fits) != lcv) { // hey, it didn't move? 328 psError(PS_ERR_UNKNOWN, false, 329 "Failed to retrieve the extension number back (%d vs %d)", 330 psFitsGetExtNum(fits), lcv); 286 331 return 15; 287 332 } -
trunk/psLib/test/fileUtils/tst_psFits.c
r2965 r2967 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1. 2$ $Name: not supported by cvs2svn $9 * @date $Date: 2005-01-13 0 1:54:26$8 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2005-01-13 02:08:30 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 16 16 17 17 #include <unistd.h> 18 #include <string.h> 18 19 19 20 static bool makeMulti(void); … … 21 22 22 23 static psS32 tst_psFitsAlloc( void ); 23 static psS32 tst_psFitsMoveExtName( void ); 24 static psS32 tst_psFitsMoveExtNum( void ); 24 static psS32 tst_psFitsMoveExtName( void ); // also tests psFitsGetExtName 25 static psS32 tst_psFitsMoveExtNum( void ); // also tests psFitsGetExtNum 25 26 26 27 testDescription tests[] = { … … 125 126 } 126 127 128 // check to see if I can retrieve the name back from the psFits object. 129 char* nameFromFile = psFitsGetExtName(fits); 130 if (strcmp(nameFromFile,extName) != 0) { // hey, it didn't move? 131 psError(PS_ERR_UNKNOWN, false, 132 "Failed to retrieve the extension name back ('%s' vs '%s'", 133 nameFromFile, extName); 134 return 3; 135 } 136 psFree(nameFromFile); 137 127 138 // check that the image is associated to the extension moved, i.e., 128 139 // did we really move to the proper extension? … … 148 159 } 149 160 161 // check to see if I can retrieve the name back from the psFits object. 162 char* nameFromFile = psFitsGetExtName(fits); 163 if (strcmp(nameFromFile,extName) != 0) { // hey, it didn't move? 164 psError(PS_ERR_UNKNOWN, false, 165 "Failed to retrieve the extension name back ('%s' vs '%s'", 166 nameFromFile, extName); 167 return 5; 168 } 169 psFree(nameFromFile); 170 150 171 // check that the image is associated to the extension moved, i.e., 151 172 // did we really move to the proper extension? … … 217 238 lcv); 218 239 return 3; 240 } 241 242 // check to see if I can retrieve the number back from the psFits object. 243 if (psFitsGetExtNum(fits) != lcv) { // hey, it didn't move? 244 psError(PS_ERR_UNKNOWN, false, 245 "Failed to retrieve the extension number back (%d vs %d)", 246 psFitsGetExtNum(fits), lcv); 247 return 5; 219 248 } 220 249 … … 265 294 } 266 295 296 // check to see if I can retrieve the number back from the psFits object. 297 if (psFitsGetExtNum(fits) != lcv) { // hey, it didn't move? 298 psError(PS_ERR_UNKNOWN, false, 299 "Failed to retrieve the extension number back (%d vs %d)", 300 psFitsGetExtNum(fits), lcv); 301 return 13; 302 } 303 267 304 // check that the image is associated to the extension moved, i.e., 268 305 // did we really move to the proper extension? … … 284 321 "Failed to move to extension %d.", 285 322 lcv); 323 return 15; 324 } 325 326 // check to see if I can retrieve the number back from the psFits object. 327 if (psFitsGetExtNum(fits) != lcv) { // hey, it didn't move? 328 psError(PS_ERR_UNKNOWN, false, 329 "Failed to retrieve the extension number back (%d vs %d)", 330 psFitsGetExtNum(fits), lcv); 286 331 return 15; 287 332 }
Note:
See TracChangeset
for help on using the changeset viewer.
