Fixes for coverity and SCA issues

Coverity:
- CID 717177 (catch exception)
- CID 716957 (fix invalid xattr_diff iterator handling and wrong filled only_in_b list)
- CID 1128391 (DEADCODE)
- CID 1219464 (DEADCODE)
- CID 1219465 (DEADCODE)

SCA:
- prefer empty() over size() for emptiness
- remove redundant checking of STLcontainer element existence before removing it
- fix potential null pointer deref
- fix reference to temporary returned
- init variable in constructor

Fix for compiler warning:
- compare between signed (int) and unsigned (size_t)