Compiler warning clean up

Refactored all codes so that they compile without (or almost without)
warnings under the various versions of the gcc compiler.

Cleaned two benign memory leaks, one benign buffer overflow, and fixed
an undefined variable error in quiva2DB