diff options
author | dos-reis <gdr@axiomatics.org> | 2013-04-01 00:00:11 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2013-04-01 00:00:11 +0000 |
commit | 664e27a1d8f4927285e8c4f89870796c9d9f518e (patch) | |
tree | 0d898301aa9fe690bc9d02e9450b39492efb4d6c /src | |
parent | 37a3397a82d94da8df1c0a0e48a39d43d17cce00 (diff) | |
download | open-axiom-664e27a1d8f4927285e8c4f89870796c9d9f518e.tar.gz |
Fix various warnings from the C++ compiler
Diffstat (limited to 'src')
-rw-r--r-- | src/ChangeLog | 13 | ||||
-rw-r--r-- | src/graph/viewman/fun2D.c | 49 | ||||
-rw-r--r-- | src/graph/viewman/fun3D.c | 77 | ||||
-rw-r--r-- | src/lib/XSpadFill.c | 6 | ||||
-rw-r--r-- | src/lib/fnct_key.c | 7 | ||||
-rw-r--r-- | src/lib/openpty.c | 39 | ||||
-rw-r--r-- | src/lib/pixmap.c | 8 | ||||
-rw-r--r-- | src/lib/sockio-c.c | 5 |
8 files changed, 102 insertions, 102 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 2707f53f..0d443583 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,18 @@ 2013-03-31 Gabriel Dos Reis <gdr@integrable-solutions.net> + * lib/sockio-c.c (get_float): Remove unused local variable val. + * lib/pixmap.c (read_pixmap_file): Remove unused local variable status. + * lib/openpty.c (makeNextPtyNames): Guard declaration by CPP macro. + * lib/fnct_key.c (define_function_keys): Remove unused local + variable saved_echo. + * lib/XSpadFill.c (XInitSpadFill): Remove unused local variable + maxDither. + * graph/viewman/fun2D.c (funView2D): Remove declaration of unused + local variable code. + * graph/viewman/fun3D.c (funView3D): Likewise. + +2013-03-31 Gabriel Dos Reis <gdr@integrable-solutions.net> + * interp/pile.boot (insertpile): Tidy. (pilePlusComments): Likewise. (pileTree): Likewise. diff --git a/src/graph/viewman/fun2D.c b/src/graph/viewman/fun2D.c index d3948b6b..af7724d9 100644 --- a/src/graph/viewman/fun2D.c +++ b/src/graph/viewman/fun2D.c @@ -1,7 +1,7 @@ /* Copyright (C) 1991-2002, The Numerical Algorithms Group Ltd. All rights reserved. - Copyright (C) 2007-2008, Gabriel Dos Reis. + Copyright (C) 2007-2013, Gabriel Dos Reis. All rights reserved. Redistribution and use in source and binary forms, with or without @@ -60,7 +60,6 @@ void funView2D(int viewCommand) { - int code; int viewPID; float f1,f2; int i1,i2,i3; @@ -76,7 +75,7 @@ funView2D(int viewCommand) if (viewport) { send_int(spadSock,1); /* acknowledge to spad */ - code = write(viewport->viewOut,&viewCommand,intSize); + write(viewport->viewOut,&viewCommand,intSize); switch (viewCommand) { @@ -85,10 +84,10 @@ funView2D(int viewCommand) i1 = get_int(spadSock); /* graph key */ i2 = get_int(spadSock); /* viewport slot 1..9 */ i2--; /* 0..8*/ - code = write(viewport->viewOut,&i1,intSize); - code = write(viewport->viewOut,&i2,intSize); + write(viewport->viewOut,&i1,intSize); + write(viewport->viewOut,&i2,intSize); i3 = 1; /* continue*/ - code = write(viewport->viewOut,&i3,intSize); + write(viewport->viewOut,&i3,intSize); sendGraphToView2D(0,i1,viewport,¤tGraphState); break; @@ -97,23 +96,23 @@ funView2D(int viewCommand) i1 = get_int(spadSock); /* graph index */ f1 = get_float(spadSock); /* translate in the x direction */ f2 = get_float(spadSock); /* translate in the y direction */ - code = write(viewport->viewOut,&i1,intSize); - code = write(viewport->viewOut,&f1,floatSize); - code = write(viewport->viewOut,&f2,floatSize); + write(viewport->viewOut,&i1,intSize); + write(viewport->viewOut,&f1,floatSize); + write(viewport->viewOut,&f2,floatSize); break; case scale2D: i1 = get_int(spadSock); /* graph index */ f1 = get_float(spadSock); /* scale in the x direction */ f2 = get_float(spadSock); /* scale in the y direction */ - code = write(viewport->viewOut,&i1,intSize); - code = write(viewport->viewOut,&f1,floatSize); - code = write(viewport->viewOut,&f2,floatSize); + write(viewport->viewOut,&i1,intSize); + write(viewport->viewOut,&f1,floatSize); + write(viewport->viewOut,&f2,floatSize); break; case hideControl2D: i1 = get_int(spadSock); - code = write(viewport->viewOut,&i1,intSize); + write(viewport->viewOut,&i1,intSize); break; case axesOnOff2D: @@ -124,47 +123,47 @@ funView2D(int viewCommand) case showing2D: i1 = get_int(spadSock); /* graph index */ i2 = get_int(spadSock); /* axes status */ - code = write(viewport->viewOut,&i1,intSize); - code = write(viewport->viewOut,&i2,intSize); + write(viewport->viewOut,&i1,intSize); + write(viewport->viewOut,&i2,intSize); break; case moveViewport: case resizeViewport: i1 = get_int(spadSock); i2 = get_int(spadSock); - code = write(viewport->viewOut,&i1,intSize); - code = write(viewport->viewOut,&i2,intSize); + write(viewport->viewOut,&i1,intSize); + write(viewport->viewOut,&i2,intSize); break; case changeTitle: s1 = get_string(spadSock); i1 = strlen(s1); - code = write(viewport->viewOut,&i1,intSize); - code = write(viewport->viewOut,s1,i1); + write(viewport->viewOut,&i1,intSize); + write(viewport->viewOut,s1,i1); break; case writeView: s1 = get_string(spadSock); i1 = strlen(s1); - code = write(viewport->viewOut,&i1,intSize); - code = write(viewport->viewOut,s1,i1); + write(viewport->viewOut,&i1,intSize); + write(viewport->viewOut,s1,i1); /* write out the types of things to be written */ i2 = get_int(spadSock); - code = write(viewport->viewOut,&i2,intSize); + write(viewport->viewOut,&i2,intSize); while (i2) { i2 = get_int(spadSock); - code = write(viewport->viewOut,&i2,intSize); + write(viewport->viewOut,&i2,intSize); } break; case spadPressedAButton: i1 = get_int(spadSock); - code = write(viewport->viewOut,&i1,intSize); + write(viewport->viewOut,&i1,intSize); break; } /* switch */ /*** get acknowledge from viewport */ - code = readViewport(viewport,&acknow,intSize); + readViewport(viewport,&acknow,intSize); send_int(spadSock,1); /* acknowledge to spad */ } else { send_int(spadSock,-1); /* send error value in acknowledge to spad */ diff --git a/src/graph/viewman/fun3D.c b/src/graph/viewman/fun3D.c index 177aece1..35f79cc4 100644 --- a/src/graph/viewman/fun3D.c +++ b/src/graph/viewman/fun3D.c @@ -1,7 +1,7 @@ /* Copyright (C) 1991-2002, The Numerical Algorithms Group Ltd. All rights reserved. - Copyright (C) 2007-2008, Gabriel Dos Reis. + Copyright (C) 2007-2013, Gabriel Dos Reis. All rights reserved. Redistribution and use in source and binary forms, with or without @@ -58,7 +58,6 @@ void funView3D(int viewCommand) { - int code; int viewPID; float f1,f2,f3,f4; int i1,i2; @@ -75,34 +74,34 @@ funView3D(int viewCommand) viewmanEvent.xclient.window = viewport->viewWindow; - code = write(viewport->viewOut,&viewCommand,intSize); + write(viewport->viewOut,&viewCommand,intSize); switch (viewCommand) { case rotate: f1 = get_float(spadSock); f2 = get_float(spadSock); - code = write(viewport->viewOut,&f1,floatSize); - code = write(viewport->viewOut,&f2,floatSize); + write(viewport->viewOut,&f1,floatSize); + write(viewport->viewOut,&f2,floatSize); break; case zoom: f1 = get_float(spadSock); - code = write(viewport->viewOut,&f1,floatSize); + write(viewport->viewOut,&f1,floatSize); break; case zoomx: f1 = get_float(spadSock); f2 = get_float(spadSock); f3 = get_float(spadSock); - code = write(viewport->viewOut,&f1,floatSize); - code = write(viewport->viewOut,&f2,floatSize); - code = write(viewport->viewOut,&f3,floatSize); + write(viewport->viewOut,&f1,floatSize); + write(viewport->viewOut,&f2,floatSize); + write(viewport->viewOut,&f3,floatSize); break; case translate: f1 = get_float(spadSock); f2 = get_float(spadSock); - code = write(viewport->viewOut,&f1,floatSize); - code = write(viewport->viewOut,&f2,floatSize); + write(viewport->viewOut,&f1,floatSize); + write(viewport->viewOut,&f2,floatSize); break; case modifyPOINT: @@ -111,16 +110,16 @@ funView3D(int viewCommand) f2 = get_float(spadSock); f3 = get_float(spadSock); f4 = get_float(spadSock); - code = write(viewport->viewOut,&i1,intSize); - code = write(viewport->viewOut,&f1,floatSize); - code = write(viewport->viewOut,&f2,floatSize); - code = write(viewport->viewOut,&f3,floatSize); - code = write(viewport->viewOut,&f4,floatSize); + write(viewport->viewOut,&i1,intSize); + write(viewport->viewOut,&f1,floatSize); + write(viewport->viewOut,&f2,floatSize); + write(viewport->viewOut,&f3,floatSize); + write(viewport->viewOut,&f4,floatSize); break; case hideControl: i1 = get_int(spadSock); - code = write(viewport->viewOut,&i1,intSize); + write(viewport->viewOut,&i1,intSize); break; case axesOnOff: @@ -129,34 +128,34 @@ funView3D(int viewCommand) case clipRegionOnOff: case clipSurfaceOnOff: i1 = get_int(spadSock); - code = write(viewport->viewOut,&i1,intSize); + write(viewport->viewOut,&i1,intSize); break; case eyeDistanceData: case hitherPlaneData: f1 = get_float(spadSock); - code = write(viewport->viewOut,&f1,floatSize); + write(viewport->viewOut,&f1,floatSize); break; case colorDef: i1 = get_int(spadSock); i2 = get_int(spadSock); - code = write(viewport->viewOut,&i1,intSize); - code = write(viewport->viewOut,&i2,intSize); + write(viewport->viewOut,&i1,intSize); + write(viewport->viewOut,&i2,intSize); break; case moveViewport: i1 = get_int(spadSock); i2 = get_int(spadSock); - code = write(viewport->viewOut,&i1,intSize); - code = write(viewport->viewOut,&i2,intSize); + write(viewport->viewOut,&i1,intSize); + write(viewport->viewOut,&i2,intSize); break; case resizeViewport: i1 = get_int(spadSock); i2 = get_int(spadSock); - code = write(viewport->viewOut,&i1,intSize); - code = write(viewport->viewOut,&i2,intSize); + write(viewport->viewOut,&i1,intSize); + write(viewport->viewOut,&i2,intSize); break; case transparent: @@ -168,56 +167,56 @@ funView3D(int viewCommand) f1 = get_float(spadSock); f2 = get_float(spadSock); f3 = get_float(spadSock); - code = write(viewport->viewOut,&f1,floatSize); - code = write(viewport->viewOut,&f2,floatSize); - code = write(viewport->viewOut,&f3,floatSize); + write(viewport->viewOut,&f1,floatSize); + write(viewport->viewOut,&f2,floatSize); + write(viewport->viewOut,&f3,floatSize); break; case translucenceDef: f1 = get_float(spadSock); - code = write(viewport->viewOut,&f1,floatSize); + write(viewport->viewOut,&f1,floatSize); break; case changeTitle: s1 = get_string(spadSock); i1 = strlen(s1); - code = write(viewport->viewOut,&i1,intSize); - code = write(viewport->viewOut,s1,i1); + write(viewport->viewOut,&i1,intSize); + write(viewport->viewOut,s1,i1); break; case writeView: s1 = get_string(spadSock); i1 = strlen(s1); - code = write(viewport->viewOut,&i1,intSize); - code = write(viewport->viewOut,s1,i1); + write(viewport->viewOut,&i1,intSize); + write(viewport->viewOut,s1,i1); /* write out the types of things to be written */ i2 = get_int(spadSock); - code = write(viewport->viewOut,&i2,intSize); + write(viewport->viewOut,&i2,intSize); while (i2) { i2 = get_int(spadSock); - code = write(viewport->viewOut,&i2,intSize); + write(viewport->viewOut,&i2,intSize); } break; case diagOnOff: i1 = get_int(spadSock); - code = write(viewport->viewOut,&i1,intSize); + write(viewport->viewOut,&i1,intSize); break; case outlineOnOff: i1 = get_int(spadSock); - code = write(viewport->viewOut,&i1,intSize); + write(viewport->viewOut,&i1,intSize); break; case spadPressedAButton: i1 = get_int(spadSock); - code = write(viewport->viewOut,&i1,intSize); + write(viewport->viewOut,&i1,intSize); break; } /* switch */ /*** get acknowledge from viewport */ - code = readViewport(viewport,&acknow,intSize); + readViewport(viewport,&acknow,intSize); send_int(spadSock,1); /* acknowledge to spad */ } else { /* if (viewport) */ send_int(spadSock,-1); /* send error value in acknowledge to spad */ diff --git a/src/lib/XSpadFill.c b/src/lib/XSpadFill.c index f4408db9..566c57ce 100644 --- a/src/lib/XSpadFill.c +++ b/src/lib/XSpadFill.c @@ -1,7 +1,7 @@ /* Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd. All rights reserved. - Copyright (C) 2007-2010, Gabriel Dos Reis. + Copyright (C) 2007-2013, Gabriel Dos Reis. All rights reserved. Redistribution and use in source and binary forms, with or without @@ -83,7 +83,6 @@ int XInitSpadFill(Display *dsply, int scr, Colormap * mapOfColors, int * hues, int *solid, int * dithered, int * shades) { - int maxDither; XColor BlackColor, WhiteColor; XColor retColor; int maxSolid; @@ -120,7 +119,6 @@ XInitSpadFill(Display *dsply, int scr, Colormap * mapOfColors, int * hues, if (DisplayPlanes(dsply, scr) < 8) { *dithered = totalDithered = maxGreyShade = XInitShades(dsply, scr); - maxDither = *dithered - 1; spadColors = (unsigned long *) malloc(2 * sizeof(unsigned long)); spadColors[0] = BlackColor.pixel; spadColors[1] = WhiteColor.pixel; @@ -137,7 +135,6 @@ XInitSpadFill(Display *dsply, int scr, Colormap * mapOfColors, int * hues, *dithered = totalDithered = XInitDither(dsply, scr, stippleGC, black, white); - maxDither = *dithered - 1; if ((maxSolid = makeColors(dsply, scr, &cmap, &spadColors, &totalSolid)) > 0) { *solid = totalSolid + 2; @@ -152,7 +149,6 @@ XInitSpadFill(Display *dsply, int scr, Colormap * mapOfColors, int * hues, * makeColors managed to fail -- switch to mono */ *dithered = totalDithered = maxGreyShade = XInitShades(dsply, scr); - maxDither = *dithered - 1; spadColors = (unsigned long *) malloc(2 * sizeof(unsigned long)); spadColors[0] = BlackColor.pixel; spadColors[1] = WhiteColor.pixel; diff --git a/src/lib/fnct_key.c b/src/lib/fnct_key.c index 09083999..f70bc430 100644 --- a/src/lib/fnct_key.c +++ b/src/lib/fnct_key.c @@ -1,7 +1,7 @@ /* Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd. All rights reserved. - Copyright (C) 2007-2011 Gabriel Dos Reis. + Copyright (C) 2007-2013 Gabriel Dos Reis. All rights reserved. Redistribution and use in source and binary forms, with or without @@ -103,7 +103,6 @@ define_function_keys(void) int key; int fd; char type; - int length; /** lets initialize the key pointers **/ for (key = 0; key < 13; key++) @@ -117,7 +116,7 @@ define_function_keys(void) else { /*** If so, then get the key bindings **/ while ((key = get_key(fd, &type))) { - length = get_str(fd, string); + get_str(fd, string); switch (type) { case 'D': if (key == 12) { @@ -228,7 +227,6 @@ handle_function_key(int key,int chann) int count, fd; int amount = strlen(function_key[key].str); int id; - int save_echo; /*** This procedure takes the character at in_buff[num_proc] and adds it to the buffer. It first checks to see if we should be inserting @@ -335,7 +333,6 @@ handle_function_key(int key,int chann) buff_pntr = curr_pntr = 0; /** reset the ring pointer **/ current = NULL; - save_echo = ECHOIT; ECHOIT = 0; while ((num_read = read(fd, in_buff, MAXLINE))) { do_reading(); diff --git a/src/lib/openpty.c b/src/lib/openpty.c index f737802a..5918aa7a 100644 --- a/src/lib/openpty.c +++ b/src/lib/openpty.c @@ -1,7 +1,7 @@ /* Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd. All rights reserved. - Copyright (C) 2007-2009, Gabriel Dos Reis. + Copyright (C) 2007-2013, Gabriel Dos Reis. All rights reserved. Redistribution and use in source and binary forms, with or without @@ -60,7 +60,24 @@ #include "openpty.h" -static void makeNextPtyNames(char * , char * ); +#if defined(SUNplatform) +static void +makeNextPtyNames(char *cont,char * serv) +{ + static int channelNo = 0; + static char group[] = "pqrstuvwxyzPQRST"; + static int groupNo = 0; + + sprintf(cont, "/dev/pty%c%x", group[groupNo], channelNo); + sprintf(serv, "/dev/tty%c%x", group[groupNo], channelNo); + channelNo++; /* try next */ + if (channelNo == 16) { /* move to new group */ + channelNo = 0; + groupNo++; + if (groupNo == 16) groupNo = 0; /* recycle */ + } +} +#endif /* @@ -149,21 +166,3 @@ extern char* ptsname(int); } -static void -makeNextPtyNames(char *cont,char * serv) -{ -#if defined(SUNplatform) - static int channelNo = 0; - static char group[] = "pqrstuvwxyzPQRST"; - static int groupNo = 0; - - sprintf(cont, "/dev/pty%c%x", group[groupNo], channelNo); - sprintf(serv, "/dev/tty%c%x", group[groupNo], channelNo); - channelNo++; /* try next */ - if (channelNo == 16) { /* move to new group */ - channelNo = 0; - groupNo++; - if (groupNo == 16) groupNo = 0; /* recycle */ - } -#endif -} diff --git a/src/lib/pixmap.c b/src/lib/pixmap.c index 2d321743..d0ad2097 100644 --- a/src/lib/pixmap.c +++ b/src/lib/pixmap.c @@ -1,7 +1,7 @@ /* Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd. All rights reserved. - Copyright (C) 2007-2011, Gabriel Dos Reis. + Copyright (C) 2007-2013, Gabriel Dos Reis. All rights reserved. Redistribution and use in source and binary forms, with or without @@ -271,7 +271,6 @@ read_pixmap_file(Display *display, int screen, char *filename, { XpmAttributes attr; XImage *xireturn; - int status; attr.valuemask = 0; @@ -289,7 +288,7 @@ read_pixmap_file(Display *display, int screen, char *filename, attr.valuemask |= XpmAllocCloseColors; /* we don't allocate close colors*/ - status=XpmReadFileToImage(display,filename,xi,&xireturn, &attr ); + XpmReadFileToImage(display,filename,xi,&xireturn, &attr ); *width= (*xi)->width; *height=(*xi)->height; #ifdef DEBUG @@ -306,12 +305,11 @@ write_pixmap_file(Display *dsp, int scr, char *fn, Window wid, int x, int y, int width,int height) { XImage *xi; - int status; /* reads image structure in ZPixmap format */ xi = XGetImage(dsp, wid, x, y, width, height, AllPlanes, ZPixmap); if (xi==0) return ; - status=XpmWriteFileFromImage(dsp,fn,xi,0,0); + XpmWriteFileFromImage(dsp,fn,xi,0,0); } diff --git a/src/lib/sockio-c.c b/src/lib/sockio-c.c index 662768f2..d44eb818 100644 --- a/src/lib/sockio-c.c +++ b/src/lib/sockio-c.c @@ -1,7 +1,7 @@ /* Copyright (c) 1991-2002, The Numerical Algorithms Group Ltd. All rights reserved. - Copyright (C) 2007-2010, Gabriel Dos Reis. + Copyright (C) 2007-2013, Gabriel Dos Reis. All rights reserved. Redistribution and use in source and binary forms, with or without @@ -846,9 +846,8 @@ sock_send_floats(int purpose, const double *vals, int num) OPENAXIOM_C_EXPORT double get_float(openaxiom_sio *sock) { - int val; double num = -1.0; - val = fill_buf(sock, byte_address(num), sizeof(double), "get_float"); + fill_buf(sock, byte_address(num), sizeof(double), "get_float"); #ifdef DEBUG fprintf(stderr,"get_float: received %f\n",num); #endif |