IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 4, 2006, 9:52:55 AM (20 years ago)
Author:
desonia
Message:

modified API to match current SDRS.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/fits/psFits.c

    r6354 r6767  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.52 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2006-02-08 01:03:34 $
     9 *  @version $Revision: 1.53 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2006-04-04 19:52:42 $
    1111 *
    1212 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    166166            psFits* fits = psAlloc(sizeof(psFits));
    167167        fits->fd = fptr;
     168        fits->writable = (iomode == READWRITE);
    168169        psMemSetDeallocator(fits,(psFreeFunc)fitsFree);
    169170
     
    252253            return false;
    253254        }
    254 
    255         return psFitsMoveExtNum(fits,psFitsGetSize(fits),false);
     255        int size = psFitsGetSize(fits);
     256        if (size == 0) { // empty file -- no action needed
     257            return true;
     258        } else {
     259            return psFitsMoveExtNum(fits,size-1,false);
     260        }
    256261    }
    257262
     
    329334        }
    330335
     336        if (! fits->writable) {
     337            psError(PS_ERR_IO, true,
     338                    PS_ERRORTEXT_psFits_NOT_WRITABLE);
     339            return false;
     340        }
     341
    331342        // move to the specified HDU
    332343        if (! psFitsMoveExtNum(fits,extnum,relative) ) {
     
    361372        }
    362373
     374        if (! fits->writable) {
     375            psError(PS_ERR_IO, true,
     376                    PS_ERRORTEXT_psFits_NOT_WRITABLE);
     377            return false;
     378        }
     379
    363380        // move to the specified HDU
    364381        if (! psFitsMoveExtName(fits,extname) ) {
     
    442459            psError(PS_ERR_BAD_PARAMETER_NULL, true,
    443460                    PS_ERRORTEXT_psFits_NULL);
     461            return PS_FITS_TYPE_NONE;
     462        }
     463
     464        if (! fits->writable) {
     465            psError(PS_ERR_IO, true,
     466                    PS_ERRORTEXT_psFits_NOT_WRITABLE);
    444467            return PS_FITS_TYPE_NONE;
    445468        }
Note: See TracChangeset for help on using the changeset viewer.