Commit 351284b5ec1f0544a37cea41c200227cb762d091

Authored by Jay Berkenbilt
1 parent b2e5c8c9

make -key not take an argument with a / to appease msys's path translation

git-svn-id: svn+q:///qpdf/trunk@803 71b93d88-0707-0410-a8cf-f5a4172ac649
README.windows
1 Common Setup 1 Common Setup
2 ============ 2 ============
3 3
4 -To be able to run qpdf's test suite, you must have cygwin installed. 4 +To be able to build qpdf and run its test suite, you must have either
  5 +Cygwin or MSYS from MinGW (>= 1.0.11) installed.
  6 +
  7 + qpdf's test suite, you must have cygwin installed.
5 This is because qpdf's test suite uses qtest, which requires cygwin 8 This is because qpdf's test suite uses qtest, which requires cygwin
6 perl on Windows. (Hopefully a future version of qtest will work with 9 perl on Windows. (Hopefully a future version of qtest will work with
7 ActiveState Perl.) You must have at least perl and gnu diffutils 10 ActiveState Perl.) You must have at least perl and gnu diffutils
examples/pdf-mod-info.cc
@@ -100,7 +100,7 @@ int main(int argc, char* argv[]) @@ -100,7 +100,7 @@ int main(int argc, char* argv[])
100 100
101 char* fl_in = 0; 101 char* fl_in = 0;
102 char* fl_out = 0; 102 char* fl_out = 0;
103 - char* cur_key = 0; 103 + std::string cur_key;
104 104
105 for (int i = 1; i < argc; ++i) 105 for (int i = 1; i < argc; ++i)
106 { 106 {
@@ -120,18 +120,22 @@ int main(int argc, char* argv[]) @@ -120,18 +120,22 @@ int main(int argc, char* argv[])
120 { 120 {
121 QTC::TC("examples", "pdf-mod-info -key"); 121 QTC::TC("examples", "pdf-mod-info -key");
122 cur_key = argv[i]; 122 cur_key = argv[i];
  123 + if (! ((cur_key.length() > 0) && (cur_key[0] == '/')))
  124 + {
  125 + cur_key = "/" + cur_key;
  126 + }
123 Keys[cur_key] = ""; 127 Keys[cur_key] = "";
124 } 128 }
125 else if ((! strcmp(argv[i], "-val")) && (++i < argc)) 129 else if ((! strcmp(argv[i], "-val")) && (++i < argc))
126 { 130 {
127 - if (cur_key == 0) 131 + if (cur_key.empty())
128 { 132 {
129 QTC::TC("examples", "pdf-mod-info usage wrong val"); 133 QTC::TC("examples", "pdf-mod-info usage wrong val");
130 usage(); 134 usage();
131 } 135 }
132 QTC::TC("examples", "pdf-mod-info -val"); 136 QTC::TC("examples", "pdf-mod-info -val");
133 Keys[cur_key] = argv[i]; 137 Keys[cur_key] = argv[i];
134 - cur_key = 0; 138 + cur_key.clear();
135 } 139 }
136 else 140 else
137 { 141 {
examples/qtest/mod-info.test
@@ -34,7 +34,7 @@ $td-&gt;runtest(&quot;usage #3&quot;, @@ -34,7 +34,7 @@ $td-&gt;runtest(&quot;usage #3&quot;,
34 $td->NORMALIZE_NEWLINES); 34 $td->NORMALIZE_NEWLINES);
35 35
36 $td->runtest("usage #4", 36 $td->runtest("usage #4",
37 - {$td->COMMAND => "$prg -in source1.pdf -key /date -val 01/01/01 -val 12/12/12"}, 37 + {$td->COMMAND => "$prg -in source1.pdf -key date -val 01/01/01 -val 12/12/12"},
38 {$td->FILE => "usage.out", 38 {$td->FILE => "usage.out",
39 $td->EXIT_STATUS => 2}, 39 $td->EXIT_STATUS => 2},
40 $td->NORMALIZE_NEWLINES); 40 $td->NORMALIZE_NEWLINES);
@@ -57,23 +57,23 @@ $td-&gt;runtest(&quot;dump #3&quot;, @@ -57,23 +57,23 @@ $td-&gt;runtest(&quot;dump #3&quot;,
57 $td->EXIT_STATUS => 0}); 57 $td->EXIT_STATUS => 0});
58 58
59 run_and_cmp("modify Subject", 59 run_and_cmp("modify Subject",
60 - "$prg -in files/source1.pdf -out out.pdf -key /Subject " . 60 + "$prg -in files/source1.pdf -out out.pdf -key Subject " .
61 "-val \"Export Business\"", 61 "-val \"Export Business\"",
62 "", "out.pdf", "files/1.qdf"); 62 "", "out.pdf", "files/1.qdf");
63 63
64 run_and_cmp("add Subject, remove Producer, modify CreationDate", 64 run_and_cmp("add Subject, remove Producer, modify CreationDate",
65 - "$prg -in files/source2.pdf -out out.pdf -key /Subject " .  
66 - "-val \"Tammlin\" -key /Producer -key /CreationDate -val 12/12", 65 + "$prg -in files/source2.pdf -out out.pdf -key Subject " .
  66 + "-val \"Tammlin\" -key Producer -key CreationDate -val 12/12",
67 "", "out.pdf", "files/2.qdf"); 67 "", "out.pdf", "files/2.qdf");
68 68
69 run_and_cmp("add Subject (empty-info file)", 69 run_and_cmp("add Subject (empty-info file)",
70 - "$prg -in files/empty-info.pdf -out out.pdf -key /Subject " . 70 + "$prg -in files/empty-info.pdf -out out.pdf -key Subject " .
71 "-val Tammlin", 71 "-val Tammlin",
72 "", "out.pdf", "files/3.qdf"); 72 "", "out.pdf", "files/3.qdf");
73 73
74 copy("files/no-info.pdf", "no-info.pdf") or die "can't copy no-info: $!"; 74 copy("files/no-info.pdf", "no-info.pdf") or die "can't copy no-info: $!";
75 run_and_cmp("in-place Producer added (no-info file)", 75 run_and_cmp("in-place Producer added (no-info file)",
76 - "$prg -in no-info.pdf -key /Producer -val \"Obivan Kinobi\"", 76 + "$prg -in no-info.pdf -key Producer -val \"Obivan Kinobi\"",
77 "", "no-info.pdf", "files/4.qdf"); 77 "", "no-info.pdf", "files/4.qdf");
78 78
79 cleanup(); 79 cleanup();