mirror of
https://git.gfz-potsdam.de/naaice/iphreeqc.git
synced 2025-12-16 00:28:23 +01:00
Squashed 'phreeqcpp/' changes from ceab9a1..798f8f9
798f8f9 Merge commit '3eaa057b5d2bbc9327f2ab3adfd52577c687cfca' 3eaa057 Squashed 'common/' changes from 6abe004..399aba2 4cad3d5 [iphreeqc] Fixed for R git-subtree-dir: phreeqcpp git-subtree-split: 798f8f9d827d6ba7cf6a6d0c9a1fd3c7e806c72c
This commit is contained in:
parent
8024ee1289
commit
a9c4ef8324
@ -201,6 +201,10 @@ Serializer::Deserialize(Phreeqc &phreeqc_ref, Dictionary &dictionary, std::vecto
|
||||
#if !defined(R_SO)
|
||||
std::cerr << "Unknown pack type in deserialize " << type << std::endl;
|
||||
exit(4);
|
||||
#else
|
||||
std::ostringstream oss;
|
||||
oss << "Unknown pack type in deserialize " << type << std::endl;
|
||||
phreeqc_ref.error_msg(oss.str().c_str(), STOP);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
@ -199,13 +199,17 @@ strcpy_safe(char* dest, size_t max, const char* src)
|
||||
{
|
||||
if (dest == nullptr || src == nullptr)
|
||||
{
|
||||
#if !defined(R_SO)
|
||||
std::cerr << "nullptr in Utilities::strcpy_safe." << std::endl;
|
||||
#endif
|
||||
throw;
|
||||
}
|
||||
lsrc = strlen(src);
|
||||
if (lsrc + 1 > max)
|
||||
{
|
||||
#if !defined(R_SO)
|
||||
std::cerr << "Buffer overrun in Utilities::strcpy_safe." << std::endl;
|
||||
#endif
|
||||
throw;
|
||||
}
|
||||
memcpy(dest, src, (lsrc + 1) * sizeof(char));
|
||||
@ -224,14 +228,18 @@ strcat_safe(char* dest, size_t max, const char* src)
|
||||
{
|
||||
if (dest == nullptr || src == nullptr)
|
||||
{
|
||||
#if !defined(R_SO)
|
||||
std::cerr << "nullptr in Utilities::strcat_safe." << std::endl;
|
||||
#endif
|
||||
throw;
|
||||
}
|
||||
lsrc = strlen(src);
|
||||
ldest = strlen(dest);
|
||||
if (ldest + lsrc + 1 > max)
|
||||
{
|
||||
#if !defined(R_SO)
|
||||
std::cerr << "Buffer overrun in Utilities::strcat_safe." << std::endl;
|
||||
#endif
|
||||
throw;
|
||||
}
|
||||
memcpy(&dest[ldest], src, (lsrc + 1) * sizeof(char));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user