mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-22 23:26:15 +00:00
Changed: Constification of addSlashR and removeSlashR
--HG-- branch : develop
This commit is contained in:
parent
dd6cc92035
commit
894151dba8
3 changed files with 7 additions and 14 deletions
|
@ -28,8 +28,8 @@ namespace NLMISC
|
|||
{
|
||||
|
||||
// get a string and add \r before \n if necessary
|
||||
std::string addSlashR (std::string str);
|
||||
std::string removeSlashR (std::string str);
|
||||
std::string addSlashR (const std::string &str);
|
||||
std::string removeSlashR (const std::string &str);
|
||||
|
||||
/**
|
||||
* \def MaxCStringSize
|
||||
|
|
|
@ -27,7 +27,7 @@ using namespace std;
|
|||
namespace NLMISC
|
||||
{
|
||||
|
||||
string addSlashR (string str)
|
||||
string addSlashR (const string &str)
|
||||
{
|
||||
string formatedStr;
|
||||
// replace \n with \r\n
|
||||
|
@ -42,10 +42,10 @@ string addSlashR (string str)
|
|||
return formatedStr;
|
||||
}
|
||||
|
||||
string removeSlashR (string str)
|
||||
string removeSlashR (const string &str)
|
||||
{
|
||||
string formatedStr;
|
||||
// replace \n with \r\n
|
||||
// remove \r
|
||||
for (uint i = 0; i < str.size(); i++)
|
||||
{
|
||||
if (str[i] != '\r')
|
||||
|
|
|
@ -196,15 +196,8 @@ bool sendEmail (const string &smtpServer, const string &from, const string &to,
|
|||
// we must skip the first line
|
||||
formatedBody = "\r\n";
|
||||
|
||||
// replace \n with \r\n
|
||||
for (i = 0; i < body.size(); i++)
|
||||
{
|
||||
if (body[i] == '\n' && i > 0 && body[i-1] != '\r')
|
||||
{
|
||||
formatedBody += '\r';
|
||||
}
|
||||
formatedBody += body[i];
|
||||
}
|
||||
// replace \n by \r\n
|
||||
formatedBody += addSlashR(body);
|
||||
|
||||
// add attachment if any
|
||||
if (!attachedFile.empty())
|
||||
|
|
Loading…
Reference in a new issue