Commit 6bdac26369c0d770759c2b6ce24afef608a91ec9

Authored by Jay Berkenbilt
1 parent 8d7bb3ff

finished testing C API

git-svn-id: svn+q:///qpdf/trunk@734 71b93d88-0707-0410-a8cf-f5a4172ac649
README.maintainer
... ... @@ -16,6 +16,8 @@ Release Reminders
16 16  
17 17 make_dist verifies this consistency.
18 18  
  19 + * Update release date in manual/qpdf-manual.xml
  20 +
19 21 * Each year, update copyright notices. Just search for Copyright.
20 22 Last updated: 2009.
21 23  
... ...
configure.ac
... ... @@ -2,7 +2,7 @@ dnl Process this file with autoconf to produce a configure script.
2 2 dnl This config.in requires autoconf 2.5 or greater.
3 3  
4 4 AC_PREREQ(2.60)
5   -AC_INIT(qpdf,2.0.6)
  5 +AC_INIT(qpdf,2.1.a1)
6 6  
7 7 AC_CONFIG_MACRO_DIR([m4])
8 8 AC_CONFIG_FILES([autoconf.mk])
... ...
libqpdf/qpdf-c.cc
... ... @@ -376,10 +376,10 @@ void qpdf_set_r3_encryption_parameters(
376 376 ((print == QPDF_R3_PRINT_LOW) ? QPDFWriter::r3p_low :
377 377 (print == QPDF_R3_PRINT_NONE) ? QPDFWriter::r3p_none :
378 378 QPDFWriter::r3p_full),
379   - ((print == QPDF_R3_MODIFY_ANNOTATE) ? QPDFWriter::r3m_annotate :
380   - (print == QPDF_R3_MODIFY_FORM) ? QPDFWriter::r3m_form :
381   - (print == QPDF_R3_MODIFY_ASSEMBLY) ? QPDFWriter::r3m_assembly :
382   - (print == QPDF_R3_MODIFY_NONE) ? QPDFWriter::r3m_none :
  379 + ((modify == QPDF_R3_MODIFY_ANNOTATE) ? QPDFWriter::r3m_annotate :
  380 + (modify == QPDF_R3_MODIFY_FORM) ? QPDFWriter::r3m_form :
  381 + (modify == QPDF_R3_MODIFY_ASSEMBLY) ? QPDFWriter::r3m_assembly :
  382 + (modify == QPDF_R3_MODIFY_NONE) ? QPDFWriter::r3m_none :
383 383 QPDFWriter::r3m_all));
384 384 }
385 385  
... ...
manual/qpdf-manual.xml
... ... @@ -5,8 +5,8 @@
5 5 <!ENTITY mdash "&#x2014;">
6 6 <!ENTITY ndash "&#x2013;">
7 7 <!ENTITY nbsp "&#xA0;">
8   -<!ENTITY swversion "2.0.6">
9   -<!ENTITY lastreleased "May 3, 2009">
  8 +<!ENTITY swversion "2.1.a1">
  9 +<!ENTITY lastreleased "XXX, 2009">
10 10 ]>
11 11 <book>
12 12 <bookinfo>
... ...
qpdf.spec
1 1 Summary: Command-line tools and library for transforming PDF files
2 2 Name: qpdf
3   -Version: 2.0.6
  3 +Version: 2.1.a1
