#endif
-#define FB_GEN(t, fn) \
-template<> inline t EndianIntBase<t>::swap(t x) { return fn(x); }
+#define FB_GEN(t, fn) \
+ template <> \
+ inline t EndianIntBase<t>::swap(t x) { \
+ return t(fn(std::make_unsigned<t>::type(x))); \
+ }
// fn(x) expands to (x) if the second argument is empty, which is exactly
// what we want for [u]int8_t. Also, gcc 4.7 on Intel doesn't have
char buffer[20];
if (value < 0) {
result->push_back('-');
- result->append(buffer, uint64ToBufferUnsafe(-uint64_t(value), buffer));
+ result->append(
+ buffer, uint64ToBufferUnsafe(uint64_t(-uint64_t(value)), buffer));
} else {
- result->append(buffer, uint64ToBufferUnsafe(value, buffer));
+ result->append(buffer, uint64ToBufferUnsafe(uint64_t(value), buffer));
}
}
conv.ToShortest(value, &builder);
break;
case DoubleToStringConverter::FIXED:
- conv.ToFixed(value, numDigits, &builder);
+ conv.ToFixed(value, int(numDigits), &builder);
break;
default:
CHECK(mode == DoubleToStringConverter::PRECISION);
- conv.ToPrecision(value, numDigits, &builder);
+ conv.ToPrecision(value, int(numDigits), &builder);
break;
}
- const size_t length = builder.position();
+ const size_t length = size_t(builder.position());
builder.Finalize();
result->append(buffer, length);
}
// so 21 is the longest non-exponential number > 1.
detail::kConvMaxDecimalInShortestHigh
});
- return kMaxPositiveSpace + (value < 0); // +1 for minus sign, if negative
+ return size_t(
+ kMaxPositiveSpace +
+ (value < 0 ? 1 : 0)); // +1 for minus sign, if negative
}
/**
const int n = reg[0];
if (n >= 1) {
__cpuid(static_cast<int*>(reg), 1);
- f1c_ = reg[2];
- f1d_ = reg[3];
+ f1c_ = uint32_t(reg[2]);
+ f1d_ = uint32_t(reg[3]);
}
if (n >= 7) {
__cpuidex(static_cast<int*>(reg), 7, 0);
- f7b_ = reg[1];
- f7c_ = reg[2];
+ f7b_ = uint32_t(reg[1]);
+ f7c_ = uint32_t(reg[2]);
}
#elif defined(__i386__) && defined(__PIC__) && !defined(__clang__) && \
defined(__GNUC__)
inline void podFill(Pod* b, Pod* e, T c) {
FBSTRING_ASSERT(b && e && b <= e);
/*static*/ if (sizeof(T) == 1) {
- memset(b, c, e - b);
+ memset(b, c, size_t(e - b));
} else {
auto const ee = b + ((e - b) & ~7u);
for (; b != ee; b += 8) {
// Specialization for const char*, const char*
FOLLY_MALLOC_NOINLINE
basic_fbstring(const value_type* b, const value_type* e, const A& /*a*/ = A())
- : store_(b, e - b) {
+ : store_(b, size_type(e - b)) {
}
// Nonstandard constructor
}
#elif defined(_MSC_VER)
// MSVC doesn't define __ostream_insert
- os.write(str.data(), str.size());
+ os.write(str.data(), std::streamsize(str.size()));
#else
std::__ostream_insert(os, str.data(), str.size());
#endif
S_destroy_range_a(*this, b_, e_);
}
- D_deallocate(b_, z_ - b_);
+ D_deallocate(b_, size_type(z_ - b_));
}
}
public:
size_type size() const noexcept {
- return impl_.e_ - impl_.b_;
+ return size_type(impl_.e_ - impl_.b_);
}
size_type max_size() const noexcept {
}
size_type capacity() const noexcept {
- return impl_.z_ - impl_.b_;
+ return size_type(impl_.z_ - impl_.b_);
}
bool empty() const noexcept {
throw;
}
if (impl_.b_)
- M_deallocate(impl_.b_, impl_.z_ - impl_.b_);
+ M_deallocate(impl_.b_, size_type(impl_.z_ - impl_.b_));
impl_.z_ = newB + newCap;
impl_.e_ = newB + (impl_.e_ - impl_.b_);
impl_.b_ = newB;
auto p = s.begin();
auto end = s.end();
while (p != end) {
- auto q = static_cast<const char*>(memchr(p, '}', end - p));
+ auto q = static_cast<const char*>(memchr(p, '}', size_t(end - p)));
if (!q) {
out(StringPiece(p, end));
break;
bool hasDefaultArgIndex = false;
bool hasExplicitArgIndex = false;
while (p != end) {
- auto q = static_cast<const char*>(memchr(p, '{', end - p));
+ auto q = static_cast<const char*>(memchr(p, '{', size_t(end - p)));
if (!q) {
outputString(StringPiece(p, end));
break;
}
// Format string
- q = static_cast<const char*>(memchr(p, '}', end - p));
+ q = static_cast<const char*>(memchr(p, '}', size_t(end - p)));
if (q == nullptr) {
throw BadFormatArg("folly::format: missing ending '}'");
}
arg.enforce(arg.widthIndex == FormatArg::kNoIndex,
"cannot provide width arg index without value arg index");
int sizeArg = nextArg++;
- arg.width = getSizeArg(sizeArg, arg);
+ arg.width = getSizeArg(size_t(sizeArg), arg);
}
argIndex = nextArg++;
if (arg.width == FormatArg::kDynamicWidth) {
arg.enforce(arg.widthIndex != FormatArg::kNoIndex,
"cannot provide value arg index without width arg index");
- arg.width = getSizeArg(arg.widthIndex, arg);
+ arg.width = getSizeArg(size_t(arg.widthIndex), arg);
}
try {
"folly::format: may not have both default and explicit arg indexes");
}
- doFormat(argIndex, arg, out);
+ doFormat(size_t(argIndex), arg, out);
}
}
if (arg.precision != FormatArg::kDefaultPrecision &&
val.size() > static_cast<size_t>(arg.precision)) {
- val.reset(val.data(), arg.precision);
+ val.reset(val.data(), size_t(arg.precision));
}
constexpr int padBufSize = 128;
auto pad = [&padBuf, &cb, padBufSize] (int chars) {
while (chars) {
int n = std::min(chars, padBufSize);
- cb(StringPiece(padBuf, n));
+ cb(StringPiece(padBuf, size_t(n)));
chars -= n;
}
};
val.size() < static_cast<size_t>(arg.width)) {
char fill = arg.fill == FormatArg::kDefaultFill ? ' ' : arg.fill;
int padChars = static_cast<int> (arg.width - val.size());
- memset(padBuf, fill, std::min(padBufSize, padChars));
+ memset(padBuf, fill, size_t(std::min(padBufSize, padChars)));
switch (arg.align) {
case FormatArg::Align::DEFAULT:
arg.align = FormatArg::Align::RIGHT;
} else if (prefixLen && arg.align == FormatArg::Align::PAD_AFTER_SIGN) {
// Split off the prefix, then do any padding if necessary
- cb(val.subpiece(0, prefixLen));
- val.advance(prefixLen);
+ cb(val.subpiece(0, size_t(prefixLen)));
+ val.advance(size_t(prefixLen));
arg.width = std::max(arg.width - prefixLen, 0);
}
format_value::formatString(val, arg, cb);
char sign;
if (std::is_signed<T>::value) {
if (folly::is_negative(val_)) {
- uval = -static_cast<UT>(val_);
+ uval = UT(-static_cast<UT>(val_));
sign = '-';
} else {
uval = static_cast<UT>(val_);
}
}
} else {
- uval = val_;
+ uval = static_cast<UT>(val_);
sign = '\0';
arg.enforce(arg.sign == FormatArg::Sign::DEFAULT,
int len = snprintf(valBufBegin, (valBuf + valBufSize) - valBufBegin,
"%" PRIuMAX, static_cast<uintmax_t>(uval));
#else
- int len = snprintf(valBufBegin, (valBuf + valBufSize) - valBufBegin,
- "%ju", static_cast<uintmax_t>(uval));
+ int len = snprintf(
+ valBufBegin,
+ size_t((valBuf + valBufSize) - valBufBegin),
+ "%ju",
+ static_cast<uintmax_t>(uval));
#endif
// valBufSize should always be big enough, so this should never
// happen.
"invalid specifier '", arg.presentation, "'");
format_value::formatString(val_, arg, cb);
} else {
- FormatValue<char>(val_.at(arg.splitIntKey())).format(arg, cb);
+ FormatValue<char>(val_.at(size_t(arg.splitIntKey()))).format(arg, cb);
}
}
template<bool containerMode, class... Args>
std::ostream& operator<<(std::ostream& out,
const Formatter<containerMode, Args...>& formatter) {
- auto writer = [&out] (StringPiece sp) { out.write(sp.data(), sp.size()); };
+ auto writer = [&out](StringPiece sp) {
+ out.write(sp.data(), std::streamsize(sp.size()));
+ };
formatter(writer);
return out;
}
const char* p;
if (e[-1] == ']') {
--e;
- p = static_cast<const char*>(memchr(b, '[', e - b));
+ p = static_cast<const char*>(memchr(b, '[', size_t(e - b)));
enforce(p, "unmatched ']'");
} else {
- p = static_cast<const char*>(memchr(b, '.', e - b));
+ p = static_cast<const char*>(memchr(b, '.', size_t(e - b)));
}
if (p) {
key_.assign(p + 1, e);
* buffer of size bytes.
*/
static size_t partialCount(const char* p, size_t size) {
- char v = *p;
+ uint8_t v = uint8_t(*p);
size_t s = kHeaderSize;
s += 1 + b0key(v);
if (s > size) return 0;
* return the number of bytes used by the encoding.
*/
static size_t encodedSize(const char* p) {
- return (kHeaderSize + kGroupSize +
- b0key(*p) + b1key(*p) + b2key(*p) + b3key(*p));
+ return kHeaderSize + kGroupSize +
+ b0key(uint8_t(*p)) + b1key(uint8_t(*p)) +
+ b2key(uint8_t(*p)) + b3key(uint8_t(*p));
}
/**
* that we must be able to read at least 17 bytes from the input pointer, p.
*/
static const char* decode(const char* p, uint32_t* dest) {
- uint8_t key = p[0];
+ uint8_t key = uint8_t(p[0]);
__m128i val = _mm_loadu_si128((const __m128i*)(p+1));
__m128i mask =
_mm_load_si128((const __m128i*)&detail::groupVarintSSEMasks[key * 2]);
*/
static const char* decode(const char* p, uint32_t* a, uint32_t* b,
uint32_t* c, uint32_t* d) {
- uint8_t key = p[0];
+ uint8_t key = uint8_t(p[0]);
__m128i val = _mm_loadu_si128((const __m128i*)(p+1));
__m128i mask =
_mm_load_si128((const __m128i*)&detail::groupVarintSSEMasks[key * 2]);
// Extracting 32 bits at a time out of an XMM register is a SSE4 feature
#if FOLLY_SSE >= 4
- *a = _mm_extract_epi32(r, 0);
- *b = _mm_extract_epi32(r, 1);
- *c = _mm_extract_epi32(r, 2);
- *d = _mm_extract_epi32(r, 3);
+ *a = uint32_t(_mm_extract_epi32(r, 0));
+ *b = uint32_t(_mm_extract_epi32(r, 1));
+ *c = uint32_t(_mm_extract_epi32(r, 2));
+ *d = uint32_t(_mm_extract_epi32(r, 3));
#else /* !__SSE4__ */
*a = _mm_extract_epi16(r, 0) + (_mm_extract_epi16(r, 1) << 16);
*b = _mm_extract_epi16(r, 2) + (_mm_extract_epi16(r, 3) << 16);
*/
static size_t size(uint64_t a, uint64_t b, uint64_t c, uint64_t d,
uint64_t e) {
- return (kHeaderSize + kGroupSize +
- key(a) + key(b) + key(c) + key(d) + key(e));
+ return kHeaderSize + kGroupSize +
+ key(a) + key(b) + key(c) + key(d) + key(e);
}
/**
*/
static size_t encodedSize(const char* p) {
uint16_t n = loadUnaligned<uint16_t>(p);
- return (kHeaderSize + kGroupSize +
- b0key(n) + b1key(n) + b2key(n) + b3key(n) + b4key(n));
+ return kHeaderSize + kGroupSize +
+ b0key(n) + b1key(n) + b2key(n) + b3key(n) + b4key(n);
}
/**
*/
static char* encode(char* p, uint64_t a, uint64_t b, uint64_t c,
uint64_t d, uint64_t e) {
- uint8_t b0key = key(a);
- uint8_t b1key = key(b);
- uint8_t b2key = key(c);
- uint8_t b3key = key(d);
- uint8_t b4key = key(e);
+ uint16_t b0key = key(a);
+ uint16_t b1key = key(b);
+ uint16_t b2key = key(c);
+ uint16_t b3key = key(d);
+ uint16_t b4key = key(e);
storeUnaligned<uint16_t>(
p,
- (b4key << 12) | (b3key << 9) | (b2key << 6) | (b1key << 3) | b0key);
+ uint16_t(
+ (b4key << 12) |
+ (b3key << 9) |
+ (b2key << 6) |
+ (b1key << 3) |
+ b0key));
p += 2;
storeUnaligned(p, a);
p += b0key+1;
return uint8_t(7 - (__builtin_clzll(x | 1) / 8));
}
- static uint8_t b0key(uint16_t x) { return x & 7; }
- static uint8_t b1key(uint16_t x) { return (x >> 3) & 7; }
- static uint8_t b2key(uint16_t x) { return (x >> 6) & 7; }
- static uint8_t b3key(uint16_t x) { return (x >> 9) & 7; }
- static uint8_t b4key(uint16_t x) { return (x >> 12) & 7; }
+ static uint8_t b0key(uint16_t x) { return x & 7u; }
+ static uint8_t b1key(uint16_t x) { return (x >> 3) & 7u; }
+ static uint8_t b2key(uint16_t x) { return (x >> 6) & 7u; }
+ static uint8_t b3key(uint16_t x) { return (x >> 9) & 7u; }
+ static uint8_t b4key(uint16_t x) { return (x >> 12) & 7u; }
static const uint64_t kMask[];
};
if (pushes == nextPushes) {
// pushTicket_ didn't change from A (or the previous C) to C,
// so we can linearize at B (or D)
- return pushes - pops;
+ return ssize_t(pushes - pops);
}
pushes = nextPushes;
uint64_t nextPops = popTicket_.load(std::memory_order_acquire); // D
if (pops == nextPops) {
// popTicket_ didn't chance from B (or the previous D), so we
// can linearize at C
- return pushes - pops;
+ return ssize_t(pushes - pops);
}
pops = nextPops;
}
#ifdef RW_SPINLOCK_USE_SSE_INSTRUCTIONS_
static __m128i make128(const uint16_t v[4]) {
- return _mm_set_epi16(0, 0, 0, 0, v[3], v[2], v[1], v[0]);
+ return _mm_set_epi16(0, 0, 0, 0,
+ short(v[3]), short(v[2]), short(v[1]), short(v[0]));
}
static inline __m128i fromInteger(uint64_t from) {
- return _mm_cvtsi64_si128(from);
+ return _mm_cvtsi64_si128(int64_t(from));
}
static inline uint64_t toInteger(__m128i in) {
- return _mm_cvtsi128_si64(in);
+ return uint64_t(_mm_cvtsi128_si64(in));
}
static inline uint64_t addParallel(__m128i in, __m128i kDelta) {
return toInteger(_mm_add_epi16(in, kDelta));
#ifdef RW_SPINLOCK_USE_SSE_INSTRUCTIONS_
static __m128i make128(const uint8_t v[4]) {
- return _mm_set_epi8(0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, v[3], v[2], v[1], v[0]);
+ return _mm_set_epi8(
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ char(v[3]), char(v[2]), char(v[1]), char(v[0]));
}
static inline __m128i fromInteger(uint32_t from) {
- return _mm_cvtsi32_si128(from);
+ return _mm_cvtsi32_si128(int32_t(from));
}
static inline uint32_t toInteger(__m128i in) {
- return _mm_cvtsi128_si32(in);
+ return uint32_t(_mm_cvtsi128_si32(in));
}
static inline uint32_t addParallel(__m128i in, __m128i kDelta) {
return toInteger(_mm_add_epi8(in, kDelta));
void getSlow(unsigned char* data, size_t size);
inline size_t remaining() const {
- return buffer_.get() + bufferSize_ - ptr_;
+ return size_t(buffer_.get() + bufferSize_ - ptr_);
}
const size_t bufferSize_;
// Unfortunately current gcc versions have a bug causing it to reject
// this check in a constexpr function:
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71448
- return e_ - b_;
+ return size_type(e_ - b_);
}
constexpr size_type walk_size() const {
return std::distance(b_, e_);
inline std::ostream& operator<<(std::ostream& os,
const StringPiece piece) {
- os.write(piece.start(), piece.size());
+ os.write(piece.start(), std::streamsize(piece.size()));
return os;
}
inline std::ostream& operator<<(std::ostream& os,
const MutableStringPiece piece) {
- os.write(piece.start(), piece.size());
+ os.write(piece.start(), std::streamsize(piece.size()));
return os;
}
// Check if done searching
if (++j == nsize) {
// Yay
- return i - haystack.begin();
+ return size_t(i - haystack.begin());
}
}
}
// * is a not-very-regular mix of 1's and 0's
// * does not need any other special mathematical properties
//
- static const uint64_t sc_const = 0xdeadbeefdeadbeefLL;
+ static const uint64_t sc_const = 0xdeadbeefdeadbeefULL;
uint64_t m_data[2*sc_numVars]; // unhashed data, for partial messages
uint64_t m_state[sc_numVars]; // internal state of the hash
// * is a not-very-regular mix of 1's and 0's
// * does not need any other special mathematical properties
//
- static constexpr uint64_t sc_const = 0xdeadbeefdeadbeefLL;
+ static constexpr uint64_t sc_const = 0xdeadbeefdeadbeefULL;
uint64_t m_data[2*sc_numVars]; // unhashed data, for partial messages
uint64_t m_state[sc_numVars]; // internal state of the hash
piece->end(),
[](char c) { return c != ' ' && c != '\t'; });
if (needle != piece->end()) {
- indent = std::min<size_t>(indent, needle - piece->begin());
+ indent = std::min<size_t>(indent, size_t(needle - piece->begin()));
} else {
max_length = std::max<size_t>(piece->size(), max_length);
}
// (see Bits.cpp)
#ifdef _MSC_VER
inline int popcount(unsigned int x) {
- return __popcnt(x);
+ return int(__popcnt(x));
}
inline int popcountll(unsigned long long x) {
return int(__popcnt64(x));
template <class F, class... Offset>
ssize_t wrapvFull(F f, int fd, iovec* iov, int count, Offset... offset) {
ssize_t totalBytes = 0;
- size_t r;
+ ssize_t r;
do {
r = f(fd, iov, std::min<int>(count, kIovMax), offset...);
- if (r == (size_t)-1) {
+ if (r == -1) {
if (errno == EINTR) {
continue;
}
totalBytes += r;
incr(r, offset...);
while (r != 0 && count != 0) {
- if (r >= iov->iov_len) {
- r -= iov->iov_len;
+ if (r >= ssize_t(iov->iov_len)) {
+ r -= ssize_t(iov->iov_len);
++iov;
--count;
} else {
template <>
struct GroupVarintTraits<uint32_t> {
- enum {
+ enum : uint32_t {
kGroupSize = 4,
kHeaderSize = 1,
};
template <>
struct GroupVarintTraits<uint64_t> {
- enum {
+ enum : uint32_t {
kGroupSize = 5,
kHeaderSize = 2,
};
class GroupVarintBase {
protected:
typedef GroupVarintTraits<T> Traits;
- enum { kHeaderSize = Traits::kHeaderSize };
+ enum : uint32_t { kHeaderSize = Traits::kHeaderSize };
public:
typedef T type;
/**
* Number of integers encoded / decoded in one pass.
*/
- enum { kGroupSize = Traits::kGroupSize };
+ enum : uint32_t { kGroupSize = Traits::kGroupSize };
/**
* Maximum encoded size.
*/
- enum { kMaxSize = kHeaderSize + sizeof(type) * kGroupSize };
+ enum : uint32_t { kMaxSize = kHeaderSize + sizeof(type) * kGroupSize };
/**
* Maximum size for n values.
const StringPieceLite needles) {
SparseByteSet s;
for (auto needle: needles) {
- s.add(needle);
+ s.add(uint8_t(needle));
}
for (size_t index = 0; index < haystack.size(); ++index) {
- if (s.contains(haystack[index])) {
+ if (s.contains(uint8_t(haystack[index]))) {
return index;
}
}
const char* data() const { return b_; }
const char* begin() const { return b_; }
const char* end() const { return e_; }
- size_t size() const { return e_ - b_; }
+ size_t size() const { return size_t(e_ - b_); }
bool empty() const { return size() == 0; }
const char& operator[](size_t i) const { DCHECK_GT(size(), i); return b_[i]; }
template <typename Range>
/// Returns the bitmask to pass futexWait or futexWake when communicating
/// about the specified turn
- int futexChannel(uint32_t turn) const noexcept { return 1 << (turn & 31); }
+ uint32_t futexChannel(uint32_t turn) const noexcept {
+ return 1u << (turn & 31);
+ }
uint32_t decodeCurrentSturn(uint32_t state) const noexcept {
return state & ~kWaitersMask;
template<class T, class NumericType /* = typename NumericTypeHelper<T>::type */>
dynamic::dynamic(T t) {
type_ = TypeInfo<NumericType>::type;
- new (getAddress<NumericType>()) NumericType(t);
+ new (getAddress<NumericType>()) NumericType(NumericType(t));
}
template <class Iterator>
}
inline std::size_t dynamic::count(dynamic const& key) const {
- return find(key) != items().end();
+ return find(key) != items().end() ? 1u : 0u;
}
inline dynamic::const_item_iterator dynamic::find(dynamic const& key) const {
asm ("popcntq %1, %0" : "=r" (result) : "r" (value));
return result;
#else
- return _mm_popcnt_u64(value);
+ return uint64_t(_mm_popcnt_u64(value));
#endif
}
};
if (value.type() != type_) {
return none;
}
- if (!Comparison()(length_, value.size())) {
+ if (!Comparison()(size_t(length_), value.size())) {
return makeError("different length string/array/object", value);
}
return none;
fiber == NO_WAITER &&
waitingFiber_.compare_exchange_strong(fiber, THREAD_WAITING))) {
do {
- folly::detail::MemoryIdler::futexWait(futex_.futex, THREAD_WAITING);
+ folly::detail::MemoryIdler::futexWait(
+ futex_.futex, uint32_t(THREAD_WAITING));
fiber = waitingFiber_.load(std::memory_order_acquire);
} while (fiber == THREAD_WAITING);
}
auto deadline = TimeoutController::Clock::now() + timeout;
do {
const auto wait_rv =
- futex_.futex.futexWaitUntil(THREAD_WAITING, deadline);
+ futex_.futex.futexWaitUntil(uint32_t(THREAD_WAITING), deadline);
if (wait_rv == folly::detail::FutexResult::TIMEDOUT) {
return false;
}
class Semaphore {
public:
explicit Semaphore(size_t tokenCount)
- : capacity_(tokenCount), tokens_(capacity_) {}
+ : capacity_(tokenCount), tokens_(int64_t(capacity_)) {}
Semaphore(const Semaphore&) = delete;
Semaphore(Semaphore&&) = delete;
if (n == 0) {
return true;
}
- if (!body(ByteRange(buffer_->tail(), n))) {
+ if (!body(ByteRange(buffer_->tail(), size_t(n)))) {
return false;
}
}
throw std::system_error(errno, std::system_category(),
"write() failed");
}
- v.advance(n);
+ v.advance(size_t(n));
}
}
* Returns the number of bytes in the buffer before the start of the data.
*/
uint64_t headroom() const {
- return data_ - buffer();
+ return uint64_t(data_ - buffer());
}
/**
* Returns the number of bytes in the buffer after the end of the data.
*/
uint64_t tailroom() const {
- return bufferEnd() - tail();
+ return uint64_t(bufferEnd() - tail());
}
/**
recordAndPos_ = std::make_pair(ByteRange(), off_t(-1));
range_.clear(); // at end
} else {
- size_t skipped = record.begin() - range_.begin();
+ size_t skipped = size_t(record.begin() - range_.begin());
DCHECK_GE(skipped, headerSize());
skipped -= headerSize();
range_.advance(skipped);
out.push_back(hexDigit(v & 0x0f));
} else if (*p == '\\' || *p == '\"') {
out.push_back('\\');
- out.push_back(*p++);
+ out.push_back(char(*p++));
} else if (*p <= 0x1f) {
switch (*p) {
case '\b': out.append("\\b"); p++; break;