Always imbue C locale when using istringstream.

This commit is contained in:
Vincent Richard 2016-04-10 15:05:44 +02:00
parent b1c2d4b61e
commit 7c6e00798e
7 changed files with 15 additions and 1 deletions

View File

@ -67,6 +67,8 @@ importanceHelper::Importance importanceHelper::getImportanceHeader(shared_ptr <c
int n = IMPORTANCE_NORMAL;
std::istringstream iss(value);
iss.imbue(std::locale::classic());
iss >> n;
Importance i = IMPORTANCE_NORMAL;

View File

@ -396,6 +396,8 @@ void POP3Connection::authenticateSASL()
const string list(x.begin() + 5, x.end());
std::istringstream iss(list);
iss.imbue(std::locale::classic());
string mech;
while (iss >> mech)

View File

@ -144,6 +144,7 @@ void POP3Folder::open(const int mode, bool failIfModeIsNotAvailable)
throw exceptions::command_error("STAT", response->getFirstLine());
std::istringstream iss(response->getText());
iss.imbue(std::locale::classic());
iss >> m_messageCount;
if (iss.fail())
@ -372,6 +373,7 @@ void POP3Folder::fetchMessages(std::vector <shared_ptr <message> >& msg, const f
size_t size = 0;
std::istringstream iss((*x).second);
iss.imbue(std::locale::classic());
iss >> size;
m->m_size = size;
@ -456,6 +458,7 @@ void POP3Folder::fetchMessage(shared_ptr <message> msg, const fetchAttributes& o
size_t size = 0;
std::istringstream iss(string(it, responseText.end()));
iss.imbue(std::locale::classic());
iss >> size;
dynamicCast <POP3Message>(msg)->m_size = size;
@ -677,6 +680,7 @@ shared_ptr <folderStatus> POP3Folder::getStatus()
size_t count = 0;
std::istringstream iss(response->getText());
iss.imbue(std::locale::classic());
iss >> count;
shared_ptr <POP3FolderStatus> status = make_shared <POP3FolderStatus>();

View File

@ -234,7 +234,9 @@ void SMTPConnection::helo()
for (size_t i = 1, n = resp->getLineCount() ; i < n ; ++i)
{
const string line = resp->getLineAt(i).getText();
std::istringstream iss(line);
iss.imbue(std::locale::classic());
string ext;
iss >> ext;

View File

@ -217,6 +217,7 @@ const SMTPResponse::enhancedStatusCode SMTPResponse::extractEnhancedCode(const s
enhancedStatusCode enhCode;
std::istringstream iss(responseText);
iss.imbue(std::locale::classic());
if (std::isdigit(iss.peek()))
{

View File

@ -79,6 +79,8 @@ void relay::parseImpl
std::istringstream iss(string
(buffer.begin() + position, buffer.begin() + position + (p - pstart)));
iss.imbue(std::locale::classic());
string word;
std::vector <string> previous;

View File

@ -256,8 +256,9 @@ void url::parse(const string& str)
throw exceptions::malformed_url("Port can only contain digits");
std::istringstream iss(port);
port_t portNum = 0;
iss.imbue(std::locale::classic());
port_t portNum = 0;
iss >> portNum;
if (portNum == 0)