Opened 14 years ago

Closed 14 years ago

Last modified 6 years ago

#5435 closed defect (fixed)

KYRA: Code analysis warnings

Reported by: Templier Owned by: lordhoto
Priority: normal Component: Engine: Kyra
Version: Keywords: build
Cc: Game:


Here are the warnings I get when compiling the engine using Code Analysis in VS2010. I tried to remove all the obvious false positives. Some warnings look suspicious, others are pointing to correct code that still might benefit from better error checking.

d:\sources\scummvm\scummvm\engines\kyra\script_tim.cpp(950): warning C6011: Dereferencing NULL pointer 'wsa' d:\sources\scummvm\scummvm\engines\kyra\sequences_lol.cpp(1438): warning C6291: Bitwise operation on logical result: ! has higher precedence than |. Use || or (!(x | y)) instead d:\sources\scummvm\scummvm\engines\kyra\resource_intern.cpp(950): warning C6292: Ill-defined for-loop: counts up from maximum d:\sources\scummvm\scummvm\engines\kyra\scene_lok.cpp(1108): warning C6011: Dereferencing NULL pointer 'curTable' d:\sources\scummvm\scummvm\engines\kyra\items_lok.cpp(307): warning C6287: Redundant code: the left and right sub-expressions are identical

Note: If you want to try it yourself, you will need: - the create_project patch set, along with the WIP code analysis patch ( ) - the following patch to silence some false positives ( ) - Visual Studio 2010 Ultimate or Team System (create_project support for analysis with VS2005/2008 isn't complete yet)

Ticket imported from: #3087837. Ticket imported from: bugs/5435.

Change History (3)

comment:1 by lordhoto, 14 years ago

Owner: set to lordhoto
Resolution: fixed
Status: newclosed

comment:2 by lordhoto, 14 years ago

I fixed those now, except the warnings in scene_lok.cpp which looks quite odd, since curTable is never a null-pointer, and resource_intern.cpp, which uses a rather odd loop, but it's perfectly fine since it's inner part might set the var the condition depends on to -1, which would be 0 in the next iteration and then the loop would terminate.

comment:3 by digitall, 6 years ago

Component: Engine: Kyra
Note: See TracTickets for help on using tickets.