Given `std::basic_streambuf<CharT>::int_type __c`, `std::basic_string<CharT> str_`,
and having checked `__c != std::basic_streambuf<CharT>::traits_type::eof()` (substituting typedefs
for clarity), the line `str_.push_back(__c);` is safe according to humans, but truncates according
to compilers. `str_.push_back(static_cast<CharT>(__c));` avoids that problem.
Fixes D27538.
llvm-svn: 289105
if (__c != base::traits_type::eof())
{
int n = static_cast<int>(str_.size());
- str_.push_back(__c);
+ str_.push_back(static_cast<CharT>(__c));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
if (__c != base::traits_type::eof())
{
int n = static_cast<int>(str_.size());
- str_.push_back(__c);
+ str_.push_back(static_cast<CharT>(__c));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
if (__c != base::traits_type::eof())
{
int n = static_cast<int>(str_.size());
- str_.push_back(__c);
+ str_.push_back(static_cast<CharT>(__c));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
if (__c != base::traits_type::eof())
{
int n = static_cast<int>(str_.size());
- str_.push_back(__c);
+ str_.push_back(static_cast<CharT>(__c));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
if (__c != base::traits_type::eof())
{
int n = static_cast<int>(str_.size());
- str_.push_back(__c);
+ str_.push_back(static_cast<CharT>(__c));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
if (__c != base::traits_type::eof())
{
int n = static_cast<int>(str_.size());
- str_.push_back(__c);
+ str_.push_back(static_cast<CharT>(__c));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
if (__c != base::traits_type::eof())
{
int n = static_cast<int>(str_.size());
- str_.push_back(__c);
+ str_.push_back(static_cast<CharT>(__c));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
if (__c != base::traits_type::eof())
{
int n = static_cast<int>(str_.size());
- str_.push_back(__c);
+ str_.push_back(static_cast<CharT>(__c));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
if (__c != base::traits_type::eof())
{
int n = static_cast<int>(str_.size());
- str_.push_back(__c);
+ str_.push_back(static_cast<CharT>(__c));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
if (__c != base::traits_type::eof())
{
int n = static_cast<int>(str_.size());
- str_.push_back(__c);
+ str_.push_back(static_cast<CharT>(__c));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
if (__c != base::traits_type::eof())
{
int n = static_cast<int>(str_.size());
- str_.push_back(__c);
+ str_.push_back(static_cast<CharT>(__c));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
if (__c != base::traits_type::eof())
{
int n = static_cast<int>(str_.size());
- str_.push_back(__c);
+ str_.push_back(static_cast<CharT>(__c));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
if (__c != base::traits_type::eof())
{
int n = static_cast<int>(str_.size());
- str_.push_back(__c);
+ str_.push_back(static_cast<CharT>(__c));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
if (__c != base::traits_type::eof())
{
int n = static_cast<int>(str_.size());
- str_.push_back(__c);
+ str_.push_back(static_cast<CharT>(__c));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
if (__c != base::traits_type::eof())
{
int n = static_cast<int>(str_.size());
- str_.push_back(__c);
+ str_.push_back(static_cast<CharT>(__c));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
if (__c != base::traits_type::eof())
{
int n = static_cast<int>(str_.size());
- str_.push_back(__c);
+ str_.push_back(static_cast<CharT>(__c));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
if (__c != base::traits_type::eof())
{
int n = static_cast<int>(str_.size());
- str_.push_back(__c);
+ str_.push_back(static_cast<CharT>(__c));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
if (__c != base::traits_type::eof())
{
int n = static_cast<int>(str_.size());
- str_.push_back(__c);
+ str_.push_back(static_cast<CharT>(__c));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
if (__c != base::traits_type::eof())
{
int n = static_cast<int>(str_.size());
- str_.push_back(__c);
+ str_.push_back(static_cast<CharT>(__c));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
if (__c != base::traits_type::eof())
{
int n = static_cast<int>(str_.size());
- str_.push_back(__c);
+ str_.push_back(static_cast<CharT>(__c));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
if (__c != base::traits_type::eof())
{
int n = static_cast<int>(str_.size());
- str_.push_back(__c);
+ str_.push_back(static_cast<CharT>(__c));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
if (__c != base::traits_type::eof())
{
int n = static_cast<int>(str_.size());
- str_.push_back(__c);
+ str_.push_back(static_cast<CharT>(__c));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
if (__c != base::traits_type::eof())
{
int n = static_cast<int>(str_.size());
- str_.push_back(__c);
+ str_.push_back(static_cast<CharT>(__c));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
if (__c != base::traits_type::eof())
{
int n = static_cast<int>(str_.size());
- str_.push_back(__c);
+ str_.push_back(static_cast<CharT>(__c));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
if (__c != base::traits_type::eof())
{
int n = static_cast<int>(str_.size());
- str_.push_back(__c);
+ str_.push_back(static_cast<CharT>(__c));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
if (__c != base::traits_type::eof())
{
int n = static_cast<int>(str_.size());
- str_.push_back(__c);
+ str_.push_back(static_cast<CharT>(__c));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
if (__c != base::traits_type::eof())
{
int n = static_cast<int>(str_.size());
- str_.push_back(__c);
+ str_.push_back(static_cast<CharT>(__c));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
if (__c != base::traits_type::eof())
{
int n = static_cast<int>(str_.size());
- str_.push_back(__c);
+ str_.push_back(static_cast<CharT>(__c));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
if (__c != base::traits_type::eof())
{
int n = static_cast<int>(str_.size());
- str_.push_back(__c);
+ str_.push_back(static_cast<CharT>(__c));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
if (__c != base::traits_type::eof())
{
int n = static_cast<int>(str_.size());
- str_.push_back(__c);
+ str_.push_back(static_cast<CharT>(__c));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));
if (__c != base::traits_type::eof())
{
int n = static_cast<int>(str_.size());
- str_.push_back(__c);
+ str_.push_back(static_cast<CharT>(__c));
str_.resize(str_.capacity());
base::setp(const_cast<CharT*>(str_.data()),
const_cast<CharT*>(str_.data() + str_.size()));