IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 15, 2009, 4:00:18 PM (17 years ago)
Author:
eugene
Message:

updates from trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/20090715/psLib/src/fits/psFits.c

    r25022 r25405  
    150150            char errorBuf[MAX_STRING_LENGTH], *errorMsg;
    151151#if ((_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && ! _GNU_SOURCE)
    152             errorMsg = strerror_r(thisErrno, errorBuf, MAX_STRING_LENGTH);
    153 #else
    154152            strerror_r(thisErrno, errorBuf, MAX_STRING_LENGTH);
    155153            errorMsg = errorBuf;
     154#else
     155            errorMsg = strerror_r(thisErrno, errorBuf, MAX_STRING_LENGTH);
    156156#endif
    157157            psError(PS_ERR_IO, true, "Directory (%s) for requested file is not accessible: %s",
     
    209209                char errorBuf[64], *errorMsg;
    210210# if ((_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && ! _GNU_SOURCE)
    211                 errorMsg = strerror_r (errno, errorBuf, 64);
    212 # else
    213211                strerror_r (errno, errorBuf, 64);
    214212                errorMsg = errorBuf;
     213# else
     214                errorMsg = strerror_r (errno, errorBuf, 64);
    215215# endif
    216216                psError(PS_ERR_IO, true, "Failed to delete a previously-existing file (%s), error %d: %s",
     
    344344// Therefore, we implement our own version of moving to an extension specified by name.  The pure cfitsio
    345345// version is used if "conventions.compression" handling is turned off in the psFits structure.
    346 bool psFitsMoveExtName(const psFits* fits,
    347                        const char* extname)
     346static bool fitsMoveExtName(const psFits* fits, // FITS file
     347                            const char* extname, // Extension name
     348                            bool errors // Generate errors?
     349    )
    348350{
    349351    PS_ASSERT_FITS_NON_NULL(fits, false);
     
    356358        // User wants to use cfitsio.  Good luck to them!
    357359        if (fits_movnam_hdu(fits->fd, ANY_HDU, (char*)extname, 0, &status) != 0) {
    358             psFitsError(status, true, _("Could not find HDU '%s'"), extname);
     360            if (errors) {
     361                psFitsError(status, true, _("Could not find HDU '%s'"), extname);
     362            }
    359363            return false;
    360364        }
     
    378382        if (fits_movabs_hdu(fits->fd, i, &hdutype, &status)) {
    379383            // We've run off the end
    380             psFitsError(status, true, _("Could not find HDU with %s = '%s'"), extword, extname);
     384            if (errors) {
     385                psFitsError(status, true, _("Could not find HDU with %s = '%s'"), extword, extname);
     386            }
    381387            return false;
    382388        }
     
    406412    }
    407413    psAbort("Should never reach here.");
     414}
     415
     416
     417bool psFitsMoveExtName(const psFits* fits, const char* extname)
     418{
     419    return fitsMoveExtName(fits, extname, true);
     420}
     421
     422bool psFitsMoveExtNameClean(const psFits* fits, const char* extname)
     423{
     424    return fitsMoveExtName(fits, extname, false);
    408425}
    409426
Note: See TracChangeset for help on using the changeset viewer.