Commit e9252cfb1ce8f769dfd89cfc751d60c33b56fbc3
1 parent
de0c6506
Remove usage of GFilename::c_str() GFits (the method does no longer exist).
Showing
1 changed file
with
7 additions
and
10 deletions
src/fits/GFits.cpp
| @@ -1013,12 +1013,6 @@ int GFits::extno(const std::string& extname) const | @@ -1013,12 +1013,6 @@ int GFits::extno(const std::string& extname) const | ||
| 1013 | ***************************************************************************/ | 1013 | ***************************************************************************/ |
| 1014 | void GFits::open(const GFilename& filename, const bool& create) | 1014 | void GFits::open(const GFilename& filename, const bool& create) |
| 1015 | { | 1015 | { |
| 1016 | - // Remove any HDUs | ||
| 1017 | - m_hdu.clear(); | ||
| 1018 | - | ||
| 1019 | - // Expand environment variables | ||
| 1020 | - //std::string fname(gammalib::expand_env(filename())); | ||
| 1021 | - | ||
| 1022 | // Don't allow opening if a file is already open | 1016 | // Don't allow opening if a file is already open |
| 1023 | if (m_fitsfile != NULL) { | 1017 | if (m_fitsfile != NULL) { |
| 1024 | std::string msg; | 1018 | std::string msg; |
| @@ -1034,18 +1028,21 @@ void GFits::open(const GFilename& filename, const bool& create) | @@ -1034,18 +1028,21 @@ void GFits::open(const GFilename& filename, const bool& create) | ||
| 1034 | throw GException::invalid_argument(G_OPEN, msg); | 1028 | throw GException::invalid_argument(G_OPEN, msg); |
| 1035 | } | 1029 | } |
| 1036 | 1030 | ||
| 1031 | + // Remove any HDUs | ||
| 1032 | + m_hdu.clear(); | ||
| 1033 | + | ||
| 1037 | // Initialise FITS file as readwrite and non created | 1034 | // Initialise FITS file as readwrite and non created |
| 1038 | m_readwrite = true; | 1035 | m_readwrite = true; |
| 1039 | m_created = false; | 1036 | m_created = false; |
| 1040 | 1037 | ||
| 1041 | // Try opening FITS file with readwrite access | 1038 | // Try opening FITS file with readwrite access |
| 1042 | int status = 0; | 1039 | int status = 0; |
| 1043 | - status = __ffopen(FHANDLE(m_fitsfile), filename.c_str(), 1, &status); | 1040 | + status = __ffopen(FHANDLE(m_fitsfile), filename.url().c_str(), 1, &status); |
| 1044 | 1041 | ||
| 1045 | // If failed then try opening as readonly | 1042 | // If failed then try opening as readonly |
| 1046 | if (status == 104 || status == 112) { | 1043 | if (status == 104 || status == 112) { |
| 1047 | status = 0; | 1044 | status = 0; |
| 1048 | - status = __ffopen(FHANDLE(m_fitsfile), filename.c_str(), 0, &status); | 1045 | + status = __ffopen(FHANDLE(m_fitsfile), filename.url().c_str(), 0, &status); |
| 1049 | m_readwrite = false; | 1046 | m_readwrite = false; |
| 1050 | } | 1047 | } |
| 1051 | 1048 | ||
| @@ -1053,7 +1050,7 @@ void GFits::open(const GFilename& filename, const bool& create) | @@ -1053,7 +1050,7 @@ void GFits::open(const GFilename& filename, const bool& create) | ||
| 1053 | // FITS file now | 1050 | // FITS file now |
| 1054 | if (create && status == 104) { | 1051 | if (create && status == 104) { |
| 1055 | status = 0; | 1052 | status = 0; |
| 1056 | - status = __ffinit(FHANDLE(m_fitsfile), filename.c_str(), &status); | 1053 | + status = __ffinit(FHANDLE(m_fitsfile), filename.url().c_str(), &status); |
| 1057 | m_readwrite = true; | 1054 | m_readwrite = true; |
| 1058 | m_created = true; | 1055 | m_created = true; |
| 1059 | } | 1056 | } |
| @@ -1241,7 +1238,7 @@ void GFits::saveto(const GFilename& filename, const bool& clobber) | @@ -1241,7 +1238,7 @@ void GFits::saveto(const GFilename& filename, const bool& clobber) | ||
| 1241 | // the file name does not contain the .gz extension. | 1238 | // the file name does not contain the .gz extension. |
| 1242 | if (clobber) { | 1239 | if (clobber) { |
| 1243 | if (gammalib::file_exists(filename)) { | 1240 | if (gammalib::file_exists(filename)) { |
| 1244 | - std::remove(filename.c_str()); | 1241 | + std::remove(filename.url().c_str()); |
| 1245 | } | 1242 | } |
| 1246 | else { | 1243 | else { |
| 1247 | if (gammalib::file_exists(gzfname)) { | 1244 | if (gammalib::file_exists(gzfname)) { |