From 60ec94a7c35ff3f7153c99deff29afef91500622 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Sun, 15 May 2022 14:56:04 -0400 Subject: Add QUtil::is_long_long --- libqpdf/QUtil.cc | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'libqpdf') diff --git a/libqpdf/QUtil.cc b/libqpdf/QUtil.cc index 22962199..8edfadae 100644 --- a/libqpdf/QUtil.cc +++ b/libqpdf/QUtil.cc @@ -467,6 +467,19 @@ QUtil::string_to_uint(char const* str) return QIntC::to_uint(string_to_ull(str)); } +bool +QUtil::is_long_long(char const* str) +{ + try { + auto i1 = string_to_ll(str); + std::string s1 = int_to_string(i1); + return str == s1; + } catch (std::exception&) { + // overflow or other error + } + return false; +} + unsigned char* QUtil::unsigned_char_pointer(std::string const& str) { -- cgit v1.2.3-54-g00ecf