Commit bcd7e23b093fc63aacaabdbd7be4f4c1d9109267

Authored by knodlseder
1 parent 7ce4709f

debug

src/fits/GFitsTable.cpp
@@ -265,17 +265,15 @@ GFitsTableCol& GFitsTable::operator[](const std::string& colname) @@ -265,17 +265,15 @@ GFitsTableCol& GFitsTable::operator[](const std::string& colname)
265 // Initialise pointer 265 // Initialise pointer
266 GFitsTableCol* ptr = NULL; 266 GFitsTableCol* ptr = NULL;
267 267
268 - // If there are columns then search for the specified name  
269 - if (m_columns != NULL) {  
270 - for (int i = 0; i < m_cols; ++i) {  
271 - if (m_columns[i]->name() == colname) {  
272 - ptr = m_columns[i];  
273 - if (ptr == NULL) {  
274 - throw GException::fits_no_data(G_ACCESS2,  
275 - "No data for this column");  
276 - }  
277 - break; 268 + // Search for the specified name
  269 + for (int i = 0; i < m_cols; ++i) {
  270 + if (m_columns[i]->name() == colname) {
  271 + ptr = m_columns[i];
  272 + if (ptr == NULL) {
  273 + throw GException::fits_no_data(G_ACCESS2,
  274 + "No data for this column");
278 } 275 }
  276 + break;
279 } 277 }
280 } 278 }
281 279
@@ -310,16 +308,14 @@ const GFitsTableCol&amp; GFitsTable::operator[](const std::string&amp; colname) const @@ -310,16 +308,14 @@ const GFitsTableCol&amp; GFitsTable::operator[](const std::string&amp; colname) const
310 const GFitsTableCol* ptr = NULL; 308 const GFitsTableCol* ptr = NULL;
311 309
312 // If there are columns then search for the specified name 310 // If there are columns then search for the specified name
313 - if (m_columns != NULL) {  
314 - for (int i = 0; i < m_cols; ++i) {  
315 - if (m_columns[i]->name() == colname) {  
316 - ptr = m_columns[i];  
317 - if (ptr == NULL) {  
318 - throw GException::fits_no_data(G_ACCESS2,  
319 - "No data for this column");  
320 - }  
321 - break; 311 + for (int i = 0; i < m_cols; ++i) {
  312 + if (m_columns[i]->name() == colname) {
  313 + ptr = m_columns[i];
  314 + if (ptr == NULL) {
  315 + throw GException::fits_no_data(G_ACCESS2,
  316 + "No data for this column");
322 } 317 }
  318 + break;
323 } 319 }
324 } 320 }
325 321
src/fits/GFitsTableStringCol.cpp
@@ -183,7 +183,7 @@ std::string&amp; GFitsTableStringCol::operator() (const int&amp; row, const int&amp; inx) @@ -183,7 +183,7 @@ std::string&amp; GFitsTableStringCol::operator() (const int&amp; row, const int&amp; inx)
183 const std::string& GFitsTableStringCol::operator() (const int& row, const int& inx) const 183 const std::string& GFitsTableStringCol::operator() (const int& row, const int& inx) const
184 { 184 {
185 // If data are not available then load them now 185 // If data are not available then load them now
186 - if (m_data == NULL) ((GFitsTableStringCol*)this)->fetch_data(); 186 + if (m_data == NULL) fetch_data();
187 187
188 // Return data bin 188 // Return data bin
189 return m_data[offset(row, inx)]; 189 return m_data[offset(row, inx)];
@@ -725,12 +725,12 @@ void GFitsTableStringCol::fetch_data(void) const @@ -725,12 +725,12 @@ void GFitsTableStringCol::fetch_data(void) const
725 m_size = m_number * m_length; 725 m_size = m_number * m_length;
726 726
727 // Free old buffer memory 727 // Free old buffer memory
728 - const_cast<GFitsTableStringCol*>(this)->free_buffer(); 728 + free_buffer();
729 729
730 // Allocate buffer memory 730 // Allocate buffer memory
731 - const_cast<GFitsTableStringCol*>(this)->alloc_buffer(); 731 + alloc_buffer();
732 732
733 - // Save column 733 + // Load column
734 const_cast<GFitsTableStringCol*>(this)->load_column(); 734 const_cast<GFitsTableStringCol*>(this)->load_column();
735 735
736 // Extract string from buffer 736 // Extract string from buffer
@@ -740,7 +740,7 @@ void GFitsTableStringCol::fetch_data(void) const @@ -740,7 +740,7 @@ void GFitsTableStringCol::fetch_data(void) const
740 } 740 }
741 741
742 // Free buffer memory 742 // Free buffer memory
743 - const_cast<GFitsTableStringCol*>(this)->free_buffer(); 743 + free_buffer();
744 744
745 // Return 745 // Return
746 return; 746 return;
@@ -753,7 +753,7 @@ void GFitsTableStringCol::fetch_data(void) const @@ -753,7 +753,7 @@ void GFitsTableStringCol::fetch_data(void) const
753 * The CFITSIO transfer buffer allows transparent conversion from the CFITSIO 753 * The CFITSIO transfer buffer allows transparent conversion from the CFITSIO
754 * storage format to a vector of strings. 754 * storage format to a vector of strings.
755 ***************************************************************************/ 755 ***************************************************************************/
756 -void GFitsTableStringCol::alloc_buffer(void) 756 +void GFitsTableStringCol::alloc_buffer(void) const
757 { 757 {
758 // Allocate buffer memory 758 // Allocate buffer memory
759 if (m_size > 0) { 759 if (m_size > 0) {
@@ -780,7 +780,7 @@ void GFitsTableStringCol::alloc_buffer(void) @@ -780,7 +780,7 @@ void GFitsTableStringCol::alloc_buffer(void)
780 * 780 *
781 * Release memory that has been allocated for the CFITSIO transfer buffer. 781 * Release memory that has been allocated for the CFITSIO transfer buffer.
782 ***************************************************************************/ 782 ***************************************************************************/
783 -void GFitsTableStringCol::free_buffer(void) 783 +void GFitsTableStringCol::free_buffer(void) const
784 { 784 {
785 // If there was a buffer allocated then free it 785 // If there was a buffer allocated then free it
786 if (m_buffer != NULL) { 786 if (m_buffer != NULL) {