calf
calf copied to clipboard
PVS studio check
It's not a personal todo list, but I'll try to fix some of these. Any help would be appreciated I have listed only the points I consider worth refactoring
- This seems to be overcomplicated
https://github.com/calf-studio-gear/calf/blob/6c0610bf81060432e69b942b56bf5160f3d91b05/src/analyzer.cpp#L973
The condition is equal to
bool(subindex & 1) == bool(_draw_upper)
- The 'bpm' variable is assigned values twice successively. Perhaps this is a mistake. https://github.com/calf-studio-gear/calf/blob/6c0610bf81060432e69b942b56bf5160f3d91b05/src/modules_delay.cpp#L140-L141 Same issue here https://github.com/calf-studio-gear/calf/blob/6c0610bf81060432e69b942b56bf5160f3d91b05/src/modules_mod.cpp#L673-L674
- It's odd to compare a bool type value with a value of float type. Perhaps there is a mistake in operator priority. Someone who understand the code should check this https://github.com/calf-studio-gear/calf/blob/6c0610bf81060432e69b942b56bf5160f3d91b05/src/modules_dist.cpp#L478 Same here https://github.com/calf-studio-gear/calf/blob/6c0610bf81060432e69b942b56bf5160f3d91b05/src/modules_dist.cpp#L889 And here https://github.com/calf-studio-gear/calf/blob/6c0610bf81060432e69b942b56bf5160f3d91b05/src/modules_dist.cpp#L291
- There is a strange if blocks logic here https://github.com/calf-studio-gear/calf/blob/6c0610bf81060432e69b942b56bf5160f3d91b05/src/calf/orfanidis_eq.h#L327-L350 ~~5. Pointer to local variable 'value_text' is stored outside the scope of this variable. Such a pointer will become invalid. https://github.com/calf-studio-gear/calf/blob/6c0610bf81060432e69b942b56bf5160f3d91b05/src/modmatrix.cpp#L160~~