[prev in list] [next in list] [prev in thread] [next in thread] 

List:       fossil-dev
Subject:    Re: [fossil-dev] cppcheck results
From:       Andy Goth <andrew.m.goth () gmail ! com>
Date:       2014-09-08 0:53:23
Message-ID: 540CFE03.5050806 () gmail ! com
[Download RAW message or body]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 9/7/2014 4:43 AM, Stephan Beal wrote:
> On Sun, Sep 7, 2014 at 4:37 AM, Edward Berner wrote: * cgi.c, line
> 1604: Storing fgetc() return value in char variable and then
> comparing with EOF. 1604: while( (c = fgetc(g.httpIn))!=EOF &&
> fossil_isdigit(c) ){
> 
> not certain - i know that EOF is a bit of a funny beast in C++, but
> not sure what special care it needs in C.

EOF is distinct from any possible value that can be stored in a char
variable.  If you store it at all, you should store it in an int.

- -- 
Andy Goth | <andrew.m.goth/at/gmail/dot/com>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (MingW32)

iQEcBAEBAgAGBQJUDP4DAAoJELtYwrrr47Y4PvIH/0MTdtuIKcgRnMCmhUsdleyD
dVbEUOTGcfZdi3mLJ83zRC9pnLIVbRbBzWAFesOEMYerWqQoq0M+v/x/PEuPUcUC
pSZkhuDTWpq95Gir3VT8HzEotevAnGXSTHVwXtLBZO0tP7CH78tFN9ORzd1Zfx2B
3/AC23v6R6XSNLvJOsIZWdoPn4wWR6Qg4bmJqIMrGimMIWf84Q1ewjNdObtCIP7L
e17SC87aFFCzFQeV9XH0f/xG1M28of8K3gIBoosxlD+jqI49bFoj3YPDW7b8Mo9B
UnTaAI3bICOqVO5dM1+5ciqo4lorrSSalIvkqcNaaYtJG4B+hnReG9ZGtxu38Rs=
=Jb+j
-----END PGP SIGNATURE-----

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic