aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2022-10-28 04:00:00 +0200
committerIgor Pashev <pashev.igor@gmail.com>2022-10-29 11:57:20 +0200
commit8df721df25864f89772c58a4486314855bf1a37e (patch)
tree7c89253922a8f09b964876b438056e2655cc9062
parent467b6fb9eeb12d064c1f6fa4d7f87638e49685ca (diff)
downloadopen-axiom-8df721df25864f89772c58a4486314855bf1a37e.tar.gz
Fix some compiler warnings & buffer overflows
-rw-r--r--src/clef/edible.c1
-rw-r--r--src/etc/asq.c.pamphlet4
-rw-r--r--src/graph/include/view.h3
-rw-r--r--src/graph/view2D/header2.h2
-rw-r--r--src/graph/view2D/process2d.c6
-rw-r--r--src/graph/view2D/write2d.c46
-rw-r--r--src/graph/view3D/header.h7
-rw-r--r--src/graph/view3D/lighting3d.c20
-rw-r--r--src/graph/view3D/process3d.c4
-rw-r--r--src/graph/view3D/smoothShade3d.c2
-rw-r--r--src/graph/view3D/static.h22
-rw-r--r--src/graph/view3D/volume3d.c11
-rw-r--r--src/graph/view3D/write3d.c42
-rw-r--r--src/graph/viewAlone/spoon2D.c9
-rw-r--r--src/graph/viewAlone/spoonComp.c5
-rw-r--r--src/graph/viewman/fun2D.c2
-rw-r--r--src/graph/viewman/fun3D.c2
-rw-r--r--src/hyper/ReadBitmap.c2
-rw-r--r--src/hyper/dialog.c29
-rw-r--r--src/hyper/extent1.c3
-rw-r--r--src/hyper/htadd.c2
-rw-r--r--src/hyper/hthits.c2
-rw-r--r--src/hyper/htinp.c2
-rw-r--r--src/hyper/initx.c2
-rw-r--r--src/hyper/keyin.c4
-rw-r--r--src/hyper/lex.c2
-rw-r--r--src/hyper/macro.c3
-rw-r--r--src/hyper/parse-aux.c4
-rw-r--r--src/hyper/parse-input.c2
-rw-r--r--src/hyper/parse-types.c4
-rw-r--r--src/hyper/parse.c8
-rw-r--r--src/hyper/show-types.c2
-rw-r--r--src/hyper/spadint.c13
-rw-r--r--src/include/edin.h2
-rw-r--r--src/include/open-axiom/token8
-rw-r--r--src/include/spadcolors.h6
-rw-r--r--src/io/InputFragment.cxx10
-rw-r--r--src/lib/cfuns-c.cxx5
-rw-r--r--src/lib/edin.c12
-rw-r--r--src/lib/prt.c8
-rw-r--r--src/lib/sockio-c.cxx2
-rw-r--r--src/lib/wct.c2
-rw-r--r--src/rt/Lisp.cc2
-rw-r--r--src/sman/session.c2
-rw-r--r--src/syntax/Parser.cxx18
-rw-r--r--src/utils/command.cc2
46 files changed, 166 insertions, 185 deletions
diff --git a/src/clef/edible.c b/src/clef/edible.c
index 7a6c4826..c3022060 100644
--- a/src/clef/edible.c
+++ b/src/clef/edible.c
@@ -69,7 +69,6 @@ using namespace OpenAxiom;
#define Cursor_shape(x)
-static void check_flip(void);
static void catch_signals(void);
static void init_parent(void);
static void set_function_chars(void);
diff --git a/src/etc/asq.c.pamphlet b/src/etc/asq.c.pamphlet
index 44771f36..0ef9c5ef 100644
--- a/src/etc/asq.c.pamphlet
+++ b/src/etc/asq.c.pamphlet
@@ -450,7 +450,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/* asq is a mini browser for the AXIOM databases */
-#define VERSION 7
+#define ASQ_VERSION 7
/* 040206007 tpd fix anal compiler warnings */
/* 030710006 tpd remove share directory */
/* 940112005 tpd cleanup of printinfo */
@@ -1448,7 +1448,7 @@ int pprintcond(int seekpt,char *path);
printf("searchkey can be either a domain or its abbreviation.\n");
printf("\n e.g. %s -so Integer\n",arg);
printf(" will give the source file name written to stdout\n");
- printf(" (Version %d)\n",VERSION);
+ printf(" (Version %d)\n", ASQ_VERSION);
return(0);
}
diff --git a/src/graph/include/view.h b/src/graph/include/view.h
index 5d77d46f..6df571a0 100644
--- a/src/graph/include/view.h
+++ b/src/graph/include/view.h
@@ -34,8 +34,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/* This file is to be included by all the viewport files */
#define check(code) checker(code,__LINE__,"")
-#undef saymem
+#ifndef saymem
#define saymem(a,b,c) saymemWithLine(a,b,c,__LINE__)
+#endif
#define exitWithAck(ACK,ACKsize,i) \
check(write(Socket,&(ACK),sizeof(ACKsize))); exit(i);
#define NIL(type) ((type *)NULL)
diff --git a/src/graph/view2D/header2.h b/src/graph/view2D/header2.h
index c7d63985..bbd11a10 100644
--- a/src/graph/view2D/header2.h
+++ b/src/graph/view2D/header2.h
@@ -228,7 +228,7 @@ typedef struct _buttonStruct {
typedef struct _controlPanelStruct {
int numOfButtons;
Window controlWindow,messageWindow,colormapWindow;
- char message[40];
+ char message[80];
struct _buttonStruct buttonQueue[maxButtons2D];
} controlPanelStruct;
diff --git a/src/graph/view2D/process2d.c b/src/graph/view2D/process2d.c
index 276948ef..52c326f6 100644
--- a/src/graph/view2D/process2d.c
+++ b/src/graph/view2D/process2d.c
@@ -493,7 +493,7 @@ processEvents(void)
Window whichWindow;
XWindowAttributes graphWindowAttrib;
buttonStruct *controlButton;
- mouseCoord mouseXY;
+ mouseCoord mouseXY = {0.0, 0.0};
int i,
someInt,
mouseW4,
@@ -561,7 +561,7 @@ processEvents(void)
switch(((XEvent *)event)->type) {
case ClientMessage:
- if (event->xclient.data.l[0] == wm_delete_window) {
+ if ((Atom)event->xclient.data.l[0] == wm_delete_window) {
goodbye(-1);
}
else {
@@ -799,7 +799,7 @@ processEvents(void)
for (i=0; i<maxGraphs; i++) {
if (graphStateArray[i].showing && graphStateArray[i].selected) {
if (zoomXON) {
- graphStateArray[i].scaleX *= (1 - mouseXY.y * 0.3);
+ graphStateArray[i].scaleX *= (1 - mouseXY.x * 0.3);
if (graphStateArray[i].scaleX > maxScale)
graphStateArray[i].scaleX = maxScale;
else if (graphStateArray[i].scaleX < minScale)
diff --git a/src/graph/view2D/write2d.c b/src/graph/view2D/write2d.c
index 4431da08..395b821a 100644
--- a/src/graph/view2D/write2d.c
+++ b/src/graph/view2D/write2d.c
@@ -47,33 +47,31 @@
#include "Gfun.H1"
-#define numBits (8*sizeof(int))
+#define numBits ((int)(8*sizeof(int)))
int
writeViewport(int thingsToWrite)
{
FILE *viewDataFile;
- char viewDirName[80],
- viewBitmapFilename[80],viewDataFilename[80],command[80];
+ char buf[1024];
int i,j,k,ii;
pointListStruct *aList;
pointStruct *aPoint;
XWindowAttributes vwInfo;
XGetWindowAttributes(dsply,viewport->titleWindow,&vwInfo);
- sprintf(viewDirName,"%s%s",filename,".VIEW");
- sprintf(command,"%s%s%s","rm -r ",viewDirName," > /dev/null 2>&1");
- system(command);
- sprintf(command,"%s%s%s","mkdir ",viewDirName," > /dev/null 2>&1");
- if (system(command)) {
- fprintf(stderr," Error: Cannot create %s\n",viewDirName);
+ sprintf(buf, "rm -f %s.VIEW", filename);
+ system(buf);
+ sprintf(buf, "mkdir %s.VIEW", filename);
+ if (system(buf)) {
+ fprintf(stderr," Error: Cannot create %s.VIEW\n", filename);
return(-1);
} else {
/*** Create the data file ***/
- sprintf(viewDataFilename,"%s%s",viewDirName,"/data");
- if ((viewDataFile = fopen(viewDataFilename,"w")) == NULL) {
- fprintf(stderr," Error: Cannot create %s\n",viewDataFilename);
+ sprintf(buf,"%s.VIEW/data", filename);
+ if ((viewDataFile = fopen(buf,"w")) == NULL) {
+ fprintf(stderr," Error: Cannot create %s\n", buf);
perror("fopen");
return(-1);
} else {
@@ -101,9 +99,9 @@ writeViewport(int thingsToWrite)
fclose(viewDataFile);
for (i=0; i<maxGraphs; i++) {
if (graphArray[i].key) {
- sprintf(viewDataFilename,"%s%s%d",viewDirName,"/graph",i);
- if ((viewDataFile = fopen(viewDataFilename,"w")) == NULL) {
- fprintf(stderr," Error: Cannot create %s\n",viewDataFilename);
+ sprintf(buf,"%s.VIEW/graph%d", filename, i);
+ if ((viewDataFile = fopen(buf,"w")) == NULL) {
+ fprintf(stderr," Error: Cannot create %s\n", buf);
perror("fopen");
return(-1);
} else {
@@ -143,37 +141,37 @@ writeViewport(int thingsToWrite)
switch (ii) {
case Pixmap:
/*** Create the pixmap (bitmaps need leaf name) ***/
- sprintf(viewBitmapFilename,"%s%s",viewDirName,"/image.xpm");
+ sprintf(buf,"%s.VIEW/image.xpm", filename);
XGetWindowAttributes(dsply,viewport->viewWindow,&vwInfo);
- write_pixmap_file(dsply,scrn,viewBitmapFilename,
+ write_pixmap_file(dsply,scrn,buf,
viewport->titleWindow,0,0,vwInfo.width,
vwInfo.height+titleHeight);
break;
case Bitmap:
/*** Create the bitmap (bitmaps need leaf name) ***/
- sprintf(viewBitmapFilename,"%s%s",viewDirName,"/image.bm");
+ sprintf(buf,"%s.VIEW/image.bm", filename);
XGetWindowAttributes(dsply,viewport->viewWindow,&vwInfo);
- XWriteBitmapFile(dsply,viewBitmapFilename,
+ XWriteBitmapFile(dsply,buf,
viewport->titleWindow,vwInfo.width,
vwInfo.height+vwInfo.border_width+20,-1,-1);
break;
case Image:
/*** Create the pixmap (bitmaps need leaf name) ***/
- sprintf(viewBitmapFilename,"%s%s",viewDirName,"/image.xpm");
+ sprintf(buf,"%s.VIEW/image.xpm", filename);
XResizeWindow(dsply,viewport->titleWindow,300,300+titleHeight);
XResizeWindow(dsply,viewport->viewWindow,300,300);
XGetWindowAttributes(dsply,viewport->viewWindow,&vwInfo);
drawViewport(Xoption);
writeTitle();
- write_pixmap_file(dsply,scrn,viewBitmapFilename,
+ write_pixmap_file(dsply,scrn,buf,
viewport->titleWindow,0,0,vwInfo.width,
vwInfo.height+titleHeight);
/*** Create the bitmap (bitmaps need leaf name) ***/
mono = 1;
drawViewport(Xoption);
writeTitle();
- sprintf(viewBitmapFilename,"%s%s%s",viewDirName,"/","image.bm");
- XWriteBitmapFile(dsply,viewBitmapFilename,
+ sprintf(buf,"%s.VIEW/image.bm", filename);
+ XWriteBitmapFile(dsply,buf,
viewport->titleWindow,vwInfo.width,
vwInfo.height+vwInfo.border_width+20,-1,-1);
mono = 0;
@@ -181,7 +179,7 @@ writeViewport(int thingsToWrite)
case Postscript:
/*** Create postscript output for viewport (in axiom2D.ps) ***/
- sprintf(PSfilename,"%s%s",viewDirName,"/axiom2D.ps");
+ sprintf(PSfilename,"%s.VIEW/axiom2D.ps", filename);
if (PSInit(viewport->viewWindow,viewport->titleWindow) == psError)
return (-1);
drawViewport(PSoption); /* write new script file in /tmp */
diff --git a/src/graph/view3D/header.h b/src/graph/view3D/header.h
index 53dd24ab..e029f12b 100644
--- a/src/graph/view3D/header.h
+++ b/src/graph/view3D/header.h
@@ -134,19 +134,12 @@
/*** colors ***/
/******************************/
-#define totalHuesConst 27
-
-#define hueEnd 360
-
-#undef hueStep
-#define hueStep (hueEnd/totalHuesConst)
#define black BlackPixel(dsply,scrn)
#define white WhitePixel(dsply,scrn)
#define numPlanes 1
#define numColors 10
#define startColor 0
-#define maxColors (DisplayCells(dsply,scrn)-1)
#define maxPlanes (DefaultVisual((dpy),(scr))->bits_per_rgb)
/**********************************/
diff --git a/src/graph/view3D/lighting3d.c b/src/graph/view3D/lighting3d.c
index 666c708c..5d0b5489 100644
--- a/src/graph/view3D/lighting3d.c
+++ b/src/graph/view3D/lighting3d.c
@@ -79,6 +79,26 @@
#define arrowHead (control->buttonQueue[lightTranslucent].buttonX + 5)
static viewTriple point0 = {0,0,0};
+static float labels[basicScreen][7] = {
+ {105,0,4,106,0,3,labelColor}, /* script x label - 4 segments */
+ {106,0,3,112,0,10,labelColor},
+ {112,0,10,114,0,9,labelColor},
+ {106,0,10,113,0,3,labelColor},
+ {0,106,9,0,107,10,labelColor}, /* script y label - 7 segments */
+ {0,107,10,0,107,6,labelColor},
+ {0,107,6,0,113,5,labelColor},
+ {0,113,10,0,113,-3,labelColor},
+ {0,113,-3,0,111,-5,labelColor},
+ {0,111,-5,0,110,-1,labelColor},
+ {0,110,-1,0,114,3,labelColor},
+ {0,5,114,0,6,115,labelColor}, /* script z label - 8 segments */
+ {0,6,115,0,11,116,labelColor},
+ {0,11,116,0,12,113,labelColor},
+ {0,12,113,0,10,111,labelColor},
+ {0,10,111,0,11,110,labelColor},
+ {0,11,110,0,11,103,labelColor},
+ {0,11,103,0,9,102,labelColor},
+ {0,9,102,0,9,105,labelColor}};
/***************************
* int makeLightingPanel() *
diff --git a/src/graph/view3D/process3d.c b/src/graph/view3D/process3d.c
index 5c5e7d68..f5adbf9e 100644
--- a/src/graph/view3D/process3d.c
+++ b/src/graph/view3D/process3d.c
@@ -856,7 +856,7 @@ processEvents(void)
XEvent *event, tempEvent;
Window whichWindow;
buttonStruct *controlButton;
- mouseCoord mouseXY, linearMouseXY;
+ mouseCoord mouseXY = {0.0, 0.0}, linearMouseXY = {0.0, 0.0};
int someInt, mouseW4, mouseH4;
int toggleReady =yes;
int checkButton = no;
@@ -939,7 +939,7 @@ processEvents(void)
switch(((XEvent *)event)->type) {
case ClientMessage:
- if (event->xclient.data.l[0] == wm_delete_window) {
+ if ((Atom)event->xclient.data.l[0] == wm_delete_window) {
goodbye(-1);
}
else {
diff --git a/src/graph/view3D/smoothShade3d.c b/src/graph/view3D/smoothShade3d.c
index 5d09a4ed..b794f210 100644
--- a/src/graph/view3D/smoothShade3d.c
+++ b/src/graph/view3D/smoothShade3d.c
@@ -753,7 +753,7 @@ showAxesLabels(int dFlag)
else GSetForeground(GC9991,psBlack,dFlag);
/* axes label for X */
- if ((int)axesZ[0][0] >= (int)axesZ[0][2]) {
+ if ((int)axesZ[0][0] >= (int)axesZ[0][1]) {
if (axesXY[0][2] < axesXY[0][0]) xcoord2 = axesXY[0][2]-5;
else xcoord2 = axesXY[0][2] + 5;
if (axesXY[0][3] < axesXY[0][1]) ycoord2 = axesXY[0][3]-5;
diff --git a/src/graph/view3D/static.h b/src/graph/view3D/static.h
index 201f272b..8175c642 100644
--- a/src/graph/view3D/static.h
+++ b/src/graph/view3D/static.h
@@ -40,24 +40,4 @@ static float axes[3][6] = {{-117,0,0,117,0,0}, /* x axis */
{0,-117,0,0,117,0}, /* y axis */
{0,0,-117,0,0,117}}; /* z axis */
-/* text labels are currently used */
-static float labels[basicScreen][7] = {
- {105,0,4,106,0,3,labelColor}, /* script x label - 4 segments */
- {106,0,3,112,0,10,labelColor},
- {112,0,10,114,0,9,labelColor},
- {106,0,10,113,0,3,labelColor},
- {0,106,9,0,107,10,labelColor}, /* script y label - 7 segments */
- {0,107,10,0,107,6,labelColor},
- {0,107,6,0,113,5,labelColor},
- {0,113,10,0,113,-3,labelColor},
- {0,113,-3,0,111,-5,labelColor},
- {0,111,-5,0,110,-1,labelColor},
- {0,110,-1,0,114,3,labelColor},
- {0,5,114,0,6,115,labelColor}, /* script z label - 8 segments */
- {0,6,115,0,11,116,labelColor},
- {0,11,116,0,12,113,labelColor},
- {0,12,113,0,10,111,labelColor},
- {0,10,111,0,11,110,labelColor},
- {0,11,110,0,11,103,labelColor},
- {0,11,103,0,9,102,labelColor},
- {0,9,102,0,9,105,labelColor}};
+
diff --git a/src/graph/view3D/volume3d.c b/src/graph/view3D/volume3d.c
index 348a39d6..87bce529 100644
--- a/src/graph/view3D/volume3d.c
+++ b/src/graph/view3D/volume3d.c
@@ -698,7 +698,7 @@ void
drawVolumePanel (void)
{
- int i,strlength;
+ size_t i,strlength;
/* Draw some lines for volume panel. */
@@ -733,13 +733,16 @@ drawVolumePanel (void)
100,100,Xoption);
- for (i=0; i<strlen(clipMess); i++)
+ strlength = strlen(clipMess);
+ for (i=0; i<strlength; i++)
GDrawString(trashGC,volumeWindow,clipMessX,clipMessY + i*clipMessDy,
&(clipMess[i]),1,Xoption);
- for (i=0; i<strlen(eyeMess1); i++)
+ strlength = strlen(eyeMess1);
+ for (i=0; i<strlength; i++)
GDrawString(trashGC,volumeWindow,eyeMess1X,eyeMess1Y + i*eyeMess1Dy,
&(eyeMess1[i]),1,Xoption);
- for (i=0; i<strlen(eyeMess2); i++)
+ strlength = strlen(eyeMess2);
+ for (i=0; i<strlength; i++)
GDrawString(trashGC,volumeWindow,eyeMess2X,eyeMess2Y + i*eyeMess2Dy,
&(eyeMess2[i]),1,Xoption);
diff --git a/src/graph/view3D/write3d.c b/src/graph/view3D/write3d.c
index 724fe5cc..7eeaf15b 100644
--- a/src/graph/view3D/write3d.c
+++ b/src/graph/view3D/write3d.c
@@ -51,7 +51,7 @@
#include "all_3d.H1"
/* upper limit as to how many kinds of files could be written (numBits-1) */
-#define numBits (8*sizeof(int))
+#define numBits ((int)(8*sizeof(int)))
#define StellarColors 9
int
@@ -64,25 +64,21 @@ writeViewport (int thingsToWrite)
viewTriple *aPt;
XWindowAttributes vwInfo;
FILE *viewDataFile;
- char viewDirName[80], viewDataFilename[80],
- viewBitmapFilename[80], viewPixmapFilename[80],
- command[80];
+ char buf[1024];
XGetWindowAttributes(dsply,viewport->titleWindow,&vwInfo);
- sprintf(viewDirName,"%s%s",filename,".VIEW");
- sprintf(command,"%s%s%s","rm -r ",viewDirName," > /dev/null 2>&1");
- system(command);
- sprintf(command,"%s%s%s","mkdir ",viewDirName," > /dev/null 2>&1");
- system(command);
- if (0) {
- fprintf(stderr," Error: Cannot create %s\n",viewDirName);
+ sprintf(buf, "rm -f %s.VIEW", filename);
+ system(buf);
+ sprintf(buf, "mkdir %s.VIEW", filename);
+ if (system(buf)) {
+ fprintf(stderr," Error: Cannot create %s.VIEW\n", filename);
return(-1);
} else {
/*** Create the data file ***/
- sprintf(viewDataFilename,"%s%s",viewDirName,"/data");
- if ((viewDataFile = fopen(viewDataFilename,"w")) == NULL) {
- fprintf(stderr," Error: Cannot create %s\n",viewDataFilename);
+ sprintf(buf,"%s.VIEW/data", filename);
+ if ((viewDataFile = fopen(buf,"w")) == NULL) {
+ fprintf(stderr," Error: Cannot create %s\n", buf);
perror("fopen");
return(-1);
} else {
@@ -140,18 +136,18 @@ writeViewport (int thingsToWrite)
switch (ii) {
case Bitmap:
/*** Create the pixmap (bitmaps need leaf name) ***/
- sprintf(viewBitmapFilename,"%s%s%s",viewDirName,"/","image.bm");
+ sprintf(buf,"%s.VIEW/image.bm", filename);
XGetWindowAttributes(dsply,viewport->viewWindow,&vwInfo);
- XWriteBitmapFile(dsply,viewBitmapFilename,
+ XWriteBitmapFile(dsply,buf,
viewport->titleWindow,vwInfo.width,
vwInfo.height+vwInfo.border_width+20,-1,-1);
break;
case Pixmap:
/*** Create the pixmap (bitmaps need leaf name) ***/
- sprintf(viewPixmapFilename,"%s%s%s",viewDirName,"/","image.xpm");
+ sprintf(buf,"%s.VIEW/image.xpm", filename);
XGetWindowAttributes(dsply,viewport->viewWindow,&vwInfo);
- write_pixmap_file(dsply,scrn,viewPixmapFilename,
+ write_pixmap_file(dsply,scrn,buf,
viewport->titleWindow,0,0,vwInfo.width,
vwInfo.height+titleHeight);
break;
@@ -159,7 +155,7 @@ writeViewport (int thingsToWrite)
case Image:
/*** Create the image (bitmaps need leaf name) ***/
writeImage = yes;
- sprintf(viewPixmapFilename,"%s%s%s",viewDirName,"/","image.xpm");
+ sprintf(buf,"%s.VIEW/image.xpm", filename);
XResizeWindow(dsply,viewport->titleWindow,300,300+titleHeight);
XResizeWindow(dsply,viewport->viewWindow,300,300);
viewport->hueTop = totalHues-1; viewport->hueOffset = 0;
@@ -174,7 +170,7 @@ writeViewport (int thingsToWrite)
drawViewport(Xoption);
writeTitle();
XGetWindowAttributes(dsply,viewport->viewWindow,&vwInfo);
- write_pixmap_file(dsply,scrn,viewPixmapFilename,
+ write_pixmap_file(dsply,scrn,buf,
viewport->titleWindow,0,0,vwInfo.width,
vwInfo.height+titleHeight);
viewport->monoOn = 1;
@@ -182,8 +178,8 @@ writeViewport (int thingsToWrite)
firstTime = 1;
drawViewport(Xoption);
writeTitle();
- sprintf(viewBitmapFilename,"%s%s%s",viewDirName,"/","image.bm");
- XWriteBitmapFile(dsply,viewBitmapFilename,
+ sprintf(buf,"%s.VIEW/image.bm", filename);
+ XWriteBitmapFile(dsply,buf,
viewport->titleWindow,vwInfo.width,
vwInfo.height+vwInfo.border_width+20,-1,-1);
@@ -192,7 +188,7 @@ writeViewport (int thingsToWrite)
case Postscript:
/*** Create postscript output for viewport (in axiom3D.ps) ***/
- sprintf(PSfilename,"%s%s",viewDirName,"/axiom3D.ps");
+ sprintf(PSfilename,"%s.VIEW/axiom3D.ps", filename);
if (PSInit(viewport->viewWindow,viewport->titleWindow) == psError)
return(-1);
drawViewport(PSoption); /* write new script file in /tmp */
diff --git a/src/graph/viewAlone/spoon2D.c b/src/graph/viewAlone/spoon2D.c
index 00f46e31..912d834b 100644
--- a/src/graph/viewAlone/spoon2D.c
+++ b/src/graph/viewAlone/spoon2D.c
@@ -58,7 +58,7 @@ spoonView2D(void)
{
int i,code,pipe0[2],pipe1[2],there;
- char envAXIOM[100],runView[100];
+ char runView[100];
sprintf(errorStr,"%s","creating pipes");
check(pipe(pipe0));
@@ -84,8 +84,7 @@ spoonView2D(void)
close(pipe1[1]);
printf("(spoon2D child) start the TwoDimensionalViewport process\n");
sprintf(errorStr,"%s","(viewAlone) execution of the TwoDimensionalViewport process");
- sprintf(envAXIOM,"%s",oa_getenv("AXIOM"));
- sprintf(runView,"%s%s",envAXIOM,"/lib/view2D");
+ sprintf(runView,"%s/lib/view2D",oa_getenv("AXIOM"));
check(execl(runView,runView, (char*)NULL));
fprintf(stderr,"Could not execute view2D! Check that view2D is on your path variable.\n");
exit(-1);
@@ -215,7 +214,7 @@ makeView2DFromFileData(view2DStruct *doView2D)
int i,j,k;
char title[256];
FILE *graphFile;
- char graphFilename[256];
+ char graphFilename[512];
pointListStruct *aList;
pointStruct *aPoint;
printf("(spoon2D makeView2DFromFileData)\n");
@@ -280,7 +279,7 @@ makeView2DFromFileData(view2DStruct *doView2D)
for (i=0; i<maxGraphs; i++) {
if (graphArray[i].key) {
/** OPEN FILE FOR GRAPHS **/
- sprintf(graphFilename,"%s%s%d",pathname,"/graph",i);
+ sprintf(graphFilename,"%s/graph%d",pathname,i);
if ((graphFile = fopen(graphFilename,"r")) == NULL) {
fprintf(stderr," Error: Cannot find the file %s\n",graphFilename);
perror("fopen");
diff --git a/src/graph/viewAlone/spoonComp.c b/src/graph/viewAlone/spoonComp.c
index 5714d04f..0b3be3ba 100644
--- a/src/graph/viewAlone/spoonComp.c
+++ b/src/graph/viewAlone/spoonComp.c
@@ -60,7 +60,7 @@ spoonView3D(int type)
{
int i,j,k,code,pipe0[2],pipe1[2];
- char envAXIOM[100],runView[100];
+ char runView[100];
LLPoint *anLLPoint;
LPoint *anLPoint;
int *anIndex;
@@ -86,8 +86,7 @@ spoonView3D(int type)
sprintf(errorStr,"%s",
"(viewAlone) execution of the ThreeDimensionalViewport process");
- sprintf(envAXIOM,"%s",oa_getenv("AXIOM"));
- sprintf(runView,"%s%s",envAXIOM,"/lib/view3D");
+ sprintf(runView,"%s/lib/view3D",oa_getenv("AXIOM"));
check(execl(runView,runView, (char*) NULL));
fprintf(stderr,"Could not execute view3D!\n");
exit(-1);
diff --git a/src/graph/viewman/fun2D.c b/src/graph/viewman/fun2D.c
index af7724d9..17fedab5 100644
--- a/src/graph/viewman/fun2D.c
+++ b/src/graph/viewman/fun2D.c
@@ -183,7 +183,7 @@ forkView2D(void)
int there;
int pipe0[2], pipe1[2];
- char envAXIOM[100],runView[100];
+ char envAXIOM[100], runView[200];
#ifdef DEBUG
fprintf(stderr,"fun2D:Pipe calls for 2D\n");
diff --git a/src/graph/viewman/fun3D.c b/src/graph/viewman/fun3D.c
index 35f79cc4..93645a29 100644
--- a/src/graph/viewman/fun3D.c
+++ b/src/graph/viewman/fun3D.c
@@ -235,7 +235,7 @@ forkView3D(int typeOfViewport)
int pipe0[2],pipe1[2];
int *anIndex;
- char envAXIOM[100],runView[100];
+ char envAXIOM[100], runView[200];
int j,k;
LLPoint *anLLPoint;
LPoint *anLPoint;
diff --git a/src/hyper/ReadBitmap.c b/src/hyper/ReadBitmap.c
index d1ada58c..ee8e89d2 100644
--- a/src/hyper/ReadBitmap.c
+++ b/src/hyper/ReadBitmap.c
@@ -58,7 +58,6 @@ HTReadBitmapFile(Display *display,int screen,char * filename,
XImage *image;
FILE *fd;
char Line[256], Buff[256];
- int num_chars;
char *ptr;
int rch;
int version;
@@ -134,7 +133,6 @@ HTReadBitmapFile(Display *display,int screen,char * filename,
(image)->bytes_per_line = chars_line = (*width + 7) / 8;
file_chars_line = chars_line + padding;
- num_chars = chars_line * (*height);
file_chars = file_chars_line * (*height);
(image)->data = (char *) halloc((image)->bytes_per_line * (image)->height,
"Read Pixmap--Image data");
diff --git a/src/hyper/dialog.c b/src/hyper/dialog.c
index fe7b78aa..e3ae5122 100644
--- a/src/hyper/dialog.c
+++ b/src/hyper/dialog.c
@@ -88,6 +88,13 @@ static void redraw_win();
static void tough_enter(InputItem * sym);
static void
+strnmov(char *dest, const char *src, size_t n)
+{
+ while (n-- && (*dest++ = *src++));
+}
+
+
+static void
redraw_win()
{
XUnmapSubwindows(gXDisplay, gWindow->fMainWindow);
@@ -248,7 +255,7 @@ move_sym_forward(LineStruct *line, int num, int size, InputItem *sym)
return 1;
}
else {
- strncpy(&line->buffer[num], line->buffer, line->len);
+ strnmov(&line->buffer[num], line->buffer, line->len);
line->len += num;
line->changed = 1;
return 0;
@@ -310,7 +317,7 @@ insert_buffer(char *buffer, InputItem *sym)
else {
line->next->buffer[0] = line->buffer[size - 1];
line->changed = 1;
- strncpy(&line->buffer[line->buff_pntr + 1],
+ strnmov(&line->buffer[line->buff_pntr + 1],
&line->buffer[line->buff_pntr], size - line->buff_pntr - 1);
line->buffer[line->buff_pntr++] = buffer[0];
line->changed = 1;
@@ -346,7 +353,7 @@ insert_buffer(char *buffer, InputItem *sym)
/* we are not the leaders */
newline->buffer[0] = line->buffer[size - 1];
newline->len = 1;
- strncpy(&line->buffer[line->buff_pntr + 1],
+ strnmov(&line->buffer[line->buff_pntr + 1],
&line->buffer[line->buff_pntr], size - line->buff_pntr);
if (line->buff_pntr < size - 1) {
line->buffer[line->buff_pntr++] = buffer[0];
@@ -672,7 +679,7 @@ move_rest_back(LineStruct *line, int size)
return c;
while (line->next != NULL && line->len > size) {
- strncpy(line->buffer, &(line->buffer[1]), size - 1);
+ strnmov(line->buffer, &(line->buffer[1]), size - 1);
line->buffer[size - 1] = line->next->buffer[0];
line->changed = 1;
line = line->next;
@@ -685,7 +692,7 @@ move_rest_back(LineStruct *line, int size)
if (line->len > 0) {
line->changed = 1;
if (line->len > 1)
- strncpy(line->buffer, &(line->buffer[1]), line->len - 1);
+ strnmov(line->buffer, &(line->buffer[1]), line->len - 1);
line->buffer[--line->len] = 0;
if (line->len == 0) {
/* I have to fix the previous line */
@@ -867,7 +874,7 @@ move_back_one_char(InputItem *sym)
else if (line->len > 0) {
d = line->buffer[0];
if (line->len <= sym->size) {
- strncpy(line->buffer, &(line->buffer[1]), line->len - 1);
+ strnmov(line->buffer, &(line->buffer[1]), line->len - 1);
if (c == 0) {
line->len--;
line->buffer[line->len] = 0;
@@ -876,7 +883,7 @@ move_back_one_char(InputItem *sym)
line->buffer[line->len - 1] = c;
}
else {
- strncpy(line->buffer, &(line->buffer[1]), sym->size - 2);
+ strnmov(line->buffer, &(line->buffer[1]), sym->size - 2);
if (c == 0) {
line->buffer[sym->size - 1] = 0;
line->len--;
@@ -905,7 +912,7 @@ move_back_one_char(InputItem *sym)
if (line->len <= sym->size) {
- strncpy(&line->buffer[line->buff_pntr - 1],
+ strnmov(&line->buffer[line->buff_pntr - 1],
&(line->buffer[line->buff_pntr]),
line->len - line->buff_pntr);
if (c == 0)
@@ -914,7 +921,7 @@ move_back_one_char(InputItem *sym)
line->buffer[line->len - 1] = c;
}
else {
- strncpy(&(line->buffer[line->buff_pntr - 1]),
+ strnmov(&(line->buffer[line->buff_pntr - 1]),
&(line->buffer[line->buff_pntr]),
sym->size - line->buff_pntr);
if (c == 0) {
@@ -1040,7 +1047,7 @@ delete_one_char(InputItem *sym)
* exists at the end
*/
if (line->len <= sym->size) {
- strncpy(&line->buffer[line->buff_pntr],
+ strnmov(&line->buffer[line->buff_pntr],
&(line->buffer[line->buff_pntr + 1]),
line->len - line->buff_pntr);
if (c == 0)
@@ -1049,7 +1056,7 @@ delete_one_char(InputItem *sym)
line->buffer[line->len - 1] = c;
}
else {
- strncpy(&(line->buffer[line->buff_pntr]),
+ strnmov(&(line->buffer[line->buff_pntr]),
&(line->buffer[line->buff_pntr + 1]),
sym->size - line->buff_pntr);
if (c == 0) {
diff --git a/src/hyper/extent1.c b/src/hyper/extent1.c
index 0642957c..95766791 100644
--- a/src/hyper/extent1.c
+++ b/src/hyper/extent1.c
@@ -1319,12 +1319,9 @@ compute_header_extent(HyperDocPage *page)
* for the header here
*/
- int ty; /* UNUSED */
-
gExtentRegion = Header;
right_margin_space = non_scroll_right_margin_space;
init_extents();
- ty = text_y = 3 * top_margin + line_height + max(page->title->height, twheight);
gLineNode = page->header->next;
compute_text_extent(page->header->next);
page->header->height = text_height(page->header->next,
diff --git a/src/hyper/htadd.c b/src/hyper/htadd.c
index 21321ae7..b3a5962a 100644
--- a/src/hyper/htadd.c
+++ b/src/hyper/htadd.c
@@ -94,7 +94,7 @@ main(int argc, char **argv)
using namespace OpenAxiom;
/*int i;*/
char db_dir[256]; /* the directory where the db file is */
- char dbfilename[256]; /* the database filename */
+ char dbfilename[512]; /* the database filename */
char *filenames[1000]; /* the files to be added */
char **fnames = filenames;
short flag; /* flag for deleting or adding */
diff --git a/src/hyper/hthits.c b/src/hyper/hthits.c
index 470bf297..4e628b16 100644
--- a/src/hyper/hthits.c
+++ b/src/hyper/hthits.c
@@ -220,7 +220,7 @@ handlePage(FILE* infile, PgInfo* pg)
static char *pgBuf = 0;
static int pgBufSize = 0;
- char *title, *body;
+ char *title = NULL, *body = NULL;
if (pg->size > pgBufSize - 1) {
if (pgBuf)
diff --git a/src/hyper/htinp.c b/src/hyper/htinp.c
index 7799c194..b44047f8 100644
--- a/src/hyper/htinp.c
+++ b/src/hyper/htinp.c
@@ -439,7 +439,7 @@ send_command(char *command,int com_type)
}
else {
FILE *f;
- char name[512], str[512]/*, *c*/;
+ char name[512], str[1024]/*, *c*/;
sprintf(name, "/tmp/hyper%s.input", oa_getenv("SPADNUM"));
f = fopen(name, "w");
diff --git a/src/hyper/initx.c b/src/hyper/initx.c
index 0ee4afa0..c69c2071 100644
--- a/src/hyper/initx.c
+++ b/src/hyper/initx.c
@@ -1018,7 +1018,7 @@ is_it_850(XFontStruct *fontarg)
/* return 1 if it is 850 */
s = XGetAtomName(gXDisplay,(Atom)fontarg->properties[i].card32);
- val = !( strcmp("850",s) * strcmp("ibm-850",s));
+ val = !( strcmp("850",s) && strcmp("ibm-850",s));
XFree(s);
return( val );
}
diff --git a/src/hyper/keyin.c b/src/hyper/keyin.c
index eef07e7b..fa8af8de 100644
--- a/src/hyper/keyin.c
+++ b/src/hyper/keyin.c
@@ -82,7 +82,7 @@ unsigned int UnsupportedModMask = LockMask | ControlMask
static unsigned int
get_modifier_mask(KeySym sym)
{
- unsigned int i, mask;
+ unsigned int mask;
XModifierKeymap *mod;
KeyCode kcode;
const int masks[8] = {
@@ -94,7 +94,7 @@ get_modifier_mask(KeySym sym)
kcode = XKeysymToKeycode(gXDisplay,sym);
if (mod) {
- for (i = 0; i < (8 * mod->max_keypermod); i++){
+ for (int i = 0; i < (8 * mod->max_keypermod); i++){
if (!mod->modifiermap[i]) continue;
else if (kcode == mod->modifiermap[i]){
mask = masks[i / mod->max_keypermod];
diff --git a/src/hyper/lex.c b/src/hyper/lex.c
index d571e6cd..ed281403 100644
--- a/src/hyper/lex.c
+++ b/src/hyper/lex.c
@@ -435,7 +435,7 @@ AGAIN:
input_string = sock_buf;
goto AGAIN;
default:
- fprintf(stderr, "Get Char: Unknown type of input: %d\n", input_type);
+ fprintf(stderr, "Get Char: Unknown type of input: %d\n", (int)input_type);
return -1;
}
}
diff --git a/src/hyper/macro.c b/src/hyper/macro.c
index 0b0d1889..7bf0f77b 100644
--- a/src/hyper/macro.c
+++ b/src/hyper/macro.c
@@ -101,7 +101,6 @@ number(const char *str)
static char *
load_macro(MacroStore *macro)
{
- int ret_val;
long start_fpos;
int size = 0;
char *trace;
@@ -158,7 +157,7 @@ load_macro(MacroStore *macro)
}
start_fpos = fpos;
scan_HyperDoc();
- ret_val = fseek(cfile, macro->fpos.pos + start_fpos, 0);
+ fseek(cfile, macro->fpos.pos + start_fpos, 0);
size = fpos - start_fpos;
macro_buff = (char *) halloc((size + 1) * sizeof(char), "Macro_buf");
for (size = 0, trace = macro_buff; size < fpos - (start_fpos) - 1; size++)
diff --git a/src/hyper/parse-aux.c b/src/hyper/parse-aux.c
index 4c7600b9..24efcf89 100644
--- a/src/hyper/parse-aux.c
+++ b/src/hyper/parse-aux.c
@@ -512,7 +512,6 @@ int
get_filename()
{
int c, ws;
- static int seen_white = 0; /*UNUSED */
static char buffer[256];
char *buf = buffer;
@@ -524,8 +523,6 @@ get_filename()
keyword_fpos = fpos;
c = get_char();
ws = whitespace(c);
- if (ws)
- seen_white = 1;
} while (ws);
switch (c) {
case EOF:
@@ -545,7 +542,6 @@ get_filename()
*buf = '\0';
token.type = openaxiom_Word_token;
token.id = buffer;
- seen_white = 0;
break;
}
return 1;
diff --git a/src/hyper/parse-input.c b/src/hyper/parse-input.c
index 1c619151..727acc9d 100644
--- a/src/hyper/parse-input.c
+++ b/src/hyper/parse-input.c
@@ -562,9 +562,9 @@ parse_radioboxes()
/* quick search for the name in the current list */
if (already_there(newrb->name)) {
+ fprintf(stderr, "Tried to redefine radioboxes %s\n", newrb->name);
free(newrb->name);
free(newrb);
- fprintf(stderr, "Tried to redefine radioboxes %s\n", newrb->name);
print_page_and_filename();
jump();
}
diff --git a/src/hyper/parse-types.c b/src/hyper/parse-types.c
index f5a42cd9..e42d93f9 100644
--- a/src/hyper/parse-types.c
+++ b/src/hyper/parse-types.c
@@ -196,9 +196,9 @@ parse_condnode()
break;
default:
{
- char eb[128];
+ char eb[160];
token_name(token.type);
- sprintf(eb, "Unexpected Token %s\n", eb);
+ sprintf(eb, "Unexpected Token %s\n", ebuffer);
htperror(eb, HTCONDNODE);
}
break;
diff --git a/src/hyper/parse.c b/src/hyper/parse.c
index 1ca0f77e..cddaa8ae 100644
--- a/src/hyper/parse.c
+++ b/src/hyper/parse.c
@@ -298,8 +298,8 @@ parse_header(HyperDocPage *page)
static void
init_parse_page(HyperDocPage *page)
{
- gEndedPage = gInDesc = gStringValueOk = gInIf =
- gInButton = gInOptional = gInVerbatim = gInPaste = gInItems =
+ gEndedPage = false; gInDesc = false; gStringValueOk = false; gInIf = false;
+ gInButton = false; gInOptional = false; gInVerbatim = false; gInPaste = false; gInItems = false;
gInSpadsrc = false;
example_number = 1;
cur_page = page;
@@ -325,8 +325,8 @@ init_parse_page(HyperDocPage *page)
void
init_parse_patch(HyperDocPage *page)
{
- gEndedPage = gInDesc = gStringValueOk = gInIf =
- gInButton = gInOptional = gInVerbatim = gInPaste = gInItems =
+ gEndedPage = false; gInDesc = false; gStringValueOk = false; gInIf = false;
+ gInButton = false; gInOptional = false; gInVerbatim = false; gInPaste = false; gInItems = false;
gInSpadsrc = false;
gParserMode = AllMode;
gParserRegion = Scrolling;
diff --git a/src/hyper/show-types.c b/src/hyper/show-types.c
index 1942901b..e34498d8 100644
--- a/src/hyper/show-types.c
+++ b/src/hyper/show-types.c
@@ -464,10 +464,8 @@ show_input(TextNode *node)
/*Window root, child;*/
/*int root_x, root_y, win_x, win_y, buttons;*/
InputItem *item;
- char *inpbuffer;
item = node->link->reference.string;
- inpbuffer = item->curr_line->buffer;
wc.border_width = 0;
wc.x = node->x;
diff --git a/src/hyper/spadint.c b/src/hyper/spadint.c
index aa381ba0..df2cd526 100644
--- a/src/hyper/spadint.c
+++ b/src/hyper/spadint.c
@@ -137,7 +137,7 @@ static void
send_pile(openaxiom_sio *sock,char * str)
{
FILE *f;
- char name[512], command[512];
+ char name[512], command[532];
sprintf(name, "/tmp/hyper%s.input", oa_getenv("SPADNUM"));
f = fopen(name, "w");
@@ -218,7 +218,7 @@ start_user_buffer(HyperDocPage *page)
SPAD = (char *) oa_getenv("AXIOM");
if (SPAD == NULL) {
- sprintf(SPAD, "/spad/mnt/rios");
+ SPAD = "/spad/mnt/rios";
}
sprintf(spadbuf, "%s/lib/spadbuf", SPAD);
sprintf(complfile, "%s/lib/command.list", SPAD);
@@ -542,16 +542,18 @@ print_to_string1(TextNode *command,int * sizeBuf)
case openaxiom_StringValue_token:
item = return_item(node->data.text);
if (item != NULL) {
- if (node->space)
+ if (node->space) {
storeChar(' ');
+ }
curr_line = item->lines;
while (curr_line != NULL) {
for (lcount = 0, s = curr_line->buffer; *s && lcount < item->size;
s++, lcount++) {
storeChar(funnyUnescape(*s));
}
- if (curr_line->len <= item->size && curr_line->next)
+ if (curr_line->len <= item->size && curr_line->next) {
storeChar('\n');
+ }
curr_line = curr_line->next;
}
}
@@ -1032,8 +1034,9 @@ print_source_to_string1(TextNode *command,int * sizeBuf)
s++, lcount++) {
storeChar(funnyUnescape(*s));
}
- if (curr_line->len <= item->size && curr_line->next)
+ if (curr_line->len <= item->size && curr_line->next) {
storeChar('\n');
+ }
curr_line = curr_line->next;
}
}
diff --git a/src/include/edin.h b/src/include/edin.h
index 65f77aeb..f010aa2a 100644
--- a/src/include/edin.h
+++ b/src/include/edin.h
@@ -49,6 +49,8 @@ extern int convert_buffer(char * , char * , int * , int );
extern void init_buff(char * , int );
extern void forwardcopy(char * , char * , int );
extern void forwardflag_cpy(int * ,int * , int );
+extern void strmov(char *, const char*);
+extern void strnmov(char *, const char*, size_t);
extern void flagcpy(int * , int * );
extern void flagncpy(int * , int * , int );
extern void send_function_to_child(void);
diff --git a/src/include/open-axiom/token b/src/include/open-axiom/token
index a586fa6d..7f379593 100644
--- a/src/include/open-axiom/token
+++ b/src/include/open-axiom/token
@@ -483,13 +483,15 @@ namespace OpenAxiom {
comment_token(t, TokenValue::Commentary);
pos.column = frag(pos).length();
break;
- case '-':
- if (pos.column + 1 < frag(pos).size()
- and frag(pos)[pos.column + 1] == '>') {
+ case '-': {
+ std::size_t c = pos.column + 1;
+ if (c < frag(pos).size()
+ and frag(pos)[c] == '>') {
t.value = TokenValue::MapsTo;
pos.column += 2;
}
break;
+ }
default: break;
}
}
diff --git a/src/include/spadcolors.h b/src/include/spadcolors.h
index 63621599..a9541e73 100644
--- a/src/include/spadcolors.h
+++ b/src/include/spadcolors.h
@@ -50,13 +50,13 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define startColor 0
#define endColor (startColor+numColors)
-#define colorStep ((maxColors+1)/numColors)
-
#define yes 1
#define no 0
#define smoothConst 50
+#ifndef saymem
#define saymem(a,b,c) saymemWithLine(a,b,c,0)
+#endif
#define Colorcells 256 /* KF number of elements in permutation vector */
/* #define shade 5 */
#define saturation 0.8
@@ -76,6 +76,4 @@ extern Colormap colorMap;
extern int num;
extern int scrn;
-#define maxColors DisplayCells(dsply,scrn)-1
-
#endif /* OPENAXIOM_SPADCOLORS_included */
diff --git a/src/io/InputFragment.cxx b/src/io/InputFragment.cxx
index 595b88b1..827aa372 100644
--- a/src/io/InputFragment.cxx
+++ b/src/io/InputFragment.cxx
@@ -76,16 +76,18 @@ namespace OpenAxiom {
// Return true if line is entirely a positive comment, i.e. a description.
static bool positive_comment(const Line& line) {
- if (line.indent + 1 >= line.length())
+ std::size_t i = line.indent + 1;
+ if (i >= line.length())
return false;
- return line[line.indent] == '+' and line[line.indent + 1] == '+';
+ return line[line.indent] == '+' and line[i] == '+';
}
// Return true if line is entirely a negative comment.
static bool negative_comment(const Line& line) {
- if (line.indent + 1 >= line.length())
+ std::size_t i = line.indent + 1;
+ if (i >= line.length())
return false;
- return line[line.indent] == '-' and line[line.indent + 1] == '-';
+ return line[line.indent] == '-' and line[i] == '-';
}
// Clean up and dress up the line with indentation information.
diff --git a/src/lib/cfuns-c.cxx b/src/lib/cfuns-c.cxx
index 11c28691..5dbcd6bc 100644
--- a/src/lib/cfuns-c.cxx
+++ b/src/lib/cfuns-c.cxx
@@ -79,11 +79,6 @@
#endif
namespace OpenAxiom {
- // Make a copy of string data on free store.
- static char*
- copy_c_str(const std::string& s) {
- return strdup(s.c_str());
- }
OPENAXIOM_C_EXPORT int
addtopath(char *dir)
diff --git a/src/lib/edin.c b/src/lib/edin.c
index f85a632a..568bb77a 100644
--- a/src/lib/edin.c
+++ b/src/lib/edin.c
@@ -792,6 +792,18 @@ forwardflag_cpy(int *buff1,int * buff2,int num)
buff1[count] = buff2[count];
}
+void
+strnmov(char *dest, const char *src, size_t n)
+{
+ while (n-- && (*dest++ = *src++));
+}
+
+void
+strmov(char *dest, const char *src)
+{
+ while ((*dest++ = *src++));
+}
+
void
flagcpy(int *s,int *t)
{
diff --git a/src/lib/prt.c b/src/lib/prt.c
index f111e2d9..ee5b3af0 100644
--- a/src/lib/prt.c
+++ b/src/lib/prt.c
@@ -152,7 +152,7 @@ delete_current_char(void)
if (buff_flag[curr_pntr] == 1 || buff_flag[curr_pntr] == 0) {
myputchar(_BLANK);
myputchar(_BKSPC);
- strcpy(&buff[curr_pntr],
+ strmov(&buff[curr_pntr],
&buff[curr_pntr + 1]);
flagcpy(&buff_flag[curr_pntr],
&buff_flag[curr_pntr + 1]);
@@ -165,7 +165,7 @@ delete_current_char(void)
myputchar(_BLANK);
myputchar(_BKSPC);
myputchar(_BKSPC);
- strcpy(&buff[curr_pntr],
+ strmov(&buff[curr_pntr],
&buff[curr_pntr + 2]);
flagcpy(&buff_flag[curr_pntr],
&buff_flag[curr_pntr + 2]);
@@ -380,7 +380,7 @@ back_over_current_char(void)
myputchar(_BLANK);
myputchar(_BKSPC);
myputchar(_BKSPC);
- strcpy(&buff[curr_pntr - 2],
+ strmov(&buff[curr_pntr - 2],
&buff[curr_pntr]);
flagcpy(&buff_flag[curr_pntr - 2],
&buff_flag[curr_pntr]);
@@ -392,7 +392,7 @@ back_over_current_char(void)
myputchar(_BKSPC);
myputchar(_BLANK);
myputchar(_BKSPC);
- strcpy(&buff[curr_pntr - 1],
+ strmov(&buff[curr_pntr - 1],
&buff[curr_pntr]);
flagcpy(&buff_flag[curr_pntr - 1],
&buff_flag[curr_pntr]);
diff --git a/src/lib/sockio-c.cxx b/src/lib/sockio-c.cxx
index 24b8f475..dda95ec3 100644
--- a/src/lib/sockio-c.cxx
+++ b/src/lib/sockio-c.cxx
@@ -1123,7 +1123,7 @@ init_purpose_table()
OPENAXIOM_C_EXPORT int
make_server_number()
{
- spad_server_number = oa_getpid();
+ spad_server_number = oa_getpid() % 1024;
return spad_server_number;
}
diff --git a/src/lib/wct.c b/src/lib/wct.c
index 35cc01e9..44510558 100644
--- a/src/lib/wct.c
+++ b/src/lib/wct.c
@@ -572,7 +572,7 @@ rescan_wct(void)
else if (new_len < old_len) {
/* this time I simply copy backwards and do the substituting */
diff = old_len - new_len;
- strncpy(&buff[curr_pntr - diff],
+ strnmov(&buff[curr_pntr - diff],
&buff[curr_pntr],
buff_pntr - curr_pntr);
flagncpy(&buff_flag[curr_pntr - diff],
diff --git a/src/rt/Lisp.cc b/src/rt/Lisp.cc
index fae3e02f..045d087c 100644
--- a/src/rt/Lisp.cc
+++ b/src/rt/Lisp.cc
@@ -327,7 +327,7 @@ namespace OpenAxiom {
unimplemented(x);
if (auto op = special_operator(*s))
return op(ctx, x);
- auto fun = symbol_function(ctx, *s);
+ return to_value( symbol_function(ctx, *s));
}
Value
diff --git a/src/sman/session.c b/src/sman/session.c
index e7edf001..20a29307 100644
--- a/src/sman/session.c
+++ b/src/sman/session.c
@@ -105,6 +105,7 @@ term_handler(int sig)
exit(1);
}
+#ifdef DEBUG
static void
pr()
{
@@ -116,6 +117,7 @@ pr()
}
fprintf(stderr,"\n");
}
+#endif
static void
close_client(int frame)
diff --git a/src/syntax/Parser.cxx b/src/syntax/Parser.cxx
index ada3963b..be73b088 100644
--- a/src/syntax/Parser.cxx
+++ b/src/syntax/Parser.cxx
@@ -72,24 +72,6 @@ namespace {
TokenSequence::size_type position;
};
- const Token* next_token(ParsingContext& ctx) {
- while (auto t = ctx.current_token()) {
- switch (t->category) {
- case TokenCategory::Whitespace:
- break;
-
- case TokenCategory::Comment:
- if (t->value == TokenValue::Wisecrack)
- break;
-
- default:
- return t;
- }
- ctx.advance();
- }
- return nullptr;
- }
-
// Simple wrapper around standard file streams, along with the pathname
// to the file.
template<typename T>
diff --git a/src/utils/command.cc b/src/utils/command.cc
index f560f169..55716bc1 100644
--- a/src/utils/command.cc
+++ b/src/utils/command.cc
@@ -302,7 +302,7 @@ static void print_usage(void) {
print_line(" --optimize=<n> Set compiler optimization level to <n>, a natural number.");
print_line("");
print_line("If invoked without options and without an input file "
- "OpenAxiom will start as an interative program with Superman"
+ "OpenAxiom will start as an interactive program with Superman"
" as the master process, the majority of uses. If invoked "
"with a file as single argument, OpenAxiom assumes the file is a Spad "
"script and will attempt to execute it as such.");