Fixed many Clang type conversion warnings with static_cast
This commit is contained in:
parent
c6b51a2635
commit
c3a9a7d2c5
19 changed files with 91 additions and 74 deletions
|
|
@ -39,7 +39,7 @@ std::streamsize straccbuf::xsputn(const char * s, std::streamsize num)
|
|||
{
|
||||
if (index == 0) {
|
||||
// The first item received is the format string
|
||||
str = std::string(s, num);
|
||||
str = std::string(s, static_cast<std::string::size_type>(num));
|
||||
}
|
||||
else {
|
||||
std::ostringstream buf;
|
||||
|
|
@ -53,7 +53,7 @@ std::streamsize straccbuf::xsputn(const char * s, std::streamsize num)
|
|||
if (*q && *q != '%' && std::isdigit(*q) &&
|
||||
std::string::size_type(*q - '0') == index) {
|
||||
p++;
|
||||
buf << std::string(s, num);
|
||||
buf << std::string(s, static_cast<std::string::size_type>(num));
|
||||
matched = true;
|
||||
} else {
|
||||
buf << *p;
|
||||
|
|
@ -63,7 +63,7 @@ std::streamsize straccbuf::xsputn(const char * s, std::streamsize num)
|
|||
}
|
||||
}
|
||||
if (! matched)
|
||||
buf << std::string(s, num);
|
||||
buf << std::string(s, static_cast<std::string::size_type>(num));
|
||||
|
||||
str = buf.str();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -129,7 +129,8 @@ namespace {
|
|||
// Convert the rational number to a floating-point, extending the
|
||||
// floating-point to a large enough size to get a precise answer.
|
||||
|
||||
mp_prec_t num_prec = mpz_sizeinbase(mpq_numref(quant), 2);
|
||||
mp_prec_t num_prec =
|
||||
static_cast<mpfr_prec_t>(mpz_sizeinbase(mpq_numref(quant), 2));
|
||||
num_prec += amount_t::extend_by_digits*64;
|
||||
if (num_prec < MPFR_PREC_MIN)
|
||||
num_prec = MPFR_PREC_MIN;
|
||||
|
|
@ -138,7 +139,8 @@ namespace {
|
|||
mpfr_set_prec(tempfnum, num_prec);
|
||||
mpfr_set_z(tempfnum, mpq_numref(quant), rnd);
|
||||
|
||||
mp_prec_t den_prec = mpz_sizeinbase(mpq_denref(quant), 2);
|
||||
mp_prec_t den_prec =
|
||||
static_cast<mpfr_prec_t>(mpz_sizeinbase(mpq_denref(quant), 2));
|
||||
den_prec += amount_t::extend_by_digits*64;
|
||||
if (den_prec < MPFR_PREC_MIN)
|
||||
den_prec = MPFR_PREC_MIN;
|
||||
|
|
@ -168,9 +170,11 @@ namespace {
|
|||
}
|
||||
}
|
||||
if (point > 0) {
|
||||
while (--index >= (point + 1 + zeros_prec) && buf[index] == '0')
|
||||
while (--index >= (point + 1 + static_cast<std::size_t>(zeros_prec)) &&
|
||||
buf[index] == '0')
|
||||
buf[index] = '\0';
|
||||
if (index >= (point + zeros_prec) && buf[index] == '.')
|
||||
if (index >= (point + static_cast<std::size_t>(zeros_prec)) &&
|
||||
buf[index] == '.')
|
||||
buf[index] = '\0';
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -567,7 +567,7 @@ void commodity_t::parse_symbol(std::istream& in, string& symbol)
|
|||
while (_p - buf < 255 && in.good() && ! in.eof() && c != '\n') {
|
||||
std::size_t bytes = 0;
|
||||
std::ptrdiff_t size = _p - buf;
|
||||
unsigned char d = c;
|
||||
unsigned char d = static_cast<unsigned char>(c);
|
||||
|
||||
// Check for the start of a UTF-8 multi-byte encoded string
|
||||
if (d >= 192 && d <= 223 && size < 254)
|
||||
|
|
@ -627,7 +627,7 @@ void commodity_t::parse_symbol(char *& p, string& symbol)
|
|||
char * q = std::strchr(p + 1, '"');
|
||||
if (! q)
|
||||
throw_(amount_error, _("Quoted commodity symbol lacks closing quote"));
|
||||
symbol = string(p + 1, 0, q - p - 1);
|
||||
symbol = string(p + 1, 0, static_cast<std::string::size_type>(q - p - 1));
|
||||
p = q + 2;
|
||||
} else {
|
||||
char * q = next_element(p);
|
||||
|
|
|
|||
|
|
@ -171,7 +171,7 @@ namespace {
|
|||
const char * b = str.c_str();
|
||||
for (const char * p = b; *p; p++) {
|
||||
if (*p == ch) {
|
||||
strings.push_back(string(b, p - b));
|
||||
strings.push_back(string(b, static_cast<std::string::size_type>(p - b)));
|
||||
b = p + 1;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ format_t::element_t * format_t::parse_elements(const string& fmt,
|
|||
std::size_t num = 0;
|
||||
while (*p && std::isdigit(*p)) {
|
||||
num *= 10;
|
||||
num += *p++ - '0';
|
||||
num += static_cast<std::size_t>(*p++ - '0');
|
||||
}
|
||||
current->min_width = num;
|
||||
|
||||
|
|
@ -165,7 +165,7 @@ format_t::element_t * format_t::parse_elements(const string& fmt,
|
|||
num = 0;
|
||||
while (*p && std::isdigit(*p)) {
|
||||
num *= 10;
|
||||
num += *p++ - '0';
|
||||
num += static_cast<std::size_t>(*p++ - '0');
|
||||
}
|
||||
current->max_width = num;
|
||||
if (current->min_width == 0)
|
||||
|
|
@ -188,10 +188,10 @@ format_t::element_t * format_t::parse_elements(const string& fmt,
|
|||
*p != 'D' && *p != 'E' && *p != 'F'))
|
||||
throw_(format_error, _("%$ field reference must be a digit from 1-9"));
|
||||
|
||||
unsigned int index = std::isdigit(*p) ? *p - '0' : (*p - 'A' + 10);
|
||||
element_t * tmpl_elem = tmpl->elements.get();
|
||||
int index = std::isdigit(*p) ? *p - '0' : (*p - 'A' + 10);
|
||||
element_t * tmpl_elem = tmpl->elements.get();
|
||||
|
||||
for (unsigned int i = 1; i < index && tmpl_elem; i++) {
|
||||
for (int i = 1; i < index && tmpl_elem; i++) {
|
||||
tmpl_elem = tmpl_elem->next.get();
|
||||
while (tmpl_elem && tmpl_elem->type != element_t::EXPR)
|
||||
tmpl_elem = tmpl_elem->next.get();
|
||||
|
|
@ -335,7 +335,7 @@ string format_t::real_calc(scope_t& scope)
|
|||
switch (elem->type) {
|
||||
case element_t::STRING:
|
||||
if (elem->min_width > 0)
|
||||
out.width(elem->min_width);
|
||||
out.width(static_cast<std::streamsize>(elem->min_width));
|
||||
out << boost::get<string>(elem->data);
|
||||
break;
|
||||
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ class format_t : public expr_base_t<string>
|
|||
out << std::right;
|
||||
|
||||
if (elem->min_width > 0)
|
||||
out.width(elem->min_width);
|
||||
out.width(static_cast<std::streamsize>(elem->min_width));
|
||||
}
|
||||
|
||||
void dump(std::ostream& out) const;
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@ void item_t::parse_tags(const char * p,
|
|||
(std::isdigit(*(b + 1)) || *(b + 1) == '=')) {
|
||||
if (const char * e = std::strchr(p, ']')) {
|
||||
char buf[256];
|
||||
std::strncpy(buf, b + 1, e - b - 1);
|
||||
std::strncpy(buf, b + 1, static_cast<std::size_t>(e - b - 1));
|
||||
buf[e - b - 1] = '\0';
|
||||
|
||||
if (char * pp = std::strchr(buf, '=')) {
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ void process_environment(const char ** envp, const string& tag,
|
|||
|
||||
if (*q == '=') {
|
||||
try {
|
||||
string value = string(*p, q - *p);
|
||||
string value = string(*p, static_cast<std::string::size_type>(q - *p));
|
||||
if (! value.empty())
|
||||
process_option(string("$") + buf, string(buf), scope, q + 1, value);
|
||||
}
|
||||
|
|
@ -190,7 +190,7 @@ strings_list process_arguments(strings_list args, scope_t& scope)
|
|||
const char * value = NULL;
|
||||
|
||||
if (const char * p = std::strchr(name, '=')) {
|
||||
opt_name = string(name, p - name);
|
||||
opt_name = string(name, static_cast<std::string::size_type>(p - name));
|
||||
value = ++p;
|
||||
DEBUG("option.args", " read option value from option: " << value);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -52,13 +52,14 @@ format_posts::format_posts(report_t& _report,
|
|||
const char * f = format.c_str();
|
||||
|
||||
if (const char * p = std::strstr(f, "%/")) {
|
||||
first_line_format.parse_format(string(f, 0, p - f));
|
||||
first_line_format.parse_format
|
||||
(string(f, 0, static_cast<std::string::size_type>(p - f)));
|
||||
const char * n = p + 2;
|
||||
if (const char * p = std::strstr(n, "%/")) {
|
||||
next_lines_format.parse_format(string(n, 0, p - n),
|
||||
first_line_format);
|
||||
between_format.parse_format(string(p + 2),
|
||||
first_line_format);
|
||||
if (const char * pp = std::strstr(n, "%/")) {
|
||||
next_lines_format.parse_format
|
||||
(string(n, 0, static_cast<std::string::size_type>(pp - n)),
|
||||
first_line_format);
|
||||
between_format.parse_format(string(pp + 2), first_line_format);
|
||||
} else {
|
||||
next_lines_format.parse_format(string(n), first_line_format);
|
||||
}
|
||||
|
|
@ -99,7 +100,7 @@ void format_posts::operator()(post_t& post)
|
|||
}
|
||||
|
||||
if (prepend_format) {
|
||||
out.width(prepend_width);
|
||||
out.width(static_cast<std::streamsize>(prepend_width));
|
||||
out << prepend_format(bound_scope);
|
||||
}
|
||||
|
||||
|
|
@ -135,11 +136,14 @@ format_accounts::format_accounts(report_t& _report,
|
|||
const char * f = format.c_str();
|
||||
|
||||
if (const char * p = std::strstr(f, "%/")) {
|
||||
account_line_format.parse_format(string(f, 0, p - f));
|
||||
account_line_format.parse_format
|
||||
(string(f, 0, static_cast<std::string::size_type>(p - f)));
|
||||
const char * n = p + 2;
|
||||
if (const char * p = std::strstr(n, "%/")) {
|
||||
total_line_format.parse_format(string(n, 0, p - n), account_line_format);
|
||||
separator_format.parse_format(string(p + 2), account_line_format);
|
||||
if (const char * pp = std::strstr(n, "%/")) {
|
||||
total_line_format.parse_format
|
||||
(string(n, 0, static_cast<std::string::size_type>(pp - n)),
|
||||
account_line_format);
|
||||
separator_format.parse_format(string(pp + 2), account_line_format);
|
||||
} else {
|
||||
total_line_format.parse_format(n, account_line_format);
|
||||
}
|
||||
|
|
@ -181,7 +185,7 @@ std::size_t format_accounts::post_account(account_t& account, const bool flat)
|
|||
}
|
||||
|
||||
if (prepend_format) {
|
||||
out.width(prepend_width);
|
||||
out.width(static_cast<std::streamsize>(prepend_width));
|
||||
out << prepend_format(bound_scope);
|
||||
}
|
||||
|
||||
|
|
@ -256,7 +260,8 @@ void format_accounts::flush()
|
|||
out << separator_format(bound_scope);
|
||||
|
||||
if (prepend_format) {
|
||||
static_cast<std::ostream&>(report.output_stream).width(prepend_width);
|
||||
static_cast<std::ostream&>(report.output_stream)
|
||||
.width(static_cast<std::streamsize>(prepend_width));
|
||||
static_cast<std::ostream&>(report.output_stream)
|
||||
<< prepend_format(bound_scope);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -270,9 +270,9 @@ namespace {
|
|||
if (args.has(0)) {
|
||||
if (args[0].is_long()) {
|
||||
if (args.get<long>(0) > 2)
|
||||
name = format_t::truncate(account.fullname(),
|
||||
args.get<long>(0) - 2,
|
||||
2 /* account_abbrev_length */);
|
||||
name = format_t::truncate
|
||||
(account.fullname(), static_cast<std::size_t>(args.get<long>(0) - 2),
|
||||
/* account_abbrev_length= */ 2);
|
||||
else
|
||||
name = account.fullname();
|
||||
} else {
|
||||
|
|
|
|||
20
src/print.cc
20
src/print.cc
|
|
@ -98,8 +98,9 @@ namespace {
|
|||
string leader = buf.str();
|
||||
out << leader;
|
||||
|
||||
std::size_t columns = (report.HANDLED(columns_) ?
|
||||
report.HANDLER(columns_).value.to_long() : 80);
|
||||
std::size_t columns =
|
||||
(report.HANDLED(columns_) ?
|
||||
static_cast<std::size_t>(report.HANDLER(columns_).value.to_long()) : 80);
|
||||
|
||||
if (xact.note)
|
||||
print_note(out, *xact.note, columns, unistring(leader).length());
|
||||
|
|
@ -152,17 +153,18 @@ namespace {
|
|||
|
||||
std::size_t account_width =
|
||||
(report.HANDLER(account_width_).specified ?
|
||||
report.HANDLER(account_width_).value.to_long() : 36);
|
||||
static_cast<std::size_t>(report.HANDLER(account_width_).value.to_long()) : 36);
|
||||
|
||||
if (account_width < name.length())
|
||||
account_width = name.length();
|
||||
|
||||
if (! post->has_flags(POST_CALCULATED) || report.HANDLED(generated)) {
|
||||
out << name.extract();
|
||||
int slip = (static_cast<int>(account_width) -
|
||||
static_cast<int>(name.length()));
|
||||
std::string::size_type slip =
|
||||
(static_cast<std::string::size_type>(account_width) -
|
||||
static_cast<std::string::size_type>(name.length()));
|
||||
if (slip > 0) {
|
||||
out.width(slip);
|
||||
out.width(static_cast<std::streamsize>(slip));
|
||||
out << ' ';
|
||||
}
|
||||
|
||||
|
|
@ -185,8 +187,10 @@ namespace {
|
|||
|
||||
string trimmed_amt(amt);
|
||||
trim_left(trimmed_amt);
|
||||
int amt_slip = (static_cast<int>(amt.length()) -
|
||||
static_cast<int>(trimmed_amt.length()));
|
||||
std::string::size_type amt_slip =
|
||||
(static_cast<std::string::size_type>(amt.length()) -
|
||||
static_cast<std::string::size_type>(trimmed_amt.length()));
|
||||
|
||||
if (slip + amt_slip < 2)
|
||||
amtbuf << string(2 - (slip + amt_slip), ' ');
|
||||
amtbuf << amt;
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ namespace {
|
|||
|
||||
long accounts_len(account_t& account)
|
||||
{
|
||||
return account.accounts.size();
|
||||
return static_cast<long>(account.accounts.size());
|
||||
}
|
||||
|
||||
account_t& accounts_getitem(account_t& account, long i)
|
||||
|
|
@ -53,7 +53,7 @@ namespace {
|
|||
static account_t * last_account = NULL;
|
||||
static accounts_map::iterator elem;
|
||||
|
||||
long len = account.accounts.size();
|
||||
long len = static_cast<long>(account.accounts.size());
|
||||
|
||||
if (labs(i) >= len) {
|
||||
PyErr_SetString(PyExc_IndexError, _("Index out of range"));
|
||||
|
|
|
|||
|
|
@ -81,11 +81,11 @@ namespace {
|
|||
#endif
|
||||
|
||||
long balance_len(balance_t& bal) {
|
||||
return bal.amounts.size();
|
||||
return static_cast<long>(bal.amounts.size());
|
||||
}
|
||||
|
||||
amount_t balance_getitem(balance_t& bal, long i) {
|
||||
long len = bal.amounts.size();
|
||||
long len = static_cast<long>(bal.amounts.size());
|
||||
|
||||
if (labs(i) >= len) {
|
||||
PyErr_SetString(PyExc_IndexError, _("Index out of range"));
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ namespace {
|
|||
|
||||
long xacts_len(journal_t& journal)
|
||||
{
|
||||
return journal.xacts.size();
|
||||
return static_cast<long>(journal.xacts.size());
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
|
@ -66,7 +66,7 @@ namespace {
|
|||
static journal_t * last_journal = NULL;
|
||||
static xacts_list::iterator elem;
|
||||
|
||||
long len = journal.xacts.size();
|
||||
long len = static_cast<long>(journal.xacts.size());
|
||||
|
||||
if (labs(i) >= len) {
|
||||
PyErr_SetString(PyExc_IndexError, _("Index out of range"));
|
||||
|
|
@ -91,7 +91,7 @@ namespace {
|
|||
|
||||
long accounts_len(account_t& account)
|
||||
{
|
||||
return account.accounts.size();
|
||||
return static_cast<long>(account.accounts.size());
|
||||
}
|
||||
|
||||
account_t& accounts_getitem(account_t& account, long i)
|
||||
|
|
@ -100,7 +100,7 @@ namespace {
|
|||
static account_t * last_account = NULL;
|
||||
static accounts_map::iterator elem;
|
||||
|
||||
long len = account.accounts.size();
|
||||
long len = static_cast<long>(account.accounts.size());
|
||||
|
||||
if (labs(i) >= len) {
|
||||
PyErr_SetString(PyExc_IndexError, _("Index out of range"));
|
||||
|
|
@ -210,7 +210,8 @@ namespace {
|
|||
|
||||
post_t * posts_getitem(collector_wrapper& collector, long i)
|
||||
{
|
||||
post_t * post = collector.posts_collector->posts[i];
|
||||
post_t * post =
|
||||
collector.posts_collector->posts[static_cast<std::string::size_type>(i)];
|
||||
std::cerr << typeid(post).name() << std::endl;
|
||||
std::cerr << typeid(*post).name() << std::endl;
|
||||
std::cerr << typeid(post->account).name() << std::endl;
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ namespace {
|
|||
|
||||
long posts_len(xact_base_t& xact)
|
||||
{
|
||||
return xact.posts.size();
|
||||
return static_cast<long>(xact.posts.size());
|
||||
}
|
||||
|
||||
post_t& posts_getitem(xact_base_t& xact, long i)
|
||||
|
|
@ -53,7 +53,7 @@ namespace {
|
|||
static xact_base_t * last_xact = NULL;
|
||||
static posts_list::iterator elem;
|
||||
|
||||
long len = xact.posts.size();
|
||||
long len = static_cast<long>(xact.posts.size());
|
||||
|
||||
if (labs(i) >= len) {
|
||||
PyErr_SetString(PyExc_IndexError, _("Index out of range"));
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ protected:
|
|||
// write multiple characters
|
||||
virtual std::streamsize xsputn (const char* s, std::streamsize num) {
|
||||
char * buf = new char[num + 1];
|
||||
std::strncpy(buf, s, num);
|
||||
std::strncpy(buf, s, static_cast<std::size_t>(num));
|
||||
buf[num] = '\0';
|
||||
if (PyFile_WriteString(buf, reinterpret_cast<PyObject *>(fo)) < 0)
|
||||
num = 0;
|
||||
|
|
@ -148,7 +148,7 @@ protected:
|
|||
* - but at most size of putback area
|
||||
*/
|
||||
size_t numPutback;
|
||||
numPutback = gptr() - eback();
|
||||
numPutback = static_cast<size_t>(gptr() - eback());
|
||||
if (numPutback > pbSize) {
|
||||
numPutback = pbSize;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -577,7 +577,7 @@ value_t report_t::fn_trim(call_scope_t& args)
|
|||
return string_value(empty_string);
|
||||
}
|
||||
else {
|
||||
return string_value(string(p, e - p));
|
||||
return string_value(string(p, static_cast<std::string::size_type>(e - p)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -641,9 +641,10 @@ value_t report_t::fn_truncated(call_scope_t& args)
|
|||
{
|
||||
return string_value(format_t::truncate
|
||||
(args.get<string>(0),
|
||||
(args.has<int>(1) &&
|
||||
args.get<int>(1) > 0) ? args.get<int>(1) : 0,
|
||||
args.has<int>(2) ? args.get<int>(2) : 0));
|
||||
(args.has<int>(1) && args.get<int>(1) > 0) ?
|
||||
static_cast<std::size_t>(args.get<int>(1)) : 0,
|
||||
args.has<int>(2) ?
|
||||
static_cast<std::size_t>(args.get<int>(2)) : 0));
|
||||
}
|
||||
|
||||
value_t report_t::fn_justify(call_scope_t& args)
|
||||
|
|
|
|||
|
|
@ -1079,7 +1079,7 @@ post_t * instance_t::parse_post(char * line,
|
|||
|
||||
char buf[MAX_LINE + 1];
|
||||
std::strcpy(buf, line);
|
||||
std::size_t beg = 0;
|
||||
std::streamsize beg = 0;
|
||||
|
||||
try {
|
||||
|
||||
|
|
@ -1135,7 +1135,7 @@ post_t * instance_t::parse_post(char * line,
|
|||
p++; e--;
|
||||
}
|
||||
|
||||
string name(p, e - p);
|
||||
string name(p, static_cast<std::string::size_type>(e - p));
|
||||
DEBUG("textual.parse", "line " << linenum << ": "
|
||||
<< "Parsed account name " << name);
|
||||
|
||||
|
|
@ -1166,8 +1166,8 @@ post_t * instance_t::parse_post(char * line,
|
|||
// Parse the optional amount
|
||||
|
||||
if (next && *next && (*next != ';' && *next != '=')) {
|
||||
beg = next - line;
|
||||
ptristream stream(next, len - beg);
|
||||
beg = static_cast<std::streamsize>(next - line);
|
||||
ptristream stream(next, static_cast<std::size_t>(len - beg));
|
||||
|
||||
if (*next != '(') // indicates a value expression
|
||||
post->amount.parse(stream, PARSE_NO_REDUCE);
|
||||
|
|
@ -1223,7 +1223,7 @@ post_t * instance_t::parse_post(char * line,
|
|||
<< "And it's for a total price");
|
||||
}
|
||||
|
||||
beg = ++next - line;
|
||||
beg = static_cast<std::streamsize>(++next - line);
|
||||
|
||||
p = skip_ws(next);
|
||||
if (*p) {
|
||||
|
|
@ -1237,8 +1237,8 @@ post_t * instance_t::parse_post(char * line,
|
|||
throw parse_error(_("Posting is missing a cost amount"));
|
||||
}
|
||||
|
||||
beg = p - line;
|
||||
ptristream cstream(p, len - beg);
|
||||
beg = static_cast<std::streamsize>(p - line);
|
||||
ptristream cstream(p, static_cast<std::size_t>(len - beg));
|
||||
|
||||
if (*p != '(') // indicates a value expression
|
||||
post->cost->parse(cstream, PARSE_NO_MIGRATE);
|
||||
|
|
@ -1288,14 +1288,14 @@ post_t * instance_t::parse_post(char * line,
|
|||
DEBUG("textual.parse", "line " << linenum << ": "
|
||||
<< "Found a balance assignment indicator");
|
||||
|
||||
beg = ++next - line;
|
||||
beg = static_cast<std::streamsize>(++next - line);
|
||||
|
||||
p = skip_ws(next);
|
||||
if (*p) {
|
||||
post->assigned_amount = amount_t();
|
||||
|
||||
beg = p - line;
|
||||
ptristream stream(p, len - beg);
|
||||
beg = static_cast<std::streamsize>(p - line);
|
||||
ptristream stream(p, static_cast<std::size_t>(len - beg));
|
||||
|
||||
if (*p != '(') // indicates a value expression
|
||||
post->assigned_amount->parse(stream, PARSE_NO_MIGRATE);
|
||||
|
|
@ -1398,7 +1398,8 @@ post_t * instance_t::parse_post(char * line,
|
|||
}
|
||||
catch (const std::exception&) {
|
||||
add_error_context(_("While parsing posting:"));
|
||||
add_error_context(line_context(buf, beg, len));
|
||||
add_error_context(line_context(buf, static_cast<std::string::size_type>(beg),
|
||||
static_cast<std::string::size_type>(len)));
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,8 +92,9 @@ public:
|
|||
|
||||
if (this_len)
|
||||
utf8::unchecked::utf32to8
|
||||
(utf32chars.begin() + begin,
|
||||
utf32chars.begin() + begin +
|
||||
(utf32chars.begin() + static_cast<std::string::difference_type>(begin),
|
||||
utf32chars.begin() + static_cast<std::string::difference_type>(begin) +
|
||||
static_cast<std::string::difference_type>
|
||||
(len ? (len > this_len ? this_len : len) : this_len),
|
||||
std::back_inserter(utf8result));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue