Quoting Ivan Skytte Jørgensen <[EMAIL PROTECTED]>: > I gave the I also gave it a spin with Flexelint 8.0w. It complains a lot, > and I have included the most interesting warnings. Nedit is partially > excused because it has to support a few odd and old platforms, so I have > filtered out the ones I think related to legacy platforms / compiler bugs.
Good work. A couple of comments on some of these: > file.c: 1198: The casts in: > if ((int)(strlen(fullname) + 5) > (int)MAXPATHLEN) > look weird. It should be: > if ((strlen(fullname) + 5) > (size_t)MAXPATHLEN) No cast at all needed here IMO. This looks like a case of someone trying to remove warnings by brute force. The best way, of course, is to have MAXPATHLEN defined as unsigned, but even that probably isn't necessary, given the type promotion to the unsigned type that's big enough for the compare (assuming size_t is unsigned, which it should be). Casting just muddies the waters here. > selection.c:95-110 > char *endptr; > ... > if (isdigit((unsigned char) *endptr ) ... > Why the cast? These "ctype function" casts were added when passing a plain char caused problems. I think it was on older Sun machines that the bug occurred. The implementation used macros to implement is...() and toupper/tolower, using the character's ordinal value as an index into a table. This worked for ASCII, but, since char was a signed value, failed for non-ASCII (eg Latin1) characters. The cast to unsigned char cured this. (A cast to int was rejected since this would cause sign extension.) I would prefer that these casts remain; it was a painful problem to find in the first place, and I wouldn't want to see a regression. > Flexelint produced a lot more warnings. The complete output is available at > http://i1.dk/download/nedit/ > > > Will the developers accept patches that solve some of the issues ? Certainly. I would recommend that the appropriate changes go straight into the codebase. -- NEdit Develop mailing list - [email protected] http://www.nedit.org/mailman/listinfo/develop
