LF operations fixes, and coverity code scan fixes

This branch contains various fixes, firstly a rewrite of LF operations; "lf hid fskdemod" and "lf io fskdemod". The changes makes the code a lot cleaner, and also makes the 'lf hid fskdemod' work better, with less (none?) false readings. However, the changes breaks 'lf io fskdemod'. Hopefully that's temporary, as soon as someone can test it and provide some feedback, it should be easy to correct the indices and fix it. 

The second batch of changes comes from coverity. I used the cloud scan (https://scan.coverity.com/) which is free for open source projects, and fixed ~30 issues. Some of them were false positives, other typical findings are illegal memory writes or reads. A lot of small issues. Because there were so many, I haven't been able to test each one individually, but I am fairly confident I didn't break anything that wasn't already broken. 

Unless anyone yells 'STOP', I'll merge this soonish. If you want access to the coverity scan, send me a message. I thought I'd switch the scan to use the main repo (I did it on my clone) and set it up with a bit of automation.