2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-12-22 10:58:58 +00:00

Replace calls to QUtil::int_to_string with std::to_string

This commit is contained in:
m-holger 2022-09-21 17:49:21 +01:00 committed by Jay Berkenbilt
parent da67a0aa04
commit 2e6869483b
40 changed files with 215 additions and 247 deletions

View File

@ -110,7 +110,7 @@ show_bookmark_details(QPDFOutlineObjectHelper outline, std::vector<int> numbers)
QTC::TC("examples", "pdf-bookmarks dest");
QPDFObjGen og = dest_page.getObjGen();
if (page_map.count(og)) {
target = QUtil::int_to_string(page_map[og]);
target = std::to_string(page_map[og]);
}
}
std::cout << "[ -> " << target << " ] ";

View File

@ -59,7 +59,7 @@ StringCounter::handleEOF()
// Write a comment at the end of the stream just to show how we
// can enhance the output if we want.
write("\n% strings found: ");
write(QUtil::int_to_string(this->count));
write(std::to_string(this->count));
}
int

View File

@ -144,8 +144,7 @@ main(int argc, char* argv[])
auto iter2 = number_tree.begin();
for (int i = 7; i <= 350; i += 7) {
iter2.insertAfter(
i,
QPDFObjectHandle::newString("-" + QUtil::int_to_string(i) + "-"));
i, QPDFObjectHandle::newString("-" + std::to_string(i) + "-"));
}
std::cout << "Numbers:" << std::endl;
int n = 1;

View File

