diff options
author | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2006-02-10 17:28:17 +0100 |
---|---|---|
committer | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2006-02-10 17:28:17 +0100 |
commit | f2646e054ce3d1bfa86471553e663b426a143ad8 (patch) | |
tree | fbd7f6d2c4133646805c304a0ed0daed941ab103 | |
parent | 34eacf87403f8a3382beab0271a28764b030c333 (diff) |
fix DSC parsing for non-DSC documents
-rw-r--r-- | src/PostscriptDSC.cxx | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/PostscriptDSC.cxx b/src/PostscriptDSC.cxx index dfc9775..985722d 100644 --- a/src/PostscriptDSC.cxx +++ b/src/PostscriptDSC.cxx @@ -120,14 +120,18 @@ PostscriptDSC::parse(int fd) { } } } + + if (page_len && page_off) { + page_len[p1 - 1] = ftello(fp) - page_off[p1 - 1]; - page_len[p1 - 1] = ftello(fp) - page_off[p1 - 1]; - - for (int i=0; i<pages; i++) { - if (page_off[i] == 0 || page_len[i] == 0) { - fprintf(stderr, "Page %d not defined\n", i); - return 1; + for (int i=0; i<pages; i++) { + if (page_off[i] == 0 || page_len[i] == 0) { + fprintf(stderr, "Page %d not defined\n", i); + return 1; + } } + } else { + return 1; } return 0; |