4 4 Release: 1%{?dist}
5 5 License: Artistic
6 6 Group: System Environment/Libraries
... ...
qpdf/qpdf-ctest.c
... ... @@ -159,6 +159,46 @@ static void test10(char const* infile,
159 159 report_errors();
160 160 }
161 161  
  162 +static void test11(char const* infile,
  163 + char const* password,
  164 + char const* outfile)
  165 +{
  166 + qpdf_read(qpdf, infile, password);
  167 + qpdf_init_write(qpdf, outfile);
  168 + qpdf_set_static_ID(qpdf, QPDF_TRUE);
  169 + qpdf_set_r2_encryption_parameters(
  170 + qpdf, "user1", "owner1", QPDF_FALSE, QPDF_TRUE, QPDF_TRUE, QPDF_TRUE);
  171 + qpdf_write(qpdf);
  172 + report_errors();
  173 +}
  174 +
  175 +static void test12(char const* infile,
  176 + char const* password,
  177 + char const* outfile)
  178 +{
  179 + qpdf_read(qpdf, infile, password);
  180 + qpdf_init_write(qpdf, outfile);
  181 + qpdf_set_static_ID(qpdf, QPDF_TRUE);
  182 + qpdf_set_r3_encryption_parameters(
  183 + qpdf, "user2", "owner2", QPDF_TRUE, QPDF_TRUE,
  184 + QPDF_R3_PRINT_LOW, QPDF_R3_MODIFY_ALL);
  185 + qpdf_write(qpdf);
  186 + report_errors();
  187 +}
  188 +
  189 +static void test13(char const* infile,
  190 + char const* password,
  191 + char const* outfile)
  192 +{
  193 + qpdf_read(qpdf, infile, password);
  194 + printf("user password: %s\n", qpdf_get_user_password(qpdf));
  195 + qpdf_init_write(qpdf, outfile);
  196 + qpdf_set_static_ID(qpdf, QPDF_TRUE);
  197 + qpdf_set_preserve_encryption(qpdf, QPDF_FALSE);
  198 + qpdf_write(qpdf);
  199 + report_errors();
  200 +}
  201 +
162 202 int main(int argc, char* argv[])
163 203 {
164 204 char* whoami = 0;
... ... @@ -202,6 +242,9 @@ int main(int argc, char* argv[])
202 242 (n == 8) ? test08 :
203 243 (n == 9) ? test09 :
204 244 (n == 10) ? test10 :
  245 + (n == 11) ? test11 :
  246 + (n == 12) ? test12 :
  247 + (n == 13) ? test13 :
205 248 0);
206 249  
207 250 if (fn == 0)
... ...
qpdf/qpdf.cc
... ... @@ -472,7 +472,7 @@ int main(int argc, char* argv[])
472 472 // 1 2 3 4 5 6 7 8
473 473 // 12345678901234567890123456789012345678901234567890123456789012345678901234567890
474 474 std::cout
475   - << whoami << " version 2.0.6" << std::endl
  475 + << whoami << " version 2.1.a1" << std::endl
476 476 << "Copyright (c) 2005-2009 Jay Berkenbilt"
477 477 << std::endl
478 478 << "This software may be distributed under the terms of version 2 of the"
... ...
qpdf/qtest/qpdf.test
... ... @@ -851,6 +851,31 @@ $td-&gt;runtest(&quot;invalid password&quot;,
851 851 $td->EXIT_STATUS => 2},
852 852 $td->NORMALIZE_NEWLINES);
853 853  
  854 +my @cenc = (
  855 + [11, 'hybrid-xref.pdf', "''", 'r2', ""],
  856 + [12, 'hybrid-xref.pdf', "''", 'r3', ""],
  857 + [13, 'c-r2.pdf', 'user1', 'decrypt with user',
  858 + "user password: user1\n"],
  859 + [13, 'c-r3.pdf', 'owner2', 'decrypt with owner',
  860 + "user password: user2\n"],
  861 + );
  862 +$n_tests += 2 * @cenc;
  863 +
  864 +foreach my $d (@cenc)
  865 +{
  866 + my ($n, $infile, $pass, $description, $output) = @$d;
  867 + my $outfile = $description;
  868 + $outfile =~ s/ /-/g;
  869 + my $outfile = "c-$outfile.pdf";
  870 + $td->runtest("C API encryption: $description",
  871 + {$td->COMMAND => "qpdf-ctest $n $infile $pass a.pdf"},
  872 + {$td->STRING => $output, $td->EXIT_STATUS => 0},
  873 + $td->NORMALIZE_NEWLINES);
  874 + $td->runtest("check $description",
  875 + {$td->FILE => "a.pdf"},
  876 + {$td->FILE => $outfile});
  877 +}
  878 +
854 879 # Test combinations of linearization and encryption. Note that we do
855 880 # content checks on encrypted and linearized files in various
856 881 # combinations below. Here we are just making sure that they are
... ...
qpdf/qtest/qpdf/c-decrypt-with-owner.pdf 0 → 100644
No preview for this file type
qpdf/qtest/qpdf/c-decrypt-with-user.pdf 0 → 100644
No preview for this file type
qpdf/qtest/qpdf/c-r2.pdf 0 → 100644
No preview for this file type
qpdf/qtest/qpdf/c-r3.pdf 0 → 100644
No preview for this file type