2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-06-01 18:00:52 +00:00
Commit Graph

34 Commits

Author SHA1 Message Date
Jay Berkenbilt
2050977099 Add QPDFObjectHandle manipulation to C API 2020-11-28 19:48:07 -05:00
Jay Berkenbilt
ff65e272a8 Fix printf formatting for newer msvc
Use autoconf rather than ifdefs to determine what format string to use
for long long.
2020-10-16 07:02:23 -04:00
Jay Berkenbilt
d71f05ca07 Fix sign and conversion warnings (major)
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-21 13:17:21 -04:00
Jay Berkenbilt
6ec22f117d Modernize encryption API for more granularity
Setting encryption permissions for R >= 3 set permission bits in
groups corresponding to menu options in Acrobat 5. The new API allows
the bits to be set individually.
2019-01-17 11:43:56 -05:00
Jay Berkenbilt
2780a1871d Add C API for checking PDF files 2018-02-18 21:06:27 -05:00
Jay Berkenbilt
eaacf94005 Update C API with new QPDFWriter methods 2017-09-12 14:30:39 -04:00
Jay Berkenbilt
4f8c734d8e Missing free in some test code
There was a missing free causing a memory leak in some test code. The
memory leak was not in library code.
2017-08-26 22:04:49 -04:00
Jay Berkenbilt
b8bdef0ad1 Implement deterministic ID
For non-encrypted files, determinstic ID generation uses file contents
instead of timestamp and file name. At a small runtime cost, this
enables generation of the same /ID if the same inputs are converted in
the same way multiple times.
2015-10-31 18:56:42 -04:00
Jay Berkenbilt
7be97b3e80 Fix long long format string for WIN32 2013-03-05 13:35:46 -05:00
Jay Berkenbilt
53bfa86084 Fix inadvertent pointer to integer cast 2013-03-05 13:35:46 -05:00
Jay Berkenbilt
fd64959398 Favor strerror_s and fopen_s on MSVC
Make remaining calls to fopen and strerror use strerror_s and fopen_s
on MSVC.
2013-03-05 13:35:46 -05:00
Jay Berkenbilt
ac4deac187 Call QUtil::safe_fopen in place of fopen
fopen was previuosly called wrapped by QUtil::fopen_wrapper, but
QUtil::safe_fopen does this itself, which is less cumbersome.
2013-03-05 13:35:46 -05:00
Jay Berkenbilt
6b9297882e Mark secure CRT warnings with comment
Put a specific comment marker next to every piece of code that MSVC
gives warning 4996 for.  This warning is generated for calls to
functions that Microsoft considers insecure or deprecated.  This
change is in preparation for fixing all these cases even though none
of them are actually incorrect or insecure as used in qpdf.  The
comment marker makes them easier to find so they can be fixed in
subsequent commits.
2013-03-05 13:33:32 -05:00
Jay Berkenbilt
f8306913ba Update "C" API with functions for new features 2012-12-31 10:32:32 -05:00
Jay Berkenbilt
32051283b9 Fix spelling errors 2012-07-29 14:44:12 -04:00
Jay Berkenbilt
8318d81ada Fix and test support for files >= 4 GB 2012-06-24 15:56:50 -04:00
Jay Berkenbilt
76b1659177 enhance PointerHolder so that it can explicitly be told to use delete [] instead of delete, thus making it useful to run valgrind over qpdf during its test suite 2011-08-11 11:57:37 -04:00
Jay Berkenbilt
14fe2e6de3 qpdf_set_info_key, qpdf_get_info_key 2011-08-11 10:48:37 -04:00
Jay Berkenbilt
b36f62a326 add qpdf_read_memory to C API
git-svn-id: svn+q:///qpdf/trunk@1044 71b93d88-0707-0410-a8cf-f5a4172ac649
2010-10-04 15:24:10 +00:00
Jay Berkenbilt
a80d9d176d add C interface for getting software version
git-svn-id: svn+q:///qpdf/trunk@903 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-10-24 13:23:20 +00:00
Jay Berkenbilt
2243a01c6c comment
git-svn-id: svn+q:///qpdf/trunk@898 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-10-23 17:58:12 +00:00
Jay Berkenbilt
b052ca548e logico
git-svn-id: svn+q:///qpdf/trunk@896 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-10-23 17:00:49 +00:00
Jay Berkenbilt
b1702fb16c more tweaking of C error interface
git-svn-id: svn+q:///qpdf/trunk@894 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-10-23 16:50:22 +00:00
Jay Berkenbilt
7f5d78c2d1 improve C error handling interface
git-svn-id: svn+q:///qpdf/trunk@884 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-10-23 15:27:30 +00:00
Jay Berkenbilt
398354b6f0 update C API for error retrieval
git-svn-id: svn+q:///qpdf/trunk@830 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-10-20 00:24:44 +00:00
Jay Berkenbilt
b67a3c15e7 DLL.hh -> DLL.h, move public enumerated types into Constants.h and use them both for C and C++ interfaces
git-svn-id: svn+q:///qpdf/trunk@828 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-10-19 20:17:14 +00:00
Jay Berkenbilt
a8715c495b add C API for R4 encryption
git-svn-id: svn+q:///qpdf/trunk@825 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-10-19 00:36:51 +00:00
Jay Berkenbilt
c2023db265 Implement changes suggested by Zarko and our subsequent conversations:
- Add a way to set the minimum PDF version
 - Add a way to force the PDF version
 - Have isEncrypted return true if an /Encrypt dictionary exists even
   when we can't read the file
 - Allow qpdf_init_write to be called multiple times
 - Update some comments in headers


git-svn-id: svn+q:///qpdf/trunk@748 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-10-05 00:42:48 +00:00
Jay Berkenbilt
6bdac26369 finished testing C API
git-svn-id: svn+q:///qpdf/trunk@734 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-09-27 20:33:17 +00:00
Jay Berkenbilt
8d7bb3ff50 add methods for getting encryption data
git-svn-id: svn+q:///qpdf/trunk@733 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-09-27 20:05:38 +00:00
Jay Berkenbilt
40f4b1ef52 more tests of C API
git-svn-id: svn+q:///qpdf/trunk@732 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-09-27 18:28:51 +00:00
Jay Berkenbilt
65bf77fa35 more tests of C API
git-svn-id: svn+q:///qpdf/trunk@728 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-09-27 16:55:24 +00:00
Jay Berkenbilt
fe6771e0e5 add many new tests to exercise C api
git-svn-id: svn+q:///qpdf/trunk@727 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-09-27 16:01:45 +00:00
Jay Berkenbilt
91d8c48533 add qpdf-ctest as C test program
git-svn-id: svn+q:///qpdf/trunk@726 71b93d88-0707-0410-a8cf-f5a4172ac649
2009-09-27 14:52:04 +00:00