From 9e8cec5ec9ebde16efbd35dcf69f8f4593b5d1f1 Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Fri, 10 Feb 2006 18:46:07 +0100 Subject: remove debug output --- src/GsWidget.cxx | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/GsWidget.cxx b/src/GsWidget.cxx index 27a8cb7..c71ab11 100644 --- a/src/GsWidget.cxx +++ b/src/GsWidget.cxx @@ -148,7 +148,6 @@ int GsWidget::open_file(int fd) { if (dsc->parse(in_fd) == 0) { int bb_x, bb_y, bb_w, bb_h; - dsc->print(); dsc->get_bounding_box(&bb_x, &bb_y, &bb_w, &bb_h); paper_x = bb_w; paper_y = bb_h; -- cgit v1.2.3 From c0382411064786243e6b6deaed64d240618e6fba Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Fri, 10 Feb 2006 18:49:29 +0100 Subject: use page numbers starting with 1 in interface --- src/GsWidget.cxx | 4 ++-- src/PostscriptDSC.cxx | 12 ++++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/GsWidget.cxx b/src/GsWidget.cxx index c71ab11..6f5eb44 100644 --- a/src/GsWidget.cxx +++ b/src/GsWidget.cxx @@ -168,7 +168,7 @@ int GsWidget::load() { pid_t pid; if (dsc) { - return load_page(0); + return load_page(1); } if (in_fd < 0) { @@ -208,7 +208,7 @@ GsWidget::load_page(int p) { return 1; } - if (p < 0 || p >= dsc->get_pages()) { + if (p < 1 || p > dsc->get_pages()) { fprintf(stderr, "Page %d not found in document\n", p); return 1; } diff --git a/src/PostscriptDSC.cxx b/src/PostscriptDSC.cxx index 3062763..b8b998a 100644 --- a/src/PostscriptDSC.cxx +++ b/src/PostscriptDSC.cxx @@ -156,12 +156,20 @@ PostscriptDSC::get_setup_len() { size_t PostscriptDSC::get_page_off(int p) { - return page_off[p]; + if (p < 1 || p > pages) { + return 0; + } else { + return page_off[p - 1]; + } } size_t PostscriptDSC::get_page_len(int p) { - return page_len[p]; + if (p < 1 || p > pages) { + return 0; + } else { + return page_len[p - 1]; + } } void -- cgit v1.2.3