summaryrefslogtreecommitdiff
path: root/src/GsWidget.cxx
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2009-03-04 18:20:11 +0100
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2009-03-04 18:20:11 +0100
commit365b6bf765a25e6cab087491fd2a5416499256ef (patch)
tree952665e655143a3c99a7d9fff440b0e0e67b7431 /src/GsWidget.cxx
parent00b21c9ee2af7457ce9f05f80144a245d1ef0750 (diff)
fix const related warnings reported by gcc 4.3.3 (via Kapil Hari Paranjape)
Diffstat (limited to 'src/GsWidget.cxx')
-rw-r--r--src/GsWidget.cxx16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/GsWidget.cxx b/src/GsWidget.cxx
index 79f1083..dbf7340 100644
--- a/src/GsWidget.cxx
+++ b/src/GsWidget.cxx
@@ -285,7 +285,8 @@ int GsWidget::fd_copy(int to, int from, size_t len) {
}
void GsWidget::exec_gs() {
- char *argv[16];
+ const char * const argv[] = {"gs", "-dSAFER", "-dQUIET",
+ "-sDEVICE=x11alpha", "-dNOPLATFONTS", "-dNOPAUSE", "-", NULL};
char gvenv[256];
int d_null = open("/dev/null", O_WRONLY);
@@ -295,15 +296,10 @@ void GsWidget::exec_gs() {
(int) fl_xid(window()), (int) offscreen);
putenv(gvenv);
- argv[0] = "gs";
- argv[1] = "-dSAFER";
- argv[2] = "-dQUIET";
- argv[3] = "-sDEVICE=x11alpha";
- argv[4] = "-dNOPLATFONTS";
- argv[5] = "-dNOPAUSE";
- argv[6] = "-";
- argv[7] = NULL;
- execvp(argv[0], argv);
+
+ // const cast is necessary because of execvp declaration, see:
+ // http://www.opengroup.org/onlinepubs/000095399/functions/exec.html
+ execvp(argv[0], const_cast<char * const *>(argv));
perror("exec");
fprintf(stderr, "Please install ghostscript and make sure 'gs' "
"is in the PATH.\n");