Update of /cvsroot/monetdb/MonetDB5/src/modules/mal
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv1710
Modified Files:
tablet.mx
Log Message:
The mode parameter for fopen is "r", not "R".
There is little point in seeking to the end of the file end then
reading a block of data.
Only look at data actually read, i.e. use the return value of fread.
Index: tablet.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/modules/mal/tablet.mx,v
retrieving revision 1.90
retrieving revision 1.91
diff -u -d -r1.90 -r1.91
--- tablet.mx 4 Jun 2007 07:09:05 -0000 1.90
+++ tablet.mx 4 Jun 2007 08:58:04 -0000 1.91
@@ -1661,16 +1661,19 @@
char buf[BUFSIZ+1],*s=buf;
size_t nr=0;
FILE *f;
- f= fopen(datafile,"R");
+ f= fopen(datafile,"r");
if(f == NULL) return 0;
+ buf[BUFSIZ]=0;
+ if( (nr = fread(buf, 0, BUFSIZ,f)) >0){
+ buf[nr] = 0;
+ nr = 0;
+ for(s = buf; *s; s++)
+ nr++;
+ } else
+ nr = 0;
fseek(f,0L,SEEK_END);
size= ftell(f);
- buf[BUFSIZ]=0;
- if( fread(buf, 0, BUFSIZ,f) >0){
- for(; *s; s++)
- if( *s=='\n') nr++;
- }
fclose(f);
if( nr == 0)
return size/BUFSIZ;
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Monetdb-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-checkins