aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2002-01-30 22:55:15 +0000
committerGuy Harris <guy@alum.mit.edu>2002-01-30 22:55:15 +0000
commitd4017a1ee13a71b6618f297ec16c763dccbd1c9f (patch)
tree652f57913375a41369f00200172557bf7b333857 /tools
parenta8e66fb1c52e8af73563f07cbd297096fed47083 (diff)
Fix up some type/size problems that showed up when compiling on Digital
UNIX on Alpha. svn path=/trunk/; revision=4635
Diffstat (limited to 'tools')
-rw-r--r--tools/lemon/lemon.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/tools/lemon/lemon.c b/tools/lemon/lemon.c
index a5f0421c2d..dc4dd8a0d8 100644
--- a/tools/lemon/lemon.c
+++ b/tools/lemon/lemon.c
@@ -25,7 +25,7 @@
** drh@acm.org
** http://www.hwaci.com/drh/
**
-** $Id: lemon.c,v 1.11 2001/07/22 10:25:50 guy Exp $
+** $Id: lemon.c,v 1.12 2002/01/30 22:55:15 guy Exp $
*/
#include <stdio.h>
#include <stdarg.h>
@@ -2113,7 +2113,7 @@ void Parse(struct lemon *gp)
struct pstate ps;
FILE *fp;
char *filebuf;
- size_t filesize;
+ long filesize;
int lineno;
char c;
char *cp, *nextcp;
@@ -2134,15 +2134,16 @@ void Parse(struct lemon *gp)
fseek(fp,0,2);
filesize = ftell(fp);
rewind(fp);
+ /* XXX - what if filesize is bigger than the maximum size_t value? */
filebuf = (char *)malloc( filesize+1 );
if( filebuf==0 ){
- ErrorMsg(ps.filename,0,"Can't allocate %d of memory to hold this file.",
+ ErrorMsg(ps.filename,0,"Can't allocate %ld of memory to hold this file.",
filesize+1);
gp->errorcnt++;
return;
}
- if( fread(filebuf,1,filesize,fp)!=filesize ){
- ErrorMsg(ps.filename,0,"Can't read in all %d bytes of this file.",
+ if( fread(filebuf,1,filesize,fp)!=(size_t)filesize ){
+ ErrorMsg(ps.filename,0,"Can't read in all %ld bytes of this file.",
filesize);
free(filebuf);
gp->errorcnt++;
@@ -3129,9 +3130,9 @@ void ReportTable(
stp = lemp->sorted[i];
tablesize = 1;
while( tablesize<stp->naction ) tablesize += tablesize;
- fprintf(out," { &yyActionTable[%d], %d, %d},\n",
+ fprintf(out," { &yyActionTable[%d], %lu, %d},\n",
stp->tabstart,
- tablesize - 1,
+ (unsigned long)tablesize - 1,
stp->tabdfltact); lineno++;
}
tplt_xfer(lemp->name,in,out,&lineno);