@ -24,8 +24,7 @@ process(char const* whoami, char const* infile, std::string outprefix)
inpdf.processFile(infile);
std::vector<QPDFPageObjectHelper> pages =
QPDFPageDocumentHelper(inpdf).getAllPages();
int pageno_len =
QIntC::to_int(QUtil::uint_to_string(pages.size()).length());
int pageno_len = QIntC::to_int(std::to_string(pages.size()).length());
int pageno = 0;
for (auto& page: pages) {
std::string outfile =

View File

@ -86,7 +86,6 @@ class QPDF_DLL_CLASS Pipeline
Pipeline& operator<<(char const* cstr);
QPDF_DLL
Pipeline& operator<<(std::string const&);
// Calls QUtil::int_to_string
QPDF_DLL
Pipeline& operator<<(short);
QPDF_DLL
@ -95,7 +94,6 @@ class QPDF_DLL_CLASS Pipeline
Pipeline& operator<<(long);
QPDF_DLL
Pipeline& operator<<(long long);
// Calls QUtil::uint_to_string
QPDF_DLL
Pipeline& operator<<(unsigned short);
QPDF_DLL

View File

@ -105,8 +105,7 @@ FileInputSource::seek(qpdf_offset_t offset, int whence)
if (QUtil::seek(this->file, offset, whence) == -1) {
QUtil::throw_system_error(
std::string("seek to ") + this->filename + ", offset " +
QUtil::int_to_string(offset) + " (" + QUtil::int_to_string(whence) +
")");
std::to_string(offset) + " (" + std::to_string(whence) + ")");
}
}
@ -128,8 +127,7 @@ FileInputSource::read(char* buffer, size_t length)
this->filename,
"",
this->last_offset,
(std::string("read ") + QUtil::uint_to_string(length) +
" bytes"));
(std::string("read ") + std::to_string(length) + " bytes"));
} else if (length > 0) {
this->seek(0, SEEK_END);
this->last_offset = this->tell();

View File

@ -148,7 +148,7 @@ JSON::JSON_string::write(Pipeline* p, size_t) const
}
JSON::JSON_number::JSON_number(long long value) :
encoded(QUtil::int_to_string(value))
encoded(std::to_string(value))
{
}
@ -554,7 +554,7 @@ JSON::checkSchemaInternal(
sch_arr->elements.at(0).get(),
flags,
errors,
prefix + "." + QUtil::int_to_string(i));
prefix + "." + std::to_string(i));
++i;
}
} else {
@ -570,7 +570,7 @@ JSON::checkSchemaInternal(
QTC::TC("libtests", "JSON schema array length mismatch");
errors.push_back(
err_prefix + " is supposed to be an array of length " +
QUtil::uint_to_string(n_elements));
std::to_string(n_elements));
return false;
} else {
// A multi-element array in the schema must correspond to
@ -584,7 +584,7 @@ JSON::checkSchemaInternal(
sch_arr->elements.at(i).get(),
flags,
errors,
prefix + "." + QUtil::uint_to_string(i));
prefix + "." + std::to_string(i));
++i;
}
}
@ -703,10 +703,10 @@ JSONParser::handle_u_code(
if (high_offset) {
QTC::TC("libtests", "JSON 16 high high");
throw std::runtime_error(
"JSON: offset " + QUtil::int_to_string(new_high_offset) +
"JSON: offset " + std::to_string(new_high_offset) +
": UTF-16 high surrogate found after previous high surrogate"
" at offset " +
QUtil::int_to_string(high_offset));
std::to_string(high_offset));
}
high_offset = new_high_offset;
high_surrogate = codepoint;
@ -715,7 +715,7 @@ JSONParser::handle_u_code(
if (offset + i != (high_offset + 6)) {
QTC::TC("libtests", "JSON 16 low not after high");
throw std::runtime_error(
"JSON: offset " + QUtil::int_to_string(offset + i) +
"JSON: offset " + std::to_string(offset + i) +
": UTF-16 low surrogate found not immediately after high"
" surrogate");
}
@ -797,7 +797,7 @@ JSONParser::decode_string(std::string const& str, qpdf_offset_t offset)
if (high_offset) {
QTC::TC("libtests", "JSON 16 dangling high");
throw std::runtime_error(
"JSON: offset " + QUtil::int_to_string(high_offset) +
"JSON: offset " + std::to_string(high_offset) +
": UTF-16 high surrogate not followed by low surrogate");
}
return result;
@ -822,8 +822,7 @@ JSONParser::getToken()
if (*p == 0) {
QTC::TC("libtests", "JSON parse null character");
throw std::runtime_error(
"JSON: null character at offset " +
QUtil::int_to_string(offset));
"JSON: null character at offset " + std::to_string(offset));
}
action = append;
switch (lex_state) {
@ -860,7 +859,7 @@ JSONParser::getToken()
} else {
QTC::TC("libtests", "JSON parse bad character");
throw std::runtime_error(
"JSON: offset " + QUtil::int_to_string(offset) +
"JSON: offset " + std::to_string(offset) +
": unexpected character " + std::string(p, 1));
}
break;
@ -878,12 +877,12 @@ JSONParser::getToken()
if (number_saw_e) {
QTC::TC("libtests", "JSON parse point after e");
throw std::runtime_error(
"JSON: offset " + QUtil::int_to_string(offset) +
"JSON: offset " + std::to_string(offset) +
": numeric literal: decimal point after e");
} else if (number_saw_point) {
QTC::TC("libtests", "JSON parse duplicate point");
throw std::runtime_error(
"JSON: offset " + QUtil::int_to_string(offset) +
"JSON: offset " + std::to_string(offset) +
": numeric literal: decimal point already seen");
} else {
number_saw_point = true;
@ -892,7 +891,7 @@ JSONParser::getToken()
if (number_saw_e) {
QTC::TC("libtests", "JSON parse duplicate e");
throw std::runtime_error(
"JSON: offset " + QUtil::int_to_string(offset) +
"JSON: offset " + std::to_string(offset) +
": numeric literal: e already seen");
} else {
number_saw_e = true;
@ -903,7 +902,7 @@ JSONParser::getToken()
} else {
QTC::TC("libtests", "JSON parse unexpected sign");
throw std::runtime_error(
"JSON: offset " + QUtil::int_to_string(offset) +
"JSON: offset " + std::to_string(offset) +
": numeric literal: unexpected sign");
}
} else if (QUtil::is_space(*p)) {
@ -915,7 +914,7 @@ JSONParser::getToken()
} else {
QTC::TC("libtests", "JSON parse numeric bad character");
throw std::runtime_error(
"JSON: offset " + QUtil::int_to_string(offset) +
"JSON: offset " + std::to_string(offset) +
": numeric literal: unexpected character " +
std::string(p, 1));
}
@ -933,7 +932,7 @@ JSONParser::getToken()
} else {
QTC::TC("libtests", "JSON parse keyword bad character");
throw std::runtime_error(
"JSON: offset " + QUtil::int_to_string(offset) +
"JSON: offset " + std::to_string(offset) +
": keyword: unexpected character " + std::string(p, 1));
}
break;
@ -956,7 +955,7 @@ JSONParser::getToken()
} else {
QTC::TC("libtests", "JSON parse backslash bad character");
throw std::runtime_error(
"JSON: offset " + QUtil::int_to_string(offset) +
"JSON: offset " + std::to_string(offset) +
": invalid character after backslash: " +
std::string(p, 1));
}
@ -966,8 +965,7 @@ JSONParser::getToken()
if (!QUtil::is_hex_digit(*p)) {
QTC::TC("libtests", "JSON parse bad hex after u");
throw std::runtime_error(
"JSON: offset " +
QUtil::int_to_string(offset - u_count - 1) +
"JSON: offset " + std::to_string(offset - u_count - 1) +
": \\u must be followed by four hex digits");
}
if (++u_count == 4) {
@ -1006,15 +1004,14 @@ JSONParser::getToken()
case ls_u4:
QTC::TC("libtests", "JSON parse premature end of u");
throw std::runtime_error(
"JSON: offset " +
QUtil::int_to_string(offset - u_count - 1) +
"JSON: offset " + std::to_string(offset - u_count - 1) +
": \\u must be followed by four characters");
case ls_string:
case ls_backslash:
QTC::TC("libtests", "JSON parse unterminated string");
throw std::runtime_error(
"JSON: offset " + QUtil::int_to_string(offset) +
"JSON: offset " + std::to_string(offset) +
": unterminated string");
break;
}
@ -1032,7 +1029,7 @@ JSONParser::handleToken()
if (parser_state == ps_done) {
QTC::TC("libtests", "JSON parse junk after object");
throw std::runtime_error(
"JSON: offset " + QUtil::int_to_string(offset) +
"JSON: offset " + std::to_string(offset) +
": material follows end of object: " + token);
}
@ -1076,7 +1073,7 @@ JSONParser::handleToken()
if (number_saw_point && (number_after_point == 0)) {
QTC::TC("libtests", "JSON parse decimal with no digits");
throw std::runtime_error(
"JSON: offset " + QUtil::int_to_string(offset) +
"JSON: offset " + std::to_string(offset) +
": decimal point with no digits");
}
if ((number_before_point > 1) &&
@ -1084,13 +1081,13 @@ JSONParser::handleToken()
((first_char == '-') && (token.at(1) == '0')))) {
QTC::TC("libtests", "JSON parse leading zero");
throw std::runtime_error(
"JSON: offset " + QUtil::int_to_string(offset) +
"JSON: offset " + std::to_string(offset) +
": number with leading zero");
}
if ((number_before_point == 0) && (number_after_point == 0)) {
QTC::TC("libtests", "JSON parse number no digits");
throw std::runtime_error(
"JSON: offset " + QUtil::int_to_string(offset) +
"JSON: offset " + std::to_string(offset) +
": number with no digits");
}
item = std::make_shared<JSON>(JSON::makeNumber(token));
@ -1106,7 +1103,7 @@ JSONParser::handleToken()
} else {
QTC::TC("libtests", "JSON parse invalid keyword");
throw std::runtime_error(
"JSON: offset " + QUtil::int_to_string(offset) +
"JSON: offset " + std::to_string(offset) +
": invalid keyword " + token);
}
break;
@ -1139,21 +1136,20 @@ JSONParser::handleToken()
case ps_dict_after_key:
QTC::TC("libtests", "JSON parse expected colon");
throw std::runtime_error(
"JSON: offset " + QUtil::int_to_string(offset) +
": expected ':'");
"JSON: offset " + std::to_string(offset) + ": expected ':'");
break;
case ps_dict_after_item:
QTC::TC("libtests", "JSON parse expected , or }");
throw std::runtime_error(
"JSON: offset " + QUtil::int_to_string(offset) +
"JSON: offset " + std::to_string(offset) +
": expected ',' or '}'");
break;
case ps_array_after_item:
QTC::TC("libtests", "JSON parse expected, or ]");
throw std::runtime_error(
"JSON: offset " + QUtil::int_to_string(offset) +
"JSON: offset " + std::to_string(offset) +
": expected ',' or ']'");
break;
@ -1162,7 +1158,7 @@ JSONParser::handleToken()
if (lex_state != ls_string) {
QTC::TC("libtests", "JSON parse string as dict key");
throw std::runtime_error(
"JSON: offset " + QUtil::int_to_string(offset) +
"JSON: offset " + std::to_string(offset) +
": expect string as dictionary key");
}
break;
@ -1181,7 +1177,7 @@ JSONParser::handleToken()
{
QTC::TC("libtests", "JSON parse unexpected }");
throw std::runtime_error(
"JSON: offset " + QUtil::int_to_string(offset) +
"JSON: offset " + std::to_string(offset) +
": unexpected dictionary end delimiter");
}
} else if (delimiter == ']') {
@ -1191,14 +1187,14 @@ JSONParser::handleToken()
{
QTC::TC("libtests", "JSON parse unexpected ]");
throw std::runtime_error(
"JSON: offset " + QUtil::int_to_string(offset) +
"JSON: offset " + std::to_string(offset) +
": unexpected array end delimiter");
}
} else if (delimiter == ':') {
if (parser_state != ps_dict_after_key) {
QTC::TC("libtests", "JSON parse unexpected :");
throw std::runtime_error(
"JSON: offset " + QUtil::int_to_string(offset) +
"JSON: offset " + std::to_string(offset) +
": unexpected colon");
}
} else if (delimiter == ',') {
@ -1206,7 +1202,7 @@ JSONParser::handleToken()
(parser_state == ps_array_after_item))) {
QTC::TC("libtests", "JSON parse unexpected ,");
throw std::runtime_error(
"JSON: offset " + QUtil::int_to_string(offset) +
"JSON: offset " + std::to_string(offset) +
": unexpected comma");
}
} else if (delimiter != '\0') {
@ -1265,7 +1261,7 @@ JSONParser::handleToken()
if (tos->checkDictionaryKeySeen(dict_key)) {
QTC::TC("libtests", "JSON parse duplicate key");
throw std::runtime_error(
"JSON: offset " + QUtil::int_to_string(dict_key_offset) +
"JSON: offset " + std::to_string(dict_key_offset) +
": duplicated dictionary key");
}
if (!reactor || !reactor->dictionaryItem(dict_key, *item)) {
@ -1326,7 +1322,7 @@ JSONParser::handleToken()
}
if (ps_stack.size() > 500) {
throw std::runtime_error(
"JSON: offset " + QUtil::int_to_string(offset) +
"JSON: offset " + std::to_string(offset) +
": maximum object depth exceeded");
}
parser_state = next_state;

View File

@ -132,7 +132,7 @@ JSONHandler::handle(std::string const& path, JSON j)
size_t i = 0;
j.forEachArrayItem([&i, &path, this](JSON v) {
this->m->h.array_item_handler->handle(
path + "[" + QUtil::uint_to_string(i) + "]", v);
path + "[" + std::to_string(i) + "]", v);
++i;
});
this->m->h.array_end_handler(path);

View File

