summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS6
-rw-r--r--configure.ac2
-rw-r--r--src/GsWidget.cxx4
-rw-r--r--src/PSEditModel.H2
-rw-r--r--src/PostscriptDSC.cxx18
5 files changed, 25 insertions, 7 deletions
diff --git a/NEWS b/NEWS
index 9afc912..a8d696c 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,11 @@
flpsed ChangeLog
=================
+flpsed-0.3.7
+ - use setenv() instead of putenv() for POSIX
+ compatibility (noticed by Jeff Orczykowski on Solaris 8).
+ - fix gcc-4.1 compilation problem.
+ - fix segfault in DSC code reported by Morten Brix Pedersen.
+
flpsed-0.3.6
- Add support for PostScript Document Structure Convention.
- Pages can now be accessed in random order.
diff --git a/configure.ac b/configure.ac
index cdee12a..108b5af 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
-AC_INIT(flpsed, 0.3.6, Johannes.Hofmann@gmx.de)
+AC_INIT(flpsed, 0.3.7-pre1, Johannes.Hofmann@gmx.de)
AM_INIT_AUTOMAKE
AC_CONFIG_SRCDIR([src/GsWidget.H])
AC_CONFIG_HEADER(config.h)
diff --git a/src/GsWidget.cxx b/src/GsWidget.cxx
index d92b8ba..5741be6 100644
--- a/src/GsWidget.cxx
+++ b/src/GsWidget.cxx
@@ -298,10 +298,10 @@ void GsWidget::exec_gs() {
dup2(d_null, STDOUT_FILENO);
- snprintf(gvenv, sizeof(gvenv), "%d %d",
+ snprintf(gvenv, sizeof(gvenv), "GHOSTVIEW=%d %d",
(int) fl_xid(window()), (int) offscreen);
- setenv("GHOSTVIEW", gvenv, 1);
+ putenv(gvenv);
argv[0] = "gs";
argv[1] = "-dSAFER";
argv[2] = "-dQUIET";
diff --git a/src/PSEditModel.H b/src/PSEditModel.H
index d181814..b5ebc14 100644
--- a/src/PSEditModel.H
+++ b/src/PSEditModel.H
@@ -83,7 +83,7 @@ public:
int dump_tags();
- int PSEditModel::load(FILE *fp);
+ int load(FILE *fp);
int save(FILE *sfp, int tmp_fd);
};
diff --git a/src/PostscriptDSC.cxx b/src/PostscriptDSC.cxx
index b8b998a..345a32b 100644
--- a/src/PostscriptDSC.cxx
+++ b/src/PostscriptDSC.cxx
@@ -22,6 +22,7 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
+#include <ctype.h>
#include "PostscriptDSC.H"
PostscriptDSC::PostscriptDSC() {
@@ -49,7 +50,7 @@ PostscriptDSC::parse(int fd) {
FILE *fp;
char linebuf[1024];
int x, y, w, h;
- int p1, p2, ps;
+ int p1 = 0, ps;
int i = 0;
int bb_read = 0;
@@ -93,7 +94,18 @@ PostscriptDSC::parse(int fd) {
page_len = (size_t*) malloc(sizeof(size_t) * pages);
memset(page_len, 0, sizeof(size_t) * pages);
- } else if (sscanf(linebuf, "%%%%Page: %d %d", &p1, &p2) == 2) {
+ } else if (strncmp(linebuf, "%%Page: ", strlen("%%Page: ")) == 0) {
+ char *p_str = &linebuf[strlen(linebuf)];
+
+ // move p_str back to beginning of last number in linebuf
+ while (p_str > linebuf && !isdigit(*p_str)) {
+ p_str--;
+ }
+ while (p_str > linebuf && isdigit(*p_str)) {
+ p_str--;
+ }
+
+ p1 = atoi(p_str);
if (!page_off || !page_len) {
fprintf(stderr, "Number of pages not defined\n");
@@ -120,7 +132,7 @@ PostscriptDSC::parse(int fd) {
}
}
- if (page_len && page_off) {
+ if (page_len && page_off && p1 > 0 && p1 <= pages) {
page_len[p1 - 1] = ftello(fp) - page_off[p1 - 1];
for (int i=0; i<pages; i++) {