Merge branch 'issue-3' into 'master'

Fixed -Wcatch-value warnings reported by CRAN

Closes #3

See merge request coupled/IPhreeqc!8
This commit is contained in:
Scott R Charlton 2019-01-30 18:12:57 -07:00
commit f485cbe944
3 changed files with 23 additions and 23 deletions

View File

@ -591,7 +591,7 @@ int IPhreeqc::load_db(const char* filename)
this->PhreeqcPtr->phrq_io->push_istream(&ifs, false);
this->PhreeqcPtr->read_database();
}
catch (IPhreeqcStop)
catch (const IPhreeqcStop&)
{
this->close_input_files();
}
@ -602,7 +602,7 @@ int IPhreeqc::load_db(const char* filename)
{
this->PhreeqcPtr->error_msg(errmsg, STOP); // throws IPhreeqcStop
}
catch (IPhreeqcStop)
catch (const IPhreeqcStop&)
{
// do nothing
}
@ -654,7 +654,7 @@ int IPhreeqc::load_db_str(const char* input)
this->PhreeqcPtr->phrq_io->push_istream(&iss, false);
this->PhreeqcPtr->read_database();
}
catch (IPhreeqcStop)
catch (const IPhreeqcStop&)
{
this->close_input_files();
}
@ -665,7 +665,7 @@ int IPhreeqc::load_db_str(const char* input)
{
this->PhreeqcPtr->error_msg(errmsg, STOP); // throws PhreeqcStop
}
catch (IPhreeqcStop)
catch (const IPhreeqcStop&)
{
// do nothing
}
@ -743,7 +743,7 @@ int IPhreeqc::RunAccumulated(void)
// this may throw
this->do_run(sz_routine, &iss, NULL, NULL, NULL);
}
catch (IPhreeqcStop)
catch (const IPhreeqcStop&)
{
// do nothing
}
@ -755,7 +755,7 @@ int IPhreeqc::RunAccumulated(void)
{
this->PhreeqcPtr->error_msg(errmsg.c_str(), STOP); // throws PhreeqcStop
}
catch (IPhreeqcStop)
catch (const IPhreeqcStop&)
{
// do nothing
}
@ -768,7 +768,7 @@ int IPhreeqc::RunAccumulated(void)
{
this->PhreeqcPtr->error_msg(errmsg, STOP); // throws PhreeqcStop
}
catch (IPhreeqcStop)
catch (const IPhreeqcStop&)
{
// do nothing
}
@ -814,7 +814,7 @@ int IPhreeqc::RunFile(const char* filename)
// this may throw
this->do_run(sz_routine, &ifs, NULL, NULL, NULL);
}
catch (IPhreeqcStop)
catch (const IPhreeqcStop&)
{
this->close_input_files();
}
@ -826,7 +826,7 @@ int IPhreeqc::RunFile(const char* filename)
{
this->PhreeqcPtr->error_msg(errmsg.c_str(), STOP); // throws PhreeqcStop
}
catch (IPhreeqcStop)
catch (const IPhreeqcStop&)
{
// do nothing
}
@ -839,7 +839,7 @@ int IPhreeqc::RunFile(const char* filename)
{
this->PhreeqcPtr->error_msg(errmsg, STOP); // throws PhreeqcStop
}
catch (IPhreeqcStop)
catch (const IPhreeqcStop&)
{
// do nothing
}
@ -877,7 +877,7 @@ int IPhreeqc::RunString(const char* input)
// this may throw
this->do_run(sz_routine, &iss, NULL, NULL, NULL);
}
catch (IPhreeqcStop)
catch (const IPhreeqcStop&)
{
this->close_input_files();
}
@ -889,7 +889,7 @@ int IPhreeqc::RunString(const char* input)
{
this->PhreeqcPtr->error_msg(errmsg.c_str(), STOP); // throws PhreeqcStop
}
catch (IPhreeqcStop)
catch (const IPhreeqcStop&)
{
// do nothing
}
@ -902,7 +902,7 @@ int IPhreeqc::RunString(const char* input)
{
this->PhreeqcPtr->error_msg(errmsg, STOP); // throws PhreeqcStop
}
catch (IPhreeqcStop)
catch (const IPhreeqcStop&)
{
// do nothing
}
@ -1761,7 +1761,7 @@ void IPhreeqc::fpunchf(const char *name, const char *format, double d)
ASSERT(this->SelectedOutputMap.find(this->PhreeqcPtr->current_selected_output->Get_n_user()) != this->SelectedOutputMap.end());
this->SelectedOutputMap[this->PhreeqcPtr->current_selected_output->Get_n_user()]->PushBackDouble(name, d);
}
catch (std::bad_alloc)
catch (const std::bad_alloc&)
{
this->PhreeqcPtr->malloc_error();
}
@ -1780,7 +1780,7 @@ void IPhreeqc::fpunchf(const char *name, const char *format, char *s)
ASSERT(this->SelectedOutputMap.find(this->PhreeqcPtr->current_selected_output->Get_n_user()) != this->SelectedOutputMap.end());
this->SelectedOutputMap[this->PhreeqcPtr->current_selected_output->Get_n_user()]->PushBackString(name, s);
}
catch (std::bad_alloc)
catch (const std::bad_alloc&)
{
this->PhreeqcPtr->malloc_error();
}
@ -1799,7 +1799,7 @@ void IPhreeqc::fpunchf(const char *name, const char *format, int i)
ASSERT(this->SelectedOutputMap.find(this->PhreeqcPtr->current_selected_output->Get_n_user()) != this->SelectedOutputMap.end());
this->SelectedOutputMap[this->PhreeqcPtr->current_selected_output->Get_n_user()]->PushBackLong(name, (long)i);
}
catch (std::bad_alloc)
catch (const std::bad_alloc&)
{
this->PhreeqcPtr->malloc_error();
}

View File

@ -30,13 +30,13 @@ padfstring(char *dest, const char *src, int* len)
{
int sofar, c_len;
c_len = (int)strlen(src);
c_len = (int)strlen(src);
for (sofar = 0; (sofar < *len) && (*src != '\0'); ++sofar)
*dest++ = *src++;
while (sofar++ < *len)
*dest++ = ' ';
*len = c_len;
*len = c_len;
}
IPQ_RESULT

View File

@ -74,7 +74,7 @@ fpunchf(const char *name, const char *format, double d)
{
if (phrq_io) phrq_io->fpunchf(name, format, d);
}
catch(std::bad_alloc)
catch(const std::bad_alloc&)
{
malloc_error();
}
@ -86,7 +86,7 @@ fpunchf(const char *name, const char *format, char * s)
{
if (phrq_io) phrq_io->fpunchf(name, format, s);
}
catch(std::bad_alloc)
catch(const std::bad_alloc&)
{
malloc_error();
}
@ -98,7 +98,7 @@ fpunchf(const char *name, const char *format, int d)
{
if (phrq_io) phrq_io->fpunchf(name, format, d);
}
catch(std::bad_alloc)
catch(const std::bad_alloc&)
{
malloc_error();
}
@ -136,7 +136,7 @@ fpunchf_user(int user_index, const char *format, double d)
{
if (phrq_io) phrq_io->fpunchf(name, format, (double) d);
}
catch(std::bad_alloc)
catch(const std::bad_alloc&)
{
malloc_error();
}
@ -173,7 +173,7 @@ fpunchf_user(int user_index, const char *format, char * d)
{
if (phrq_io) phrq_io->fpunchf(name, format, d);
}
catch(std::bad_alloc)
catch(const std::bad_alloc&)
{
malloc_error();
}