aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/QUtil.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2022-05-15 20:56:04 +0200
committerJay Berkenbilt <ejb@ql.org>2022-05-16 19:39:26 +0200
commit60ec94a7c35ff3f7153c99deff29afef91500622 (patch)
tree91de8c310c6c0f8e5803d6b3ede4f00e5f3048ed /libqpdf/QUtil.cc
parent173b944ef8f1dd3f971a6089a52fcd1ae07ca8f1 (diff)
downloadqpdf-60ec94a7c35ff3f7153c99deff29afef91500622.tar.zst
Add QUtil::is_long_long
Diffstat (limited to 'libqpdf/QUtil.cc')
-rw-r--r--libqpdf/QUtil.cc13
1 files changed, 13 insertions, 0 deletions
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)
{