Use nullptr instead of NULL whenever possible.

Microsoft recommends to avoid using NULL or zero (0) as a null pointer constant since nullptr is less vulnerable to misuse and works better in most situations.

Also fix some cases where NULL was used instead of 0 or FALSE.