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
|
// get a string and add \r before \n if necessary
|
||||||
std::string addSlashR (std::string str);
|
std::string addSlashR (const std::string &str);
|
||||||
std::string removeSlashR (std::string str);
|
std::string removeSlashR (const std::string &str);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \def MaxCStringSize
|
* \def MaxCStringSize
|
||||||
|
|
|
@ -27,7 +27,7 @@ using namespace std;
|
||||||
namespace NLMISC
|
namespace NLMISC
|
||||||
{
|
{
|
||||||
|
|
||||||
string addSlashR (string str)
|
string addSlashR (const string &str)
|
||||||
{
|
{
|
||||||
string formatedStr;
|
string formatedStr;
|
||||||
// replace \n with \r\n
|
// replace \n with \r\n
|
||||||
|
@ -42,10 +42,10 @@ string addSlashR (string str)
|
||||||
return formatedStr;
|
return formatedStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
string removeSlashR (string str)
|
string removeSlashR (const string &str)
|
||||||
{
|
{
|
||||||
string formatedStr;
|
string formatedStr;
|
||||||
// replace \n with \r\n
|
// remove \r
|
||||||
for (uint i = 0; i < str.size(); i++)
|
for (uint i = 0; i < str.size(); i++)
|
||||||
{
|
{
|
||||||
if (str[i] != '\r')
|
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
|
// we must skip the first line
|
||||||
formatedBody = "\r\n";
|
formatedBody = "\r\n";
|
||||||
|
|
||||||
// replace \n with \r\n
|
// replace \n by \r\n
|
||||||
for (i = 0; i < body.size(); i++)
|
formatedBody += addSlashR(body);
|
||||||
{
|
|
||||||
if (body[i] == '\n' && i > 0 && body[i-1] != '\r')
|
|
||||||
{
|
|
||||||
formatedBody += '\r';
|
|
||||||
}
|
|
||||||
formatedBody += body[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
// add attachment if any
|
// add attachment if any
|
||||||
if (!attachedFile.empty())
|
if (!attachedFile.empty())
|
||||||
|
|
Loading…
Reference in a new issue