* Added Stream_GetRemainingCapacity to check remaining stream size before writes. * Fixed shadow server memory leak. * Fixed lots of scanbuild warnings * Added missing argument checks in many functions * Added missing static function declarations