Merge the latest trunk changes into shared-schema branch.  Also fix a C99-ism 
in that branch.

FossilOrigin-Name: 42338e9e6979bb497823527f8f39e96f63623c59