@ -10,7 +10,7 @@ get_description(QPDFObjectHandle& node)
{
std::string result("Name/Number tree node");
if (node.isIndirect()) {
result += " (object " + QUtil::int_to_string(node.getObjectID()) + ")";
result += " (object " + std::to_string(node.getObjectID()) + ")";
}
return result;
}
@ -103,7 +103,7 @@ NNTreeIterator::getNextKid(PathElement& pe, bool backward)
impl.qpdf,
pe.node,
("skipping over invalid kid at index " +
QUtil::int_to_string(pe.kid_number)));
std::to_string(pe.kid_number)));
}
} else {
result = QPDFObjectHandle::newNull();
@ -159,7 +159,7 @@ NNTreeIterator::increment(bool backward)
warn(
impl.qpdf,
this->node,
("item " + QUtil::int_to_string(this->item_number) +
("item " + std::to_string(this->item_number) +
" has the wrong type"));
} else {
found_valid_key = true;
@ -685,8 +685,7 @@ NNTreeIterator::deepen(QPDFObjectHandle node, bool first, bool allow_empty)
warn(
impl.qpdf,
node,
("converting kid number " +
QUtil::int_to_string(kid_number) +
("converting kid number " + std::to_string(kid_number) +
" to an indirect object"));
next = impl.qpdf.makeIndirectObject(next);
kids.setArrayItem(kid_number, next);
@ -695,7 +694,7 @@ NNTreeIterator::deepen(QPDFObjectHandle node, bool first, bool allow_empty)
warn(
impl.qpdf,
node,
("kid number " + QUtil::int_to_string(kid_number) +
("kid number " + std::to_string(kid_number) +
" is not an indirect object"));
}
}
@ -853,7 +852,7 @@ NNTreeImpl::compareKeyItem(
error(
qpdf,
this->oh,
("item at index " + QUtil::int_to_string(2 * idx) +
("item at index " + std::to_string(2 * idx) +
" is not the right type"));
}
return details.compareKeys(key, items.getArrayItem(2 * idx));
@ -866,10 +865,7 @@ NNTreeImpl::compareKeyKid(
if (!(kids.isArray() && (idx < kids.getArrayNItems()) &&
kids.getArrayItem(idx).isDictionary())) {
QTC::TC("qpdf", "NNTree kid is invalid");
error(
qpdf,
this->oh,
"invalid kid at index " + QUtil::int_to_string(idx));
error(qpdf, this->oh, "invalid kid at index " + std::to_string(idx));
}
return withinLimits(key, kids.getArrayItem(idx));
}

View File

@ -48,8 +48,8 @@ void
PDFVersion::getVersion(std::string& version, int& extension_level) const
{
extension_level = this->extension_level;
version = QUtil::int_to_string(this->major_version) + "." +
QUtil::int_to_string(this->minor_version);
version = std::to_string(this->major_version) + "." +
std::to_string(this->minor_version);
}
int

View File

@ -57,56 +57,56 @@ Pipeline::operator<<(std::string const& str)
Pipeline&
Pipeline::operator<<(short i)
{
this->writeString(QUtil::int_to_string(i));
this->writeString(std::to_string(i));
return *this;
}
Pipeline&
Pipeline::operator<<(int i)
{
this->writeString(QUtil::int_to_string(i));
this->writeString(std::to_string(i));
return *this;
}
Pipeline&
Pipeline::operator<<(long i)
{
this->writeString(QUtil::int_to_string(i));
this->writeString(std::to_string(i));
return *this;
}
Pipeline&
Pipeline::operator<<(long long i)
{
this->writeString(QUtil::int_to_string(i));
this->writeString(std::to_string(i));
return *this;
}
Pipeline&
Pipeline::operator<<(unsigned short i)
{
this->writeString(QUtil::uint_to_string(i));
this->writeString(std::to_string(i));
return *this;
}
Pipeline&
Pipeline::operator<<(unsigned int i)
{
this->writeString(QUtil::uint_to_string(i));
this->writeString(std::to_string(i));
return *this;
}
Pipeline&
Pipeline::operator<<(unsigned long i)
{
this->writeString(QUtil::uint_to_string(i));
this->writeString(std::to_string(i));
return *this;
}
Pipeline&
Pipeline::operator<<(unsigned long long i)
{
this->writeString(QUtil::uint_to_string(i));
this->writeString(std::to_string(i));
return *this;
}

View File

@ -53,7 +53,7 @@ Pl_AES_PDF::setIV(unsigned char const* iv, size_t bytes)
throw std::logic_error(
"Pl_AES_PDF: specified initialization vector"
" size in bytes must be " +
QUtil::uint_to_string(bytes));
std::to_string(bytes));
}
this->use_specified_iv = true;
memcpy(this->specified_iv, iv, bytes);

View File

@ -302,9 +302,8 @@ Pl_DCT::compress(void* cinfo_p, Buffer* b)
QIntC::to_size(cinfo->input_components);
if (b->getSize() != expected_size) {
throw std::runtime_error(
"Pl_DCT: image buffer size = " +
QUtil::uint_to_string(b->getSize()) +
"; expected size = " + QUtil::uint_to_string(expected_size));
"Pl_DCT: image buffer size = " + std::to_string(b->getSize()) +
"; expected size = " + std::to_string(expected_size));
}
JSAMPROW row_pointer[1];
unsigned char* buffer = b->getBuffer();

View File

@ -286,7 +286,7 @@ Pl_Flate::checkError(char const* prefix, int error_code)
default:
msg += std::string("zlib unknown error (") +
QUtil::int_to_string(error_code) + ")";
std::to_string(error_code) + ")";
break;
}
}

View File

@ -25,7 +25,7 @@ Pl_Function::Pl_Function(
if (code != 0) {
throw std::runtime_error(
std::string(identifier) + " function returned code " +
QUtil::int_to_string(code));
std::to_string(code));
}
};
}
@ -40,7 +40,7 @@ Pl_Function::Pl_Function(
if (code != 0) {
throw std::runtime_error(
std::string(identifier) + " function returned code " +
QUtil::int_to_string(code));
std::to_string(code));
}
};
}

View File

@ -98,7 +98,7 @@ Pl_LZWDecoder::getFirstChar(unsigned int code)
} else {
throw std::runtime_error(
"Pl_LZWDecoder::getFirstChar called with invalid code (" +
QUtil::int_to_string(code) + ")");
std::to_string(code) + ")");
}
return result;
}
@ -126,7 +126,7 @@ Pl_LZWDecoder::addToTable(unsigned char next)
} else {
throw std::runtime_error(
"Pl_LZWDecoder::addToTable called with invalid code (" +
QUtil::int_to_string(this->last_code) + ")");
std::to_string(this->last_code) + ")");
}
Buffer entry(1 + last_size);

View File

