[GRASS-dev] portable.h elimination

Paul Kelly paul-grass at stjohnspoint.co.uk
Wed Mar 14 09:42:01 EDT 2007


On Wed, 14 Mar 2007, Glynn Clements wrote:

>
> Paul Kelly wrote:
>
>> For some reason (can't quite remember why) I changed test.c in the past to
>> try and get this to work. ISTR someone suggested somewhere extra seeks
>> were needed on Windows.
>
> You need to seek when switching between reading and writing. Windows'
> FILE structure only has a single buffer (rather than separate
> read/write buffers), so you need to force it to flush/discard any
> buffered data.

Do you think extra seeks need added anywhere else in the library, or is it 
just this test program that is affected?

>> This is what I changed:
>
> Can you commit those, please.
>
>> And with that the output from the test is now:
>>
>> ==============TEST=============
>> gcc -L/c/grass/grass6/dist.i686-pc-mingw32/lib -Wl,--export-dynamic,--enable-runtime-pseudo-reloc  -L/c/grass/forgrass/lib     -I/c/grass/forgrass/include -g -O2  -I/c/grass/forgrass/include -I/c/grass/forgrass/include  -I/c/grass/grass6/dist.i686-pc-mingw32/include  -o OBJ.i686-pc-mingw32/test test.c -lgrass_dig2 -lgrass_gis -lgrass_datetime -lxdr -liberty -lws2_32    -lz     -lgrass_rtree  -lgrass_rtree \
>>  			-lgrass_gis -lgrass_datetime -lxdr -liberty -lws2_32    -lz     -lgrass_datetime  -lxdr -liberty -lws2_32    -lz
>> cd OBJ.i686-pc-mingw32; PATH=".:/bin:/mingw/bin:/mingw/lib:/c/grass/forgrass/bin:/c/grass/forgrass/lib:/c/tcl/bin:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem:/c/Program Files/QuickTime/QTSystem/:/c/grass/forgrass/bin:/c/grass/forgrass/lib:/c/tcl/bin:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem:/c/Program Files/QuickTime/QTSystem/:/c/jed09916/bin:/c/grass/grass6/dist.i686-pc-mingw32/lib" ./test; diff ./test.tmp ../test.ok
>> Binary files ./test.tmp and ../test.ok differ
>> make: *** [OBJ.i686-pc-mingw32/test] Error 1
>>
>> i.e. the test files are still different, but it doesn't have lots of
>> errors while running. I have no idea if/how that is significant!
>
> The stream of errors indicates that what was read back doesn't match
> what was written, i.e. a problem with low-level I/O.
>
> The "diff" failure indicates that what was written wasn't what was
> expected. This could be a text/binary issue (I don't see $(FMODE_OBJ)
> in the link command); it could even be due to differences in
> floating-point rounding (even if only the lowest bit of a double is
> wrong, the test will still fail).

None of those - it was just that I had put the dig_fseek() call in too 
late - it should have been before the call to fprintf(). With it before 
fprintf(), now everything works even without bothering about $(FMODE_OBJ) 
so I have committed the changes to CVS and enabled the test for MinGW in 
the Makefile.

Paul




More information about the grass-dev mailing list