aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/QUtil.cc
AgeCommit message (Collapse)Author
2022-02-16Remove special case for 0xad for 10.6.2.release-qpdf-10.6.2Jay Berkenbilt
2022-02-15Silently/transparently recognize UTF-16LE as UTF-16 (fixes #649)Jay Berkenbilt
The PDF spec only allows UTF-16BE, but most readers seem to accept UTF-16LE as well, so now qpdf does too.
2022-02-15Handle odd PDFDoc codepoints in UTF-8 during transcoding (fixes #650)Jay Berkenbilt
There are codepoints in PDFDoc that are not valid UTF-8 but map to valid UTF-8. We were handling those correctly with bidirectional mapping. However, if those same code points appeared in UTF-8, where they have no meaning, they were left as fixed points when converting to PDFDoc, where they do have meaning. This change recognizes them as errors.
2022-02-09Fix one more PDF doc encoding error for 10.6 release (fixes #637)release-qpdf-10.6.0Jay Berkenbilt
2022-02-08WHITESPACE ONLY -- expand tabs in source codeJay Berkenbilt
This comment expands all tabs using an 8-character tab-width. You should ignore this commit when using git blame or use git blame -w. In the early days, I used to use tabs where possible for indentation, since emacs did this automatically. In recent years, I have switched to only using spaces, which means qpdf source code has been a mixture of spaces and tabs. I have avoided cleaning this up because of not wanting gratuitous whitespaces change to cloud the output of git blame, but I changed my mind after discussing with users who view qpdf source code in editors/IDEs that have other tab widths by default and in light of the fact that I am planning to start applying automatic code formatting soon.
2022-02-07Use make_array_pointer_holderJay Berkenbilt
This will be able to be replaced with QUtil::make_shared_array
2022-02-07Add QUtil::make_shared_array to help with PointerHolder transitionJay Berkenbilt
2022-02-05Improve use of std::unique_ptrJay Berkenbilt
* Use unique_ptr in place of shared_ptr in some cases * unique_ptr for arrays does not require a custom deleter * use std::make_unique (c++14) where possible
2022-02-04Add a blank line after the first header included in each sourceJay Berkenbilt
2022-02-04PointerHolder: deprecate getPointer() and getRefcount()Jay Berkenbilt
Use get() and use_count() instead. Add #define NO_POINTERHOLDER_DEPRECATION to remove deprecation markers for these only. This commit also removes all deprecated PointerHolder API calls from qpdf's code except in PointerHolder's test suite, which must continue to test the deprecated APIs.
2022-02-01Make QPDFArgParser accept const argvJay Berkenbilt
This makes it much more convention to use the initializeFromArgv functions since you can use string literals.
2022-01-30Add QUtil::make_shared_cstrJay Berkenbilt
Replace most of the calls to QUtil::copy_string with this instead.
2022-01-11Add missing characters from PDF doc encoding (fixes #606)Jay Berkenbilt
2021-12-29Add QUtil::file_can_be_openedJay Berkenbilt
2021-04-18Fix timezone portability issue (fixes #515)Jay Berkenbilt
2021-02-18Add QUtil::path_basenameJay Berkenbilt
2021-02-13QUtil::double_to_string: trim trailing zeroes with option to disableJay Berkenbilt
2021-02-11Allow zone information to be omitted from timestamp stringsJay Berkenbilt
2021-02-11Add autoconf test for localtime_rJay Berkenbilt
2021-02-10Minor clean up of Windows headersJay Berkenbilt
2021-02-09Add QUtil methods for dealing with PDF timestamp stringsJay Berkenbilt
2021-02-08Add QUtil::pipe_file and QUtil::file_providerJay Berkenbilt
2020-10-27Improve efficiency of number to string conversionJay Berkenbilt
2020-10-21Protect numeric conversion against user's locale (fixes #459)Jay Berkenbilt
2020-04-16Fix warnings reported by -Wshadow=local (fixes #431)Jay Berkenbilt
2020-04-06Don't include <cwchar> if not building with wcharJay Berkenbilt
2020-04-06Delegate random number generation to crypto provider (fixes #418)Jay Berkenbilt
2020-04-06Make random data provider code thread-safeJay Berkenbilt
This uses C++-11 thread-safe static initializers now.
2020-04-06Remove QUtil::srandomJay Berkenbilt
2020-04-04Allow qpdf to be built on systems without wchar_t (fixes #406)Jay Berkenbilt
2020-04-03Remove redundant methods in QUtilJay Berkenbilt
This was being saved until we had to break ABI.
2020-02-29Include header for wcslen (fixes #405)Jay Berkenbilt
2020-01-14Pull wmain -> main code from qpdf.cc into QUtil.ccJay Berkenbilt
2020-01-14Add error detection for read_lines_from_file(FILE*)Jay Berkenbilt
2020-01-13QUtil::read_lines_from_file: optional EOL preservationJay Berkenbilt
2020-01-13Refactor QUtil::read_lines_from_fileJay Berkenbilt
This commit adds the preserve_eol flags but doesn't implement EOL preservation yet.
2019-11-09Allow odd/even modifiers in numeric range (fixes #364)Jay Berkenbilt
2019-08-31Add remove_file and rename_file to QUtilJay Berkenbilt
2019-06-22In shippable code, favor smart pointers (fixes #235)Jay Berkenbilt
Use PointerHolder in several places where manually memory allocation and deallocation were being used. This helps to protect against memory leaks when exceptions are thrown in surprising places.
2019-06-22Add QUtil::read_file_into_memoryJay Berkenbilt
This code was essentially duplicated between test_driver and standalone_fuzz_target_runner.
2019-06-22Rename QUtil::strcasecmp to QUtil::str_compare_nocase (fixes #242)Jay Berkenbilt
2019-06-21Fix bounds error in utf16_to_utf8 conversionJay Berkenbilt
2019-06-21Fix sign and conversion warnings (major)Jay Berkenbilt
This makes all integer type conversions that have potential data loss explicit with calls that do range checks and raise an exception. After this commit, qpdf builds with no warnings when -Wsign-conversion -Wconversion is used with gcc or clang or when -W3 -Wd4800 is used with MSVC. This significantly reduces the likelihood of potential crashes from bogus integer values. There are some parts of the code that take int when they should take size_t or an offset. Such places would make qpdf not support files with more than 2^31 of something that usually wouldn't be so large. In the event that such a file shows up and is valid, at least qpdf would raise an error in the right spot so the issue could be legitimately addressed rather than failing in some weird way because of a silent overflow condition.
2019-06-21QUtil: add unsigned int/string functionsJay Berkenbilt
2019-05-16Fix Windows memory error (fixes #330)Jay Berkenbilt
2019-04-21Support Unicode in filenames (fixes #298)Jay Berkenbilt
2019-03-11"_setmode" and "_stricmp" are not available on Borland C++Builder, neither ↵Thorsten Schöning
the classic one nor newer ones based on CLANG.
2019-01-17Add QUtil::possible_repaired_encodingsJay Berkenbilt
2019-01-17Add status-reporting transcoders to QUtilJay Berkenbilt
2019-01-17QUtil::analyze_encodingJay Berkenbilt