@ -49,7 +49,7 @@ Pl_QPDFTokenizer::finish()
while (true) {
QPDFTokenizer::Token token = this->m->tokenizer.readToken(
input, "offset " + QUtil::int_to_string(input->tell()), true);
input, "offset " + std::to_string(input->tell()), true);
this->m->filter->handleToken(token);
if (token.getType() == QPDFTokenizer::tt_eof) {
break;

View File

@ -773,9 +773,9 @@ QPDF::read_xref(qpdf_offset_t xref_offset)
"",
0,
(std::string("reported number of objects (") +
QUtil::int_to_string(size) +
std::to_string(size) +
") is not one plus the highest object number (" +
QUtil::int_to_string(max_obj) + ")"));
std::to_string(max_obj) + ")"));
}
// We no longer need the deleted_objects table, so go ahead and
@ -954,7 +954,7 @@ QPDF::read_xrefTable(qpdf_offset_t xref_offset)
this->m->file->getName(),
"xref table",
this->m->file->getLastOffset(),
"invalid xref entry (obj=" + QUtil::int_to_string(i) + ")");
"invalid xref entry (obj=" + std::to_string(i) + ")");
}
if (type == 'f') {
// Save deleted items until after we've checked the
@ -1160,7 +1160,7 @@ QPDF::processXRefStream(qpdf_offset_t xref_offset, QPDFObjectHandle& xref_obj)
"xref stream",
xref_offset,
("Cross-reference stream's /Index's item " +
QUtil::int_to_string(i) + " is not an integer"));
std::to_string(i) + " is not an integer"));
}
}
QTC::TC("qpdf", "QPDF xref /Index is array", n_index == 2 ? 0 : 1);
@ -1181,9 +1181,9 @@ QPDF::processXRefStream(qpdf_offset_t xref_offset, QPDFObjectHandle& xref_obj)
xref_offset,
("Cross-reference stream claims to contain"
" too many entries: " +
QUtil::int_to_string(indx.at(i)) + " " +
QUtil::uint_to_string(max_num_entries) + " " +
QUtil::uint_to_string(num_entries)));
std::to_string(indx.at(i)) + " " +
std::to_string(max_num_entries) + " " +
std::to_string(num_entries)));
}
num_entries += toS(indx.at(i));
}
@ -1203,8 +1203,8 @@ QPDF::processXRefStream(qpdf_offset_t xref_offset, QPDFObjectHandle& xref_obj)
xref_offset,
("Cross-reference stream data has the wrong size;"
" expected = " +
QUtil::uint_to_string(expected_size) +
"; actual = " + QUtil::uint_to_string(actual_size)));
std::to_string(expected_size) +
"; actual = " + std::to_string(actual_size)));
if (expected_size > actual_size) {
throw x;
} else {
@ -1356,7 +1356,7 @@ QPDF::insertXrefEntry(int obj, int f0, qpdf_offset_t f1, int f2, bool overwrite)
this->m->file->getName(),
"xref stream",
this->m->file->getLastOffset(),
"unknown xref stream entry type " + QUtil::int_to_string(f0));
"unknown xref stream entry type " + std::to_string(f0));
break;
}
}
@ -1747,7 +1747,7 @@ QPDF::recoverStreamLength(
input->getName(),
this->m->last_object_description,
stream_offset,
"recovered stream length: " + QUtil::uint_to_string(length)));
"recovered stream length: " + std::to_string(length)));
}
QTC::TC("qpdf", "QPDF recovered stream length");
@ -2026,8 +2026,8 @@ QPDF::resolveObjectsInStream(int obj_stream_number)
this->m->file->getName(),
this->m->last_object_description,
this->m->file->getLastOffset(),
("supposed object stream " +
QUtil::int_to_string(obj_stream_number) + " is not a stream"));
("supposed object stream " + std::to_string(obj_stream_number) +
" is not a stream"));
}
// For linearization data in the object, use the data from the
@ -2045,8 +2045,8 @@ QPDF::resolveObjectsInStream(int obj_stream_number)
qpdf_e_damaged_pdf,
this->m->last_object_description,
this->m->file->getLastOffset(),
("supposed object stream " +
QUtil::int_to_string(obj_stream_number) + " has wrong type"));
("supposed object stream " + std::to_string(obj_stream_number) +
" has wrong type"));
}
if (!(dict.getKey("/N").isInteger() && dict.getKey("/First").isInteger())) {
@ -2055,7 +2055,7 @@ QPDF::resolveObjectsInStream(int obj_stream_number)
this->m->file->getName(),
this->m->last_object_description,
this->m->file->getLastOffset(),
("object stream " + QUtil::int_to_string(obj_stream_number) +
("object stream " + std::to_string(obj_stream_number) +
" has incorrect keys"));
}
@ -2069,7 +2069,7 @@ QPDF::resolveObjectsInStream(int obj_stream_number)
// line-break
new BufferInputSource(
(this->m->file->getName() + " object stream " +
QUtil::int_to_string(obj_stream_number)),
std::to_string(obj_stream_number)),
bp.get()));
for (int i = 0; i < n; ++i) {

View File

@ -104,7 +104,7 @@ QPDFAcroFormDocumentHelper::addAndRenameFormFields(
std::string append;
while (!getFieldsWithQualifiedName(new_name).empty()) {
++suffix;
append = "+" + QUtil::int_to_string(suffix);
append = "+" + std::to_string(suffix);
new_name = old_name + append;
}
renames[old_name] = append;

View File

@ -135,7 +135,7 @@ QPDFCrypto_gnutls::SHA2_init(int bits)
if (code < 0) {
this->hash_ctx = nullptr;
throw std::runtime_error(
std::string("gnutls: SHA") + QUtil::int_to_string(bits) +
std::string("gnutls: SHA") + std::to_string(bits) +
" error: " + std::string(gnutls_strerror(code)));
}
}

View File

@ -39,7 +39,7 @@ QPDFExc::createWhat(
}
}
if (offset > 0) {
result += "offset " + QUtil::int_to_string(offset);
result += "offset " + std::to_string(offset);
}
if (!filename.empty()) {
result += ")";

View File

@ -2472,7 +2472,7 @@ QPDFJob::handleTransformations(QPDF& pdf)
std::shared_ptr<QPDFObjectHandle::StreamDataProvider> sdp(io);
if (io->evaluate(
"image " + name + " on page " +
QUtil::int_to_string(pageno))) {
std::to_string(pageno))) {
QPDFObjectHandle new_image =
QPDFObjectHandle::newStream(&pdf);
new_image.replaceDict(image.getDict().shallowCopy());
@ -3318,7 +3318,7 @@ QPDFJob::doSplitPages(QPDF& pdf, bool& warnings)
QPDFPageLabelDocumentHelper pldh(pdf);
QPDFAcroFormDocumentHelper afdh(pdf);
std::vector<QPDFObjectHandle> const& pages = pdf.getAllPages();
size_t pageno_len = QUtil::uint_to_string(pages.size()).length();
size_t pageno_len = std::to_string(pages.size()).length();
size_t num_pages = pages.size();
for (size_t i = 0; i < num_pages; i += QIntC::to_size(m->split_pages)) {
size_t first = i + 1;

View File

@ -12,6 +12,5 @@ operator<<(std::ostream& os, const QPDFObjGen& og)
std::string
QPDFObjGen::unparse(char separator) const
{
return QUtil::int_to_string(this->obj) + separator +
QUtil::int_to_string(this->gen);
return std::to_string(this->obj) + separator + std::to_string(this->gen);
}

View File

@ -1257,7 +1257,7 @@ QPDFObjectHandle::getUniqueResourceName(
std::set<std::string> names = (namesp ? *namesp : getResourceNames());
int max_suffix = min_suffix + QIntC::to_int(names.size());
while (min_suffix <= max_suffix) {
std::string candidate = prefix + QUtil::int_to_string(min_suffix);
std::string candidate = prefix + std::to_string(min_suffix);
if (names.count(candidate) == 0) {
return candidate;
}
@ -1554,8 +1554,8 @@ QPDFObjectHandle::arrayOrStreamToStreamArray(
QPDFExc(
qpdf_e_damaged_pdf,
"",
description + ": item index " +
QUtil::int_to_string(i) + " (from 0)",
description + ": item index " + std::to_string(i) +
" (from 0)",
0,
"ignoring non-stream in an array of streams"));
}

View File

@ -335,8 +335,8 @@ QPDFParser::parse(bool& empty, bool content_stream)
bool found_fake = false;
std::string candidate;
while (!found_fake) {
candidate = "/QPDFFake" +
QUtil::int_to_string(next_fake_key++);
candidate =
"/QPDFFake" + std::to_string(next_fake_key++);
found_fake = (names.count(candidate) == 0);
QTC::TC(
"qpdf",
@ -416,7 +416,7 @@ QPDFParser::setDescriptionFromInput(
oh.setObjectDescription(
context,
(input->getName() + ", " + object_description + " at offset " +
QUtil::int_to_string(offset)));
std::to_string(offset)));
}
void

View File

@ -842,8 +842,7 @@ QPDFWriter::parseVersion(
if ((p != std::string::npos) && (version.length() > p)) {
minor = QUtil::string_to_int(version.substr(p + 1).c_str());
}
std::string tmp =
QUtil::int_to_string(major) + "." + QUtil::int_to_string(minor);
std::string tmp = std::to_string(major) + "." + std::to_string(minor);
if (tmp != version) {
// The version number in the input is probably invalid. This
// happens with some files that are designed to exercise bugs,
@ -888,11 +887,10 @@ QPDFWriter::setEncryptionParametersInternal(
this->m->encryption_V = V;
this->m->encryption_R = R;
this->m->encryption_dictionary["/Filter"] = "/Standard";
this->m->encryption_dictionary["/V"] = QUtil::int_to_string(V);
this->m->encryption_dictionary["/Length"] =
QUtil::int_to_string(key_len * 8);
this->m->encryption_dictionary["/R"] = QUtil::int_to_string(R);
this->m->encryption_dictionary["/P"] = QUtil::int_to_string(P);
this->m->encryption_dictionary["/V"] = std::to_string(V);
this->m->encryption_dictionary["/Length"] = std::to_string(key_len * 8);
this->m->encryption_dictionary["/R"] = std::to_string(R);
this->m->encryption_dictionary["/P"] = std::to_string(P);
this->m->encryption_dictionary["/O"] = QPDF_String(O).unparse(true);
this->m->encryption_dictionary["/U"] = QPDF_String(U).unparse(true);
if (V >= 5) {
@ -1037,8 +1035,7 @@ QPDFWriter::initializePipelineStack(Pipeline* p)
void
QPDFWriter::activatePipelineStack(PipelinePopper& pp)
{
std::string stack_id(
"stack " + QUtil::uint_to_string(this->m->next_stack_id));
std::string stack_id("stack " + std::to_string(this->m->next_stack_id));
Pl_Count* c =
new Pl_Count(stack_id.c_str(), this->m->pipeline_stack.back());
++this->m->next_stack_id;
@ -1161,7 +1158,7 @@ QPDFWriter::openObject(int objid)
objid = this->m->next_objid++;
}
this->m->xref[objid] = QPDFXRefEntry(1, this->m->pipeline->getCount(), 0);
writeString(QUtil::int_to_string(objid));
writeString(std::to_string(objid));
writeString(" 0 obj\n");
return objid;
}
@ -1286,7 +1283,7 @@ QPDFWriter::unparseChild(QPDFObjectHandle child, int level, int flags)
if (child.isIndirect()) {
QPDFObjGen old_og = child.getObjGen();
int new_id = this->m->obj_renumber[old_og];
writeString(QUtil::int_to_string(new_id));
writeString(std::to_string(new_id));
writeString(" 0 R");
} else {
unparseObject(child, level, flags);
@ -1310,7 +1307,7 @@ QPDFWriter::writeTrailer(
writeStringQDF("\n");
if (which == t_lin_second) {
writeString(" /Size ");
writeString(QUtil::int_to_string(size));
writeString(std::to_string(size));
} else {
for (auto const& key: trailer.getKeys()) {
writeStringQDF(" ");
@ -1318,11 +1315,11 @@ QPDFWriter::writeTrailer(
writeString(QPDF_Name::normalizeName(key));
writeString(" ");
if (key == "/Size") {
writeString(QUtil::int_to_string(size));
writeString(std::to_string(size));
if (which == t_lin_first) {
writeString(" /Prev ");
qpdf_offset_t pos = this->m->pipeline->getCount();
writeString(QUtil::int_to_string(prev));
writeString(std::to_string(prev));
int nspaces =
QIntC::to_int(pos - this->m->pipeline->getCount() + 21);
if (nspaces < 0) {
@ -1374,7 +1371,7 @@ QPDFWriter::writeTrailer(
// Write reference to encryption dictionary
if (this->m->encrypted) {
writeString(" /Encrypt ");
writeString(QUtil::int_to_string(this->m->encryption_dict_objid));
writeString(std::to_string(this->m->encryption_dict_objid));
writeString(" 0 R");
}
}
@ -1607,8 +1604,7 @@ QPDFWriter::unparseObject(
QPDFObjectHandle::parse(
"<< /BaseVersion /" + this->m->final_pdf_version +
" /ExtensionLevel " +
QUtil::int_to_string(
this->m->final_extension_level) +
std::to_string(this->m->final_extension_level) +
" >>"));
} else {
QTC::TC("qpdf", "QPDFWriter remove ADBE");
@ -1697,10 +1693,9 @@ QPDFWriter::unparseObject(
writeString(" /Length ");
if (this->m->direct_stream_lengths) {
writeString(QUtil::uint_to_string(stream_length));
writeString(std::to_string(stream_length));
} else {
writeString(
QUtil::int_to_string(this->m->cur_stream_length_id));
writeString(std::to_string(this->m->cur_stream_length_id));
writeString(" 0 R");
}
writeStringQDF("\n");
@ -1808,9 +1803,9 @@ QPDFWriter::writeObjectStreamOffsets(
writeStringQDF("\n");
writeStringNoQDF(" ");
}
writeString(QUtil::uint_to_string(i + QIntC::to_size(first_obj)));
writeString(std::to_string(i + QIntC::to_size(first_obj)));
writeString(" ");
writeString(QUtil::int_to_string(offsets.at(i)));
writeString(std::to_string(offsets.at(i)));
}
writeString("\n");
}
@ -1877,13 +1872,12 @@ QPDFWriter::writeObjectStream(QPDFObjectHandle object)
}
if (this->m->qdf_mode) {
writeString(
"%% Object stream: object " +
QUtil::int_to_string(new_obj) + ", index " +
QUtil::int_to_string(count));
"%% Object stream: object " + std::to_string(new_obj) +
", index " + std::to_string(count));
if (!this->m->suppress_original_object_ids) {
writeString(
"; original object ID: " +
QUtil::int_to_string(obj.getObj()));
std::to_string(obj.getObj()));
// For compatibility, only write the generation if
// non-zero. While object streams only allow
// objects with generation 0, if we are generating
@ -1891,7 +1885,7 @@ QPDFWriter::writeObjectStream(QPDFObjectHandle object)
// non-zero generation.
if (obj.getGen() != 0) {
QTC::TC("qpdf", "QPDFWriter original obj non-zero gen");
writeString(" " + QUtil::int_to_string(obj.getGen()));
writeString(" " + std::to_string(obj.getGen()));
}
}
writeString("\n");
@ -1928,14 +1922,14 @@ QPDFWriter::writeObjectStream(QPDFObjectHandle object)
writeStringQDF("\n ");
size_t length = stream_buffer->getSize();
adjustAESStreamLength(length);
writeString(" /Length " + QUtil::uint_to_string(length));
writeString(" /Length " + std::to_string(length));
writeStringQDF("\n ");
if (compressed) {
writeString(" /Filter /FlateDecode");
}
writeString(" /N " + QUtil::uint_to_string(offsets.size()));
writeString(" /N " + std::to_string(offsets.size()));
writeStringQDF("\n ");
writeString(" /First " + QUtil::int_to_string(first));
writeString(" /First " + std::to_string(first));
if (!object.isNull()) {
// If the original object has an /Extends key, preserve it.
QPDFObjectHandle dict = object.getDict();
@ -1982,14 +1976,12 @@ QPDFWriter::writeObject(QPDFObjectHandle object, int object_stream_index)
if (this->m->qdf_mode) {
if (this->m->page_object_to_seq.count(old_og)) {
writeString("%% Page ");
writeString(
QUtil::int_to_string(this->m->page_object_to_seq[old_og]));
writeString(std::to_string(this->m->page_object_to_seq[old_og]));
writeString("\n");
}
if (this->m->contents_to_page_seq.count(old_og)) {
writeString("%% Contents for page ");
writeString(
QUtil::int_to_string(this->m->contents_to_page_seq[old_og]));
writeString(std::to_string(this->m->contents_to_page_seq[old_og]));
writeString("\n");
}
}
@ -2016,7 +2008,7 @@ QPDFWriter::writeObject(QPDFObjectHandle object, int object_stream_index)
}
}
openObject(new_id + 1);
writeString(QUtil::uint_to_string(this->m->cur_stream_length));
writeString(std::to_string(this->m->cur_stream_length));
closeObject(new_id + 1);
}
}
@ -2093,7 +2085,7 @@ QPDFWriter::generateID()
}
seed += this->m->deterministic_id_data;
} else {
seed += QUtil::int_to_string(QUtil::get_current_time());
seed += std::to_string(QUtil::get_current_time());
seed += this->m->filename;
seed += " ";
}
@ -2562,14 +2554,14 @@ QPDFWriter::writeHintStream(int hint_id)
size_t hlen = hint_buffer->getSize();
writeString("<< /Filter /FlateDecode /S ");
writeString(QUtil::int_to_string(S));
writeString(std::to_string(S));
if (O) {
writeString(" /O ");
writeString(QUtil::int_to_string(O));
writeString(std::to_string(O));
}
writeString(" /Length ");
adjustAESStreamLength(hlen);
writeString(QUtil::uint_to_string(hlen));
writeString(std::to_string(hlen));
writeString(" >>\nstream\n");
if (this->m->encrypted) {
@ -2613,9 +2605,9 @@ QPDFWriter::writeXRefTable(
int linearization_pass)
{
writeString("xref\n");
writeString(QUtil::int_to_string(first));
writeString(std::to_string(first));
writeString(" ");
writeString(QUtil::int_to_string(last - first + 1));
writeString(std::to_string(last - first + 1));
qpdf_offset_t space_before_zero = this->m->pipeline->getCount();
writeString("\n");
for (int i = first; i <= last; ++i) {
@ -2762,23 +2754,23 @@ QPDFWriter::writeXRefStream(
writeStringQDF("\n ");
writeString(" /Type /XRef");
writeStringQDF("\n ");
writeString(" /Length " + QUtil::uint_to_string(xref_data->getSize()));
writeString(" /Length " + std::to_string(xref_data->getSize()));
if (compressed) {
writeStringQDF("\n ");
writeString(" /Filter /FlateDecode");
writeStringQDF("\n ");
writeString(
" /DecodeParms << /Columns " + QUtil::int_to_string(esize) +
" /DecodeParms << /Columns " + std::to_string(esize) +
" /Predictor 12 >>");
}
writeStringQDF("\n ");
writeString(
" /W [ 1 " + QUtil::int_to_string(f1_size) + " " +
QUtil::int_to_string(f2_size) + " ]");
" /W [ 1 " + std::to_string(f1_size) + " " + std::to_string(f2_size) +
" ]");
if (!((first == 0) && (last == size - 1))) {
writeString(
" /Index [ " + QUtil::int_to_string(first) + " " +
QUtil::int_to_string(last - first + 1) + " ]");
" /Index [ " + std::to_string(first) + " " +
std::to_string(last - first + 1) + " ]");
}
writeTrailer(which, size, true, prev, linearization_pass);
writeString("\nstream\n");
@ -3015,22 +3007,21 @@ QPDFWriter::writeLinearized()
int npages = QIntC::to_int(pages.size());
writeString(" /Linearized 1 /L ");
writeString(QUtil::int_to_string(file_size + hint_length));
writeString(std::to_string(file_size + hint_length));
// Implementation note 121 states that a space is
// mandatory after this open bracket.
writeString(" /H [ ");
writeString(
QUtil::int_to_string(this->m->xref[hint_id].getOffset()));
writeString(std::to_string(this->m->xref[hint_id].getOffset()));
writeString(" ");
writeString(QUtil::int_to_string(hint_length));
writeString(std::to_string(hint_length));
writeString(" ] /O ");
writeString(QUtil::int_to_string(first_page_object));
writeString(std::to_string(first_page_object));
writeString(" /E ");
writeString(QUtil::int_to_string(part6_end_offset + hint_length));
writeString(std::to_string(part6_end_offset + hint_length));
writeString(" /N ");
writeString(QUtil::int_to_string(npages));
writeString(std::to_string(npages));
writeString(" /T ");
writeString(QUtil::int_to_string(space_before_zero + hint_length));
writeString(std::to_string(space_before_zero + hint_length));
}
writeString(" >>");
closeObject(lindict_id);
@ -3094,8 +3085,8 @@ QPDFWriter::writeLinearized()
throw std::logic_error(
"insufficient padding for first pass xref stream; "
"first_xref_end=" +
QUtil::int_to_string(first_xref_end) +
"; endpos=" + QUtil::int_to_string(endpos));
std::to_string(first_xref_end) +
"; endpos=" + std::to_string(endpos));
}
}
writeString("\n");
@ -3197,7 +3188,7 @@ QPDFWriter::writeLinearized()
pass);
}
writeString("startxref\n");
writeString(QUtil::int_to_string(first_xref_offset));
writeString(std::to_string(first_xref_offset));
writeString("\n%%EOF\n");
discardGeneration(this->m->obj_renumber, this->m->obj_renumber_no_gen);
@ -3237,19 +3228,19 @@ QPDFWriter::writeLinearized()
fprintf(
lin_pass1_file,
"%% hint_offset=%s\n",
QUtil::int_to_string(hint_offset1).c_str());
std::to_string(hint_offset1).c_str());
fprintf(
lin_pass1_file,
"%% hint_length=%s\n",
QUtil::int_to_string(hint_length).c_str());
std::to_string(hint_length).c_str());
fprintf(
lin_pass1_file,
"%% second_xref_offset=%s\n",
QUtil::int_to_string(second_xref_offset).c_str());
std::to_string(second_xref_offset).c_str());
fprintf(
lin_pass1_file,
"%% second_xref_end=%s\n",
QUtil::int_to_string(second_xref_end).c_str());
std::to_string(second_xref_end).c_str());
fclose(lin_pass1_file);
lin_pass1_file = nullptr;
}
@ -3399,7 +3390,7 @@ QPDFWriter::writeStandard()
this->m->next_objid);
}
writeString("startxref\n");
writeString(QUtil::int_to_string(xref_offset));
writeString(std::to_string(xref_offset));
writeString("\n%%EOF\n");
if (this->m->deterministic_id) {

View File

@ -17,8 +17,7 @@ QPDFXRefEntry::QPDFXRefEntry(int type, qpdf_offset_t field1, int field2) :
field2(field2)
{
if ((type < 1) || (type > 2)) {
throw std::logic_error(
"invalid xref type " + QUtil::int_to_string(type));
throw std::logic_error("invalid xref type " + std::to_string(type));
}
}

View File

@ -23,7 +23,7 @@ QPDF_Integer::shallowCopy()
std::string
QPDF_Integer::unparse()
{
return QUtil::int_to_string(this->val);
return std::to_string(this->val);
}
JSON

View File

@ -618,9 +618,9 @@ QPDF_Stream::pipeStreamData(
// part of a library user, not by invalid input data.
throw std::runtime_error(
"stream data provider for " + og.unparse(' ') +
" provided " + QUtil::int_to_string(actual_length) +
" provided " + std::to_string(actual_length) +
" bytes instead of expected " +
QUtil::int_to_string(desired_length) + " bytes");
std::to_string(desired_length) + " bytes");
}
} else if (success) {
QTC::TC("qpdf", "QPDF_Stream provider length not provided");

View File

@ -869,8 +869,8 @@ QPDF::initializeEncryption()
"encryption dictionary",
this->m->file->getLastOffset(),
"Unsupported /R or /V in encryption dictionary; R = " +
QUtil::int_to_string(R) +
" (max 6), V = " + QUtil::int_to_string(V) + " (max 5)");
std::to_string(R) + " (max 6), V = " + std::to_string(V) +
" (max 5)");
}
this->m->encp->encryption_V = V;

