Move varInt handling code into its own file module, for reuse

Also found a bug in encoding 4bytes numbers

git-svn-id: http://svn.osgeo.org/postgis/trunk@12836 b70326c6-7e19-0410-871a-916f4a2858ee
Check return code from liblwgeom functions

Fixes some "variable set but unused" warnings

git-svn-id: http://svn.osgeo.org/postgis/trunk@12837 b70326c6-7e19-0410-871a-916f4a2858ee