diff --git a/src/fits/GFitsTable.cpp b/src/fits/GFitsTable.cpp index cac5447..fef35ac 100644 --- a/src/fits/GFitsTable.cpp +++ b/src/fits/GFitsTable.cpp @@ -265,17 +265,15 @@ GFitsTableCol& GFitsTable::operator[](const std::string& colname) // Initialise pointer GFitsTableCol* ptr = NULL; - // If there are columns then search for the specified name - if (m_columns != NULL) { - for (int i = 0; i < m_cols; ++i) { - if (m_columns[i]->name() == colname) { - ptr = m_columns[i]; - if (ptr == NULL) { - throw GException::fits_no_data(G_ACCESS2, - "No data for this column"); - } - break; + // Search for the specified name + for (int i = 0; i < m_cols; ++i) { + if (m_columns[i]->name() == colname) { + ptr = m_columns[i]; + if (ptr == NULL) { + throw GException::fits_no_data(G_ACCESS2, + "No data for this column"); } + break; } } @@ -310,16 +308,14 @@ const GFitsTableCol& GFitsTable::operator[](const std::string& colname) const const GFitsTableCol* ptr = NULL; // If there are columns then search for the specified name - if (m_columns != NULL) { - for (int i = 0; i < m_cols; ++i) { - if (m_columns[i]->name() == colname) { - ptr = m_columns[i]; - if (ptr == NULL) { - throw GException::fits_no_data(G_ACCESS2, - "No data for this column"); - } - break; + for (int i = 0; i < m_cols; ++i) { + if (m_columns[i]->name() == colname) { + ptr = m_columns[i]; + if (ptr == NULL) { + throw GException::fits_no_data(G_ACCESS2, + "No data for this column"); } + break; } } diff --git a/src/fits/GFitsTableStringCol.cpp b/src/fits/GFitsTableStringCol.cpp index 8654e4b..5fe3b2b 100644 --- a/src/fits/GFitsTableStringCol.cpp +++ b/src/fits/GFitsTableStringCol.cpp @@ -183,7 +183,7 @@ std::string& GFitsTableStringCol::operator() (const int& row, const int& inx) const std::string& GFitsTableStringCol::operator() (const int& row, const int& inx) const { // If data are not available then load them now - if (m_data == NULL) ((GFitsTableStringCol*)this)->fetch_data(); + if (m_data == NULL) fetch_data(); // Return data bin return m_data[offset(row, inx)]; @@ -725,12 +725,12 @@ void GFitsTableStringCol::fetch_data(void) const m_size = m_number * m_length; // Free old buffer memory - const_cast(this)->free_buffer(); + free_buffer(); // Allocate buffer memory - const_cast(this)->alloc_buffer(); + alloc_buffer(); - // Save column + // Load column const_cast(this)->load_column(); // Extract string from buffer @@ -740,7 +740,7 @@ void GFitsTableStringCol::fetch_data(void) const } // Free buffer memory - const_cast(this)->free_buffer(); + free_buffer(); // Return return; @@ -753,7 +753,7 @@ void GFitsTableStringCol::fetch_data(void) const * The CFITSIO transfer buffer allows transparent conversion from the CFITSIO * storage format to a vector of strings. ***************************************************************************/ -void GFitsTableStringCol::alloc_buffer(void) +void GFitsTableStringCol::alloc_buffer(void) const { // Allocate buffer memory if (m_size > 0) { @@ -780,7 +780,7 @@ void GFitsTableStringCol::alloc_buffer(void) * * Release memory that has been allocated for the CFITSIO transfer buffer. ***************************************************************************/ -void GFitsTableStringCol::free_buffer(void) +void GFitsTableStringCol::free_buffer(void) const { // If there was a buffer allocated then free it if (m_buffer != NULL) {