mirror of
https://github.com/wjwwood/serial.git
synced 2026-01-22 03:34:53 +08:00
Fixing comiler warning in win.cc
The converstion from a wstring to std::string gave a warning C4244: 'argument': conversion from 'const wchar_t' to 'const _Elem', possible loss of data.
This commit is contained in:
parent
69e0372cf0
commit
e5331d09fc
@ -3,6 +3,7 @@
|
||||
/* Copyright 2012 William Woodall and John Harrison */
|
||||
|
||||
#include <sstream>
|
||||
#include <algorithm>
|
||||
|
||||
#include "serial/impl/win.h"
|
||||
|
||||
@ -366,7 +367,11 @@ Serial::SerialImpl::setPort (const string &port)
|
||||
string
|
||||
Serial::SerialImpl::getPort () const
|
||||
{
|
||||
return string(port_.begin(), port_.end());
|
||||
string str(port_.length(), 0);
|
||||
std::transform(port_.begin(), port_.end(), str.begin(), [] (wchar_t c) {
|
||||
return (char)c;
|
||||
});
|
||||
return str;
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user