Fixed many memory leaks, mostly in error branches

Various early return branches were not freeing memory.
Caught by 'cppcheck' tool.

Change-Id: I1840fd1a95aceb31275c35d4a004769333e3c17c
Fixed many memory leaks, mostly in error branches.

Most leaks fixed by adding deallocation in the early exit branch,
some fixed by rearranging code to put the early exit before the
allocation. Also removed some unnecessary checks for null before
using delete.

Presumably none of these branches are covered by tests,
or valgrind would find the leaks.  cppcheck found them though!

Change-Id: Iecad8ca988abc560939d46bf0a5a9e7e5a1511a5
Fixed undefined use of uninitialized variable

Change-Id: Ib8d051c590628aec66335bb5de0c7c7af9f35254
Fixed memory leaks in error branches by rearranging order.

Rearranged code to put the early exit before the
allocation.

Found with cppcheck.

Change-Id: I8320d0be9269375302fc80b788f00c1f3aeca989
Added missing fclose() calls in error branches

Several error branches were missing fclose() calls
to balance earlier fopen() calls.

Fixed a couple of leaks also in these same
error branches.

Found by cppcheck.

Change-Id: I7ed3bce1f0fb399c2ab1c3d6e6eac3518d845b17
Fixed cppcheck warning about null dereference

Move deref of pointer into branch that previously
checked that it isn't null.

Change-Id: Ia1b42d80e56a2d4700c899f3c5ef7c3db502134e
Fixed many memory leaks in error branches.

Leaks fixed by adding deallocation in the early exit branch.
Also removed some unnecessary checks for null before
using delete.

Found by cppcheck.

Change-Id: I8ec80d676926d9725999034846f52d0efb0c8da4
Determine enabled modules dynamically.

VTKConfig.cmake used to explicitly include a list of modules that are enabled
with VTK is built. This had two problems:

1. Package-maintainers could not provide separate packages for VTK modules and
since each package would need to provide a different VTKConfig.cmake file.

2. Projects such as ParaView, that need to add a module explicitly at the end of
the modules processing loop could never have those "final" modules be detected
correctly in dependent projects since the VTKCOnfig.cmake file wasn't aware of
those extra modules.

We fix both these issues by dynamically determining the list of enabled modules.
We simply scan the VTK_MODULES_DIR to determine the modules that are available.
To simply developer builds, we clean the VTK_MODULES_DIR at configure time to
remove any *.cmake files to avoid leaving stray config files for modules that
the developer disabled. Note there are other generated files namely,
WrappingHierarchy related files that are placed here which we do not (and should
not) touch.

Change-Id: If87429a30ac26d3c2d7744d32e0a6503c123c1b3
Removed dead code special-casing isnan()

Change-Id: I27301b51d282215e850fa28f0769823c27c318be
Removed unused VTK_SIGN macro

Change-Id: I52e5a6b213cf1e3a9cfa19759e7f54028eb5b0db
Use vtkMath::IsNan unconditionally instead of isnan()

Change-Id: Ic09b8c96fcfbbf4ce38b1d9eed6253714ba668ec
vtkMath::IsNan is now inline making the special-casing uncessary
Removed special case for gcc 3 on OS X

VTK requires 10.5+ now, where gcc 4.0 and 4.2 are available.
No dashboard tests this path anyway.

Change-Id: If7ce8a916ff97376c3e4689c88ad998469a8ac16
Added #error for Carbon + OS X 10.7 SDK

Some of the functions used by the Carbon render window
are so old that they don't even exist in 10.7 SDK.
Added #error to catch this.

Change-Id: Ib5694a127cd59148f4ed2123d76d63f62ccc9b61
Fix Carbon build with newer Xcodes

We were trying to find Rez in the old hardcoded /Developer
folder.  Instead, now use OSX_DEVELOPER_ROOT.

Change-Id: Ie2f337c45f14bb585ccafa78e9a4414a0d17999a
Fixed Carbon build error due to modularization changes.

Fix from David Gobbi brought over from python case.

Change-Id: Ibba401173eb817be7dda1215aeec586b3b4b82f1
ENH: Add math function for nearest power of two.

There are several places in VTK where the bounding power of two is
computed.  It is safer to centralize the code.  Use an O(log(N))
algorithm instead of the O(N) algorithm that was used before.

Change-Id: Idef2522d5a9357863837959975c0592751971010
ENH: Add math function for computing log2 on integers.

Computing log2() is useful for data partitioning algorithms.
This implementation works over the full 64-bit range.

Change-Id: I83fee61d06d6ce9c1b4afe30aedfe582ffa18ed7
ENH: More efficient Ceil() and Floor() with tests.

Change-Id: I7cedee87be08261b6e07b30547300814d024c6b5
Merge topic 'cppcheck-leaks' into master

f5588ef8 Fixed many memory leaks in error branches.
f6074be3 Fixed cppcheck warning about null dereference
ccd03ca0 Added missing fclose() calls in error branches
e3bfbb77 Fixed memory leaks in error branches by rearranging order.
cad374c6 Fixed undefined use of uninitialized variable
9925eca3 Fixed many memory leaks, mostly in error branches.
192ea707 Fixed many memory leaks, mostly in error branches
Merge topic 'carbon-fix' into master

2297e5db Fixed Carbon build error due to modularization changes.
02d783e7 Fix Carbon build with newer Xcodes
caf4fcac Added #error for Carbon + OS X 10.7 SDK