Fix clang warnings and errors in CondFormats/CastorObjects.

Implemented thread-safe deletion.
Removed unused functions.