View File

@ -641,7 +641,7 @@ QPDF::JSONReactor::dictionaryItem(std::string const& key, JSON const& value)
}
} else {
throw std::logic_error(
"QPDF_json: unknown state " + QUtil::int_to_string(state));
"QPDF_json: unknown state " + std::to_string(state));
}
return true;
}
@ -679,7 +679,7 @@ QPDF::JSONReactor::setObjectDescription(QPDFObjectHandle& oh, JSON const& value)
if (!this->cur_object.empty()) {
description += ", " + this->cur_object;
}
description += " at offset " + QUtil::int_to_string(value.getStart());
description += " at offset " + std::to_string(value.getStart());
oh.setObjectDescription(&this->pdf, description);
}
@ -790,7 +790,7 @@ QPDF::writeJSONStream(
std::shared_ptr<Pl_StdioFile> f_pl;
std::string filename;
if (json_stream_data == qpdf_sj_file) {
filename = file_prefix + "-" + QUtil::int_to_string(obj.getObjectID());
filename = file_prefix + "-" + std::to_string(obj.getObjectID());
f = QUtil::safe_fopen(filename.c_str(), "wb");
f_pl = std::make_shared<Pl_StdioFile>("stream data", f);
stream_p = f_pl.get();

View File

@ -534,7 +534,7 @@ QPDF::checkLinearizationInternal()
QPDFObjGen og(page.getObjGen());
if (this->m->xref_table[og].getType() == 2) {
errors.push_back(
"page dictionary for page " + QUtil::uint_to_string(i) +
"page dictionary for page " + std::to_string(i) +
" is compressed");
}
}
@ -554,8 +554,8 @@ QPDF::checkLinearizationInternal()
errors.push_back(
"space before first xref item (/T) mismatch "
"(computed = " +
QUtil::int_to_string(this->m->first_xref_item_offset) +
"; file = " + QUtil::int_to_string(this->m->file->tell()));
std::to_string(this->m->first_xref_item_offset) +
"; file = " + std::to_string(this->m->file->tell()));
}
// P: first page number -- Implementation note 124 says Acrobat
@ -619,8 +619,8 @@ QPDF::checkLinearizationInternal()
QTC::TC("qpdf", "QPDF warn /E mismatch");
warnings.push_back(
"end of first page section (/E) mismatch: /E = " +
QUtil::int_to_string(p.first_page_end) + "; computed = " +
QUtil::int_to_string(min_E) + ".." + QUtil::int_to_string(max_E));
std::to_string(p.first_page_end) + "; computed = " +
std::to_string(min_E) + ".." + std::to_string(max_E));
}
// Check hint tables
@ -717,8 +717,8 @@ QPDF::lengthNextN(int first_object, int n, std::list<std::string>& errors)
QPDFObjGen og(first_object + i, 0);
if (this->m->xref_table.count(og) == 0) {
errors.push_back(
"no xref table entry for " +
QUtil::int_to_string(first_object + i) + " 0");
"no xref table entry for " + std::to_string(first_object + i) +
" 0");
} else {
if (this->m->obj_cache.count(og) == 0) {
stopOnError("found unknown object while"
@ -785,10 +785,9 @@ QPDF::checkHPageOffset(
if (h_nobjects != ce.nobjects) {
// This happens with pdlin when there are thumbnails.
warnings.push_back(
"object count mismatch for page " +
QUtil::int_to_string(pageno) +
": hint table = " + QUtil::int_to_string(h_nobjects) +
"; computed = " + QUtil::int_to_string(ce.nobjects));
"object count mismatch for page " + std::to_string(pageno) +
": hint table = " + std::to_string(h_nobjects) +
"; computed = " + std::to_string(ce.nobjects));
}
// Use value for number of objects in hint table rather than
@ -800,11 +799,10 @@ QPDF::checkHPageOffset(
// This condition almost certainly indicates a bad hint
// table or a bug in this code.
errors.push_back(
"page length mismatch for page " +
QUtil::int_to_string(pageno) +
": hint table = " + QUtil::int_to_string(h_length) +
"; computed length = " + QUtil::int_to_string(length) +
" (offset = " + QUtil::int_to_string(offset) + ")");
"page length mismatch for page " + std::to_string(pageno) +
": hint table = " + std::to_string(h_length) +
"; computed length = " + std::to_string(length) +
" (offset = " + std::to_string(offset) + ")");
}
offset += h_length;
@ -841,8 +839,8 @@ QPDF::checkHPageOffset(
if (!computed_shared.count(iter)) {
// pdlin puts thumbnails here even though it shouldn't
warnings.push_back(
"page " + QUtil::int_to_string(pageno) +
": shared object " + QUtil::int_to_string(iter) +
"page " + std::to_string(pageno) + ": shared object " +
std::to_string(iter) +
": in hint table but not computed list");
}
}
@ -853,8 +851,8 @@ QPDF::checkHPageOffset(
// built-in fonts and procsets here, at least in some
// cases.
warnings.push_back(
"page " + QUtil::int_to_string(pageno) +
": shared object " + QUtil::int_to_string(iter) +
"page " + std::to_string(pageno) + ": shared object " +
std::to_string(iter) +
": in computed list but not hint table");
}
}
@ -906,8 +904,8 @@ QPDF::checkHSharedObject(
errors.push_back(
"first shared object number mismatch: "
"hint table = " +
QUtil::int_to_string(so.first_shared_obj) +
"; computed = " + QUtil::int_to_string(obj));
std::to_string(so.first_shared_obj) +
"; computed = " + std::to_string(obj));
}
}
@ -923,8 +921,8 @@ QPDF::checkHSharedObject(
if (offset != h_offset) {
errors.push_back(
"first shared object offset mismatch: hint table = " +
QUtil::int_to_string(h_offset) +
"; computed = " + QUtil::int_to_string(offset));
std::to_string(h_offset) +
"; computed = " + std::to_string(offset));
}
}
@ -935,10 +933,10 @@ QPDF::checkHSharedObject(
int h_length = so.min_group_length + se.delta_group_length;
if (length != h_length) {
errors.push_back(
"shared object " + QUtil::int_to_string(i) +
"shared object " + std::to_string(i) +
" length mismatch: hint table = " +
QUtil::int_to_string(h_length) +
"; computed = " + QUtil::int_to_string(length));
std::to_string(h_length) +
"; computed = " + std::to_string(length));
}
cur_object += nobjects;
}
@ -985,15 +983,15 @@ QPDF::checkHOutlines(std::list<std::string>& warnings)
if (offset != table_offset) {
warnings.push_back(
"incorrect offset in outlines table: hint table = " +
QUtil::int_to_string(table_offset) +
"; computed = " + QUtil::int_to_string(offset));
std::to_string(table_offset) +
"; computed = " + std::to_string(offset));
}
int table_length = this->m->outline_hints.group_length;
if (length != table_length) {
warnings.push_back(
"incorrect length in outlines table: hint table = " +
QUtil::int_to_string(table_length) +
"; computed = " + QUtil::int_to_string(length));
std::to_string(table_length) +
"; computed = " + std::to_string(length));
}
} else {
warnings.push_back("incorrect first object number in outline "
@ -1443,7 +1441,7 @@ QPDF::calculateLinearizationData(std::map<int, int> const& object_stream_data)
stopOnError(
"INTERNAL ERROR: "
"QPDF::calculateLinearizationData: page object for page " +
QUtil::uint_to_string(i) + " not in lc_other_page_private");
std::to_string(i) + " not in lc_other_page_private");
}
lc_other_page_private.erase(page_og);
this->m->part7.push_back(pages.at(i));
@ -1565,8 +1563,8 @@ QPDF::calculateLinearizationData(std::map<int, int> const& object_stream_data)
stopOnError(
"INTERNAL ERROR: QPDF::calculateLinearizationData: wrong "
"number of objects placed (num_placed = " +
QUtil::uint_to_string(num_placed) +
"; number of objects: " + QUtil::uint_to_string(num_wanted));
std::to_string(num_placed) +
"; number of objects: " + std::to_string(num_wanted));
}
// Calculate shared object hint table information including

