|
From: Harald H. <h.h...@tu...> - 2005-02-13 13:57:29
|
On Sat, 12 Feb 2005, Ethan Merritt wrote:
> Current CVS gives the following errors when compiled:
> ../term/pslatex.trm:260: warning: unused variable `tmp'
> ../term/pslatex.trm:150: warning: enumeration value `PSTERM_POSTSCRIPT' not handled in switch
> ../term/pslatex.trm:257: warning: enumeration value `PSTERM_EPSLATEX' not handled in switch
> ../term/pslatex.trm:257: warning: enumeration value `PSTERM_POSTSCRIPT' not handled in switch
> ../term/post.trm:2202: warning: enumeration value `PSTERM_POSTSCRIPT' not handled in switch
> ../term/post.trm:2309: warning: 'xmin_t' might be used uninitialized in this function
> ../term/post.trm:2309: warning: 'ymin_t' might be used uninitialized in this function
> ../term/post.trm:2309: warning: 'xmax_t' might be used uninitialized in this function
> ../term/post.trm:2309: warning: 'ymax_t' might be used uninitialized in this function
I have fixed them. The patch is at the end of this mail.
> but then I get:
>
> ../term/post.trm:1463: warning: implicit declaration of function `conv_text'
> ../term/post.trm:1463: warning: format argument is not a pointer (arg 3)
>
> This is bad. Individual drivers should not be calling
> back into the gnuplot core routines (conv_text is in show.c).
> Is this conversion really necessary?
> Why do we care if a user manages to type in non-printing characters
> in an epslatex header string? "If it hurts, don't do it".
I have added this because LaTeX header strings can get relatively long.
Thus, it can be useful to split them into multiple lines which needs the
non-printing character \n. I would be really unhappy if this will not work
anymore.
In my opinion, setshow.h is not the best position to define conv_text().
Wouldn't the definition of conv_text() fit better into parse.[ch] or
util.[ch]?
Regards
Harald
And here is the patch (which does not solve the critical warning which
needs discussion first):
diff -uNr orig/term/post.trm epslatex/term/post.trm
--- orig/term/post.trm 2005-02-09 12:43:12.000000000 +0100
+++ epslatex/term/post.trm 2005-02-13 14:48:09.000000000 +0100
@@ -2199,6 +2199,7 @@
case PSTERM_PSTEX:
PSTEX_common_init();
break;
+ default:; /* do nothing, just avoid a compiler warning */
}
if (ps_params->psformat == PSTERM_EPS)
@@ -2306,7 +2307,7 @@
TERM_PUBLIC void
PS_init()
{
- unsigned int xmin_t, ymin_t, xmax_t, ymax_t;
+ unsigned int xmin_t = 0, ymin_t = 0, xmax_t = 0, ymax_t = 0;
switch (ps_params->psformat) {
case PSTERM_EPS:
@@ -2336,6 +2337,8 @@
xmin_t = term->ymax * (1-ysize-yoffset) / PS_SC;
xmax_t = term->ymax * (1-yoffset) / PS_SC;
break;
+ default:
+ int_error(NO_CARET, "invalid postscript format used");
}
/* for enhanced postscript, copy ps_params->font to ps_enh_font
@@ -2677,7 +2680,7 @@
PS_set_font(const char *font)
{
char name[32];
- int i;
+ unsigned int i;
float size;
size_t sep;
diff -uNr orig/term/pslatex.trm epslatex/term/pslatex.trm
--- orig/term/pslatex.trm 2005-02-09 12:43:12.000000000 +0100
+++ epslatex/term/pslatex.trm 2005-02-13 14:45:33.000000000 +0100
@@ -147,6 +147,7 @@
\\endgroup\n\
\\endinput\n", gpoutfile);
break;
+ default:; /* do nothing, just avoid a compiler warning */
}
if (pslatex_auxname) {
@@ -254,10 +255,10 @@
fprintf(gpoutfile, "\\GNUPLOTpicture(%d,%d)\n",
(int) (xsize * term->xmax), (int) (ysize * term->ymax));
break;
+ default:; /* do nothing, just avoid a compiler warning */
}
if (gppsfile != gpoutfile) {
- FILE *tmp;
/* these are taken from the post.trm file computation
* of the bounding box, but without the X_OFF and Y_OFF */
int urx = (int) (xsize * term->xmax / (2*PS_SC) + 0.5);
--
Harald Harders
h.h...@tu...
http://www.harald-harders.de
|