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.
The interesting warnings are:
source/preferences.h :
SetPrefOpenInTab(), GetPrefOpenInTab() and GetPrefOverrideVirtKeyBindings()
are declared multiple times in preferences.h. Probably a copy-paste error.
WindowInfo->fileFormat is declared int, but its content are the enum
fileFormats from util/fileUtils.h This could be done in a nicer way.
The switch in file.c: 634 (IncludeFile()) does not have a default.
Even though it works now, it would be better for documentations purposes that
it has a no-op default.
file.c: line ~1184, writeBckVersion()
A plain int is used for file size. It should have been an off_t, otherwise
2GB+ files will not be handled properly.
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)
The whole concept of reading/writing the backupfile in one blow is no the best
strategy. I sometimes have very, very large log files opened in nedit and
there is no reason to double the memory use of nedit.
file.c: 1594/1609:
The variable lastCheckWindow is not initialized and tested for in the if.
highlightData.c:
member "recogW" in HSDialog structure is not used at all.
utils.h declares "Stack" as a typedef and interpret.c declares it as a static
variable. This is a violation of ANSI C, but since interpret.c does not
include util.h directly or indirectly most compilers allows it. But it is bad
style.
selection.c:95-110
char *endptr;
...
if (isdigit((unsigned char) *endptr ) ...
Why the cast?
Header file source/textBuf.h not used in source/server_common.c
shell.c: DoShellMenuCmd(): 438
'left' and 'right' may not have been initialized in the call to issueCommand()
tags.c: findAllMatches(): line 1222:
The "return -1;" will lead to a memory leak for dupTagsList
tags.c: rcs_strdup(): line 1600
unchecked call to malloc()
text.c:
indentation error after if() inside forwardCharacterAP() and
backwardCharacterAP()
source/textDisp.c: 3806: TextDSetupBGClasses():
if (class_no) {
Boolean within 'if' always evaluates to True [Reference:
file ./source/textDisp.c: line 3768]
source/textDisp.c:
The macros TOP_MARGIN, BOTTOM_MARGIN, LEFT_MARGIN and RIGHT_MARGIN are not
used.
source/textSel.c:
N_CLIP_TARGETS not used.
window.c: ClosePane():
'totalHeight' is not used.
The following global functions are not used:
HighlightBackgroundColorOfCode,
HighlightCodeIsBold,
HighlightCodeIsItalic
HighlightColorOfCode
DisableUnmodified
SetFloatLabel
SetFloatText
GetSelection
SetWrapMargin
BufGetHighlightText
BufGetLineText
GetDefaultTranslations
GetTextRange
SetIntLabel
TextDGetBuffer
TextStopHandlingSelections
AddMenuSeparator
EnableCountingQuantifier
Max
Min3
Max3
PasswordText
RangesetGetColorName
RangesetSetMaxpos
SetPrefGeometry
SetPrefMapDelete
SetPrefStdOpenDialog
SetPrefStickyCaseSenseBtn
SetPrefTagFile
RedrawCalltip
MakeSortedWindowArray
global struct member '_WindowInfo::showTabBarItem' (line 357, file
source/nedit.h) not referenced
global struct member 'Href::target' (line 59, file source/help.h) not
referenced
global typedef 'TextWidgetClass' (line 123, file source/text.h) not referenced
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 ?
--
NEdit Develop mailing list - [email protected]
http://www.nedit.org/mailman/listinfo/develop