lint: take care of various warnings/errors issued by cppcheck

- [x]   ~~68~~ ~~51  error (nullPointer)~~
- [x]   ~~15  style (unreadVariable)~~
- [x]    ~~12  performance (redundantAssignment)~~
- [x]      ~~8  style (unusedVariable)~~
- [x]      ~~7  style (unassignedVariable)~~
- [x]     ~~3  warning (nullPointer)~~
- [x]      ~~1  warning (uselessAssignmentPtrArg)~~
- [x]      ~~1  warning (invalidPrintfArgType_sint)~~
- [x]      ~~1  style (obsoleteFunctionsasctime)~~
- [x]      ~~1  performance (redundantCopy)~~
- [x]      ~~1  error (syntaxError)~~
- [x]      ~~2 error (va_end_missing)~~
- [x]      ~~1  error (uninitstring)~~

Not part of this PR:
- [ ] ~~4860~~ 1688  style (unusedStructMember)
- [ ]      8  performance (passedByValue)
See #480