From d6353fb9eecc9040bb1c2bc663946fc082249a4b Mon Sep 17 00:00:00 2001 From: rlar Date: Sun, 24 Oct 2010 13:15:35 +0000 Subject: [PATCH] struct member devdep, use void* instead of char* --- ChangeLog | 18 ++++++++++++++++++ src/frontend/hpgl.c | 8 ++++---- src/frontend/plotting/plot5.c | 8 ++++---- src/frontend/plotting/x11.c | 2 +- src/frontend/postsc.c | 8 ++++---- src/frontend/wdisp/windisp.c | 2 +- src/frontend/wdisp/winprint.c | 2 +- src/include/graph.h | 2 +- src/tclspice.c | 2 +- 9 files changed, 35 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index fe0c5ecf6..e07def2e1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2010-10-24 Robert Larice + * src/frontend/hpgl.c , + * src/frontend/plotting/plot5.c , + * src/frontend/plotting/x11.c , + * src/frontend/postsc.c , + * src/frontend/wdisp/windisp.c , + * src/frontend/wdisp/winprint.c , + * src/include/graph.h , + * src/tclspice.c : + struct member devdep, use void* instead of char* + +2010-10-24 Robert Larice + * src/frontend/help/readhelp.c , + * src/ngmultidec.c , + * src/tclspice.c : + tmalloc usage, drop explicit (unsigned) cast + later to be reinstated in a tmalloc wrapper macro + 2010-10-24 Robert Larice * src/frontend/com_display.c , * src/frontend/device.c , diff --git a/src/frontend/hpgl.c b/src/frontend/hpgl.c index a578736a8..4a25bedd6 100644 --- a/src/frontend/hpgl.c +++ b/src/frontend/hpgl.c @@ -118,9 +118,9 @@ GRAPH *graph) hcopygraphid = graph->graphid; - if (!(plotfile = fopen(graph->devdep, "w"))) { - perror(graph->devdep); - graph->devdep = (char *) NULL; + if (!(plotfile = fopen((char*) graph->devdep, "w"))) { + perror((char*) graph->devdep); + graph->devdep = NULL; return(1); } @@ -154,7 +154,7 @@ GRAPH *graph) if (!screenflag) #endif - graph->devdep = (char*) tmalloc(sizeof(GLdevdep)); + graph->devdep = (GLdevdep*) tmalloc(sizeof(GLdevdep)); DEVDEP(graph).lastlinestyle = -1; DEVDEP(graph).lastx = -1; DEVDEP(graph).lasty = -1; diff --git a/src/frontend/plotting/plot5.c b/src/frontend/plotting/plot5.c index 68eb8b21b..c4f84819d 100644 --- a/src/frontend/plotting/plot5.c +++ b/src/frontend/plotting/plot5.c @@ -40,9 +40,9 @@ int Plt5_NewViewport(GRAPH *graph) { - if (!(plotfile = fopen(graph->devdep, "w"))) { - graph->devdep = (char *) NULL; - perror(graph->devdep); + if (!(plotfile = fopen((char*) graph->devdep, "w"))) { + graph->devdep = NULL; + perror((char*) graph->devdep); return(1); } @@ -77,7 +77,7 @@ Plt5_NewViewport(GRAPH *graph) } /* set to NULL so graphdb doesn't incorrectly de-allocate it */ - graph->devdep = (char *) NULL; + graph->devdep = NULL; return(0); diff --git a/src/frontend/plotting/x11.c b/src/frontend/plotting/x11.c index 22dd5edf5..ba6571fce 100644 --- a/src/frontend/plotting/x11.c +++ b/src/frontend/plotting/x11.c @@ -366,7 +366,7 @@ X11_NewViewport(GRAPH *graph) }; int trys; - graph->devdep = (char*) tmalloc(sizeof(X11devdep)); + graph->devdep = (X11devdep*) tmalloc(sizeof(X11devdep)); /* set up new shell */ DEVDEP(graph).shell = XtCreateApplicationShell("shell", diff --git a/src/frontend/postsc.c b/src/frontend/postsc.c index b35fb7d58..7a5bb1527 100644 --- a/src/frontend/postsc.c +++ b/src/frontend/postsc.c @@ -168,9 +168,9 @@ PS_NewViewport(GRAPH *graph) int x1,x2,y1,y2; hcopygraphid = graph->graphid; /* devdep initially contains name of output file */ - if (!(plotfile = fopen(graph->devdep, "w"))) { - perror(graph->devdep); - graph->devdep = (char *) NULL; + if (!(plotfile = fopen((char*)graph->devdep, "w"))) { + perror((char*)graph->devdep); + graph->devdep = NULL; return(1); } @@ -218,7 +218,7 @@ PS_NewViewport(GRAPH *graph) fprintf(plotfile, "/%s findfont %d scalefont setfont\n\n", psfont, (int) (fontsize * scale)); - graph->devdep = (char*) tmalloc(sizeof(PSdevdep)); + graph->devdep = (PSdevdep*) tmalloc(sizeof(PSdevdep)); DEVDEP(graph).lastlinestyle = -1; DEVDEP(graph).lastcolor = -1; DEVDEP(graph).lastx = -1; diff --git a/src/frontend/wdisp/windisp.c b/src/frontend/wdisp/windisp.c index 07f471292..44604272c 100644 --- a/src/frontend/wdisp/windisp.c +++ b/src/frontend/wdisp/windisp.c @@ -587,7 +587,7 @@ int WIN_NewViewport( GRAPH * graph) /* allocate device dependency info */ wd = calloc(1, sizeof(tWindowData)); if (!wd) return 1; - graph->devdep = (char *)wd; + graph->devdep = wd; /* Create the window */ i = GetSystemMetrics( SM_CYSCREEN) / 3; diff --git a/src/frontend/wdisp/winprint.c b/src/frontend/wdisp/winprint.c index 821d20216..9b26f24e0 100644 --- a/src/frontend/wdisp/winprint.c +++ b/src/frontend/wdisp/winprint.c @@ -242,7 +242,7 @@ int WPRINT_NewViewport( GRAPH * graph) /* Device dep. Info allocieren */ pd = calloc(1, sizeof(tPrintData)); if (!pd) return 1; - graph->devdep = (char *)pd; + graph->devdep = pd; /* Setze den Color-Index */ pd->ColorIndex = 0; diff --git a/src/include/graph.h b/src/include/graph.h index 9fb10d8e3..2a58da89a 100644 --- a/src/include/graph.h +++ b/src/include/graph.h @@ -126,7 +126,7 @@ struct graph { /* Space here is allocated by NewViewport and de-allocated by DestroyGraph. */ - char *devdep; + void *devdep; }; diff --git a/src/tclspice.c b/src/tclspice.c index b96c2d0f5..951fb6a23 100755 --- a/src/tclspice.c +++ b/src/tclspice.c @@ -1343,7 +1343,7 @@ int sp_Tk_Init(void) { int sp_Tk_NewViewport(GRAPH *graph) { const char *result; int width, height, fontwidth, fontheight; - graph->devdep = (char *) NULL; + graph->devdep = NULL; if(Tcl_GlobalEval(spice_interp,"spice_gr_NewViewport") != TCL_OK) { Tcl_ResetResult(spice_interp);