[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: COMPATABILITY WARNING! (was: svn commit: rev 1384 ...)

From: Daniel Berlin <dan_at_dberlin.org>
Date: 2002-02-28 06:00:50 CET

Doing this conversion led me to discover a bug in
db_load, that i should warn about.

If your db_load runs forever, just consuming more and more memory, you've
got this bug.

If your platform has char as an unsigned char by default, you have
this problem.
You can see the real bug by compiling db_load (just go to db/dist, rm -f
db_load*, make db_load to compile it again).
You'll see that it gives a warning about their use of "if ((ch =
getchar()) == EOF)"

The problem is that ch is a char, rather than an int (getchar returns EOF,
which is -1 on most platforms, on end of file), and it thus knows it'll
never be true.

So it never thinks it sees the end of the file, and happily goes around
and around again.

Change the declaration of ch to an int, and the problem goes away.

Compiling with -fsigned-char would also make the problem go away.

--Dan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Oct 21 14:37:10 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.