View File

@ -121,7 +121,7 @@ QPDF::getAllPagesInternal(
if (!kid.isIndirect()) {
QTC::TC("qpdf", "QPDF handle direct page object");
cur_node.warnIfPossible(
"kid " + QUtil::int_to_string(i) +
"kid " + std::to_string(i) +
" (from 0) is direct; converting to indirect");
kid = makeIndirectObject(kid);
kids.setArrayItem(i, kid);
@ -130,7 +130,7 @@ QPDF::getAllPagesInternal(
// shallowCopyPage in QPDFPageObjectHelper.
QTC::TC("qpdf", "QPDF resolve duplicated page object");
cur_node.warnIfPossible(
"kid " + QUtil::int_to_string(i) +
"kid " + std::to_string(i) +
" (from 0) appears more than once in the pages tree;"
" creating a new page object as a copy");
kid = makeIndirectObject(QPDFObjectHandle(kid).shallowCopy());
@ -205,8 +205,7 @@ QPDF::insertPageobjToPage(
// The library never calls insertPageobjToPage in a way
// that causes this to happen.
setLastObjectDescription(
"page " + QUtil::int_to_string(pos) + " (numbered from zero)",
og);
"page " + std::to_string(pos) + " (numbered from zero)", og);
throw QPDFExc(
qpdf_e_pages,
this->m->file->getName(),

View File

@ -107,7 +107,7 @@ SecureRandomDataProvider::provideRandomData(unsigned char* data, size_t len)
fclose(f);
if (fr != len) {
throw std::runtime_error(
"unable to read " + QUtil::uint_to_string(len) + " bytes from " +
"unable to read " + std::to_string(len) + " bytes from " +
std::string(RANDOM_DEVICE));
}

View File

@ -994,7 +994,7 @@ do_with_oh(
throw QPDFExc(
qpdf_e_internal,
q->qpdf->getFilename(),
std::string("C API object handle ") + QUtil::uint_to_string(oh),
std::string("C API object handle ") + std::to_string(oh),
0,
"attempted access to unknown object handle");
}

View File

@ -33,8 +33,8 @@ read_bits(
if (bits_wanted > bits_available) {
throw std::runtime_error(
"overflow reading bit stream: wanted = " +
QUtil::uint_to_string(bits_wanted) +
"; available = " + QUtil::uint_to_string(bits_available));
std::to_string(bits_wanted) +
"; available = " + std::to_string(bits_available));
}
if (bits_wanted > 32) {
throw std::out_of_range("read_bits: too many bits requested");

View File

@ -141,7 +141,7 @@ ArgParser::getQuack(std::string const& p)
++this->quacks;
if (this->ap.isCompleting() && (this->ap.argsLeft() == 0)) {
this->ap.insertCompletion(
std::string("thing-") + QUtil::int_to_string(this->quacks));
std::string("thing-") + std::to_string(this->quacks));
return;
}
output(std::string("got quack: ") + p);
@ -150,13 +150,13 @@ ArgParser::getQuack(std::string const& p)
void
ArgParser::endQuack()
{
output("total quacks so far: " + QUtil::int_to_string(this->quacks));
output("total quacks so far: " + std::to_string(this->quacks));
}
void
ArgParser::finalChecks()
{
output("total quacks: " + QUtil::int_to_string(this->quacks));
output("total quacks: " + std::to_string(this->quacks));
}
void

View File

@ -28,13 +28,12 @@ report(QPDF& q, QPDFObjectHandle oh, long long item, long long exp_item)
auto mk_wanted = [](long long i) {
return (
(i == -1) ? "end"
: (QUtil::int_to_string(i) + "/(-" +
QUtil::int_to_string(i) + "-)"));
: (std::to_string(i) + "/(-" + std::to_string(i) + "-)"));
};
std::string i1_wanted = mk_wanted(exp_item);
std::string i2_wanted = mk_wanted(item == exp_item ? item : -1);
auto mk_actual = [](bool found, long long v, QPDFObjectHandle& o) {
return (found ? QUtil::int_to_string(v) + "/" + o.unparse() : "end");
return (found ? std::to_string(v) + "/" + o.unparse() : "end");
};
std::string i1_actual = mk_actual(f1, item - offset, o1);
std::string i2_actual = mk_actual(f2, item, o2);
@ -63,8 +62,8 @@ test_bsearch()
auto nums = QPDFObjectHandle::newArray();
for (auto i: v) {
nums.appendItem(QPDFObjectHandle::newInteger(i));
nums.appendItem(QPDFObjectHandle::newString(
"-" + QUtil::int_to_string(i) + "-"));
nums.appendItem(
QPDFObjectHandle::newString("-" + std::to_string(i) + "-"));
}
auto limits = QPDFObjectHandle::newArray();
limits.appendItem(QPDFObjectHandle::newInteger(v.at(0)));

View File

@ -256,11 +256,10 @@ QdfFixer::processLines(std::list<std::string>& lines)
} else if (state == st_in_length) {
if (!matches(re_num)) {
fatal(
filename + ":" + QUtil::uint_to_string(lineno) +
filename + ":" + std::to_string(lineno) +
": expected integer");
}
std::string new_length =
QUtil::uint_to_string(stream_length) + "\n";
std::string new_length = std::to_string(stream_length) + "\n";
offset -= QIntC::to_offset(line.length());
offset += QIntC::to_offset(new_length.length());
std::cout << new_length;
@ -301,8 +300,8 @@ QdfFixer::checkObjId(std::string const& cur_obj_str)
int cur_obj = QUtil::string_to_int(cur_obj_str.c_str());
if (cur_obj != last_obj + 1) {
fatal(
filename + ":" + QUtil::uint_to_string(lineno) +
": expected object " + QUtil::int_to_string(last_obj + 1));
filename + ":" + std::to_string(lineno) + ": expected object " +
std::to_string(last_obj + 1));
}
last_obj = cur_obj;
xref.push_back(QPDFXRefEntry(1, QIntC::to_offset(last_offset), 0));
@ -325,16 +324,15 @@ QdfFixer::writeOstream()
for (auto iter: ostream_offsets) {
iter -= QIntC::to_offset(first);
++onum;
offsets += QUtil::int_to_string(onum) + " " +
QUtil::int_to_string(iter) + "\n";
offsets += std::to_string(onum) + " " + std::to_string(iter) + "\n";
}
auto offset_adjust = QIntC::to_offset(offsets.size());
first += offset_adjust;
stream_length += QIntC::to_size(offset_adjust);
std::string dict_data = "";
dict_data += " /Length " + QUtil::uint_to_string(stream_length) + "\n";
dict_data += " /N " + QUtil::uint_to_string(n) + "\n";
dict_data += " /First " + QUtil::int_to_string(first) + "\n";
dict_data += " /Length " + std::to_string(stream_length) + "\n";
dict_data += " /N " + std::to_string(n) + "\n";
dict_data += " /First " + std::to_string(first) + "\n";
if (!ostream_extends.empty()) {
dict_data += " /Extends " + ostream_extends + "\n";
}

View File

@ -78,7 +78,7 @@ runtest(int n)
w.write();
} else {
throw std::runtime_error(
std::string("invalid test ") + QUtil::int_to_string(n));
std::string("invalid test ") + std::to_string(n));
}
std::cout << "test " << n << " done" << std::endl;