[liblas] 02/15: Imported Upstream version 1.8.1~rc1

Bas Couwenberg sebastic at debian.org
Mon Aug 22 20:44:33 UTC 2016


This is an automated email from the git hooks/post-receive script.

sebastic pushed a commit to branch master
in repository liblas.

commit 20b9775430a689d3d605692721b9f586485ba510
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date:   Mon Aug 22 15:41:51 2016 +0200

    Imported Upstream version 1.8.1~rc1
---
 .hgtags                                            |    0
 .travis.yml                                        |   20 +
 AUTHORS                                            |    0
 CMakeLists.txt                                     |  133 +-
 COPYING                                            |    0
 CTestConfig.cmake                                  |   20 -
 INSTALL                                            |    0
 LICENSE.txt                                        |   98 +-
 NEWS                                               |    0
 apps/CMakeLists.txt                                |   46 +-
 apps/bigfile_boost_iostreams_test.cpp              |    0
 apps/bigtest.c                                     |    0
 apps/las2col.c                                     | 1065 ++++++++++
 apps/las2las.cpp                                   |    0
 apps/las2ogr.cpp                                   |    2 +-
 apps/las2pg.c                                      |  715 +++++++
 apps/las2txt.c                                     |    0
 apps/las2txt.cpp                                   |    0
 apps/lasblock.cpp                                  |    0
 apps/lascommon.c                                   |    0
 apps/lascommon.h                                   |    0
 apps/lasdiff.c                                     |    0
 apps/lasindex.cpp                                  |    0
 apps/lasindex_test.cpp                             |    0
 apps/lasinfo.cpp                                   |    0
 apps/laskernel.cpp                                 |    4 +
 apps/laskernel.hpp                                 |    0
 apps/liblas-config                                 |   24 +-
 apps/liblas-config.in                              |    0
 apps/liblas.pc.in                                  |    0
 apps/ts2las.cpp                                    |    2 +-
 apps/ts2las.hpp                                    |    0
 apps/txt2las.c                                     |    0
 bin/ci/before_install.sh                           |   18 +-
 bin/ci/common.sh                                   |    0
 bin/ci/script.sh                                   |    4 +-
 buildout/bootstrap.py                              |    0
 buildout/buildout.cfg                              |    0
 buildout/setenv.in                                 |    0
 cmake/CMakeLists.txt                               |    2 +-
 cmake/libLAS.vcproj.user.template                  |    0
 cmake/liblas-config-version.cmake                  |   38 +-
 cmake/liblas-config-version.cmake.in               |   34 +-
 cmake/liblas-config.cmake                          |   11 +-
 cmake/liblas-config.cmake.in                       |   11 +-
 cmake/modules/BuildOSGeo4W.cmake                   |    0
 cmake/modules/FindGDAL.cmake                       |   45 +-
 cmake/modules/FindGeoTIFF.cmake                    |    0
 cmake/modules/FindLASzip.cmake                     |    0
 cmake/modules/FindOracle.cmake                     |    0
 cmake/modules/FindPROJ4.cmake                      |   44 +
 cmake/modules/FindSpatialIndex.cmake               |    0
 csharp-new/liblas_swig.sln                         |    0
 csharp-new/liblas_swig_cpp/liblas.i                |    0
 csharp-new/liblas_swig_cpp/liblas_swig_cpp.vcxproj |    0
 .../liblas_swig_cpp.vcxproj.filters                |    0
 .../liblas_swig_cpp/liblas_swig_cpp.vcxproj.user   |    0
 .../liblas_swig_cs/Properties/AssemblyInfo.cs      |    0
 csharp-new/liblas_swig_cs/liblas_swig_cs.csproj    |    0
 csharp-new/liblas_swig_test/Program.cs             |    0
 .../liblas_swig_test/Properties/AssemblyInfo.cs    |    0
 csharp-new/liblas_swig_test/TestGuid.cs            |    0
 csharp-new/liblas_swig_test/TestHeader.cs          |    0
 csharp-new/liblas_swig_test/TestPoint.cs           |    0
 csharp-new/liblas_swig_test/TestReader.cs          |    0
 .../liblas_swig_test/TestSpatialReference.cs       |    0
 csharp-new/liblas_swig_test/TestVariableRecord.cs  |    0
 .../liblas_swig_test/liblas_swig_test.csproj       |    0
 csharp/HelloWorldLAS/HelloWorldLAS.csproj          |    0
 csharp/HelloWorldLAS/HelloWorldLAS_Express.csproj  |    0
 csharp/HelloWorldLAS/Program.cs                    |    0
 csharp/HelloWorldLAS/Properties/AssemblyInfo.cs    |    0
 csharp/NUnitTest/LASFilesClass.cs                  |    0
 csharp/NUnitTest/LASGuidTest.cs                    |    0
 csharp/NUnitTest/LASHeaderTest.cs                  |    0
 csharp/NUnitTest/LASPointTest.cs                   |    0
 csharp/NUnitTest/LASReaderTest.cs                  |    0
 csharp/NUnitTest/LASVariableLengthRecordTest.cs    |    0
 csharp/NUnitTest/LASWriterTest.cs                  |    0
 csharp/NUnitTest/NUnitTest.csproj                  |    0
 csharp/NUnitTest/NUnitTest_Express.csproj          |    0
 csharp/NUnitTest/Properties/AssemblyInfo.cs        |    0
 csharp/Samples/Read_Express/ReadLAS.cs             |    0
 csharp/Samples/Read_Express/Read_Express.csproj    |    0
 csharp/Samples/WriteLAS/Properties/AssemblyInfo.cs |    0
 csharp/Samples/WriteLAS/WriteLAS.cs                |    0
 csharp/Samples/WriteLAS/Write_Express.csproj       |    0
 csharp/dotnetLibLAS.sln                            |    0
 csharp/dotnetLibLAS/AssemblyInfo.cs                |    0
 csharp/dotnetLibLAS/LASException.cs                |    1 +
 csharp/dotnetLibLAS/LASGuid.cs                     |   31 +-
 csharp/dotnetLibLAS/LASHeader.cs                   |  159 +-
 csharp/dotnetLibLAS/LASPoint.cs                    |   99 +-
 csharp/dotnetLibLAS/LASReader.cs                   |   75 +-
 csharp/dotnetLibLAS/LASVariableLengthRecord.cs     |   50 +-
 csharp/dotnetLibLAS/LASWriter.cs                   |   26 +-
 .../{LibLASCAPI.cs => NativeMethods.cs}            | 2068 ++++++++++----------
 csharp/dotnetLibLAS/dotnetLibLAS.csproj            |    4 +-
 csharp/dotnetLibLAS/dotnetLibLAS.dll.config        |    0
 csharp/dotnetLibLAS/dotnetLibLAS_Express.csproj    |    0
 csharp/dotnetLibLAS/dotnetLibLas.xml               |    0
 csharp/dotnetLibLAS/liblas.snk                     |  Bin
 csharp/dotnetLibLAS_xpress.sln                     |    0
 csharp/makefile.vc                                 |    0
 doc/_static/liblas-color-pallette.css              |    0
 doc/_static/liblaslogo.png                         |  Bin
 doc/_static/pdf.png                                |  Bin
 doc/_static/sphinx.css                             |    0
 doc/_templates/indexsidebar.html                   |    0
 doc/_templates/layout.html                         |    0
 doc/api/TracFooter.html                            |    0
 doc/api/TracHeader.html                            |    0
 doc/api/doxygen.conf                               |    0
 doc/api/doxygen.css                                |    0
 doc/api/doxygen_dev.conf                           |    0
 doc/community.txt                                  |    0
 doc/compilation.txt                                |  152 +-
 doc/conf.py                                        |    0
 doc/copyright.txt                                  |    0
 doc/development/annual_report_2010.txt             |    0
 doc/development/buildbot.txt                       |   29 +-
 doc/development/format_elements.txt                |    0
 doc/development/index.txt                          |    0
 doc/development/rfc/index.txt                      |    0
 doc/development/rfc/rfc_1_verticalcs.txt           |    0
 doc/development/rfc/rfc_2_spatialreference.txt     |    0
 doc/development/source.txt                         |    0
 doc/development/specifications.txt                 |    0
 doc/development/wkt.txt                            |    0
 doc/docs.txt                                       |    0
 doc/download.txt                                   |   41 +-
 doc/faq.txt                                        |    0
 doc/features.txt                                   |    0
 doc/images/boostpro-options.png                    |  Bin
 doc/images/ccmake-osx-start.png                    |  Bin
 doc/images/cmake-gui-osx-configured.png            |  Bin
 doc/images/cmake-gui-osx-start.png                 |  Bin
 doc/images/lasblock_big.png                        |  Bin
 doc/images/lasblock_small.png                      |  Bin
 doc/images/liblas-logo.svg                         |    0
 doc/images/liblas-twitter-logo.png                 |  Bin
 doc/images/osgeo4w-advanced-install.png            |  Bin
 doc/images/osgeo4w-las2las-reproject.png           |  Bin
 doc/images/osgeo4w-lasinfo-output.png              |  Bin
 doc/images/osgeo4w-lasinfo-point.png               |  Bin
 doc/images/osgeo4w-run-liblas-shell.png            |  Bin
 doc/images/osgeo4w-select-liblas.png               |  Bin
 doc/images/windows-cmake-generator-makefiles.png   |  Bin
 .../windows-cmake-generator-visual-studio-9.png    |  Bin
 doc/images/windows-cmake-start.png                 |  Bin
 doc/images/windows-command-prompt.png              |  Bin
 doc/images/windows-msvc-build.png                  |  Bin
 doc/images/windows-osgeo4w-advanced-install.png    |  Bin
 doc/images/windows-osgeo4w-choosing-packages.png   |  Bin
 doc/images/xcode-lasinfo-arguments.png             |  Bin
 doc/images/xcode-lasinfo-output.png                |  Bin
 doc/images/xcode-set-default-executable.png        |  Bin
 doc/images/xcode-start.png                         |  Bin
 doc/index.txt                                      |    0
 doc/lastools.txt                                   |    0
 doc/liblas.json                                    |    0
 doc/make.bat                                       |    0
 doc/osgeo4w.txt                                    |    6 +-
 doc/python.txt                                     |    0
 doc/start.txt                                      |  146 +-
 doc/tutorial/boo.txt                               |    0
 doc/tutorial/cpp.txt                               |  118 +-
 doc/tutorial/csharp.txt                            |    0
 doc/tutorial/index.txt                             |    0
 doc/tutorial/ironpython.txt                        |    0
 doc/tutorial/python.txt                            |    0
 doc/tutorial/qhull.txt                             |    0
 doc/tutorial/vbnet.txt                             |    0
 doc/utilities/index.txt                            |    5 -
 doc/utilities/las2las-old.txt                      |    0
 doc/utilities/las2las.txt                          |    0
 doc/utilities/las2ogr.txt                          |    0
 doc/utilities/las2tindex.txt                       |    0
 doc/utilities/las2txt.txt                          |    0
 doc/utilities/lasblock.txt                         |    0
 doc/utilities/lasdiff.txt                          |    0
 doc/utilities/lasinfo-old.txt                      |    0
 doc/utilities/lasinfo.txt                          |    0
 doc/utilities/lasmerge.txt                         |    0
 doc/utilities/ts2las.txt                           |    0
 doc/utilities/txt2las.txt                          |    0
 include/CMakeLists.txt                             |    0
 include/liblas/bounds.hpp                          |    0
 include/liblas/capi/las_config.h                   |    0
 include/liblas/capi/las_version.h                  |   52 +-
 include/liblas/capi/liblas.h                       |    0
 include/liblas/chipper.hpp                         |    0
 include/liblas/classification.hpp                  |    0
 include/liblas/color.hpp                           |    0
 include/liblas/compatibility.hpp                   |    0
 include/liblas/detail/binary.hpp                   |    0
 include/liblas/detail/endian.hpp                   |    0
 include/liblas/detail/file_ptr_stream.hpp          |    0
 include/liblas/detail/fwd.hpp                      |    0
 include/liblas/detail/index/indexcell.hpp          |    0
 include/liblas/detail/index/indexoutput.hpp        |    0
 include/liblas/detail/opt_allocator.hpp            |    0
 include/liblas/detail/pointrecord.hpp              |    0
 include/liblas/detail/private_utility.hpp          |    0
 include/liblas/detail/reader/cachedreader.hpp      |    0
 include/liblas/detail/reader/header.hpp            |    0
 include/liblas/detail/reader/reader.hpp            |    0
 include/liblas/detail/reader/zipreader.hpp         |    0
 include/liblas/detail/sha1.hpp                     |    0
 include/liblas/detail/singleton.hpp                |    0
 include/liblas/detail/timer.hpp                    |    0
 include/liblas/detail/writer/header.hpp            |    0
 include/liblas/detail/writer/point.hpp             |    0
 include/liblas/detail/writer/writer.hpp            |    0
 include/liblas/detail/writer/zipwriter.hpp         |    0
 include/liblas/detail/zippoint.hpp                 |    0
 include/liblas/dimension.hpp                       |    0
 include/liblas/error.hpp                           |    0
 include/liblas/exception.hpp                       |    0
 include/liblas/export.hpp                          |    0
 .../detail/exception_implementation.hpp            |    0
 .../property_tree/detail/file_parser_error.hpp     |    0
 .../property_tree/detail/info_parser_error.hpp     |    0
 .../property_tree/detail/info_parser_read.hpp      |    0
 .../property_tree/detail/info_parser_utils.hpp     |    0
 .../property_tree/detail/info_parser_write.hpp     |    0
 .../detail/info_parser_writer_settings.hpp         |    0
 .../property_tree/detail/json_parser_error.hpp     |    0
 .../property_tree/detail/json_parser_read.hpp      |    0
 .../property_tree/detail/json_parser_write.hpp     |    0
 .../property_tree/detail/ptree_implementation.hpp  |    0
 .../external/property_tree/detail/ptree_utils.hpp  |    0
 .../external/property_tree/detail/rapidxml.hpp     |    6 +-
 .../property_tree/detail/xml_parser_error.hpp      |    0
 .../property_tree/detail/xml_parser_flags.hpp      |    0
 .../detail/xml_parser_read_rapidxml.hpp            |    0
 .../property_tree/detail/xml_parser_utils.hpp      |    0
 .../property_tree/detail/xml_parser_write.hpp      |    0
 .../detail/xml_parser_writer_settings.hpp          |    0
 .../liblas/external/property_tree/exceptions.hpp   |    0
 .../external/property_tree/id_translator.hpp       |    0
 .../liblas/external/property_tree/info_parser.hpp  |    0
 .../liblas/external/property_tree/ini_parser.hpp   |    0
 .../liblas/external/property_tree/json_parser.hpp  |    0
 include/liblas/external/property_tree/ptree.hpp    |    0
 .../liblas/external/property_tree/ptree_fwd.hpp    |    0
 .../external/property_tree/ptree_serialization.hpp |    0
 .../external/property_tree/stream_translator.hpp   |    0
 .../liblas/external/property_tree/string_path.hpp  |    0
 .../liblas/external/property_tree/xml_parser.hpp   |    0
 include/liblas/factory.hpp                         |    0
 include/liblas/filter.hpp                          |    0
 include/liblas/header.hpp                          |    0
 include/liblas/index.hpp                           |    0
 include/liblas/iterator.hpp                        |    0
 include/liblas/liblas.hpp                          |    0
 include/liblas/point.hpp                           |    0
 include/liblas/reader.hpp                          |    0
 include/liblas/schema.hpp                          |    0
 include/liblas/spatialreference.hpp                |    8 +-
 include/liblas/transform.hpp                       |    0
 include/liblas/utility.hpp                         |    0
 include/liblas/variablerecord.hpp                  |    0
 include/liblas/version.hpp                         |    0
 include/liblas/writer.hpp                          |    0
 python/examples/add_vlr.py                         |    0
 python/examples/grab_classes.py                    |    0
 python/examples/oci_pc.py                          |    0
 python/liblas/__init__.py                          |    0
 python/liblas/color.py                             |    0
 python/liblas/core.py                              |   11 +-
 python/liblas/file.py                              |   28 +-
 python/liblas/guid.py                              |    0
 python/liblas/header.py                            |    0
 python/liblas/point.py                             |    0
 python/liblas/schema.py                            |    0
 python/liblas/srs.py                               |    0
 python/liblas/vlr.py                               |    0
 python/scripts/las2tindex.py                       |    0
 python/setup.py                                    |    6 +-
 python/tests/Color.txt                             |    0
 python/tests/File.txt                              |    0
 python/tests/GUID.txt                              |    0
 python/tests/Header.txt                            |    0
 python/tests/Point.txt                             |    0
 python/tests/SRS-GDAL.txt                          |    0
 python/tests/SRS-GeoTIFF.txt                       |    0
 python/tests/SRS.txt                               |    0
 python/tests/Schema.txt                            |    0
 python/tests/VLR.txt                               |    0
 python/tests/__init__.py                           |    0
 python/tests/test_doctests.py                      |    0
 rpm/libLAS.spec                                    |    0
 src/CMakeLists.txt                                 |    4 +-
 src/Version.rc                                     |    0
 src/c_api.cpp                                      |    0
 src/chipper.cpp                                    |    0
 src/classification.cpp                             |    0
 src/color.cpp                                      |    0
 src/detail/index/indexcell.cpp                     |    0
 src/detail/index/indexoutput.cpp                   |    0
 src/detail/reader/cachedreader.cpp                 |    0
 src/detail/reader/header.cpp                       |    8 +-
 src/detail/reader/reader.cpp                       |    0
 src/detail/reader/zipreader.cpp                    |    0
 src/detail/sha1.cpp                                |    0
 src/detail/utility.cpp                             |    0
 src/detail/writer/header.cpp                       |    5 +-
 src/detail/writer/point.cpp                        |    0
 src/detail/writer/writer.cpp                       |    0
 src/detail/writer/zipwriter.cpp                    |   81 +-
 src/detail/zippoint.cpp                            |    0
 src/dimension.cpp                                  |    0
 src/error.cpp                                      |    0
 src/factory.cpp                                    |    0
 src/filter.cpp                                     |    0
 src/gt_citation.cpp                                |    0
 src/gt_citation.h                                  |    0
 src/gt_wkt_srs.cpp                                 |    2 +-
 src/gt_wkt_srs.h                                   |    0
 src/gt_wkt_srs_for_gdal.h                          |    0
 src/header.cpp                                     | 1828 ++++++++---------
 src/index.cpp                                      |    0
 src/point.cpp                                      |    0
 src/reader.cpp                                     |    0
 src/schema.cpp                                     |    0
 src/spatialreference.cpp                           |  283 +--
 src/tifvsi.cpp                                     |    0
 src/tifvsi.h                                       |    0
 src/transform.cpp                                  |    0
 src/utility.cpp                                    |    0
 src/variablerecord.cpp                             |    0
 src/version.cpp                                    |    0
 src/writer.cpp                                     |    0
 test/CMakeLists.txt                                |    0
 test/data/1.0_0.las                                |  Bin
 test/data/1.0_1.las                                |  Bin
 test/data/1.1_0.las                                |  Bin
 test/data/1.1_1.las                                |  Bin
 test/data/1.2-with-color.las                       |  Bin
 test/data/1.2-with-color.laz                       |  Bin
 test/data/1.2_0.las                                |  Bin
 test/data/1.2_1.las                                |  Bin
 test/data/1.2_2.las                                |  Bin
 test/data/1.2_3.las                                |  Bin
 test/data/TO_core_last_clip.las                    |  Bin
 test/data/autzen.jpg                               |  Bin
 test/data/autzen.jpg.aux.xml                       |    0
 test/data/autzen.las                               |  Bin
 test/data/autzen.wld                               |    0
 test/data/bad_points_1.1.las                       |  Bin
 test/data/certainty3d-color-utm-feet-navd88.las    |  Bin
 test/data/lots_of_vlr.las                          |  Bin
 test/data/make_bad_points.py                       |    0
 test/data/srs.las                                  |  Bin
 test/data/srs_utm17.las                            |  Bin
 test/data/srs_vertcs.las                           |  Bin
 test/sample/CMakeLists.txt                         |    0
 test/sample/files.cpp                              |    0
 test/sample/files.vcproj                           |    0
 test/sample/liblas.vsprops                         |    0
 test/sample/liblas_sample.sln                      |    0
 test/sample/read.cpp                               |    0
 test/sample/read.vcproj                            |    0
 test/sample/update.cpp                             |    0
 test/sample/update.vcproj                          |    0
 test/sample/utility.hpp                            |    0
 test/sample/write.cpp                              |    0
 test/sample/write.vcproj                           |    0
 test/unit/CMakeLists.txt                           |    0
 test/unit/bounds_test.cpp                          |    0
 test/unit/classification_test.cpp                  |    0
 test/unit/common.cpp                               |    0
 test/unit/common.hpp                               |    0
 test/unit/error_test.cpp                           |    0
 test/unit/header_test.cpp                          |    0
 test/unit/liblas_test.hpp                          |    0
 test/unit/liblas_test_suite.cpp                    |    0
 test/unit/point_test.cpp                           |    0
 test/unit/reader_iterator_test.cpp                 |    0
 test/unit/reader_test.cpp                          |    0
 test/unit/spatialreference_test.cpp                |    0
 test/unit/transform_test.cpp                       |    0
 test/unit/tut/tut.hpp                              |    0
 test/unit/tut/tut_assert.hpp                       |    0
 test/unit/tut/tut_config.hpp                       |    0
 test/unit/tut/tut_console_reporter.hpp             |    0
 test/unit/tut/tut_exception.hpp                    |    0
 test/unit/tut/tut_posix.hpp                        |    0
 test/unit/tut/tut_reporter.hpp                     |    0
 test/unit/tut/tut_restartable.hpp                  |    0
 test/unit/tut/tut_result.hpp                       |    0
 test/unit/tut/tut_runner.hpp                       |    0
 test/unit/variablerecord_test.cpp                  |    0
 test/unit/writer_test.cpp                          |    0
 test/unit/zipreader_test.cpp                       |    0
 test/unit/zipwriter_test.cpp                       |    0
 397 files changed, 4860 insertions(+), 2808 deletions(-)

diff --git a/.hgtags b/.hgtags
old mode 100755
new mode 100644
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..77a3355
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,20 @@
+# .travis.yml
+# Configure Travis CI service for
+# http://github.com/libLAS
+language: cpp
+
+compiler:
+  - g++
+  - clang
+
+before_install: ./bin/ci/before_install.sh
+script: ./bin/ci/script.sh
+
+notifications:
+  email:
+    recipients:
+      - mateusz at loskot.net
+  on_success: change # [always|never|change] # default: change
+  on_failure: always # [always|never|change] # default: always
+  irc: "chat.freenode.net#liblas"
+
diff --git a/AUTHORS b/AUTHORS
old mode 100755
new mode 100644
diff --git a/CMakeLists.txt b/CMakeLists.txt
old mode 100755
new mode 100644
index 855a9f6..d246a88
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -11,11 +11,11 @@ project(libLAS)
 
 SET(LIBLAS_VERSION_MAJOR "1")
 SET(LIBLAS_VERSION_MINOR "8")
-SET(LIBLAS_VERSION_PATCH "0")
+SET(LIBLAS_VERSION_PATCH "1")
 set(VERSION "${LIBLAS_VERSION_MAJOR}.${LIBLAS_VERSION_MINOR}.${LIBLAS_VERSION_PATCH}")
-SET(LIBLAS_LIB_VERSION "2.3.0")
+SET(LIBLAS_LIB_VERSION "2.4.0")
 SET(LIBLAS_LIB_SOVERSION "3")
-SET(LIBLAS_C_LIB_VERSION "2.3.0")
+SET(LIBLAS_C_LIB_VERSION "2.4.0")
 SET(LIBLAS_C_LIB_SOVERSION "3")
 SET(OSGEO4W_UPSTREAM_RELEASE "1")
 
@@ -25,22 +25,22 @@ if(WIN32)
 
   # Name of C library
   set(LIBLAS_C_LIB_NAME liblas_c)
-  
+
   # Name of Chipper library
-  set(LASCHIP_LIB_NAME liblas_chipper )  
-  
+  set(LASCHIP_LIB_NAME liblas_chipper )
+
   # Name of Kernel libray
   set(LASKERNEL_LIB_NAME liblas_kernel )
-  
+
 else()
   # Name of C++ library
   set(LIBLAS_LIB_NAME las)
-  
+
   # Name of C library
   set(LIBLAS_C_LIB_NAME las_c)
 
   # Name of Chipper library
-  set(LASCHIP_LIB_NAME las_chipper )  
+  set(LASCHIP_LIB_NAME las_chipper )
 
   # Name of Kernel libray
   set(LASKERNEL_LIB_NAME las_kernel )
@@ -54,6 +54,7 @@ set(CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE ON)
 # Choose package components
 set(WITH_UTILITIES TRUE CACHE BOOL "Choose if libLAS utilities should be built")
 set(WITH_TESTS TRUE CACHE BOOL "Choose if libLAS unit tests should be built")
+set(BUILD_OSGEO4W TRUE CACHE BOOL "Should OSGeo4W package for Windows be built")
 
 # Choose to use pkg-config or not
 set(WITH_PKGCONFIG FALSE CACHE BOOL
@@ -61,11 +62,6 @@ set(WITH_PKGCONFIG FALSE CACHE BOOL
 
 set(WITH_ENDIANAWARE FALSE CACHE BOOL "Choose whether or not libLAS should do runtime endianness switching.  Note that this can slow things down considerably if enabled by default")
 
-# Enable CTest and submissions to libLAS dashboard at CDash
-# http://my.cdash.org/index.php?project=libLAS
-set(ENABLE_CTEST FALSE CACHE BOOL
-  "Enable CTest to support submissions of results to CDash at http://cdash.org")
-
 ###############################################################################
 # CMake settings
 cmake_minimum_required(VERSION 2.6.0)
@@ -81,14 +77,18 @@ if (CMAKE_MAJOR_VERSION GREATER 2)
     cmake_policy(SET CMP0042 OLD)
 endif()
 
+if (CMAKE_SYSTEM_NAME MATCHES "Linux")
+set(CMAKE_SKIP_RPATH ON)
+endif()
+
 ###############################################################################
 # General build settings
 
-# Default to debug mode until final 1.6.0 release 
+# Default to debug mode until final 1.6.0 release
 if(NOT MSVC_IDE)
   if(NOT CMAKE_BUILD_TYPE)
 
-  set(CMAKE_BUILD_TYPE Release CACHE STRING 
+  set(CMAKE_BUILD_TYPE Release CACHE STRING
     "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel" FORCE)
   endif()
     message(STATUS "Setting libLAS build type - ${CMAKE_BUILD_TYPE}")
@@ -104,7 +104,7 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LIBLAS_BUILD_OUTPUT_DIRECTORY})
 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LIBLAS_BUILD_OUTPUT_DIRECTORY})
 
 # Output directory in which to build ARCHIVE target files.
-set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LIBLAS_BUILD_OUTPUT_DIRECTORY}) 
+set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LIBLAS_BUILD_OUTPUT_DIRECTORY})
 
 file(READ "doc/index.txt" README )
 file(WRITE "README.txt" "${README}")
@@ -120,7 +120,7 @@ if(WIN32)
       add_definitions(-D_CRT_NONSTDC_NO_WARNING)
       add_definitions(-D_SCL_SECURE_NO_WARNINGS)
     endif()
-    
+
     if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
       string(REGEX REPLACE "/W[0-4]" "/W4"
         CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
@@ -137,7 +137,7 @@ if(WIN32)
     mark_as_advanced(VCPROJ_USER_ENVIRONMENT_PATH_DEBUG)
 
   endif()
-  
+
   set(CMAKE_INCLUDE_PATH c:/osgeo4w64/include;$ENV{CMAKE_INCLUDE_PATH})
   set(CMAKE_LIBRARY_PATH c:/osgeo4w64/lib;$ENV{CMAKE_LIBRARY_PATH})
 else()
@@ -178,9 +178,9 @@ endif(APPLE)
 # Boost C++ Libraries support - required
 message(STATUS "Searching for Boost 1.38+ - done")
 
-# Default to using static, multithreaded libraries for 
-# linking under MSVC.  This is because we show users how to 
-# use boostpro.com installer and install those options when linking 
+# Default to using static, multithreaded libraries for
+# linking under MSVC.  This is because we show users how to
+# use boostpro.com installer and install those options when linking
 # on windows in the compilation documentation.
 if(WIN32)
   if (MSVC)
@@ -190,29 +190,34 @@ if(WIN32)
 endif(WIN32)
 
 find_package(Threads)
-find_package(Boost 1.38 COMPONENTS program_options thread system iostreams filesystem REQUIRED)
+find_package(Boost 1.42 COMPONENTS program_options thread system iostreams filesystem REQUIRED)
 
 if(Boost_FOUND AND Boost_PROGRAM_OPTIONS_FOUND)
   include_directories(${Boost_INCLUDE_DIRS})
 endif()
 
 # make these available for the user to set.
-mark_as_advanced(CLEAR Boost_INCLUDE_DIR) 
-mark_as_advanced(CLEAR Boost_LIBRARY_DIRS) 
-link_directories(${Boost_LIBRARY_DIRS}) 
+mark_as_advanced(CLEAR Boost_INCLUDE_DIR)
+mark_as_advanced(CLEAR Boost_LIBRARY_DIRS)
+link_directories(${Boost_LIBRARY_DIRS})
 
 # LASZIP support - optional, default=ON
 set(WITH_LASZIP FALSE CACHE BOOL "Choose if LASzip support should be built")
 set(WITH_STATIC_LASZIP FALSE CACHE BOOL "Choose of LASzip should be statically linked")
 mark_as_advanced(WITH_STATIC_LASZIP)
 
-find_package(LASzip 2.0.1)
-if(LASZIP_FOUND)    
+if (WITH_LASZIP)
+  find_package (LASzip 2.0.1 QUIET NO_MODULE)
+  if (NOT LASZIP_FOUND)
+    find_package (LASzip 2.0.1)
+  endif ()
+endif ()
+if(LASZIP_FOUND)
     include_directories(${LASZIP_INCLUDE_DIR})
     add_definitions(-DHAVE_LASZIP=1)
-    mark_as_advanced(CLEAR LASZIP_INCLUDE_DIR) 
-    mark_as_advanced(CLEAR LASZIP_LIBRARY) 
-    mark_as_advanced(CLEAR LASZIP_VERSION) 
+    mark_as_advanced(CLEAR LASZIP_INCLUDE_DIR)
+    mark_as_advanced(CLEAR LASZIP_LIBRARY)
+    mark_as_advanced(CLEAR LASZIP_VERSION)
     set(WITH_LASZIP TRUE)
 else()
     set(LASZIP_LIBRARY "")
@@ -222,38 +227,57 @@ endif()
 # GDAL/OGR support - optional, default=OFF
 set(WITH_GDAL FALSE CACHE BOOL "Choose if GDAL support should be built")
 
-find_package(GDAL 1.7.0)
+if (WITH_GDAL)
+  find_package (GDAL 1.7.0 NO_MODULE QUIET)
+  if (NOT GDAL_FOUND)
+    find_package (GDAL 1.7.0)
+  endif ()
+endif ()
 if (GDAL_FOUND)
   include_directories(${GDAL_INCLUDE_DIR})
   add_definitions(-DHAVE_GDAL=1)
   set(WITH_GDAL TRUE)
-  mark_as_advanced(CLEAR GDAL_INCLUDE_DIR) 
-  mark_as_advanced(CLEAR GDAL_LIBRARY) 
+  mark_as_advanced(CLEAR GDAL_INCLUDE_DIR)
+  mark_as_advanced(CLEAR GDAL_LIBRARY)
+  find_package (PROJ4 NO_MODULE QUIET)
+  if (NOT PROJ4_FOUND)
+    find_package (PROJ4)
+  endif ()
 endif()
 
-# GeoTIFF support - optional, default=OFF
-set(WITH_GEOTIFF FALSE CACHE BOOL "Choose if GeoTIFF support should be built")
+# GeoTIFF support - required, default=ON
+set(WITH_GEOTIFF TRUE CACHE BOOL "Choose if GeoTIFF support should be built")
 
-find_package(GeoTIFF 1.2.5)
+find_package (GeoTIFF 1.3.0 )
 if(GEOTIFF_FOUND)
     set(WITH_GEOTIFF TRUE)
     # Confirm required API is available
-    include(CheckFunctionExists) 
+    include(CheckFunctionExists)
     include_directories(${GEOTIFF_INCLUDE_DIR})
     add_definitions(-DHAVE_LIBGEOTIFF=1)
 
-    mark_as_advanced(CLEAR TIFF_INCLUDE_DIR) 
-    mark_as_advanced(CLEAR TIFF_LIBRARY) 
+    mark_as_advanced(CLEAR TIFF_INCLUDE_DIR)
+    mark_as_advanced(CLEAR TIFF_LIBRARY)
     if (WIN32)
         set(TIFF_NAMES libtiff_i)
     endif(WIN32)
-    find_package(TIFF) 
+    find_package (TIFF QUIET NO_MODULE)
+    if (NOT TIFF_FOUND)
+      find_package(TIFF)
+    endif ()
     if (TIFF_FOUND)
       include_directories(${TIFF_INCLUDE_DIR})
     endif()
+  find_package (JPEG NO_MODULE QUIET)
+  if (NOT JPEG_FOUND)
+    find_package (JPEG)
+  endif ()
+  find_package (ZLIB NO_MODULE QUIET)
+  if (NOT ZLIB_FOUND)
+    find_package (ZLIB)
+  endif ()
 else()
-    set(GEOTIFF_LIBRARY "")
-    set(GEOTIFF_INCLUDE_DIR "")
+    message(FATAL_ERROR "Unable to find sufficient GeoTIFF")
 endif()
 
 
@@ -330,24 +354,7 @@ if(WITH_TESTS)
   message(STATUS "Enable libLAS unit tests to build - done")
   enable_testing()
 
-
-  if(ENABLE_CTEST)
-    message(STATUS
-      "Enable CTest to support submissions of results to CDash at http://cdash.org")
-    cmake_minimum_required(VERSION 2.8.0)
-    # Dashboard has been prepared for experiments
-    # http://my.cdash.org/index.php?project=libLAS
-    include(CTest)
-    message(STATUS
-      "Enable CTest to support submissions of results to CDash at http://cdash.org - done")
-  endif()
-
   add_subdirectory(test)
-else()
-  if(ENABLE_CTEST)
-    message(WARNING
-      "CTest support requested but WITH_TESTS option not specified to build of libLAS unit tests")
-  endif()
 endif()
 
 # Add find_package(libLAS) support
@@ -365,7 +372,7 @@ SET(CPACK_CMAKE_GENERATOR "Unix Makefiles")
 
 set(CPACK_SOURCE_PACKAGE_FILE_NAME
   "${CMAKE_PROJECT_NAME}-${VERSION}")
-  
+
 list(APPEND CPACK_SOURCE_IGNORE_FILES "/test/data/TO_core_last_zoom.las")
 list(APPEND CPACK_SOURCE_IGNORE_FILES "_CPack_Packages")
 list(APPEND CPACK_SOURCE_IGNORE_FILES ".gz")
@@ -397,6 +404,6 @@ include(CPack)
 
 add_custom_target(dist COMMAND ${CMAKE_MAKE_PROGRAM} package_source)
 
-if (WIN32)
+if (WIN32 AND BUILD_OSGEO4W)
     include(BuildOSGeo4W)
-endif(WIN32)
+endif ()
diff --git a/COPYING b/COPYING
old mode 100755
new mode 100644
diff --git a/CTestConfig.cmake b/CTestConfig.cmake
deleted file mode 100755
index 2d728ca..0000000
--- a/CTestConfig.cmake
+++ /dev/null
@@ -1,20 +0,0 @@
-###############################################################################
-#
-# CTest configuration for libLAS project
-#
-# libLAS CDash: http://my.cdash.org/index.php?project=libLAS
-#
-###############################################################################
-## This file should be placed in the root directory of your project.
-## Then modify the CMakeLists.txt file in the root directory of your
-## project to incorporate the testing dashboard.
-## # The following are required to uses Dart and the Cdash dashboard
-##   ENABLE_TESTING()
-##   INCLUDE(CTest)
-set(CTEST_PROJECT_NAME "libLAS")
-set(CTEST_NIGHTLY_START_TIME "01:30:00 BST")
-
-set(CTEST_DROP_METHOD "http")
-set(CTEST_DROP_SITE "my.cdash.org")
-set(CTEST_DROP_LOCATION "/submit.php?project=libLAS")
-set(CTEST_DROP_SITE_CDASH TRUE)
diff --git a/INSTALL b/INSTALL
old mode 100755
new mode 100644
diff --git a/LICENSE.txt b/LICENSE.txt
old mode 100755
new mode 100644
index 0123861..8d8f77d
--- a/LICENSE.txt
+++ b/LICENSE.txt
@@ -1,7 +1,7 @@
 libLAS Main License
 ==============================================================================
 
-Copyright (c) 2007, Martin Isenburg, isenburg at cs.unc.edu 
+Copyright (c) 2007, Martin Isenburg, isenburg at cs.unc.edu
 
 Copyright (c) 2008, Howard Butler, hobu.inc at gmail.com
 
@@ -13,34 +13,38 @@ Copyright (c) 2008, Frank Warmerdam, warmerdam at pobox.com
 
 Copyright (c) 2008, Martin Rodriguez, mrodriguez at stereocarto.com
 
+Copyright (c) 2016, Oscar Martinez Rubi o.rubi at esciencecenter.nl
+
+Copyright (c) 2016, Romulo Goncalves r.goncalves at esciencecenter.nl
+
 All rights reserved.
 
-Redistribution and use in source and binary forms, with or without 
-modification, are permitted provided that the following 
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following
 conditions are met:
 
-    * Redistributions of source code must retain the above copyright 
+    * Redistributions of source code must retain the above copyright
       notice, this list of conditions and the following disclaimer.
-    * Redistributions in binary form must reproduce the above copyright 
-      notice, this list of conditions and the following disclaimer in 
-      the documentation and/or other materials provided 
+    * Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in
+      the documentation and/or other materials provided
       with the distribution.
-    * Neither the name of the Martin Isenburg or Iowa Department 
-      of Natural Resources nor the names of its contributors may be 
-      used to endorse or promote products derived from this software 
+    * Neither the name of the Martin Isenburg or Iowa Department
+      of Natural Resources nor the names of its contributors may be
+      used to endorse or promote products derived from this software
       without specific prior written permission.
 
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
-FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
-COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 
-OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
-AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
 OF SUCH DAMAGE.
 
 include/liblas/cstdint.hpp
@@ -58,7 +62,7 @@ modified for libLAS purposes.
 (C) Copyright Jens Mauer 2001
 
 (C) Copyright Beman Dawes 1999
- 
+
 Boost Software License - Version 1.0 - August 17th, 2003
 
 Permission is hereby granted, free of charge, to any person or organization
@@ -139,7 +143,7 @@ include/liblas/detail/sharedptr.hpp
 ==============================================================================
 
 The SharedPtr class is based on implementation of CountedPtr
-from the book "The C++ Standard Library - A Tutorial and Reference".  It is 
+from the book "The C++ Standard Library - A Tutorial and Reference".  It is
 released under the main libLAS licensing terms.
 
 (C) Copyright Nicolai M. Josuttis 1999
@@ -245,4 +249,50 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-DEALINGS IN THE SOFTWARE.
\ No newline at end of file
+DEALINGS IN THE SOFTWARE.
+
+apps/las2pg.c
+==============================================================================
+
+Copyright (c) 2016, Oscar Martinez Rubi o.rubi at esciencecenter.nl
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute, sublicense,
+and/or sell copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+
+apps/las2col.c
+==============================================================================
+
+Copyright (c) 2016, Romulo Goncalves r.goncalves at esciencecenter.nl
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute, sublicense,
+and/or sell copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
diff --git a/NEWS b/NEWS
old mode 100755
new mode 100644
diff --git a/apps/CMakeLists.txt b/apps/CMakeLists.txt
old mode 100755
new mode 100644
index 2013c07..d22b4ea
--- a/apps/CMakeLists.txt
+++ b/apps/CMakeLists.txt
@@ -1,6 +1,6 @@
 ###############################################################################
 #
-# apps/CMakeLists.txt controls building of libLAS utilities 
+# apps/CMakeLists.txt controls building of libLAS utilities
 #
 # Copyright (c) 2009 Mateusz Loskot <mateusz at loskot.net>
 #
@@ -20,6 +20,8 @@ set(LAS2TXT las2txt)
 set(TXT2LAS txt2las)
 set(TS2LAS ts2las)
 set(LASBLOCK lasblock )
+set(LAS2COL las2col )
+set(LAS2PG las2pg )
 
 set(BIGFILE_TEST bigfile_test)
 set(LASINDEX_TEST lasindex_test)
@@ -28,7 +30,7 @@ if(Boost_IOSTREAMS_FOUND)
   set(BIGFILE_BIO_TEST bigfile_boost_iostreams_test)
 endif()
 
-# Set the build type to release if it is not explicitly set by the user and 
+# Set the build type to release if it is not explicitly set by the user and
 # isn't in the cache yet
 if (NOT CMAKE_BUILD_TYPE )
   set(CMAKE_BUILD_TYPE "Release")
@@ -41,8 +43,8 @@ endif()
 
 
 set(LIBLAS_UTILITIES
-    ${LASINFO} ${LAS2LAS} ${TXT2LAS} 
-    ${LAS2OGR} ${LAS2LAS} ${LASBLOCK} ${TS2LAS}  ${LAS2TXT} )
+    ${LASINFO} ${LAS2LAS} ${TXT2LAS}  ${LAS2COL}  ${LAS2PG}
+    ${LAS2OGR} ${LAS2LAS} ${LASBLOCK} ${TS2LAS}  ${LAS2TXT})
 
 # TODO: Experimental and requires testing --mloskot
 # Generate user-specific settings for Visual Studio project
@@ -90,7 +92,7 @@ if(LAS2TXT)
     add_executable( ${LAS2TXT}  las2txt.cpp laskernel.cpp )
     target_link_libraries(${LAS2TXT} ${APPS_CPP_DEPENDENCIES}  )
 endif()
- 
+
 # Build txt2las
 if(TXT2LAS)
     set(TXT2LAS_SRC lascommon.c ${TXT2LAS}.c)
@@ -98,6 +100,20 @@ if(TXT2LAS)
     target_link_libraries(${TXT2LAS} ${LIBLAS_C_LIB_NAME})
 endif()
 
+# Build las2col
+if(LAS2COL)
+    set(LAS2COL_SRC lascommon.c ${LAS2COL}.c)
+    add_executable(${LAS2COL} ${LAS2COL_SRC})
+    target_link_libraries(${LAS2COL} ${LIBLAS_C_LIB_NAME})
+endif()
+
+# Build las2pg
+if(LAS2PG)
+    set(LAS2PG_SRC lascommon.c ${LAS2PG}.c)
+    add_executable(${LAS2PG} ${LAS2PG_SRC})
+    target_link_libraries(${LAS2PG} ${LIBLAS_C_LIB_NAME})
+endif()
+
 if(TS2LAS)
     add_executable(${TS2LAS} ts2las.cpp laskernel.cpp)
     target_link_libraries(${TS2LAS} ${APPS_CPP_DEPENDENCIES} )
@@ -124,12 +140,12 @@ endif()
 
 if (LASINDEX_TEST)
     add_executable(${LASINDEX_TEST} lasindex_test.cpp)
-    target_link_libraries(${LASINDEX_TEST} ${APPS_CPP_DEPENDENCIES})    
+    target_link_libraries(${LASINDEX_TEST} ${APPS_CPP_DEPENDENCIES})
 endif()
 
 if(BIGFILE_BIO_TEST)
     add_executable(${BIGFILE_BIO_TEST} bigfile_boost_iostreams_test.cpp)
-    target_link_libraries(${BIGFILE_BIO_TEST} ${APPS_CPP_DEPENDENCIES} )    
+    target_link_libraries(${BIGFILE_BIO_TEST} ${APPS_CPP_DEPENDENCIES} )
 endif()
 
 ###############################################################################
@@ -160,7 +176,7 @@ if(UNIX)
     INSTALL_RPATH "${LIBLAS_UTILS_RPATH}")
 
   if(WITH_PKGCONFIG)
-    
+
     set(PKGCFG_PREFIX "${CMAKE_INSTALL_PREFIX}")
     set(PKGCFG_INC_DIR "${LIBLAS_INCLUDE_SUBDIR}")
     set(PKGCFG_LIB_DIR "${LIBLAS_LIB_SUBDIR}")
@@ -182,7 +198,7 @@ if(UNIX)
     install(FILES ${CMAKE_CURRENT_BINARY_DIR}/liblas.pc
       DESTINATION ${LIBLAS_LIB_DIR}/pkgconfig
       PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
-    
+
   else()
 
     # Autoconf compatibility variables to use the same script source.
@@ -190,21 +206,19 @@ if(UNIX)
     set(exec_prefix ${CMAKE_INSTALL_PREFIX}/bin)
     set(libdir ${CMAKE_INSTALL_PREFIX}/lib)
 
-    GET_DIRECTORY_PROPERTY(LIBLAS_DEFINITIONS DIRECTORY ${libLAS_SOURCE_DIR}/ COMPILE_DEFINITIONS)   
+    GET_DIRECTORY_PROPERTY(LIBLAS_DEFINITIONS DIRECTORY ${libLAS_SOURCE_DIR}/ COMPILE_DEFINITIONS)
 
     set(LIBLAS_CONFIG_DEFINITIONS "")
     foreach(definition ${LIBLAS_DEFINITIONS})
         set(LIBLAS_CONFIG_DEFINITIONS "${LIBLAS_CONFIG_DEFINITIONS} -D${definition}")
     endforeach()
 
-     
+
     configure_file(${CMAKE_CURRENT_SOURCE_DIR}/liblas-config.in
       ${CMAKE_CURRENT_BINARY_DIR}/liblas-config @ONLY)
-      
-    install(FILES ${CMAKE_CURRENT_BINARY_DIR}/liblas-config
-      DESTINATION bin/
-      PERMISSIONS
-      OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
+
+    install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/liblas-config
+      DESTINATION bin)
 
   endif()
 
diff --git a/apps/bigfile_boost_iostreams_test.cpp b/apps/bigfile_boost_iostreams_test.cpp
old mode 100755
new mode 100644
diff --git a/apps/bigtest.c b/apps/bigtest.c
old mode 100755
new mode 100644
diff --git a/apps/las2col.c b/apps/las2col.c
new file mode 100644
index 0000000..4579f25
--- /dev/null
+++ b/apps/las2col.c
@@ -0,0 +1,1065 @@
+/***************************************************************************
+ *
+ * Project: libLAS -- C/C++ read/write library for LAS LIDAR data
+ * Purpose: LAS translation to MonetDB binary format with optional configuration
+ * Author:  Romulo Goncalves r.goncalves at esciencecenter.nl
+            Oscar Martinez Rubi o.rubi at esciencecenter.nl
+ ***************************************************************************
+ * This tool has been developed by the Netherlands eScience Center
+ * (https://www.esciencecenter.nl/)
+ *
+ * Copyright (c) 2016, Romulo Goncalves r.goncalves at esciencecenter.nl
+ *
+ * See LICENSE.txt in this source distribution for more information.
+ **************************************************************************/
+#include <sys/stat.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <pthread.h>
+#include <assert.h>
+
+#include "liblas.h"
+#include "lascommon.h"
+
+#include <limits.h>
+#include <inttypes.h>
+#if defined(__linux__) || defined(__CYGWIN__)
+
+#include <endian.h>
+#include <unistd.h>
+#elif defined(__APPLE__)
+
+#include <unistd.h>
+#	include <libkern/OSByteOrder.h>
+
+#	define htobe16(x) OSSwapHostToBigInt16(x)
+#	define htole16(x) OSSwapHostToLittleInt16(x)
+#	define be16toh(x) OSSwapBigToHostInt16(x)
+#	define le16toh(x) OSSwapLittleToHostInt16(x)
+
+#	define htobe32(x) OSSwapHostToBigInt32(x)
+#	define htole32(x) OSSwapHostToLittleInt32(x)
+#	define be32toh(x) OSSwapBigToHostInt32(x)
+#	define le32toh(x) OSSwapLittleToHostInt32(x)
+
+#	define htobe64(x) OSSwapHostToBigInt64(x)
+#	define htole64(x) OSSwapHostToLittleInt64(x)
+#	define be64toh(x) OSSwapBigToHostInt64(x)
+#	define le64toh(x) OSSwapLittleToHostInt64(x)
+
+#	define __BYTE_ORDER    BYTE_ORDER
+#	define __BIG_ENDIAN    BIG_ENDIAN
+#	define __LITTLE_ENDIAN LITTLE_ENDIAN
+#	define __PDP_ENDIAN    PDP_ENDIAN
+
+#elif defined(__OpenBSD__)
+
+#include <unistd.h>
+#	include <sys/endian.h>
+
+#elif defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__)
+
+#	include <sys/endian.h>
+
+#	define be16toh(x) betoh16(x)
+#	define le16toh(x) letoh16(x)
+
+#	define be32toh(x) betoh32(x)
+#	define le32toh(x) letoh32(x)
+
+#	define be64toh(x) betoh64(x)
+#	define le64toh(x) letoh64(x)
+
+#elif defined(__WINDOWS__)
+
+#	include <winsock2.h>
+#	include <sys/param.h>
+
+#	if BYTE_ORDER == LITTLE_ENDIAN
+
+#		define htobe16(x) htons(x)
+#		define htole16(x) (x)
+#		define be16toh(x) ntohs(x)
+#		define le16toh(x) (x)
+
+#		define htobe32(x) htonl(x)
+#		define htole32(x) (x)
+#		define be32toh(x) ntohl(x)
+#		define le32toh(x) (x)
+
+#		define htobe64(x) htonll(x)
+#		define htole64(x) (x)
+#		define be64toh(x) ntohll(x)
+#		define le64toh(x) (x)
+
+#	elif BYTE_ORDER == BIG_ENDIAN
+
+		/* that would be xbox 360 */
+#		define htobe16(x) (x)
+#		define htole16(x) __builtin_bswap16(x)
+#		define be16toh(x) (x)
+#		define le16toh(x) __builtin_bswap16(x)
+
+#		define htobe32(x) (x)
+#		define htole32(x) __builtin_bswap32(x)
+#		define be32toh(x) (x)
+#		define le32toh(x) __builtin_bswap32(x)
+
+#		define htobe64(x) (x)
+#		define htole64(x) __builtin_bswap64(x)
+#		define be64toh(x) (x)
+#		define le64toh(x) __builtin_bswap64(x)
+
+#	else
+
+#		error byte order not supported
+
+#	endif
+
+#	define __BYTE_ORDER    BYTE_ORDER
+#	define __BIG_ENDIAN    BIG_ENDIAN
+#	define __LITTLE_ENDIAN LITTLE_ENDIAN
+#	define __PDP_ENDIAN    PDP_ENDIAN
+
+#else
+
+#	error platform not supported
+
+#endif
+
+#include <math.h>
+
+#ifndef _BSD_SOURCE
+#define _BSD_SOURCE
+#endif
+
+#define boolean short
+#define int64_t long long int
+
+#define NUM_OF_ENTRIES      21
+#define DEFAULT_NUM_READ_THREADS 1
+#define DEFAULT_NUM_INPUT_FILES 2000
+#define TOLERANCE 0.0000001
+#define MAX_INT_31 2147483648.0
+
+#define set_lock(lock, s) \
+{ MT_lock_set(&lock, s);}
+#define unset_lock(node, lock, s) \
+{ MT_lock_unset(&lock, s);}
+
+
+
+
+void print_header(FILE *file, LASHeaderH header, const char* file_name);
+
+void usage()
+{
+    fprintf(stderr,"----------------------------------------------------------\n");
+    fprintf(stderr,"    las2col (version %s) usage:\n", LAS_GetVersion());
+    fprintf(stderr,"----------------------------------------------------------\n");
+    fprintf(stderr,"\n");
+
+    fprintf(stderr,"Convert a las/laz file into columnar format (binary) of MonetDB, outputs for each entry a file <ouput_prefix>_col_<entry_name>.dat:\n");
+    fprintf(stderr,"  las2col -i <input_file> -o <ouput_prefix>\n");
+    fprintf(stderr,"\n");
+
+    fprintf(stderr,"Convert a list of las/laz files (still outputs for each entry a file <ouput_prefix>_col_<entry_name>.dat):\n");
+    fprintf(stderr,"  las2col -i <las_file_1> -i <las_file_2> -o <ouput_prefix>\n");
+    fprintf(stderr,"Alternatively:\n");
+    fprintf(stderr,"  las2col -f <file_with_the_list_las/laz_files> -o <ouput_prefix>\n");
+    fprintf(stderr,"\n");
+
+    fprintf(stderr,"Convert a list of las/laz files using <num_read_threads> threads (default is 1):\n");
+    fprintf(stderr,"  las2col -f <file_with_the_list_las/laz_files> -o <ouput_prefix> --num_read_threads <number_of_threads>\n");
+    fprintf(stderr,"\n\n");
+
+    fprintf(stderr,"----------------------------------------------------------\n");
+    fprintf(stderr," The '--parse txyz' flag specifies which entries of the LAS/LAZ\n");
+    fprintf(stderr," will be extracted (default is --parse xyz). For example, 'txyzia'\n");
+    fprintf(stderr," means that six columnar (binary) MonetDB files will be generated,\n");
+    fprintf(stderr," the first one containing all gpstime values, \n");
+    fprintf(stderr," the next three containing values for x, y, and\n");
+    fprintf(stderr," z coordinates, the next one with intensity values\n");
+    fprintf(stderr," and the last one with scan angle values.\n");
+    fprintf(stderr," The supported entries are:\n");
+    fprintf(stderr,"   t - gpstime as double\n");
+    fprintf(stderr,"   x - x coordinate as double\n");
+    fprintf(stderr,"   y - y coordinate as double\n");
+    fprintf(stderr,"   z - z coordinate as double\n");
+    fprintf(stderr,"   X - x coordinate as decimal(<num_digits_unscaled_max_x>,<num_digits_scale_x>)\n");
+    fprintf(stderr,"   Y - y coordinate as decimal(<num_digits_unscaled_max_y>,<num_digits_scale_y>)\n");
+    fprintf(stderr,"   Z - z coordinate as decimal(<num_digits_unscaled_max_z>,<num_digits_scale_z>)\n");
+    fprintf(stderr,"   a - scan angle as tinyint\n");
+    fprintf(stderr,"   i - intensity as smallint\n");
+    fprintf(stderr,"   n - number of returns for given pulse as smallint\n");
+    fprintf(stderr,"   r - number of this return as smallint\n");
+    fprintf(stderr,"   c - classification number as tinyint\n");
+    fprintf(stderr,"   u - user data as tinyint\n");
+    fprintf(stderr,"   p - point source ID as smallint\n");
+    fprintf(stderr,"   e - edge of flight line as smallint\n");
+    fprintf(stderr,"   d - direction of scan flag as smallint\n");
+    fprintf(stderr,"   R - red channel of RGB color as smallint\n");
+    fprintf(stderr,"   G - green channel of RGB color as smallint\n");
+    fprintf(stderr,"   B - blue channel of RGB color as smallint\n");
+    fprintf(stderr,"   M - vertex index number as integer\n");
+    fprintf(stderr,"   k - Morton 2D code using X and Y (unscaled and no offset) as bigint\n\n");
+
+    fprintf(stderr," The '--moffset 8600000,40000000' flag specifies a global offset in X and Y \n");
+    fprintf(stderr," to be used when computing the Morton 2D code. Values must be unscaled \n\n");
+
+    fprintf(stderr," The '--check 0.01,0.01' flag checks suitability to compute Morton 2D codes \n");
+    fprintf(stderr," It checks specified scale matches the one in input file. \n");
+    fprintf(stderr," If moffset is provided it also checks that obtained Morton 2D codes \n");
+    fprintf(stderr," will be consistent, i.e. global X,Y within [0,2^31] \n\n");
+
+    fprintf(stderr,"----------------------------------------------------------\n");
+
+    fprintf(stderr," After generating the columnar files, import them in MonetDB. Example: \n");
+    fprintf(stderr,"   mclient <db_name> -s \"COPY BINARY INTO flat FROM ('<full_parent_path>/out_col_x.dat','<full_parent_path>/out_col_y.dat','<full_parent_path>/out_col_z.dat')\"\n");
+    fprintf(stderr," Note that full paths of the columnar files MUST be used. Also note that a table called flat has to be created in a MonetDB DB beforehand. The table must have \n");
+    fprintf(stderr," the columns in the same order as specified by the --parse option, and the column types must be the ones speficied above. Example: \n");
+    fprintf(stderr,"   mclient <db_name> -s \"create table flat (x double, y double, z double)\"\n");
+    fprintf(stderr," Note that for decimal entries (XYZ) the column definition at table-creation time must be decimal(<num_digits_unscaled_max>,<num_digits_scale>)\n");
+    fprintf(stderr," For example, if the maximum X value of a file (or a list of files) is 638982.55, then the X definition when creating the table is decimal(8,2). Example:\n");
+    fprintf(stderr,"   mclient <db_name> -s \"create table flat (x decimal(8,2), y decimal(8,2), z decimal(8,2))\"\n");
+}
+
+/*Global structures*/
+#define MT_Lock pthread_mutex_t
+#define MT_set_lock(p) pthread_mutex_lock(p)
+#define MT_unset_lock(p) pthread_mutex_unlock(p)
+#define MT_lock_init(p) pthread_mutex_init(p,NULL)
+#define MT_lock_destroy(p) pthread_mutex_destroy(p)
+
+#define MT_Cond pthread_cond_t
+#define MT_cond_wait(p,t) pthread_cond_wait(p,t)
+#define MT_cond_init(p) pthread_cond_init(p,NULL)
+#define MT_cond_destroy(p) pthread_cond_destroy(p)
+
+typedef void (*f_ptr)( void );
+
+MT_Lock dataLock;
+MT_Cond mainCond, writeTCond, readCond;
+int entries[NUM_OF_ENTRIES];
+double (*entriesFuncD[NUM_OF_ENTRIES])();
+int (*entriesFuncI[NUM_OF_ENTRIES])();
+short (*entriesFuncS[NUM_OF_ENTRIES])();
+char (*entriesFuncC[NUM_OF_ENTRIES])();
+int entriesType[NUM_OF_ENTRIES];
+char **files_name_in = NULL;
+int files_in_index = 0 ;
+int skip_invalid = FALSE;
+int verbose = TRUE;
+struct writeT **data = NULL;
+struct writeT *dataWriteT = NULL;
+int stop;
+
+typedef enum {
+    ENTRY_x,
+    ENTRY_y,
+    ENTRY_z,
+    ENTRY_X,
+    ENTRY_Y,
+    ENTRY_Z,
+    ENTRY_t,
+    ENTRY_i,
+    ENTRY_a,
+    ENTRY_r,
+    ENTRY_c,
+    ENTRY_u,
+    ENTRY_n,
+    ENTRY_R,
+    ENTRY_G,
+    ENTRY_B,
+    ENTRY_M,
+    ENTRY_p,
+    ENTRY_e,
+    ENTRY_d,
+    ENTRY_k
+} ENTRIES;
+
+struct writeThreadArgs {
+    int id;
+    FILE *out;
+};
+
+struct writeT {
+    long num_points;
+    char* values;
+    int type;
+};
+
+struct readThreadArgs {
+    int id;
+    int num_read_threads;
+    int num_of_entries;
+    int check;
+    int64_t global_offset_x;
+    int64_t global_offset_y;
+    double scale_x;
+    double scale_y;
+};
+
+void* writeFile(void *arg) {
+    int i = 0;
+    struct writeThreadArgs *wTA = (struct writeThreadArgs*) arg;
+
+    /*Obtain lock over data to get the pointer*/
+    while (stop == 0) {
+        MT_set_lock(&dataLock);
+        while ((stop == 0) && (dataWriteT == NULL || (dataWriteT && dataWriteT[wTA->id].values == NULL))) {
+            /*Sleep and wait for data to be read*/
+            MT_cond_wait(&writeTCond,&dataLock);
+        }
+        //Release the lock
+        MT_unset_lock(&dataLock);
+
+        if (stop) {
+            return NULL;
+        }
+
+        fwrite(dataWriteT[wTA->id].values, dataWriteT[wTA->id].type, dataWriteT[wTA->id].num_points, wTA->out);
+        //for (i = 0; i < 1000; i++)
+        //    printf("%d\n", dataWriteT[wTA->id].values[i]);
+        MT_set_lock(&dataLock);
+        free(dataWriteT[wTA->id].values);
+        dataWriteT[wTA->id].values = NULL;
+        MT_unset_lock(&dataLock);
+        fflush(wTA->out);
+
+        /*Wake up the main*/
+        pthread_cond_broadcast(&mainCond);
+    }
+    return NULL;
+}
+
+void* readFile(void *arg) {
+    struct readThreadArgs *rTA = (struct readThreadArgs*) arg;
+    LASReaderH reader = NULL;
+    LASHeaderH header = NULL;
+    LASPointH p = NULL;
+    unsigned int index = 0;
+    int read_index = 0;
+    char *file_name_in = NULL;
+    int i, j;
+
+    while(1) {
+        file_name_in = NULL;
+        /*Get next file to read*/
+        MT_set_lock(&dataLock);
+        file_name_in = files_name_in[files_in_index];
+        if (file_name_in == NULL) {
+            MT_unset_lock(&dataLock);
+            return NULL;
+        }
+        read_index = (files_in_index % rTA->num_read_threads);
+        files_in_index++;
+
+        struct writeT *dataWriteTT = (struct writeT*) malloc(sizeof(struct writeT)*rTA->num_of_entries);
+        /*Lets read the data*/
+        reader = LASReader_Create(file_name_in);
+        if (!reader) {
+            LASError_Print("Unable to read file");
+            MT_unset_lock(&dataLock);
+            exit(1);
+        }
+        MT_unset_lock(&dataLock);
+
+        header = LASReader_GetHeader(reader);
+        if (!header) {
+            LASError_Print("Unable to fetch header for file");
+            exit(1);
+        }
+
+        if (verbose)
+        {
+            print_header(stderr, header, file_name_in);
+        }
+
+        /*Allocate arrays for the columns*/
+	long num_points = LASHeader_GetPointRecordsCount(header);
+	for (i = 0; i < rTA->num_of_entries; i++) {
+		dataWriteTT[i].num_points = num_points;
+		dataWriteTT[i].values = malloc(entriesType[i]*num_points);
+		dataWriteTT[i].type = entriesType[i];
+	}
+
+	/*Changes for Oscar's new Morton code function*/
+	//unsigned int factorX = (unsigned int) (LASHeader_GetOffsetX(header) / LASHeader_GetScaleX(header));
+	//unsigned int factorY = (unsigned int) (LASHeader_GetOffsetY(header) / LASHeader_GetScaleY(header));
+
+    /*Compute factors to add to X and Y and cehck sanity of generated codes*/
+    double file_scale_x = LASHeader_GetScaleX(header);
+    double file_scale_y = LASHeader_GetScaleY(header);
+    double file_scale_z = LASHeader_GetScaleZ(header);
+    //printf("The scales are x:%lf y:%lf z:%lf\n", file_scale_x, file_scale_y, file_scale_z);
+
+	/* scaled offsets to add for the morton encoding */
+	int64_t factorX =  ((int64_t) (LASHeader_GetOffsetX(header) / file_scale_x)) - rTA->global_offset_x;
+	int64_t factorY =  ((int64_t) (LASHeader_GetOffsetY(header) / file_scale_y)) - rTA->global_offset_y;
+
+	if (rTA->check)
+	{
+	        // Check specified scales are like in the LAS file
+		if (fabs(rTA->scale_x - file_scale_x) > TOLERANCE){
+			fprintf(stderr, "ERROR: x scale in input file (%lf) does not match specified x scale (%lf)\n",file_scale_x, rTA->scale_x);
+			exit(1);
+		}
+		if (fabs(rTA->scale_y - file_scale_y) > TOLERANCE){
+			fprintf(stderr, "ERROR: y scale in input file (%lf) does not match specified y scale (%lf)\n",file_scale_y, rTA->scale_y);
+			exit(1);
+		}
+		/* Check that the extent of the file (taking into account the global offset)
+		 * is within 0,2^31 */
+		double check_min_x = 1.0 + LASHeader_GetMinX(header) - (((double) rTA->global_offset_x) * rTA->scale_x);
+		if (check_min_x < TOLERANCE) {
+			fprintf(stderr, "ERROR: Specied X global offset is too large. (MinX - (GlobalX*ScaleX)) < 0\n");
+			exit(1);
+		}
+		double check_min_y = 1.0 + LASHeader_GetMinY(header) - (((double) rTA->global_offset_y) * rTA->scale_y);
+		if (check_min_y < TOLERANCE) {
+			fprintf(stderr, "ERROR: Specied Y global offset is too large. (MinY - (GlobalY*ScaleY)) < 0\n");
+			exit(1);
+		}
+		double check_max_x = LASHeader_GetMaxX(header) - (((double) rTA->global_offset_x) * rTA->scale_x);
+		if (check_max_x > (MAX_INT_31 * rTA->scale_x)) {
+			fprintf(stderr, "ERROR: Specied X global offset is too small. (MaxX - (GlobalX*ScaleX)) > (2^31)*ScaleX\n");
+			exit(1);
+		}
+		double check_max_y = LASHeader_GetMaxY(header) - (((double) rTA->global_offset_y) * rTA->scale_y);
+		if (check_max_y > (MAX_INT_31 * rTA->scale_y)) {
+			fprintf(stderr, "ERROR: Specied Y global offset is too small. (MaxY - (GlobalY*ScaleY)) > (2^31)*ScaleY\n");
+			exit(1);
+		}
+	}
+
+        p = LASReader_GetNextPoint(reader);
+        index = 0;
+        while (p)
+        {
+            if (skip_invalid && !LASPoint_IsValid(p)) {
+                if (verbose) {
+                    LASError_Print("Skipping writing invalid point...");
+                }
+                p = LASReader_GetNextPoint(reader);
+                index -=1;
+                continue;
+            }
+
+            LASColorH color = NULL;
+            for (j = 0; j < rTA->num_of_entries; j++) {
+                uint64_t res;
+                switch (entries[j]) {
+                    case ENTRY_x:
+                    case ENTRY_y:
+                    case ENTRY_z:
+                    case ENTRY_t:
+                        ((double*) dataWriteTT[j].values)[index] = entriesFuncD[j](p);
+                        //printf(" Point is:%lf\n", ((double*) dataWriteTT[j].values)[index]);
+                        break;
+                    case ENTRY_X:
+                        ((int*) dataWriteTT[j].values)[index] = entriesFuncD[j](p) / file_scale_x;
+                        break;
+                    case ENTRY_Y:
+                        ((int*) dataWriteTT[j].values)[index] = entriesFuncD[j](p) / file_scale_y;
+                        break;
+                    case ENTRY_Z:
+                        ((int*) dataWriteTT[j].values)[index] = entriesFuncD[j](p) / file_scale_z;
+                        break;
+                    case ENTRY_i:
+                    case ENTRY_r:
+                    case ENTRY_n:
+                    case ENTRY_p:
+                    case ENTRY_e:
+                    case ENTRY_d:
+                        ((short*) dataWriteTT[j].values)[index] = entriesFuncS[j](p);
+                        break;
+                    case ENTRY_a:
+                    case ENTRY_c:
+                    case ENTRY_u:
+                        ((char*) dataWriteTT[j].values)[index] = entriesFuncC[j](p);
+                        break;
+                    case ENTRY_k:
+                        entriesFuncD[j](&res, p, factorX, factorY);
+                        ((int64_t*)dataWriteTT[j].values)[index] = res;
+                        break;
+                    case ENTRY_R:
+                    case ENTRY_G:
+                    case ENTRY_B:
+                        color = (color == NULL) ? LASPoint_GetColor(p) : color;
+                        ((unsigned short*) dataWriteTT[j].values)[index] = entriesFuncS[j](color);;
+                        break;
+                    case ENTRY_M:
+                        ((unsigned int*)dataWriteTT[j].values)[index] = index;
+                        break;
+                    default:
+                        LASError_Print("las2col:readFile: Invalid Entry.");
+                }
+            }
+            if (color != NULL)
+                LASColor_Destroy(color);
+
+            p = LASReader_GetNextPoint(reader);
+            index +=1;
+        }
+        if (verbose)
+            printf("Num of points:%d %ld for file:%s \n", index, num_points, file_name_in);
+
+        /*Give the data to the writer threads*/
+        MT_set_lock(&dataLock);
+        LASHeader_Destroy(header);
+        header = NULL;
+        LASReader_Destroy(reader);
+	    reader = NULL;
+
+        /*TODO: make sure you are not overtaking other reading threads*/
+        while (data[read_index] != NULL) {
+            MT_cond_wait(&readCond, &dataLock);
+        }
+        data[read_index] = dataWriteTT;
+        /*Wake up the main*/
+        pthread_cond_broadcast(&mainCond);
+        MT_unset_lock(&dataLock);
+
+    }
+    return NULL;
+}
+
+int doesFileExist(const char *filename) {
+    struct stat st;
+    int result = stat(filename, &st);
+    return result == 0;
+}
+
+int64_t EncodeMorton2D_1(unsigned int rawx, unsigned int rawy){
+    int64_t answer = 0;
+    int64_t i;
+    for (i = 0; i < (sizeof(int64_t)* CHAR_BIT)/2; ++i) {
+        answer |= ((rawy & ((int64_t)1 << i)) << i) | ((rawx & ((int64_t)1 << i)) << (i + 1));
+    }
+    return answer;
+}
+
+uint64_t Expand1(uint32_t a)
+{
+	uint64_t b = a & 0x7fffffff;               // b = ---- ---- ---- ---- ---- ---- ---- ---- 0edc ba98 7654 3210 fedc ba98 7654 3210
+	b = (b ^ (b <<  16)) & 0x0000ffff0000ffff; // b = ---- ---- ---- ---- 0edc ba98 7654 3210 ---- ---- ---- ---- fedc ba98 7654 3210
+	b = (b ^ (b <<  8))  & 0x00ff00ff00ff00ff; // b = ---- ---- 0edc ba98 ---- ---- 7654 3210 ---- ---- fedc ba98 ---- ---- 7654 3210
+	b = (b ^ (b <<  4))  & 0x0f0f0f0f0f0f0f0f; // b = ---- 0edc ---- ba98 ---- 7654 ---- 3210 ---- fedc ---- ba98 ---- 7654 ---- 3210
+	b = (b ^ (b <<  2))  & 0x3333333333333333; // b = --0e --dc --ba --98 --76 --54 --32 --10 --fe --dc --ba --98 --76 --54 --32 --10
+	b = (b ^ (b <<  1))  & 0x5555555555555555; // b = -0-e -d-c -b-a -9-8 -7-6 -5-4 -3-2 -1-0 -f-e -d-c -b-a -9-8 -7-6 -5-4 -3-2 -1-0
+	return b;
+}
+
+int64_t morton2D_encode(int64_t *answer, LASPointH p, unsigned int factorX, unsigned int factorY){
+    unsigned int rawx = ((unsigned int) LASPoint_GetRawX(p)) + factorX;
+    unsigned int rawy = ((unsigned int) LASPoint_GetRawY(p)) + factorY;
+    *answer = EncodeMorton2D_1(rawx, rawy);
+    return *answer;
+}
+
+/*Changes for Oscar's new Morton code function*/
+uint64_t morton2D_encodeOscar(uint64_t *answer, LASPointH p, unsigned int factorX, unsigned int factorY){
+	uint32_t x = (uint32_t) (((int64_t) LASPoint_GetRawX(p)) + factorX);
+	uint32_t y = (uint32_t) (((int64_t) LASPoint_GetRawY(p)) + factorY);
+	*answer = (Expand1(x) << 1) + Expand1(y);
+
+    return *answer;
+}
+
+int64_t S64(const char *s) {
+	int64_t i;
+	char c ;
+	int scanned = sscanf(s, "lld%" SCNd64 "%c", &i, &c);
+	if (scanned == 1) return i;
+	fprintf(stderr, "ERROR: parsing string to int64_t.\n");
+	exit(1);
+}
+
+int main(int argc, char *argv[])
+{
+    /*Initialize the catalog locks*/
+    MT_lock_init(&dataLock);
+    MT_cond_init(&mainCond);
+    MT_cond_init(&writeTCond);
+    MT_cond_init(&readCond);
+
+    char* file_name_in = 0;
+    char* file_name_out = 0;
+    char separator_sign = ' ';
+    char* parse_string = "xyz";
+    char* buffer;
+    char printstring[256];
+    LASReaderH reader = NULL;
+    LASHeaderH header = NULL;
+    LASPointH p = NULL;
+    FILE** files_out = NULL;
+    int len, j;
+    int64_t mortonkey = 0;
+    int num_files_in = 0, num_files, num_of_entries=0, check = 0, num_read_threads = DEFAULT_NUM_READ_THREADS;
+    int i;
+    pthread_t *writeThreads = NULL;
+    pthread_t *readThreads = NULL;
+    struct readThreadArgs *dataRead = NULL;
+    boolean input_file = FALSE;
+    int64_t global_offset_x = 0;
+    int64_t global_offset_y = 0;
+    double scale_x;
+    double scale_y;
+
+
+    if (argc == 1) {
+        usage();
+        exit(0);
+    }
+
+    /*Allocate space for input files*/
+    files_name_in = (char**) malloc(sizeof(char*)*DEFAULT_NUM_INPUT_FILES);
+
+    for (i = 1; i < argc; i++)
+    {
+        if (    strcmp(argv[i],"-h") == 0 ||
+                strcmp(argv[i],"-help") == 0 ||
+                strcmp(argv[i],"--help") == 0
+           )
+        {
+            usage();
+            exit(0);
+        }
+        else if (   strcmp(argv[i],"-v") == 0 ||
+                strcmp(argv[i],"--verbose") == 0
+                )
+        {
+            verbose = TRUE;
+        }
+        else if ( strcmp(argv[i],"--num_read_threads") == 0)
+        {
+            num_read_threads = atoi(argv[++i]);
+        }
+        else if (   strcmp(argv[i],"-s") == 0 ||
+                strcmp(argv[i],"--skip_invalid") == 0
+                )
+        {
+            skip_invalid = TRUE;
+        }
+        else if (   strcmp(argv[i], "--parse") == 0 ||
+                strcmp(argv[i], "-parse") == 0
+                )
+        {
+            i++;
+            if ( (parse_string = argv[i]) == NULL) {
+                usage();
+                exit(0);
+            }
+        }
+        else if (   strcmp(argv[i], "--moffset") == 0 ||
+                strcmp(argv[i], "-moffset") == 0
+                )
+        {
+            i++;
+            buffer = strtok (argv[i], ",");
+            j = 0;
+            while (buffer) {
+                if (j == 0) {
+                    global_offset_x = S64(buffer);
+                }
+                else if (j == 1) {
+                    global_offset_y = S64(buffer);
+                }
+                j++;
+                buffer = strtok (NULL, ",");
+                while (buffer && *buffer == '\040')
+                    buffer++;
+            }
+            if (j != 2){
+                fprintf(stderr, "Only two int64_t are required in moffset option!\n");
+                exit(1);
+            }
+
+        }
+        else if (   strcmp(argv[i], "--check") == 0 ||
+                strcmp(argv[i], "-check") == 0
+                )
+        {
+            i++;
+            check = 1;
+            buffer = strtok (argv[i], ",");
+            j = 0;
+            while (buffer) {
+                if (j == 0) {
+                    sscanf(buffer, "%lf", &scale_x);
+                }
+                else if (j == 1) {
+                    sscanf(buffer, "%lf", &scale_y);
+                }
+                j++;
+                buffer = strtok (NULL, ",");
+                while (buffer && *buffer == '\040')
+                    buffer++;
+            }
+            if (j != 2){
+                fprintf(stderr, "Only two doubles are required in moffset option!\n");
+                exit(1);
+            }
+        }
+        else if (   strcmp(argv[i],"--input") == 0  ||
+                strcmp(argv[i],"-input") == 0   ||
+                strcmp(argv[i],"-i") == 0       ||
+                strcmp(argv[i],"-in") == 0
+                )
+        {
+            i++;
+            files_name_in[num_files_in++] = argv[i];
+
+            if (num_files_in % DEFAULT_NUM_INPUT_FILES)
+                files_name_in = (char**) realloc(files_name_in, (num_files_in*2)*sizeof(char*));
+        }
+        else if (strcmp(argv[i],"--file") == 0  ||
+                strcmp(argv[i],"-file") == 0   ||
+                strcmp(argv[i],"-f") == 0
+                )
+        {
+            i++;
+            int read;
+            char line_buffer[BUFSIZ];
+            FILE* in = NULL;
+
+            in = fopen(argv[i], "r");
+            if (!in) {
+                fprintf(stderr, "ERROR: the path for file containing the input files is invalid %s\n", argv[i]);
+                exit(1);
+            }
+            while (fgets(line_buffer, sizeof(line_buffer), in)) {
+                line_buffer[strlen(line_buffer)-1]='\0';
+                files_name_in[num_files_in++] = strdup(line_buffer);
+
+                if (num_files_in % DEFAULT_NUM_INPUT_FILES)
+                    files_name_in = (char**) realloc(files_name_in, (num_files_in*2)*sizeof(char*));
+            }
+            fclose(in);
+            input_file = TRUE;
+        }
+        else if (   strcmp(argv[i],"--output") == 0  ||
+                    strcmp(argv[i],"--out") == 0     ||
+                    strcmp(argv[i],"-out") == 0     ||
+                    strcmp(argv[i],"-o") == 0
+                )
+        {
+            i++;
+            file_name_out = argv[i];
+        }
+        else
+        {
+            fprintf(stderr, "ERROR: unknown argument '%s'\n",argv[i]);
+            usage();
+            exit(1);
+        }
+    } /* end looping through argc/argv */
+    num_of_entries = strlen(parse_string);
+
+    if (num_files_in == 0)
+    {
+        LASError_Print("No input filename was specified");
+        usage();
+        exit(1);
+    }
+    files_name_in[num_files_in] = NULL;
+    num_files = num_files_in;
+
+    if (file_name_out == 0){
+      LASError_Print("No output prefix was specified");
+      usage();
+      exit(1);
+    }
+
+    /*Entries metadata*/
+    i = 0;
+    for (;;)
+    {
+        switch (parse_string[i])
+        {
+                /* // the morton code on xy */
+            case 'k':
+                entries[i] = ENTRY_k;
+                entriesType[i] = sizeof(int64_t);
+	            /*Changes for Oscar's new Morton code function*/
+                //entriesFunc[i] = (void*)morton2D_encode;
+                entriesFuncD[i] = (void*)morton2D_encodeOscar;
+                break;
+                /* // the x coordinate  double*/
+            case 'x':
+                entries[i] = ENTRY_x;
+                entriesType[i] = sizeof(double);
+                entriesFuncD[i] = (void*)LASPoint_GetX;
+                break;
+                /* // the y coordinate double*/
+            case 'y':
+                entries[i] = ENTRY_y;
+                entriesType[i] = sizeof(double);
+                entriesFuncD[i] = (void*)LASPoint_GetY;
+                break;
+                /* // the z coordinate double*/
+            case 'z':
+                entries[i] = ENTRY_z;
+                entriesType[i] = sizeof(double);
+                entriesFuncD[i] = (void*)LASPoint_GetZ;
+                break;
+                /* // the X coordinate decimal*/
+            case 'X':
+                entries[i] = ENTRY_X;
+                entriesType[i] = sizeof(int);
+                entriesFuncD[i] = (void*)LASPoint_GetX;
+                break;
+                /* // the y coordinate decimal*/
+            case 'Y':
+                entries[i] = ENTRY_Y;
+                entriesType[i] = sizeof(int);
+                entriesFuncD[i] = (void*)LASPoint_GetY;
+                break;
+                /* // the z coordinate decimal*/
+            case 'Z':
+                entries[i] = ENTRY_Z;
+                entriesType[i] = sizeof(int);
+                entriesFuncD[i] = (void*)LASPoint_GetZ;
+                break;
+                /* // the gps-time */
+            case 't':
+                entries[i] = ENTRY_t;
+                entriesType[i] = sizeof(double);
+                entriesFuncD[i] = (void*)LASPoint_GetTime;
+                break;
+                /* // the intensity */
+            case 'i':
+                entries[i] = ENTRY_i;
+                entriesType[i] = sizeof(unsigned short);
+                entriesFuncS[i] = (void*)LASPoint_GetIntensity;
+                break;
+                /* the scan angle */
+            case 'a':
+                entries[i] = ENTRY_a;
+                entriesType[i] = sizeof(char);
+                entriesFuncC[i] = (void*)LASPoint_GetScanAngleRank;
+                break;
+                /* the number of the return */
+            case 'r':
+                entries[i] = ENTRY_r;
+                entriesType[i] = sizeof(short);
+                entriesFuncS[i] = (void*)LASPoint_GetReturnNumber;
+                break;
+                /* the classification */
+            case 'c':
+                entries[i] = ENTRY_c;
+                entriesType[i] = sizeof(char);
+                entriesFuncC[i] = (void*)LASPoint_GetClassification;
+                break;
+                /* the user data */
+            case 'u':
+                entries[i] = ENTRY_u;
+                entriesType[i] = sizeof(char);
+                entriesFuncC[i] = (void*)LASPoint_GetUserData;
+                break;
+                /* the number of returns of given pulse */
+            case 'n':
+                entries[i] = ENTRY_n;
+                entriesType[i] = sizeof(short);
+                entriesFuncS[i] = (void*)LASPoint_GetNumberOfReturns;
+                break;
+                /* the red channel color */
+            case 'R':
+                entries[i] = ENTRY_R;
+                entriesType[i] = sizeof(unsigned short);
+                entriesFuncS[i] = (void*)LASColor_GetRed;
+                break;
+                /* the green channel color */
+            case 'G':
+                entries[i] = ENTRY_G;
+                entriesType[i] = sizeof(unsigned short);
+                entriesFuncS[i] = (void*)LASColor_GetGreen;
+                break;
+                /* the blue channel color */
+            case 'B':
+                entries[i] = ENTRY_B;
+                entriesType[i] = sizeof(unsigned short);
+                entriesFuncS[i] = (void*)LASColor_GetBlue;
+                break;
+            case 'M':
+                entries[i] = ENTRY_M;
+                entriesType[i] = sizeof(int);
+                break;
+            case 'p':
+                entries[i] = ENTRY_p;
+                entriesType[i] = sizeof(short);
+                entriesFuncS[i] = (void*)LASPoint_GetPointSourceId;
+                break;
+                /* the edge of flight line flag */
+            case 'e':
+                entries[i] = ENTRY_e;
+                entriesType[i] = sizeof(short);
+                entriesFuncS[i] = (void*)LASPoint_GetFlightLineEdge;
+                break;
+                /* the direction of scan flag */
+            case 'd':
+                entries[i] = ENTRY_d;
+                entriesType[i] = sizeof(short);
+                entriesFuncS[i] = (void*)LASPoint_GetScanDirection;
+                break;
+        }
+        i++;
+        if (parse_string[i] == 0)
+        {
+            break;
+        }
+    }
+
+    /*Prepare the output files*/
+    if (file_name_out == NULL)
+    {
+        len = (int)strlen(file_name_in);
+        file_name_out = LASCopyString(file_name_in);
+        if (file_name_out[len-3] == '.' && file_name_out[len-2] == 'g' && file_name_out[len-1] == 'z')
+        {
+            len = len - 4;
+        }
+        while (len > 0 && file_name_out[len] != '.')
+        {
+            len--;
+        }
+        file_name_out[len] = '\0';
+    }
+
+    char *str = malloc(sizeof(char)*(strlen(file_name_out)+12));
+    files_out = (FILE**) malloc(sizeof(FILE*)*num_of_entries);
+    for (i = 0; i < num_of_entries; i++) {
+        sprintf(str, "%s_col_%c.dat", file_name_out, parse_string[i]);
+        if(doesFileExist(str)) {
+            remove(str);
+        }
+
+        files_out[i] = fopen(str, "wb");
+
+        if (files_out[i] == 0) {
+            LASError_Print("Could not open file for write");
+            usage();
+            exit(1);
+        }
+    }
+    free(str);
+
+    /*Initialize structures for the reading threads*/
+    //data = (struct writeT**) malloc(num_read_threads*sizeof(struct writeT*)); //Malloc is more efficient than calloc
+    data = (struct writeT**) calloc(num_read_threads, sizeof(struct writeT*));
+
+    dataRead = (struct readThreadArgs*) malloc(sizeof(struct readThreadArgs)*num_read_threads);
+    /* Launch read Threads */
+    stop = 0;
+    readThreads = (pthread_t*) malloc(sizeof(pthread_t)*num_read_threads);
+    for (i=0; i < num_read_threads; i++) {
+        dataRead[i].id = i;
+        dataRead[i].num_read_threads = num_read_threads;
+        dataRead[i].num_of_entries = num_of_entries;
+        dataRead[i].check = check;
+        dataRead[i].global_offset_x = global_offset_x;
+        dataRead[i].global_offset_y = global_offset_y;
+        dataRead[i].scale_x = scale_x;
+        dataRead[i].scale_y = scale_y;
+        pthread_create(&readThreads[i], NULL, readFile, (void*)dataRead);
+    }
+
+    int writeIndex = 0;
+    writeThreads = (pthread_t*) malloc(sizeof(pthread_t)*num_of_entries);
+
+    /* Launch Threads */
+    struct writeThreadArgs *dataWrite = (struct writeThreadArgs *) malloc(sizeof(struct writeThreadArgs) *num_of_entries);
+    for (i = 0; i < num_of_entries; i++) {
+        dataWrite[i].id = i;
+        dataWrite[i].out = files_out[i];
+        pthread_create(&writeThreads[i], NULL, writeFile, (void*)(&dataWrite[i]));
+    }
+    sleep(1);
+    //Do we need to comment this one out!?
+    int done = 0;
+    while (num_files) {
+        /*Obtain lock over data to get the pointer*/
+        MT_set_lock(&dataLock);
+        dataWriteT = data[writeIndex];
+        while (dataWriteT == NULL) {
+            /*Sleep and wait for data to be read*/
+            MT_cond_wait(&mainCond,&dataLock);
+            dataWriteT = data[writeIndex];
+        }
+        data[writeIndex] = NULL;
+        //Release the lock
+
+        /*Tell the write threads there is new data*/
+        pthread_cond_broadcast(&writeTCond);
+
+        /*Tell the read threads there is a new buf empty*/
+        pthread_cond_broadcast(&readCond);
+        MT_unset_lock(&dataLock);
+
+        /*Keep looping*/
+        writeIndex++;
+        writeIndex = (writeIndex % num_read_threads);
+
+        MT_set_lock(&dataLock);
+        while (done == 0) {
+            /*Sleep and wait for data to be read*/
+            MT_cond_wait(&mainCond,&dataLock);
+            done = 1;
+            for (i = 0; i < num_of_entries; i++) {
+                if (dataWriteT[i].values != NULL) {
+                    done = 0;
+                    break;
+                }
+            }
+        }
+        num_files--;
+        if (verbose)
+            printf("Files to go %d\n", num_files);
+        free(dataWriteT);
+        dataWriteT = NULL;
+        done = 0;
+        MT_unset_lock(&dataLock);
+    }
+
+    /*Tell the write threads to exit*/
+    MT_set_lock(&dataLock);
+    stop = 1;
+    pthread_cond_broadcast(&writeTCond);
+    MT_unset_lock(&dataLock);
+
+    /* Wait for Threads to Finish */
+    for (i=0; i<num_of_entries; i++) {
+        pthread_join(writeThreads[i], NULL);
+    }
+    free(dataWrite);
+    free(writeThreads);
+
+    MT_cond_destroy(&readCond);
+    MT_cond_destroy(&writeTCond);
+    MT_cond_destroy(&mainCond);
+    MT_lock_destroy(&dataLock);
+
+    for (i = 0; i < num_of_entries; i++) {
+        fflush(files_out[i]);
+        if (verbose)
+            printf("close file %d\n", i);
+        fsync(files_out[i]);
+        fclose(files_out[i]);
+    }
+    free(files_out);
+    if (input_file) {
+        for (i=0 ; i < num_files_in; i++)
+            free(files_name_in[i]);
+
+        free(files_name_in);
+    }
+
+    free(dataRead);
+
+    if (readThreads)
+        free(readThreads);
+
+    return 0;
+}
diff --git a/apps/las2las.cpp b/apps/las2las.cpp
old mode 100755
new mode 100644
diff --git a/apps/las2ogr.cpp b/apps/las2ogr.cpp
old mode 100755
new mode 100644
index 9fdb44d..bfd04c4
--- a/apps/las2ogr.cpp
+++ b/apps/las2ogr.cpp
@@ -279,7 +279,7 @@ int main(int argc, char* argv[])
 
             if (in_file.empty() || out_file.empty() || out_frmt.empty())
             {
-                throw std::runtime_error("missing input paremeters");
+                throw std::runtime_error("missing input parameters");
             }
         }
 
diff --git a/apps/las2pg.c b/apps/las2pg.c
new file mode 100644
index 0000000..05bbd20
--- /dev/null
+++ b/apps/las2pg.c
@@ -0,0 +1,715 @@
+/***************************************************************************
+ *
+ * Project: libLAS -- C/C++ read/write library for LAS LIDAR data
+ * Purpose: LAS translation to PostgreSQL binary format with optional configuration
+ * Author:  Oscar Martinez Rubi o.rubi at esciencecenter.nl
+ ***************************************************************************
+ * This tool has been developed by the Netherlands eScience Center
+ * (https://www.esciencecenter.nl/)
+ *
+ * Copyright (c) 2016, Oscar Martinez Rubi o.rubi at esciencecenter.nl
+ *
+ * See LICENSE.txt in this source distribution for more information.
+ **************************************************************************/
+
+#include <time.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <netinet/in.h>
+#include <stdint.h>
+#include <limits.h>
+#include <inttypes.h>
+#if defined(__linux__) || defined(__CYGWIN__)
+
+#	include <endian.h>
+
+#elif defined(__APPLE__)
+
+#	include <libkern/OSByteOrder.h>
+
+#	define htobe16(x) OSSwapHostToBigInt16(x)
+#	define htole16(x) OSSwapHostToLittleInt16(x)
+#	define be16toh(x) OSSwapBigToHostInt16(x)
+#	define le16toh(x) OSSwapLittleToHostInt16(x)
+
+#	define htobe32(x) OSSwapHostToBigInt32(x)
+#	define htole32(x) OSSwapHostToLittleInt32(x)
+#	define be32toh(x) OSSwapBigToHostInt32(x)
+#	define le32toh(x) OSSwapLittleToHostInt32(x)
+
+#	define htobe64(x) OSSwapHostToBigInt64(x)
+#	define htole64(x) OSSwapHostToLittleInt64(x)
+#	define be64toh(x) OSSwapBigToHostInt64(x)
+#	define le64toh(x) OSSwapLittleToHostInt64(x)
+
+#	define __BYTE_ORDER    BYTE_ORDER
+#	define __BIG_ENDIAN    BIG_ENDIAN
+#	define __LITTLE_ENDIAN LITTLE_ENDIAN
+#	define __PDP_ENDIAN    PDP_ENDIAN
+
+#elif defined(__OpenBSD__)
+
+#	include <sys/endian.h>
+
+#elif defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__)
+
+#	include <sys/endian.h>
+
+#	define be16toh(x) betoh16(x)
+#	define le16toh(x) letoh16(x)
+
+#	define be32toh(x) betoh32(x)
+#	define le32toh(x) letoh32(x)
+
+#	define be64toh(x) betoh64(x)
+#	define le64toh(x) letoh64(x)
+
+#elif defined(__WINDOWS__)
+
+#	include <winsock2.h>
+#	include <sys/param.h>
+
+#	if BYTE_ORDER == LITTLE_ENDIAN
+
+#		define htobe16(x) htons(x)
+#		define htole16(x) (x)
+#		define be16toh(x) ntohs(x)
+#		define le16toh(x) (x)
+
+#		define htobe32(x) htonl(x)
+#		define htole32(x) (x)
+#		define be32toh(x) ntohl(x)
+#		define le32toh(x) (x)
+
+#		define htobe64(x) htonll(x)
+#		define htole64(x) (x)
+#		define be64toh(x) ntohll(x)
+#		define le64toh(x) (x)
+
+#	elif BYTE_ORDER == BIG_ENDIAN
+
+		/* that would be xbox 360 */
+#		define htobe16(x) (x)
+#		define htole16(x) __builtin_bswap16(x)
+#		define be16toh(x) (x)
+#		define le16toh(x) __builtin_bswap16(x)
+
+#		define htobe32(x) (x)
+#		define htole32(x) __builtin_bswap32(x)
+#		define be32toh(x) (x)
+#		define le32toh(x) __builtin_bswap32(x)
+
+#		define htobe64(x) (x)
+#		define htole64(x) __builtin_bswap64(x)
+#		define be64toh(x) (x)
+#		define le64toh(x) __builtin_bswap64(x)
+
+#	else
+
+#		error byte order not supported
+
+#	endif
+
+#	define __BYTE_ORDER    BYTE_ORDER
+#	define __BIG_ENDIAN    BIG_ENDIAN
+#	define __LITTLE_ENDIAN LITTLE_ENDIAN
+#	define __PDP_ENDIAN    PDP_ENDIAN
+
+#else
+
+#	error platform not supported
+
+#endif
+
+#include <math.h>
+
+#include "liblas.h"
+
+#ifndef _BSD_SOURCE
+#define _BSD_SOURCE
+#endif
+
+#define combine(a,b,c) ( (a) = ((unsigned long long)(b) << 32) | (c) )
+
+unsigned int unity = 1;
+#define is_littleEndian() (*(unsigned char *)&unity) // will return 1 if little endian, otherwise 0
+
+#define TOLERANCE 0.0000001
+#define MAX_INT_31 2147483648.0
+
+#define VERSION "1.1"
+
+
+struct postHeader {
+    char *s;
+    uint32_t i1;
+    uint32_t i2;
+};
+
+struct postRow {
+    uint16_t h;
+    uint32_t varSize;
+    uint32_t vardSize;
+};
+
+void print_header(FILE *file, LASHeaderH header, const char* file_name);
+
+void usage()
+{
+    fprintf(stderr,"----------------------------------------------------------\n");
+    fprintf(stderr,"    las2pg (version %s) usage:\n", VERSION);
+    fprintf(stderr,"----------------------------------------------------------\n");
+    fprintf(stderr,"\n");
+
+    fprintf(stderr,"Convert a las/laz file into PostgreSQL binary dump format, outputs <input_file>:\n");
+    fprintf(stderr,"  las2pg -i <input_file>.las\n");
+    fprintf(stderr,"\n");
+
+    fprintf(stderr,"Convert a las/laz file into PostgreSQL binary dump format, outputs <ouput_name>:\n");
+    fprintf(stderr,"  las2pg -i <input_file>.las -o <output_name>\n");
+    fprintf(stderr,"Use flag --stdout to write to standard output (recommended use together with a pipe, see below).\n");
+    fprintf(stderr,"\n\n");
+
+    fprintf(stderr,"----------------------------------------------------------\n");
+    fprintf(stderr," The '--parse txyzia' flag specifies what exactly to\n");
+    fprintf(stderr," write for each row (default is --parse xyz). For example, 'txyzia'\n");
+    fprintf(stderr," means that the first field of each row will be the\n");
+    fprintf(stderr," gpstime, the next three fields will be the x, y, and\n");
+    fprintf(stderr," z coordinates, the next field will be the intensity\n");
+    fprintf(stderr," and the next field will be the scan angle.\n");
+    fprintf(stderr," The supported entries are:\n");
+    fprintf(stderr,"   t - gpstime as double\n");
+    fprintf(stderr,"   x - x coordinate as double\n");
+    fprintf(stderr,"   y - y coordinate as double\n");
+    fprintf(stderr,"   z - z coordinate as double\n");
+    fprintf(stderr,"   a - scan angle as integer\n");
+    fprintf(stderr,"   i - intensity as integer\n");
+    fprintf(stderr,"   n - number of returns for given pulse as integer\n");
+    fprintf(stderr,"   r - number of this return as integer\n");
+    fprintf(stderr,"   c - classification number as integer\n");
+    fprintf(stderr,"   u - user data as integer\n");
+    fprintf(stderr,"   p - point source ID as integer\n");
+    fprintf(stderr,"   e - edge of flight line as integer\n");
+    fprintf(stderr,"   d - direction of scan flag as integer\n");
+    fprintf(stderr,"   R - red channel of RGB color as integer\n");
+    fprintf(stderr,"   G - green channel of RGB color as integer\n");
+    fprintf(stderr,"   B - blue channel of RGB color as integer\n");
+    fprintf(stderr,"   M - vertex index number as integer\n");
+    fprintf(stderr,"   k - Morton 2D code using X and Y (unscaled and no offset) as bigint\n\n");
+
+    fprintf(stderr," The moffset flag (for example '--moffset 8600000,40000000') specifies a global offset to substract to X and Y \n");
+    fprintf(stderr," to be used when computing the Morton 2D code. Values must be unscaled \n\n");
+
+    fprintf(stderr," The check flag (for example '--check 0.01,0.01') checks suitability to compute Morton 2D codes \n");
+    fprintf(stderr," It checks specified scale matches the one in input file. \n");
+    fprintf(stderr," If moffset is provided it also checks that obtained Morton 2D codes \n");
+    fprintf(stderr," will be consistent, i.e. global X,Y within [0,2^31] \n\n");
+
+    fprintf(stderr,"----------------------------------------------------------\n");
+
+    fprintf(stderr," The intended use of this tool is by using the --stdout flag and a pipe to avoid storing intermediate files. Example: \n");
+    fprintf(stderr,"    las2pg 1.2-with-color.laz --parse xyzRGBi --stdout | psql -c \"copy flat from stdin with binary\" \n");
+    fprintf(stderr," This obviously require a table called flat to be created in a PostgreSQL DB beforehand. The table must have \n");
+    fprintf(stderr," the columns in the same order as specified by the --parse option, and the column types must be the ones speficied above. Example: \n");
+    fprintf(stderr,"    psql -c \"create table flat (x double precision, y double precision, z double precision, r integer, g integer, b integer, i integer)\" \n\n");
+}
+
+
+uint64_t bigEndian_double(double a)
+{
+    uint64_t b;
+    unsigned char *src = (unsigned char *)&a,
+    *dst = (unsigned char *)&b;
+
+    if (is_littleEndian())
+    {
+        dst[0] = src[7];
+        dst[1] = src[6];
+        dst[2] = src[5];
+        dst[3] = src[4];
+        dst[4] = src[3];
+        dst[5] = src[2];
+        dst[6] = src[1];
+        dst[7] = src[0];
+    }
+    else
+        b = *(uint64_t *)&a;
+
+        return b;
+}
+
+int64_t S64(const char *s) {
+    int64_t i;
+    char c ;
+    int scanned = sscanf(s, "%" SCNd64 "%c", &i, &c);
+    if (scanned == 1) return i;
+    fprintf(stderr, "ERROR: parsing string to int64_t.\n");
+    exit(1);
+}
+
+static uint64_t Expand1(uint32_t a)
+{
+  uint64_t b = a & 0x7fffffff;               // b = ---- ---- ---- ---- ---- ---- ---- ---- 0edc ba98 7654 3210 fedc ba98 7654 3210
+  b = (b ^ (b <<  16)) & 0x0000ffff0000ffff; // b = ---- ---- ---- ---- 0edc ba98 7654 3210 ---- ---- ---- ---- fedc ba98 7654 3210
+  b = (b ^ (b <<  8))  & 0x00ff00ff00ff00ff; // b = ---- ---- 0edc ba98 ---- ---- 7654 3210 ---- ---- fedc ba98 ---- ---- 7654 3210
+  b = (b ^ (b <<  4))  & 0x0f0f0f0f0f0f0f0f; // b = ---- 0edc ---- ba98 ---- 7654 ---- 3210 ---- fedc ---- ba98 ---- 7654 ---- 3210
+  b = (b ^ (b <<  2))  & 0x3333333333333333; // b = --0e --dc --ba --98 --76 --54 --32 --10 --fe --dc --ba --98 --76 --54 --32 --10
+  b = (b ^ (b <<  1))  & 0x5555555555555555; // b = -0-e -d-c -b-a -9-8 -7-6 -5-4 -3-2 -1-0 -f-e -d-c -b-a -9-8 -7-6 -5-4 -3-2 -1-0
+  return b;
+}
+
+static uint64_t EncodeMorton2D(uint32_t x, uint32_t y)
+{
+  return (Expand1(x) << 1) + Expand1(y);
+}
+
+int main(int argc, char *argv[])
+{
+    int i;
+    int j;
+    char* buffer;
+    int use_stdout = FALSE;
+    int skip_invalid = FALSE;
+    int num_entries = 0;
+
+    int verbose = FALSE;
+    char* file_name_in = 0;
+    char* file_name_out = 0;
+    char separator_sign = ' ';
+    char* parse_string = "xyz";
+
+    int64_t global_offset_x = 0;
+    int64_t global_offset_y = 0;
+    int check = FALSE;
+    double scale_x;
+    double scale_y;
+
+    LASReaderH reader = NULL;
+    LASHeaderH header = NULL;
+    LASPointH p = NULL;
+    FILE* file_out;
+    int len;
+
+    unsigned int index = 0;
+    if (argc == 1) {
+        usage();
+        exit(0);
+    }
+
+    for (i = 1; i < argc; i++)
+    {
+        if (    strcmp(argv[i],"-h") == 0 ||
+                strcmp(argv[i],"-help") == 0 ||
+                strcmp(argv[i],"--help") == 0
+           )
+        {
+            usage();
+            exit(0);
+        }
+        else if (   strcmp(argv[i],"-v") == 0 ||
+                strcmp(argv[i],"--verbose") == 0
+                )
+        {
+            verbose = TRUE;
+        }
+        else if (   strcmp(argv[i],"-s") == 0 ||
+                strcmp(argv[i],"--skip_invalid") == 0
+                )
+        {
+            skip_invalid = TRUE;
+        }
+        else if (   strcmp(argv[i], "--parse") == 0 ||
+                    strcmp(argv[i], "-parse") == 0
+                )
+        {
+            i++;
+            parse_string = argv[i];
+        }
+        else if (   strcmp(argv[i], "--moffset") == 0 ||
+                    strcmp(argv[i], "-moffset") == 0
+                )
+        {
+            i++;
+		    buffer = strtok (argv[i], ",");
+		    j = 0;
+		    while (buffer) {
+		        if (j == 0) {
+		            global_offset_x = S64(buffer);
+		        }
+		        else if (j == 1) {
+		            global_offset_y = S64(buffer);
+		        }
+		        j++;
+		        buffer = strtok (NULL, ",");
+		        while (buffer && *buffer == '\040')
+		            buffer++;
+		    }
+		    if (j != 2){
+		    	fprintf(stderr, "Only two int64_t are required in moffset option!\n");
+		        exit(1);
+		    }
+
+        }
+        else if (   strcmp(argv[i], "--check") == 0 ||
+                    strcmp(argv[i], "-check") == 0
+                )
+        {
+            i++;
+            check = TRUE;
+		    buffer = strtok (argv[i], ",");
+		    j = 0;
+		    while (buffer) {
+		        if (j == 0) {
+		            sscanf(buffer, "%lf", &scale_x);
+		        }
+		        else if (j == 1) {
+		            sscanf(buffer, "%lf", &scale_y);
+		        }
+		        j++;
+		        buffer = strtok (NULL, ",");
+		        while (buffer && *buffer == '\040')
+		            buffer++;
+		    }
+		    if (j != 2){
+		    	fprintf(stderr, "Only two doubles are required in moffset option!\n");
+		        exit(1);
+		    }
+        }
+        else if (   strcmp(argv[i], "--stdout") == 0
+                )
+        {
+            use_stdout = TRUE;
+        }
+        else if (   strcmp(argv[i],"--input") == 0  ||
+                strcmp(argv[i],"-input") == 0   ||
+                strcmp(argv[i],"-i") == 0       ||
+                strcmp(argv[i],"-in") == 0
+                )
+        {
+            i++;
+            file_name_in = argv[i];
+        }
+        else if (   strcmp(argv[i],"--output") == 0  ||
+                    strcmp(argv[i],"--out") == 0     ||
+                    strcmp(argv[i],"-out") == 0     ||
+                    strcmp(argv[i],"-o") == 0
+                )
+        {
+            i++;
+            file_name_out = argv[i];
+        }
+        else if (file_name_in == 0 && file_name_out == 0)
+        {
+            file_name_in = argv[i];
+        }
+        else if (file_name_in && file_name_out == 0)
+        {
+            file_name_out = argv[i];
+        }
+        else
+        {
+            fprintf(stderr, "ERROR: unknown argument '%s'\n",argv[i]);
+            usage();
+            exit(1);
+        }
+    } /* end looping through argc/argv */
+    num_entries = strlen(parse_string);
+
+    if (use_stdout == TRUE && file_name_out){
+      LASError_Print("If an ouput file is specified, --stdout must not be used!");
+      exit(1);
+    }
+
+    reader = LASReader_Create(file_name_in);
+    if (!reader) {
+        LASError_Print("Unable to read file");
+        exit(1);
+    }
+
+    header = LASReader_GetHeader(reader);
+    if (!header) {
+        LASError_Print("Unable to fetch header for file");
+        exit(1);
+    }
+
+    if (use_stdout)
+    {
+        file_out = stdout;
+    }
+    else
+    {
+        if (file_name_out == NULL)
+        {
+            if (file_name_in == NULL)
+            {
+                LASError_Print("No input filename was specified");
+                usage();
+                exit(1);
+            }
+
+            len = (int)strlen(file_name_in);
+            file_name_out = LASCopyString(file_name_in);
+            if (file_name_out[len-3] == '.' && file_name_out[len-2] == 'g' && file_name_out[len-1] == 'z')
+            {
+                len = len - 4;
+            }
+            while (len > 0 && file_name_out[len] != '.')
+            {
+                len--;
+            }
+            file_name_out[len] = '\0';
+        }
+        file_out = fopen(file_name_out, "wb");
+    }
+
+    if (file_out == 0)
+    {
+        LASError_Print("Could not open file for write");
+        usage();
+        exit(1);
+    }
+
+    if (verbose)
+    {
+        print_header(stderr, header, file_name_in);
+    }
+
+    // Compute factors to add to X and Y and check sanity of generated codes
+    double file_scale_x = LASHeader_GetScaleX(header);
+    double file_scale_y = LASHeader_GetScaleY(header);
+
+    if (check)
+    {
+    	// Check specified scales are like in the LAS file
+    	if (fabs(scale_x - file_scale_x) > TOLERANCE){
+	    fprintf(stderr, "ERROR: x scale in input file (%lf) does not match specified x scale (%lf)\n",file_scale_x, scale_x);
+            exit(1);
+    	}
+    	if (fabs(scale_y - file_scale_y) > TOLERANCE){
+    	    fprintf(stderr, "ERROR: y scale in input file (%lf) does not match specified y scale (%lf)\n",file_scale_y, scale_y);
+            exit(1);
+    	}
+    	/* Check that the extent of the file (taking into account the global offset)
+    	 * is within 0,2^31 */
+        double check_min_x = 1.0 + LASHeader_GetMinX(header) - (((double) global_offset_x) * scale_x);
+    	if (check_min_x < TOLERANCE) {
+    	    fprintf(stderr, "ERROR: Specied X global offset is too large. (MinX - (GlobalX*ScaleX)) < 0\n");
+            exit(1);
+    	}
+        double check_min_y = 1.0 + LASHeader_GetMinY(header) - (((double) global_offset_y) * scale_y);
+    	if (check_min_y < TOLERANCE) {
+            fprintf(stderr, "ERROR: Specied Y global offset is too large. (MinY - (GlobalY*ScaleY)) < 0\n");
+            exit(1);
+    	}
+        double check_max_x = LASHeader_GetMaxX(header) - (((double) global_offset_x) * scale_x);
+    	if (check_max_x > (MAX_INT_31 * scale_x)) {
+    		fprintf(stderr, "ERROR: Specied X global offset is too small. (MaxX - (GlobalX*ScaleX)) > (2^31)*ScaleX\n");
+            exit(1);
+    	}
+        double check_max_y = LASHeader_GetMaxY(header) - (((double) global_offset_y) * scale_y);
+    	if (check_max_y > (MAX_INT_31 * scale_y)) {
+    		fprintf(stderr, "ERROR: Specied Y global offset is too small. (MaxY - (GlobalY*ScaleY)) > (2^31)*ScaleY\n");
+            exit(1);
+    	}
+    }
+
+
+    /*Write Postgres header*/
+    struct postHeader pgHeader;
+    pgHeader.s = "PGCOPY\n\377\r\n\0";
+    int i1T = 0, i2T = 0;
+    pgHeader.i1 = htonl(i1T);
+    pgHeader.i2 = htonl(i2T);
+    fwrite(pgHeader.s, 11, 1, file_out);
+    fwrite(&pgHeader.i1, sizeof(uint32_t), 1, file_out);
+    fwrite(&pgHeader.i2, sizeof(uint32_t), 1, file_out);
+
+    /* declaration for morton*/
+    uint32_t rawx = 0;
+    uint32_t rawy = 0;
+    uint64_t mortonkey = 0;
+
+    /* scaled offsets to add for the morton encoding */
+    int64_t factorX =  ((int64_t) (LASHeader_GetOffsetX(header) / file_scale_x)) - global_offset_x;
+    int64_t factorY =  ((int64_t) (LASHeader_GetOffsetY(header) / file_scale_y)) - global_offset_y;
+
+    p = LASReader_GetNextPoint(reader);
+    while (p)
+    {
+        if (skip_invalid && !LASPoint_IsValid(p)) {
+            if (verbose) {
+                LASError_Print("Skipping writing invalid point...");
+            }
+            p = LASReader_GetNextPoint(reader);
+            index -=1;
+            continue;
+        }
+        struct postRow pgRow;
+        uint32_t size;
+        uint16_t hT = num_entries;
+        pgRow.h = htons(hT);
+        fwrite(& pgRow.h, 2, 1, file_out);
+        size = sizeof(double);
+        pgRow.vardSize = htonl(size);
+        size = sizeof(uint32_t);
+        pgRow.varSize = htonl(size);
+
+        i = 0;
+        for (;;)
+        {
+            LASColorH color = LASPoint_GetColor(p);
+            double vard;
+            int var;
+            unsigned long long int vardL, varL;
+
+            switch (parse_string[i])
+               {
+                    /* // the morton code on xy */
+                case 'k':
+                    rawx = (uint32_t) (((int64_t) LASPoint_GetRawX(p)) + factorX);
+                    rawy = (uint32_t) (((int64_t) LASPoint_GetRawY(p)) + factorY);
+                    mortonkey = EncodeMorton2D(rawx,rawy);
+                    varL = htobe64(mortonkey);
+                    fwrite(&pgRow.vardSize, sizeof(uint32_t), 1, file_out);
+                    fwrite(&varL, sizeof(uint64_t), 1, file_out);
+                    break;
+                    /* // the x coordinate */
+                case 'x':
+                    vard = LASPoint_GetX(p);
+                    fwrite(&pgRow.vardSize, sizeof(uint32_t), 1, file_out);
+                    vardL = bigEndian_double(vard);
+                    fwrite(&vardL, sizeof(double), 1, file_out);
+                    break;
+                    /* // the y coordinate */
+                case 'y':
+                    vard = LASPoint_GetY(p);
+                    fwrite(&pgRow.vardSize, sizeof(uint32_t), 1, file_out);
+                    vardL = bigEndian_double(vard);
+                    fwrite(&vardL, sizeof(double), 1, file_out);
+                    break;
+                    /* // the z coordinate */
+                case 'z':
+                    vard = LASPoint_GetZ(p);
+                    fwrite(&pgRow.vardSize, sizeof(uint32_t), 1, file_out);
+                    vardL = bigEndian_double(vard);
+                    fwrite(&vardL, sizeof(double), 1, file_out);
+                    break;
+                    /* // the gps-time */
+                case 't':
+                    vard = LASPoint_GetTime(p);
+                    fwrite(&pgRow.vardSize, sizeof(uint32_t), 1, file_out);
+                    vardL = bigEndian_double(vard);
+                    fwrite(&vardL, sizeof(double), 1, file_out);
+                    break;
+                    /* // the intensity */
+                case 'i':
+                    var = LASPoint_GetIntensity(p);
+                    fwrite(&pgRow.varSize, sizeof(uint32_t), 1, file_out);
+                    varL = htonl(var);
+                    fwrite(&varL, sizeof(uint32_t), 1, file_out);
+                    break;
+                    /* the scan angle */
+                case 'a':
+                    var = LASPoint_GetScanAngleRank(p);
+                    fwrite(&pgRow.varSize, sizeof(uint32_t), 1, file_out);
+                    varL = htonl(var);
+                    fwrite(&varL, sizeof(uint32_t), 1, file_out);
+                    break;
+                    /* the number of the return */
+                case 'r':
+                    var = LASPoint_GetReturnNumber(p);
+                    fwrite(&pgRow.varSize, sizeof(uint32_t), 1, file_out);
+                    varL = htonl(var);
+                    fwrite(&varL, sizeof(uint32_t), 1, file_out);
+                    break;
+                    /* the classification */
+                case 'c':
+                    var = LASPoint_GetClassification(p);
+                    fwrite(&pgRow.varSize, sizeof(uint32_t), 1, file_out);
+                    varL = htonl(var);
+                    fwrite(&varL, sizeof(uint32_t), 1, file_out);
+                    break;
+                    /* the user data */
+                case 'u':
+                    var = LASPoint_GetUserData(p);
+                    fwrite(&pgRow.varSize, sizeof(uint32_t), 1, file_out);
+                    varL = htonl(var);
+                    fwrite(&varL, sizeof(uint32_t), 1, file_out);
+                    break;
+                    /* the number of returns of given pulse */
+                case 'n':
+                    var = LASPoint_GetNumberOfReturns(p);
+                    fwrite(&pgRow.varSize, sizeof(uint32_t), 1, file_out);
+                    varL = htonl(var);
+                    fwrite(&varL, sizeof(uint32_t), 1, file_out);
+                    break;
+                    /* the red channel color */
+                case 'R':
+                    var = LASColor_GetRed(color);
+                    fwrite(&pgRow.varSize, sizeof(uint32_t), 1, file_out);
+                    varL = htonl(var);
+                    fwrite(&varL, sizeof(uint32_t), 1, file_out);
+                    break;
+                    /* the green channel color */
+                case 'G':
+                    var = LASColor_GetGreen(color);
+                    fwrite(&pgRow.varSize, sizeof(uint32_t), 1, file_out);
+                    varL = htonl(var);
+                    fwrite(&varL, sizeof(uint32_t), 1, file_out);
+                    break;
+                    /* the blue channel color */
+                case 'B':
+                    var = LASColor_GetBlue(color);
+                    fwrite(&pgRow.varSize, sizeof(uint32_t), 1, file_out);
+                    varL = htonl(var);
+                    fwrite(&varL, sizeof(uint32_t), 1, file_out);
+                    break;
+                case 'M':
+                    var = index;
+                    fwrite(&pgRow.varSize, sizeof(uint32_t), 1, file_out);
+                    varL = htonl(var);
+                    fwrite(&varL, sizeof(uint32_t), 1, file_out);
+                    break;
+                case 'p':
+                    var = LASPoint_GetPointSourceId(p);
+                    fwrite(&pgRow.varSize, sizeof(uint32_t), 1, file_out);
+                    varL = htonl(var);
+                    fwrite(&varL, sizeof(uint32_t), 1, file_out);
+                    break;
+                    /* the edge of flight line flag */
+                case 'e':
+                    var = LASPoint_GetFlightLineEdge(p);
+                    fwrite(&pgRow.varSize, sizeof(uint32_t), 1, file_out);
+                    varL = htonl(var);
+                    fwrite(&varL, sizeof(uint32_t), 1, file_out);
+                    break;
+                    /* the direction of scan flag */
+                case 'd':
+                    var = LASPoint_GetScanDirection(p);
+                    fwrite(&pgRow.varSize, sizeof(uint32_t), 1, file_out);
+                    varL = htonl(var);
+                    fwrite(&varL, sizeof(uint32_t), 1, file_out);
+                    break;
+            }
+            i++;
+            if (!parse_string[i])
+            {
+                break;
+            }
+            LASColor_Destroy(color);
+        }
+        p = LASReader_GetNextPoint(reader);
+        index +=1;
+    }
+    short endT = -1;
+    short end = htons(endT);
+    fwrite(&end, sizeof(end), 1, file_out);
+
+    fflush(file_out);
+    fclose(file_out);
+
+    LASReader_Destroy(reader);
+    LASHeader_Destroy(header);
+    return 0;
+}
diff --git a/apps/las2txt.c b/apps/las2txt.c
old mode 100755
new mode 100644
diff --git a/apps/las2txt.cpp b/apps/las2txt.cpp
old mode 100755
new mode 100644
diff --git a/apps/lasblock.cpp b/apps/lasblock.cpp
old mode 100755
new mode 100644
diff --git a/apps/lascommon.c b/apps/lascommon.c
old mode 100755
new mode 100644
diff --git a/apps/lascommon.h b/apps/lascommon.h
old mode 100755
new mode 100644
diff --git a/apps/lasdiff.c b/apps/lasdiff.c
old mode 100755
new mode 100644
diff --git a/apps/lasindex.cpp b/apps/lasindex.cpp
old mode 100755
new mode 100644
diff --git a/apps/lasindex_test.cpp b/apps/lasindex_test.cpp
old mode 100755
new mode 100644
diff --git a/apps/lasinfo.cpp b/apps/lasinfo.cpp
old mode 100755
new mode 100644
diff --git a/apps/laskernel.cpp b/apps/laskernel.cpp
old mode 100755
new mode 100644
index 4c2ec0d..f6c655f
--- a/apps/laskernel.cpp
+++ b/apps/laskernel.cpp
@@ -1323,7 +1323,11 @@ std::vector<liblas::TransformPtr> GetTransforms(po::variables_map vm, bool verbo
         liblas::ReprojectionTransform trans(in_ref, out_ref);
     
         liblas::Point minimum(&header);
+        minimum.SetCoordinates(b.minx(), b.miny(), b.minz());
+
         liblas::Point maximum(&header);
+        maximum.SetCoordinates(b.maxx(), b.maxy(), b.maxz());
+        
         trans.transform(minimum);
         trans.transform(maximum);
         b = liblas::Bounds<double>(minimum, maximum);
diff --git a/apps/laskernel.hpp b/apps/laskernel.hpp
old mode 100755
new mode 100644
diff --git a/apps/liblas-config b/apps/liblas-config
old mode 100755
new mode 100644
index d78c469..a711dd2
--- a/apps/liblas-config
+++ b/apps/liblas-config
@@ -4,22 +4,22 @@ exec_prefix=/usr/local/bin
 libdir=/usr/local/lib
 
 INCLUDES="-I${prefix}/include "
-LIBS="-L$libdir -llas -llas_c -L/usr/local/lib /usr/local/lib/libboost_program_options-mt.dylib /usr/local/lib/libboost_thread-mt.dylib" 
+LIBS="-L$libdir -llas -llas_c -L/usr/lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu/libboost_program_options.so /usr/lib/x86_64-linux-gnu/libboost_thread.so" 
 
-GDAL_INCLUDE="/usr/local/include"
+GDAL_INCLUDE=""
 if test -n "$GDAL_INCLUDE" ; then 
     INCLUDES="$INCLUDES -I$GDAL_INCLUDE"
 fi
-GDAL_LIBRARY="/usr/local/Cellar/gdal/1.11.0/lib/libgdal.dylib"
+GDAL_LIBRARY=""
 if test -n "$GDAL_LIBRARY" ; then 
     LIBS="$LIBS $GDAL_LIBRARY"
 fi
 
-GEOTIFF_INCLUDE="/usr/local/include"
+GEOTIFF_INCLUDE="/usr/include"
 if test -n "$GEOTIFF_INCLUDE" ; then 
     INCLUDES="$INCLUDES -I$GEOTIFF_INCLUDE"
 fi
-GEOTIFF_LIBRARY="/usr/local/lib/libgeotiff.dylib"
+GEOTIFF_LIBRARY="/usr/lib/libgeotiff.so"
 if test -n "$GEOTIFF_LIBRARY" ; then 
     LIBS="$LIBS $GEOTIFF_LIBRARY"
 fi
@@ -34,11 +34,11 @@ if test -n "$ORACLE_OCI_LIBRARY" ; then
     LIBS="$LIBS $ORACLE_OCI_LIBRARY   "
 fi
 
-TIFF_INCLUDE="/usr/local/include"
+TIFF_INCLUDE="/usr/include/x86_64-linux-gnu"
 if test -n "$TIFF_INCLUDE" ; then 
     INCLUDES="$INCLUDES -I$TIFF_INCLUDE"
 fi
-TIFF_LIBRARY="/usr/local/lib/libtiff.dylib"
+TIFF_LIBRARY="/usr/lib/x86_64-linux-gnu/libtiff.so"
 if test -n "$TIFF_LIBRARY" ; then 
     LIBS="$LIBS $TIFF_LIBRARY"
 fi
@@ -52,11 +52,11 @@ if test -n "$LIBXML2_LIBRARIES" ; then
     LIBS="$LIBS $LIBXML2_LIBRARIES"
 fi
 
-LASZIP_INCLUDE_DIR="/usr/local/include"
+LASZIP_INCLUDE_DIR=""
 if test -n "$LASZIP_INCLUDE_DIR" ; then 
     INCLUDES="$INCLUDES -I$LASZIP_INCLUDE_DIR"
 fi
-LASZIP_LIBRARY="/usr/local/lib/liblaszip.dylib"
+LASZIP_LIBRARY=""
 if test -n "$LASZIP_LIBRARY" ; then 
     LIBS="$LIBS $LASZIP_LIBRARY"
 fi
@@ -95,7 +95,7 @@ case $1 in
     ;;
 
   --defines)
-    echo  -DHAVE_LASZIP=1 -DHAVE_GDAL=1 -DHAVE_LIBGEOTIFF=1
+    echo  -DHAVE_LIBGEOTIFF=1
     ;;
 
   --includes)
@@ -107,11 +107,11 @@ case $1 in
     ;;
 
   --cxxflags)
-    echo   -Wextra -Wall -Wno-unused-parameter -Wno-unused-variable -Wpointer-arith -Wcast-align -Wcast-qual -Wfloat-equal -Wredundant-decls -Wno-long-long
+    echo   -Wextra -Wall -Wno-unused-parameter -Wno-unused-variable -Wpointer-arith -Wcast-align -Wcast-qual -Wfloat-equal -Wredundant-decls -Wno-long-long -std=c++98 -ansi
     ;;
     
   --version)
-    echo 1.8.0
+    echo 1.8.1
     ;;
 
   *)
diff --git a/apps/liblas-config.in b/apps/liblas-config.in
old mode 100755
new mode 100644
diff --git a/apps/liblas.pc.in b/apps/liblas.pc.in
old mode 100755
new mode 100644
diff --git a/apps/ts2las.cpp b/apps/ts2las.cpp
old mode 100755
new mode 100644
index 69823c9..da41893
--- a/apps/ts2las.cpp
+++ b/apps/ts2las.cpp
@@ -325,7 +325,7 @@ int main(int argc, char* argv[])
     
     if (input.empty())
     {
-        std::cerr << "No input TerraSolid .bin file was specfied!" << std::endl;
+        std::cerr << "No input TerraSolid .bin file was specified!" << std::endl;
         OutputHelp(std::cout, options);
         return 1;
     }
diff --git a/apps/ts2las.hpp b/apps/ts2las.hpp
old mode 100755
new mode 100644
diff --git a/apps/txt2las.c b/apps/txt2las.c
old mode 100755
new mode 100644
diff --git a/bin/ci/before_install.sh b/bin/ci/before_install.sh
index 6b360c0..54f5525 100755
--- a/bin/ci/before_install.sh
+++ b/bin/ci/before_install.sh
@@ -4,21 +4,23 @@ source ./bin/ci/common.sh
 echo "$(tmstamp) *** before_install::apt-get starting $(date) ***"
 sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 16126D3A3E5C1192
 sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable -y
+#sudo add-apt-repository ppa:boost-latest/ppa -y
 sudo apt-get update -qq
-sudo apt-get install -qq cmake libboost-program-options-dev libboost-thread-dev libboost-system-dev libboost-filesystem-dev
+sudo apt-get install -qq cmake libboost-all-dev
 sudo apt-get install \
-    libgdal-dev \
+    libgdal1h \
     libgeos-dev \
     libgeos++-dev \
     libproj-dev \
     libxml2-dev \
-    libtiff4-dev
+    libtiff4-dev \
+    libgeotiff-dev 
 # install libgeotiff from sources
-wget http://download.osgeo.org/geotiff/libgeotiff/libgeotiff-1.4.0.tar.gz
-tar -xzf libgeotiff-1.4.0.tar.gz
-cd libgeotiff-1.4.0
-./configure --prefix=/usr && make && sudo make install
-cd $TRAVIS_BUILD_DIR
+#wget http://download.osgeo.org/geotiff/libgeotiff/libgeotiff-1.4.0.tar.gz
+#tar -xzf libgeotiff-1.4.0.tar.gz
+#cd libgeotiff-1.4.0
+#./configure --prefix=/usr && make && sudo make install
+#cd $TRAVIS_BUILD_DIR
 
 echo "$(tmstamp) *** before_install::apt-get finished $(date) ***"
 gcc --version
diff --git a/bin/ci/common.sh b/bin/ci/common.sh
old mode 100755
new mode 100644
diff --git a/bin/ci/script.sh b/bin/ci/script.sh
index fbb1438..11ac158 100755
--- a/bin/ci/script.sh
+++ b/bin/ci/script.sh
@@ -5,7 +5,7 @@ mkdir -p _build
 cd _build
 
 echo "$(tmstamp) *** script::cmake-config starting $(date) ***"
-cmake .. -DWITH_GDAL=ON -DWITH_GEOTIFF=ON
+cmake .. -DWITH_GDAL=ON -DWITH_GEOTIFF=ON -DCMAKE_BUILD_TYPE=Debug
 echo "$(tmstamp) *** script::cmake-config finished $(date) ***"
 
 echo "$(tmstamp) *** script::cmake-build make -j ${NUMTHREADS} $(date) ***"
@@ -13,5 +13,5 @@ make -j ${NUMTHREADS}
 echo "$(tmstamp) *** script::cmake-build finished $(date) ***"
 
 echo "$(tmstamp) *** script::cmake-test starting $(date) ***"
-ctest -V --output-on-failure .
+LD_LIBRARY_PATH=./bin/Debug ./bin/Debug/liblas_test ../test/data
 echo "$(tmstamp) *** script::cmake-test finished $(date) ***"
diff --git a/buildout/bootstrap.py b/buildout/bootstrap.py
old mode 100755
new mode 100644
diff --git a/buildout/buildout.cfg b/buildout/buildout.cfg
old mode 100755
new mode 100644
diff --git a/buildout/setenv.in b/buildout/setenv.in
old mode 100755
new mode 100644
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
old mode 100755
new mode 100644
index 18c876a..c7f583d
--- a/cmake/CMakeLists.txt
+++ b/cmake/CMakeLists.txt
@@ -6,7 +6,7 @@
 # ${CMAKE_INSTALL_PREFIX}/${INSTALL_CMAKE_DIR} and ${PROJECT_ROOT_DIR}
 # is the relative path to the root from there.
 if (NOT WIN32)
-  set(INSTALL_CMAKE_DIR "share/cmake/${PROJECT_NAME}-${VERSION}")
+  set(INSTALL_CMAKE_DIR "share/cmake/${PROJECT_NAME}")
   set (PROJECT_ROOT_DIR "../../..")
 else ()
   set(INSTALL_CMAKE_DIR "cmake")
diff --git a/cmake/libLAS.vcproj.user.template b/cmake/libLAS.vcproj.user.template
old mode 100755
new mode 100644
diff --git a/cmake/liblas-config-version.cmake b/cmake/liblas-config-version.cmake
old mode 100755
new mode 100644
index 5409e23..ebdbb17
--- a/cmake/liblas-config-version.cmake
+++ b/cmake/liblas-config-version.cmake
@@ -1,18 +1,42 @@
 # Version checking for libLAS
 
-set(PACKAGE_VERSION "1.8.0")
+set(PACKAGE_VERSION "1.8.1")
 set(PACKAGE_VERSION_MAJOR "1")
 set(PACKAGE_VERSION_MINOR "8")
-set(PACKAGE_VERSION_PATCH "0")
+set(PACKAGE_VERSION_PATCH "1")
  
-if (WIN32 AND NOT "${CMAKE_GENERATOR}" STREQUAL "Unix Makefiles")
-  # Reject if there's a mismatch on compiler versions (Windows only)
+if (NOT PACKAGE_FIND_NAME STREQUAL "libLAS")
+  # Check package name (in particular, because of the way cmake finds
+  # package config files, the capitalization could easily be "wrong").
+  # This is necessary to ensure that the automatically generated
+  # variables, e.g., <package>_FOUND, are consistently spelled.
+  set (REASON "package = libLAS, NOT ${PACKAGE_FIND_NAME}")
+  set (PACKAGE_VERSION_UNSUITABLE TRUE)
+elseif (NOT (APPLE OR (NOT DEFINED CMAKE_SIZEOF_VOID_P) OR
+      CMAKE_SIZEOF_VOID_P EQUAL 8))
+  # Reject if there's a 32-bit/64-bit mismatch (not necessary with Apple
+  # since a multi-architecture library is built for that platform).
+  set (REASON "sizeof(*void) =  8")
+  set (PACKAGE_VERSION_UNSUITABLE TRUE)
+elseif (MSVC AND NOT MSVC_VERSION STREQUAL "")
+  # Reject if there's a mismatch in MSVC compiler versions
+  set (REASON "_MSC_VER = ")
+  set (PACKAGE_VERSION_UNSUITABLE TRUE)
+elseif (NOT CMAKE_CROSSCOMPILING STREQUAL "FALSE")
+  # Reject if there's a mismatch in ${CMAKE_CROSSCOMPILING}
+  set (REASON "cross-compiling = FALSE")
   set (PACKAGE_VERSION_UNSUITABLE TRUE)
 elseif (PACKAGE_FIND_VERSION)
-  if (${PACKAGE_FIND_VERSION} VERSION_EQUAL ${PACKAGE_VERSION})
+  if (PACKAGE_FIND_VERSION VERSION_EQUAL PACKAGE_VERSION)
     set (PACKAGE_VERSION_EXACT TRUE)
-  elseif (${PACKAGE_FIND_VERSION} VERSION_LESS ${PACKAGE_VERSION}
-    AND ${PACKAGE_FIND_VERSION_MAJOR} EQUAL ${PACKAGE_VERSION_MAJOR})
+  elseif (PACKAGE_FIND_VERSION VERSION_LESS PACKAGE_VERSION
+    AND PACKAGE_FIND_VERSION_MAJOR EQUAL PACKAGE_VERSION_MAJOR)
     set (PACKAGE_VERSION_COMPATIBLE TRUE)
   endif ()
 endif ()
+
+# If unsuitable, append the reason to the package version so that it's
+# visible to the user.
+if (PACKAGE_VERSION_UNSUITABLE)
+  set (PACKAGE_VERSION "${PACKAGE_VERSION} (${REASON})")
+endif ()
diff --git a/cmake/liblas-config-version.cmake.in b/cmake/liblas-config-version.cmake.in
old mode 100755
new mode 100644
index 7ad76d6..f9b7c7c
--- a/cmake/liblas-config-version.cmake.in
+++ b/cmake/liblas-config-version.cmake.in
@@ -5,14 +5,38 @@ set(PACKAGE_VERSION_MAJOR "@LIBLAS_VERSION_MAJOR@")
 set(PACKAGE_VERSION_MINOR "@LIBLAS_VERSION_MINOR@")
 set(PACKAGE_VERSION_PATCH "@LIBLAS_VERSION_PATCH@")
  
-if (WIN32 AND NOT "${CMAKE_GENERATOR}" STREQUAL "@CMAKE_GENERATOR@")
-  # Reject if there's a mismatch on compiler versions (Windows only)
+if (NOT PACKAGE_FIND_NAME STREQUAL "@PROJECT_NAME@")
+  # Check package name (in particular, because of the way cmake finds
+  # package config files, the capitalization could easily be "wrong").
+  # This is necessary to ensure that the automatically generated
+  # variables, e.g., <package>_FOUND, are consistently spelled.
+  set (REASON "package = @PROJECT_NAME@, NOT ${PACKAGE_FIND_NAME}")
+  set (PACKAGE_VERSION_UNSUITABLE TRUE)
+elseif (NOT (APPLE OR (NOT DEFINED CMAKE_SIZEOF_VOID_P) OR
+      CMAKE_SIZEOF_VOID_P EQUAL @CMAKE_SIZEOF_VOID_P@))
+  # Reject if there's a 32-bit/64-bit mismatch (not necessary with Apple
+  # since a multi-architecture library is built for that platform).
+  set (REASON "sizeof(*void) =  @CMAKE_SIZEOF_VOID_P@")
+  set (PACKAGE_VERSION_UNSUITABLE TRUE)
+elseif (MSVC AND NOT MSVC_VERSION STREQUAL "@MSVC_VERSION@")
+  # Reject if there's a mismatch in MSVC compiler versions
+  set (REASON "_MSC_VER = @MSVC_VERSION@")
+  set (PACKAGE_VERSION_UNSUITABLE TRUE)
+elseif (NOT CMAKE_CROSSCOMPILING STREQUAL "@CMAKE_CROSSCOMPILING@")
+  # Reject if there's a mismatch in ${CMAKE_CROSSCOMPILING}
+  set (REASON "cross-compiling = @CMAKE_CROSSCOMPILING@")
   set (PACKAGE_VERSION_UNSUITABLE TRUE)
 elseif (PACKAGE_FIND_VERSION)
-  if (${PACKAGE_FIND_VERSION} VERSION_EQUAL ${PACKAGE_VERSION})
+  if (PACKAGE_FIND_VERSION VERSION_EQUAL PACKAGE_VERSION)
     set (PACKAGE_VERSION_EXACT TRUE)
-  elseif (${PACKAGE_FIND_VERSION} VERSION_LESS ${PACKAGE_VERSION}
-    AND ${PACKAGE_FIND_VERSION_MAJOR} EQUAL ${PACKAGE_VERSION_MAJOR})
+  elseif (PACKAGE_FIND_VERSION VERSION_LESS PACKAGE_VERSION
+    AND PACKAGE_FIND_VERSION_MAJOR EQUAL PACKAGE_VERSION_MAJOR)
     set (PACKAGE_VERSION_COMPATIBLE TRUE)
   endif ()
 endif ()
+
+# If unsuitable, append the reason to the package version so that it's
+# visible to the user.
+if (PACKAGE_VERSION_UNSUITABLE)
+  set (PACKAGE_VERSION "${PACKAGE_VERSION} (${REASON})")
+endif ()
diff --git a/cmake/liblas-config.cmake b/cmake/liblas-config.cmake
old mode 100755
new mode 100644
index 50f6a50..c1d1b9a
--- a/cmake/liblas-config.cmake
+++ b/cmake/liblas-config.cmake
@@ -4,20 +4,20 @@
 #  libLAS_FOUND = LIBLAS_FOUND - TRUE
 #  libLAS_INCLUDE_DIRS - include directories for libLAS
 #  libLAS_LIBRARY_DIRS - library directory
-#  libLAS_LIBRARIES    - all the libraries of the components requested
-#                                if no components specified then all found
+#  libLAS_LIBRARIES    - the libraries (as targets)
+#  libLAS_BINARY_DIRS  - the directory for dll and utilites
 #  libLAS_VERSION      - libLAS library version
 
 message (STATUS "Reading ${CMAKE_CURRENT_LIST_FILE}")
-set (libLAS_VERSION "")
-message (STATUS "libLAS configuration, version "
-  ${libLAS_VERSION})
+# libLAS_VERSION is set by version file
+message (STATUS "libLAS configuration, version " ${libLAS_VERSION})
 
 # Tell the user project where to find our headers and libraries
 get_filename_component (_DIR ${CMAKE_CURRENT_LIST_FILE} PATH)
 get_filename_component (PROJECT_ROOT_DIR "${_DIR}/../../.." ABSOLUTE)
 set (libLAS_INCLUDE_DIRS "${PROJECT_ROOT_DIR}/include")
 set (libLAS_LIBRARY_DIRS "${PROJECT_ROOT_DIR}/lib")
+set (libLAS_BINARY_DIRS "${PROJECT_ROOT_DIR}/bin")
 
 include ("${_DIR}/liblas-depends.cmake")
 if(WIN32)
@@ -26,4 +26,5 @@ else()
   set (libLAS_LIBRARIES las las_c)
 endif()
 
+# For backwards compatibility
 set (LIBLAS_FOUND TRUE)
diff --git a/cmake/liblas-config.cmake.in b/cmake/liblas-config.cmake.in
old mode 100755
new mode 100644
index 51e1163..175e997
--- a/cmake/liblas-config.cmake.in
+++ b/cmake/liblas-config.cmake.in
@@ -4,20 +4,20 @@
 #  libLAS_FOUND = LIBLAS_FOUND - TRUE
 #  libLAS_INCLUDE_DIRS - include directories for libLAS
 #  libLAS_LIBRARY_DIRS - library directory
-#  libLAS_LIBRARIES    - all the libraries of the components requested
-#                                if no components specified then all found
+#  libLAS_LIBRARIES    - the libraries (as targets)
+#  libLAS_BINARY_DIRS  - the directory for dll and utilites
 #  libLAS_VERSION      - libLAS library version
 
 message (STATUS "Reading ${CMAKE_CURRENT_LIST_FILE}")
-set (libLAS_VERSION "@PACKAGE_VERSION@")
-message (STATUS "libLAS configuration, version "
-  ${libLAS_VERSION})
+# libLAS_VERSION is set by version file
+message (STATUS "libLAS configuration, version " ${libLAS_VERSION})
 
 # Tell the user project where to find our headers and libraries
 get_filename_component (_DIR ${CMAKE_CURRENT_LIST_FILE} PATH)
 get_filename_component (PROJECT_ROOT_DIR "${_DIR}/@PROJECT_ROOT_DIR@" ABSOLUTE)
 set (libLAS_INCLUDE_DIRS "${PROJECT_ROOT_DIR}/include")
 set (libLAS_LIBRARY_DIRS "${PROJECT_ROOT_DIR}/lib")
+set (libLAS_BINARY_DIRS "${PROJECT_ROOT_DIR}/bin")
 
 include ("${_DIR}/liblas-depends.cmake")
 if(WIN32)
@@ -26,4 +26,5 @@ else()
   set (libLAS_LIBRARIES las las_c)
 endif()
 
+# For backwards compatibility
 set (LIBLAS_FOUND TRUE)
diff --git a/cmake/modules/BuildOSGeo4W.cmake b/cmake/modules/BuildOSGeo4W.cmake
old mode 100755
new mode 100644
diff --git a/cmake/modules/FindGDAL.cmake b/cmake/modules/FindGDAL.cmake
old mode 100755
new mode 100644
index 0c06636..2945192
--- a/cmake/modules/FindGDAL.cmake
+++ b/cmake/modules/FindGDAL.cmake
@@ -4,7 +4,7 @@
 # On success, the macro sets the following variables:
 # GDAL_FOUND       = if the library found
 # GDAL_LIBRARY     = full path to the library
-# GDAL_INCLUDE_DIR = where to find the library headers 
+# GDAL_INCLUDE_DIR = where to find the library headers
 #
 # On Unix, macro sets also:
 # GDAL_VERSION_STRING = human-readable string containing version of the library
@@ -85,7 +85,6 @@ MACRO(COMPARE_VERSION_STRINGS a_in b_in result_out)
   SET(${result_out} ${result})
 ENDMACRO(COMPARE_VERSION_STRINGS)
 
-MESSAGE(STATUS "Searching for GDAL ${GDAL_FIND_VERSION}+ library")
 set (GDAL_VERSION_COUNT 3)
 
 SET(GDAL_NAMES gdal)
@@ -124,7 +123,7 @@ IF(WIN32)
     IF(MSVC)
 
         FIND_PATH(GDAL_INCLUDE_DIR
-            NAMES gdal.h 
+            NAMES gdal.h
             PATH_PREFIXES gdal gdal-1.6
             PATHS
             "${OSGEO4W_ROOT_DIR}/apps/gdal-dev/include"
@@ -139,14 +138,14 @@ IF(WIN32)
             "$ENV{LIB_DIR}/lib"
             /usr/lib
             c:/msys/local/lib
-            "${OSGEO4W_ROOT_DIR}/apps/gdal-dev/lib"            
+            "${OSGEO4W_ROOT_DIR}/apps/gdal-dev/lib"
             ${OSGEO4W_ROOT_DIR}/lib)
-        
+
         IF(GDAL_LIBRARY)
             SET(GDAL_LIBRARY;odbc32;odbccp32 CACHE STRING INTERNAL)
         ENDIF()
     ENDIF(MSVC)
-  
+
 ELSEIF(UNIX)
 
     # Try to use framework on Mac OS X
@@ -155,32 +154,33 @@ ELSEIF(UNIX)
     ENDIF()
 
     # Try to use GDAL_HOME location if specified
-    IF($ENV{GDAL_HOME})
+    IF(DEFINED ENV{GDAL_HOME})
         SET(GDAL_CONFIG_PREFER_PATH
             "$ENV{GDAL_HOME}/bin" CACHE STRING "Search for gdal-config program in preferred location")
     ENDIF()
 
     # Try to use OSGeo4W installation
-    IF($ENV{OSGEO4W_HOME})
+    IF(DEFINED ENV{OSGEO4W_HOME})
         SET(GDAL_CONFIG_PREFER_OSGEO4W_PATH
             "$ENV{OSGEO4W_HOME}/bin" CACHE STRING "Search for gdal-config program provided by OSGeo4W")
     ENDIF()
 
     # Try to use FWTools installation
-    IF($ENV{FWTOOLS_HOME})
+    IF(DEFINED ENV{FWTOOLS_HOME})
         SET(GDAL_CONFIG_PREFER_FWTOOLS_PATH
             "$ENV{FWTOOLS_HOME}/bin_safe" CACHE STRING "Search for gdal-config program provided by FWTools")
     ENDIF()
 
     FIND_PROGRAM(GDAL_CONFIG gdal-config
+        HINTS
         ${GDAL_CONFIG_PREFER_PATH}
         ${GDAL_CONFIG_PREFER_OSGEO4W_PATH}
         ${GDAL_CONFIG_PREFER_FWTOOLS_PATH}
         ${GDAL_MAC_PATH}
         /usr/local/bin/
         /usr/bin/)
-            
-    IF(GDAL_CONFIG) 
+
+    IF(GDAL_CONFIG)
 
         # TODO: Replace the regex hacks with CMake version comparison feature:
         # if(version1 VERSION_LESS version2)
@@ -192,18 +192,15 @@ ELSEIF(UNIX)
         STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\1" GDAL_VERSION_MAJOR "${GDAL_VERSION_STATED}")
         STRING(REGEX REPLACE "([0-9]+)\\.(/^\\d{1,2}$/)\\.([0-9]+)" "\\2" GDAL_VERSION_MINOR "${GDAL_VERSION_STATED}")
         STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\3" GDAL_VERSION_PATCH "${GDAL_VERSION_STATED}")
-        
+
         # Check for GDAL version
         if (GDAL_FIND_VERSION)
-        COMPARE_VERSION_STRINGS( "${GDAL_VERSION_STATED}" "${GDAL_FIND_VERSION}" version_result)
-        IF (version_result LESS 0)
-            MESSAGE (FATAL_ERROR "GDAL version is too old (${GDAL_VERSION_STATED}). Use ${GDAL_FIND_VERSION} or higher requested.")
-        else()
-            MESSAGE(STATUS "Found acceptable GDAL version ${GDAL_VERSION_STATED}")
+            COMPARE_VERSION_STRINGS( "${GDAL_VERSION_STATED}" "${GDAL_FIND_VERSION}" version_result)
+            IF (version_result LESS 0)
+                MESSAGE (FATAL_ERROR "GDAL version is too old (${GDAL_VERSION_STATED}). Use ${GDAL_FIND_VERSION} or higher requested.")
+            ENDIF()
             set (GDAL_VERSION_STRING ${GDAL_VERSION_STATED})
-            # set (GDAL_VERSION "1.6")
             set (GDAL_VERSION_COMPATIBLE true)
-        ENDIF()
         endif()
 
         set (GDAL_FOUND TRUE)
@@ -211,15 +208,15 @@ ELSEIF(UNIX)
         EXEC_PROGRAM(${GDAL_CONFIG} ARGS --prefix OUTPUT_VARIABLE GDAL_PREFIX)
 
         FIND_PATH(GDAL_INCLUDE_DIR
-            gdal.h 
+            gdal.h
             PATH_PREFIXES gdal
-            PATHS
+            HINTS
             ${GDAL_PREFIX}/include/gdal
             ${GDAL_PREFIX}/include
-            /usr/local/include 
+            /usr/local/include
             /usr/include)
 
-        # Extract link dirs for rpath  
+        # Extract link dirs for rpath
         EXEC_PROGRAM(${GDAL_CONFIG} ARGS --libs OUTPUT_VARIABLE GDAL_CONFIG_LIBS)
 
         # Split off the link dirs (for rpath)
@@ -249,7 +246,7 @@ ELSEIF(UNIX)
         ELSE()
             SET(GDAL_LIBRARY ${GDAL_LINK_DIRECTORIES}/lib${GDAL_LIB_NAME}.so CACHE STRING INTERNAL)
         ENDIF()
-      
+
     ELSE()
         MESSAGE("FindGDAL.cmake: gdal-config not found. Please set it manually: GDAL_CONFIG=${GDAL_CONFIG}")
     ENDIF(GDAL_CONFIG)
diff --git a/cmake/modules/FindGeoTIFF.cmake b/cmake/modules/FindGeoTIFF.cmake
old mode 100755
new mode 100644
diff --git a/cmake/modules/FindLASzip.cmake b/cmake/modules/FindLASzip.cmake
old mode 100755
new mode 100644
diff --git a/cmake/modules/FindOracle.cmake b/cmake/modules/FindOracle.cmake
old mode 100755
new mode 100644
diff --git a/cmake/modules/FindPROJ4.cmake b/cmake/modules/FindPROJ4.cmake
new file mode 100644
index 0000000..2a819ce
--- /dev/null
+++ b/cmake/modules/FindPROJ4.cmake
@@ -0,0 +1,44 @@
+###############################################################################
+# CMake module to search for PROJ.4 library
+#
+# On success, the macro sets the following variables:
+# PROJ4_FOUND       = if the library found
+# PROJ4_LIBRARY     = full path to the library
+# PROJ4_INCLUDE_DIR = where to find the library headers 
+# also defined, but not for general use are
+# PROJ4_LIBRARY, where to find the PROJ.4 library.
+#
+# Copyright (c) 2009 Mateusz Loskot <mateusz at loskot.net>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+#
+###############################################################################
+
+# Try to use OSGeo4W installation
+IF(WIN32)
+    SET(PROJ4_OSGEO4W_HOME "C:/OSGeo4W") 
+
+    IF($ENV{OSGEO4W_HOME})
+        SET(PROJ4_OSGEO4W_HOME "$ENV{OSGEO4W_HOME}") 
+    ENDIF()
+ENDIF(WIN32)
+
+FIND_PATH(PROJ4_INCLUDE_DIR proj_api.h
+    PATHS ${PROJ4_OSGEO4W_HOME}/include
+    DOC "Path to PROJ.4 library include directory")
+
+SET(PROJ4_NAMES ${PROJ4_NAMES} proj proj_i)
+FIND_LIBRARY(PROJ4_LIBRARY
+    NAMES ${PROJ4_NAMES}
+    PATHS ${PROJ4_OSGEO4W_HOME}/lib
+    DOC "Path to PROJ.4 library file")
+
+# Handle the QUIETLY and REQUIRED arguments and set SPATIALINDEX_FOUND to TRUE
+# if all listed variables are TRUE
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(PROJ4 DEFAULT_MSG PROJ4_LIBRARY PROJ4_INCLUDE_DIR)
+
+IF(PROJ4_FOUND)
+  SET(PROJ4_LIBRARIES ${PROJ4_LIBRARY})
+ENDIF()
diff --git a/cmake/modules/FindSpatialIndex.cmake b/cmake/modules/FindSpatialIndex.cmake
old mode 100755
new mode 100644
diff --git a/csharp-new/liblas_swig.sln b/csharp-new/liblas_swig.sln
old mode 100755
new mode 100644
diff --git a/csharp-new/liblas_swig_cpp/liblas.i b/csharp-new/liblas_swig_cpp/liblas.i
old mode 100755
new mode 100644
diff --git a/csharp-new/liblas_swig_cpp/liblas_swig_cpp.vcxproj b/csharp-new/liblas_swig_cpp/liblas_swig_cpp.vcxproj
old mode 100755
new mode 100644
diff --git a/csharp-new/liblas_swig_cpp/liblas_swig_cpp.vcxproj.filters b/csharp-new/liblas_swig_cpp/liblas_swig_cpp.vcxproj.filters
old mode 100755
new mode 100644
diff --git a/csharp-new/liblas_swig_cpp/liblas_swig_cpp.vcxproj.user b/csharp-new/liblas_swig_cpp/liblas_swig_cpp.vcxproj.user
old mode 100755
new mode 100644
diff --git a/csharp-new/liblas_swig_cs/Properties/AssemblyInfo.cs b/csharp-new/liblas_swig_cs/Properties/AssemblyInfo.cs
old mode 100755
new mode 100644
diff --git a/csharp-new/liblas_swig_cs/liblas_swig_cs.csproj b/csharp-new/liblas_swig_cs/liblas_swig_cs.csproj
old mode 100755
new mode 100644
diff --git a/csharp-new/liblas_swig_test/Program.cs b/csharp-new/liblas_swig_test/Program.cs
old mode 100755
new mode 100644
diff --git a/csharp-new/liblas_swig_test/Properties/AssemblyInfo.cs b/csharp-new/liblas_swig_test/Properties/AssemblyInfo.cs
old mode 100755
new mode 100644
diff --git a/csharp-new/liblas_swig_test/TestGuid.cs b/csharp-new/liblas_swig_test/TestGuid.cs
old mode 100755
new mode 100644
diff --git a/csharp-new/liblas_swig_test/TestHeader.cs b/csharp-new/liblas_swig_test/TestHeader.cs
old mode 100755
new mode 100644
diff --git a/csharp-new/liblas_swig_test/TestPoint.cs b/csharp-new/liblas_swig_test/TestPoint.cs
old mode 100755
new mode 100644
diff --git a/csharp-new/liblas_swig_test/TestReader.cs b/csharp-new/liblas_swig_test/TestReader.cs
old mode 100755
new mode 100644
diff --git a/csharp-new/liblas_swig_test/TestSpatialReference.cs b/csharp-new/liblas_swig_test/TestSpatialReference.cs
old mode 100755
new mode 100644
diff --git a/csharp-new/liblas_swig_test/TestVariableRecord.cs b/csharp-new/liblas_swig_test/TestVariableRecord.cs
old mode 100755
new mode 100644
diff --git a/csharp-new/liblas_swig_test/liblas_swig_test.csproj b/csharp-new/liblas_swig_test/liblas_swig_test.csproj
old mode 100755
new mode 100644
diff --git a/csharp/HelloWorldLAS/HelloWorldLAS.csproj b/csharp/HelloWorldLAS/HelloWorldLAS.csproj
old mode 100755
new mode 100644
diff --git a/csharp/HelloWorldLAS/HelloWorldLAS_Express.csproj b/csharp/HelloWorldLAS/HelloWorldLAS_Express.csproj
old mode 100755
new mode 100644
diff --git a/csharp/HelloWorldLAS/Program.cs b/csharp/HelloWorldLAS/Program.cs
old mode 100755
new mode 100644
diff --git a/csharp/HelloWorldLAS/Properties/AssemblyInfo.cs b/csharp/HelloWorldLAS/Properties/AssemblyInfo.cs
old mode 100755
new mode 100644
diff --git a/csharp/NUnitTest/LASFilesClass.cs b/csharp/NUnitTest/LASFilesClass.cs
old mode 100755
new mode 100644
diff --git a/csharp/NUnitTest/LASGuidTest.cs b/csharp/NUnitTest/LASGuidTest.cs
old mode 100755
new mode 100644
diff --git a/csharp/NUnitTest/LASHeaderTest.cs b/csharp/NUnitTest/LASHeaderTest.cs
old mode 100755
new mode 100644
diff --git a/csharp/NUnitTest/LASPointTest.cs b/csharp/NUnitTest/LASPointTest.cs
old mode 100755
new mode 100644
diff --git a/csharp/NUnitTest/LASReaderTest.cs b/csharp/NUnitTest/LASReaderTest.cs
old mode 100755
new mode 100644
diff --git a/csharp/NUnitTest/LASVariableLengthRecordTest.cs b/csharp/NUnitTest/LASVariableLengthRecordTest.cs
old mode 100755
new mode 100644
diff --git a/csharp/NUnitTest/LASWriterTest.cs b/csharp/NUnitTest/LASWriterTest.cs
old mode 100755
new mode 100644
diff --git a/csharp/NUnitTest/NUnitTest.csproj b/csharp/NUnitTest/NUnitTest.csproj
old mode 100755
new mode 100644
diff --git a/csharp/NUnitTest/NUnitTest_Express.csproj b/csharp/NUnitTest/NUnitTest_Express.csproj
old mode 100755
new mode 100644
diff --git a/csharp/NUnitTest/Properties/AssemblyInfo.cs b/csharp/NUnitTest/Properties/AssemblyInfo.cs
old mode 100755
new mode 100644
diff --git a/csharp/Samples/Read_Express/ReadLAS.cs b/csharp/Samples/Read_Express/ReadLAS.cs
old mode 100755
new mode 100644
diff --git a/csharp/Samples/Read_Express/Read_Express.csproj b/csharp/Samples/Read_Express/Read_Express.csproj
old mode 100755
new mode 100644
diff --git a/csharp/Samples/WriteLAS/Properties/AssemblyInfo.cs b/csharp/Samples/WriteLAS/Properties/AssemblyInfo.cs
old mode 100755
new mode 100644
diff --git a/csharp/Samples/WriteLAS/WriteLAS.cs b/csharp/Samples/WriteLAS/WriteLAS.cs
old mode 100755
new mode 100644
diff --git a/csharp/Samples/WriteLAS/Write_Express.csproj b/csharp/Samples/WriteLAS/Write_Express.csproj
old mode 100755
new mode 100644
diff --git a/csharp/dotnetLibLAS.sln b/csharp/dotnetLibLAS.sln
old mode 100755
new mode 100644
diff --git a/csharp/dotnetLibLAS/AssemblyInfo.cs b/csharp/dotnetLibLAS/AssemblyInfo.cs
old mode 100755
new mode 100644
diff --git a/csharp/dotnetLibLAS/LASException.cs b/csharp/dotnetLibLAS/LASException.cs
old mode 100755
new mode 100644
index 7adf693..ee0b102
--- a/csharp/dotnetLibLAS/LASException.cs
+++ b/csharp/dotnetLibLAS/LASException.cs
@@ -64,6 +64,7 @@ namespace LibLAS
     /// <summary>
     /// LASException class
     /// </summary>
+    [SerializableAttribute] 
     public class LASException :
         System.ApplicationException
     {
diff --git a/csharp/dotnetLibLAS/LASGuid.cs b/csharp/dotnetLibLAS/LASGuid.cs
old mode 100755
new mode 100644
index 873a351..c200284
--- a/csharp/dotnetLibLAS/LASGuid.cs
+++ b/csharp/dotnetLibLAS/LASGuid.cs
@@ -59,15 +59,30 @@ namespace LibLAS
     {
         private LASGuidH hguid;
 
+        protected virtual void Dispose(bool disposing)
+        {
+            // free native resources if there are any.
+            if (hguid != IntPtr.Zero)
+            {
+                NativeMethods.LASGuid_Destroy(hguid);
+                hguid = IntPtr.Zero;
+            }
+        }
+
         /// <summary>
         /// The object user should call this method when they finished with the object.
         /// </summary>
         /// 
         public void Dispose()
         {
-            CAPI.LASGuid_Destroy(hguid);
-            // Clean up unmanaged resources here.
-            // Dispose other contained disposable objects.
+            Dispose(true);
+            GC.SuppressFinalize(this);
+        }
+
+        ~LASGuid()
+        {
+            // Finalizer calls Dispose(false)
+            Dispose(false);
         }
 
         /// <summary>
@@ -75,7 +90,7 @@ namespace LibLAS
         /// </summary>
         public LASGuid()
         {
-            hguid = CAPI.LASGuid_Create();
+            hguid = NativeMethods.LASGuid_Create();
         }
 
         /// <summary>
@@ -94,7 +109,7 @@ namespace LibLAS
         /// <param name="guidString">string A GUID string in the form "00000000-0000-0000-0000-000000000000"</param>
         public LASGuid(String guidString)
         {
-            hguid = CAPI.LASGuid_CreateFromString(guidString);
+            hguid = NativeMethods.LASGuid_CreateFromString(guidString);
         }
 
         /// <summary>
@@ -103,7 +118,7 @@ namespace LibLAS
         /// <returns>the String value of the Guid</returns>
         public override string ToString()
         {
-            return CAPI.LASGuid_AsString(hguid);
+            return NativeMethods.LASGuid_AsString(hguid);
         }
 
         /// <summary>
@@ -135,7 +150,7 @@ namespace LibLAS
                 return false;
             }
 
-            if (CAPI.LASGuid_Equals(hguid, guidd.GetPointer()) == 1)
+            if (NativeMethods.LASGuid_Equals(hguid, guidd.GetPointer()) == 1)
             {
                 return true;
             }
@@ -168,7 +183,7 @@ namespace LibLAS
                 return false;
             }
 
-            if (CAPI.LASGuid_Equals(hguid, obj.GetPointer()) == 1)
+            if (NativeMethods.LASGuid_Equals(hguid, obj.GetPointer()) == 1)
             {
                 return true;
             }
diff --git a/csharp/dotnetLibLAS/LASHeader.cs b/csharp/dotnetLibLAS/LASHeader.cs
old mode 100755
new mode 100644
index 3a76c38..90eedaa
--- a/csharp/dotnetLibLAS/LASHeader.cs
+++ b/csharp/dotnetLibLAS/LASHeader.cs
@@ -58,16 +58,30 @@ namespace LibLAS
     public class LASHeader : IDisposable
     {
 
+        protected virtual void Dispose(bool disposing)
+        {
+            // free native resources if there are any.
+            if (hHeader != IntPtr.Zero)
+            {
+                NativeMethods.LASHeader_Destroy(hHeader);
+                hHeader = IntPtr.Zero;
+            }
+        }
+
         /// <summary>
         /// The object user should call this method when they finished with the object.
-        /// In .NET is magaged by the GC.
         /// </summary>
+        /// 
         public void Dispose()
         {
+            Dispose(true);
+            GC.SuppressFinalize(this);
+        }
 
-            CAPI.LASHeader_Destroy(hHeader);
-            // Clean up unmanaged resources here.
-            // Dispose other contained disposable objects.
+        ~LASHeader()
+        {
+            // Finalizer calls Dispose(false)
+            Dispose(false);
         }
 
         enum FormatVersion
@@ -137,7 +151,7 @@ namespace LibLAS
         /// Other fields filled with 0.</remarks>
         public LASHeader()
         {
-            hHeader = CAPI.LASHeader_Create();
+            hHeader = NativeMethods.LASHeader_Create();
         }
 
         /// <summary>
@@ -146,38 +160,7 @@ namespace LibLAS
         /// <returns>new LASHeader instance.</returns>
         public LASHeader Copy()
         {
-            return new LASHeader(CAPI.LASHeader_Copy(hHeader));
-        }
-
-        /// <summary>
-        /// Destroy the unmanaged resources to the instance.
-        /// </summary>
-        /// <remarks>The user could call this method when they finished with the object.</remarks>
-        public void Destroy()
-        {
-            CAPI.LASHeader_Destroy(hHeader);
-        }
-
-        /// <summary>
-        /// Comparison overload to the LASHeader
-        /// </summary>
-        /// <param name="lasHeader1">LASHeader instance to be compared</param>
-        /// <param name="lasHeader2">LASHeader instance to be compared</param>
-        /// <returns>true if lasHeader1==lasHeader2</returns>
-        public static bool operator ==(LASHeader lasHeader1, LASHeader lasHeader2)
-        {
-            return lasHeader1.Equals(lasHeader2);
-        }
-
-        /// <summary>
-        /// Comparison overload to the LASHeader
-        /// </summary>
-        /// <param name="lasHeader1">LASHeader instance to be compared</param>
-        /// <param name="lasHeader2">LASHeader instance to be compared</param>
-        /// <returns></returns>
-        public static bool operator !=(LASHeader lasHeader1, LASHeader lasHeader2)
-        {
-            return !(lasHeader1 == lasHeader2);
+            return new LASHeader(NativeMethods.LASHeader_Copy(hHeader));
         }
 
         /// <summary>
@@ -188,7 +171,7 @@ namespace LibLAS
         {
             get
             {
-                return CAPI.LASHeader_GetFileSignature(hHeader);
+                return NativeMethods.LASHeader_GetFileSignature(hHeader);
             }
         }
 
@@ -200,11 +183,11 @@ namespace LibLAS
         {
             get
             {
-                return CAPI.LASHeader_GetFileSourceId(hHeader);
+                return NativeMethods.LASHeader_GetFileSourceId(hHeader);
             }
             set
             {
-                LASError error = CAPI.LASHeader_SetFileSourceId(hHeader, value);
+                LASError error = NativeMethods.LASHeader_SetFileSourceId(hHeader, value);
                 if ((Int32)error != 0)
                 {
                     LASException e = new LASException("Exception in Set Header SetFileSourceId.");
@@ -221,7 +204,7 @@ namespace LibLAS
         {
             get
             {
-                return CAPI.LASHeader_GetReserved(hHeader);
+                return NativeMethods.LASHeader_GetReserved(hHeader);
             }
         }
 
@@ -233,7 +216,7 @@ namespace LibLAS
         {
             get
             {
-                return CAPI.LASHeader_GetProjectId(hHeader);
+                return NativeMethods.LASHeader_GetProjectId(hHeader);
             }
         }
 
@@ -246,11 +229,11 @@ namespace LibLAS
         {
             get
             {
-                return CAPI.LASHeader_GetVersionMajor(hHeader);
+                return NativeMethods.LASHeader_GetVersionMajor(hHeader);
             }
             set
             {
-                LASError error = CAPI.LASHeader_SetVersionMajor(hHeader, value);
+                LASError error = NativeMethods.LASHeader_SetVersionMajor(hHeader, value);
                 if ((Int32)error != 0)
                 {
                     LASException e = new LASException("Exception in Set Header VersionMajor.");
@@ -269,11 +252,11 @@ namespace LibLAS
             get
             {
 
-                return CAPI.LASHeader_GetVersionMinor(hHeader);
+                return NativeMethods.LASHeader_GetVersionMinor(hHeader);
             }
             set
             {
-                LASError error = CAPI.LASHeader_SetVersionMinor(hHeader, value);
+                LASError error = NativeMethods.LASHeader_SetVersionMinor(hHeader, value);
                 if ((Int32)error != 0)
                 {
                     LASException e = new LASException("Exception in Set Header VersionMinor.");
@@ -291,11 +274,11 @@ namespace LibLAS
         {
             get
             {
-                return CAPI.LASHeader_GetSystemId(hHeader);
+                return NativeMethods.LASHeader_GetSystemId(hHeader);
             }
             set
             {
-                LASError error = CAPI.LASHeader_SetSystemId(hHeader, value);
+                LASError error = NativeMethods.LASHeader_SetSystemId(hHeader, value);
                 if ((Int32)error != 0)
                 {
                     LASException e = new LASException("Exception in Set Header SystemId.");
@@ -314,11 +297,11 @@ namespace LibLAS
             get
             {
 
-                return CAPI.LASHeader_GetSoftwareId(hHeader);
+                return NativeMethods.LASHeader_GetSoftwareId(hHeader);
             }
             set
             {
-                LASError error = CAPI.LASHeader_SetSoftwareId(hHeader, value);
+                LASError error = NativeMethods.LASHeader_SetSoftwareId(hHeader, value);
                 if ((Int32)error != 0)
                 {
                     LASException e = new LASException("Exception in Set Header SoftwareId.");
@@ -336,11 +319,11 @@ namespace LibLAS
         {
             get
             {
-                return CAPI.LASHeader_GetCreationDOY(hHeader);
+                return NativeMethods.LASHeader_GetCreationDOY(hHeader);
             }
             set
             {
-                LASError error = CAPI.LASHeader_SetCreationDOY(hHeader, value);
+                LASError error = NativeMethods.LASHeader_SetCreationDOY(hHeader, value);
                 if ((Int32)error != 0)
                 {
                     LASException e = new LASException("Exception in Set Header CreationDOY.");
@@ -357,11 +340,11 @@ namespace LibLAS
         {
             get
             {
-                return CAPI.LASHeader_GetCreationYear(hHeader);
+                return NativeMethods.LASHeader_GetCreationYear(hHeader);
             }
             set
             {
-                LASError error = CAPI.LASHeader_SetCreationYear(hHeader, value);
+                LASError error = NativeMethods.LASHeader_SetCreationYear(hHeader, value);
                 if ((Int32)error != 0)
                 {
                     LASException e = new LASException("Exception in Set Header CreationYear.");
@@ -378,7 +361,7 @@ namespace LibLAS
         {
             get
             {
-                return CAPI.LASHeader_GetHeaderSize(hHeader);
+                return NativeMethods.LASHeader_GetHeaderSize(hHeader);
             }
         }
 
@@ -389,7 +372,7 @@ namespace LibLAS
         {
             get
             {
-                return CAPI.LASHeader_GetDataOffset(hHeader);
+                return NativeMethods.LASHeader_GetDataOffset(hHeader);
             }
         }
 
@@ -400,7 +383,7 @@ namespace LibLAS
         {
             get
             {
-                return CAPI.LASHeader_GetRecordsCount(hHeader);
+                return NativeMethods.LASHeader_GetRecordsCount(hHeader);
             }
         }
 
@@ -413,11 +396,11 @@ namespace LibLAS
         {
             get
             {
-                return CAPI.LASHeader_GetDataFormatId(hHeader);
+                return NativeMethods.LASHeader_GetDataFormatId(hHeader);
             }
             set
             {
-                LASError error = CAPI.LASHeader_SetDataFormatId(hHeader, value);
+                LASError error = NativeMethods.LASHeader_SetDataFormatId(hHeader, value);
                 if ((Int32)error != 0)
                 {
                     LASException e = new LASException("Exception in Set Header DataFormatId.");
@@ -433,7 +416,7 @@ namespace LibLAS
         {
             get
             {
-                return CAPI.LASHeader_GetDataRecordLength(hHeader);
+                return NativeMethods.LASHeader_GetDataRecordLength(hHeader);
             }
         }
 
@@ -447,12 +430,12 @@ namespace LibLAS
             get
             {
                 //Get total number of point records stored in the LAS file.
-                return CAPI.LASHeader_GetPointRecordsCount(hHeader);
+                return NativeMethods.LASHeader_GetPointRecordsCount(hHeader);
             }
             set
             {
                 //Set number of point records that will be stored in a new LAS file.
-                LASError error = CAPI.LASHeader_SetPointRecordsCount(hHeader, value);
+                LASError error = NativeMethods.LASHeader_SetPointRecordsCount(hHeader, value);
                 if ((Int32)error != 0)
                 {
                     LASException e = new LASException("Exception in Set Header PointRecordsCount.");
@@ -469,7 +452,7 @@ namespace LibLAS
         public UInt32 GetPointRecordsByReturnCount(int index)
         {
             // Get array of the total point records per return.
-            return CAPI.LASHeader_GetPointRecordsByReturnCount(hHeader, index);
+            return NativeMethods.LASHeader_GetPointRecordsByReturnCount(hHeader, index);
         }
 
         //    /// Set values of 5-elements array of total point records per return.
@@ -483,7 +466,7 @@ namespace LibLAS
         /// <param name="value">the number of point records for the return </param>
         public void SetPointRecordsByReturnCount(int index, UInt32 value)
         {
-            LASError error = CAPI.LASHeader_SetPointRecordsByReturnCount(hHeader, index, value);
+            LASError error = NativeMethods.LASHeader_SetPointRecordsByReturnCount(hHeader, index, value);
             if ((Int32)error != 0)
             {
                 LASException e = new LASException("Exception in Set Header SetPointRecordsByReturnCount.");
@@ -497,7 +480,7 @@ namespace LibLAS
         /// <returns>scale factor for X coordinate.</returns>
         public double GetScaleX()
         {
-            return CAPI.LASHeader_GetScaleX(hHeader);
+            return NativeMethods.LASHeader_GetScaleX(hHeader);
         }
 
         /// <summary>
@@ -506,7 +489,7 @@ namespace LibLAS
         /// <returns>scale factor for Y coordinate.</returns>
         public double GetScaleY()
         {
-            return CAPI.LASHeader_GetScaleY(hHeader);
+            return NativeMethods.LASHeader_GetScaleY(hHeader);
         }
 
         /// <summary>
@@ -515,7 +498,7 @@ namespace LibLAS
         /// <returns>scale factor for Z coordinate.</returns>
         public double GetScaleZ()
         {
-            return CAPI.LASHeader_GetScaleZ(hHeader);
+            return NativeMethods.LASHeader_GetScaleZ(hHeader);
         }
 
         /// <summary>
@@ -526,7 +509,7 @@ namespace LibLAS
         /// <param name="z">Z scale factor of the coordinate</param>
         public void SetScale(double x, double y, double z)
         {
-            LASError error = CAPI.LASHeader_SetScale(hHeader, x, y, z);
+            LASError error = NativeMethods.LASHeader_SetScale(hHeader, x, y, z);
             if ((Int32)error != 0)
             {
                 LASException e = new LASException("Exception in Set Header SetScale.");
@@ -540,7 +523,7 @@ namespace LibLAS
         /// <returns>X coordinate offset.</returns>
         public double GetOffsetX()
         {
-            return CAPI.LASHeader_GetOffsetX(hHeader);
+            return NativeMethods.LASHeader_GetOffsetX(hHeader);
         }
 
         /// <summary>
@@ -549,7 +532,7 @@ namespace LibLAS
         /// <returns>Y coordinate offset.</returns>
         public double GetOffsetY()
         {
-            return CAPI.LASHeader_GetOffsetY(hHeader);
+            return NativeMethods.LASHeader_GetOffsetY(hHeader);
         }
 
         /// <summary>
@@ -558,7 +541,7 @@ namespace LibLAS
         /// <returns>Z coordinate offset.</returns>
         public double GetOffsetZ()
         {
-            return CAPI.LASHeader_GetOffsetZ(hHeader);
+            return NativeMethods.LASHeader_GetOffsetZ(hHeader);
         }
 
         //Set values of X, Y and Z coordinates offset.
@@ -570,7 +553,7 @@ namespace LibLAS
         /// <param name="z">Z coordinate offset.</param>
         public void SetOffset(double x, double y, double z)
         {
-            LASError error = CAPI.LASHeader_SetOffset(hHeader, x, y, z);
+            LASError error = NativeMethods.LASHeader_SetOffset(hHeader, x, y, z);
             if ((Int32)error != 0)
             {
                 LASException e = new LASException("Exception in Set Header SetOffset.");
@@ -582,9 +565,9 @@ namespace LibLAS
         /// Get maximum value of extent of X coordinate.
         /// </summary>
         /// <returns>maximum value of extent of X coordinate.</returns>
-        public double MaxX()
+        public double GetMaxX()
         {
-            return CAPI.LASHeader_GetMaxX(hHeader);
+            return NativeMethods.LASHeader_GetMaxX(hHeader);
         }
 
         /// <summary>
@@ -593,7 +576,7 @@ namespace LibLAS
         /// <returns>maximum value of extent of Y coordinate.</returns>
         public double GetMaxY()
         {
-            return CAPI.LASHeader_GetMaxY(hHeader);
+            return NativeMethods.LASHeader_GetMaxY(hHeader);
         }
 
         /// <summary>
@@ -602,7 +585,7 @@ namespace LibLAS
         /// <returns>maximum value of extent of Z coordinate.</returns>
         public double GetMaxZ()
         {
-            return CAPI.LASHeader_GetMaxZ(hHeader);
+            return NativeMethods.LASHeader_GetMaxZ(hHeader);
         }
 
         /// <summary>
@@ -611,7 +594,7 @@ namespace LibLAS
         /// <returns>minimum value of extent of X coordinate.</returns>
         public double GetMinX()
         {
-            return CAPI.LASHeader_GetMinX(hHeader);
+            return NativeMethods.LASHeader_GetMinX(hHeader);
         }
 
         /// <summary>
@@ -620,7 +603,7 @@ namespace LibLAS
         /// <returns>minimum value of extent of Y coordinate.</returns>
         public double GetMinY()
         {
-            return CAPI.LASHeader_GetMinY(hHeader);
+            return NativeMethods.LASHeader_GetMinY(hHeader);
         }
 
         /// <summary>
@@ -629,7 +612,7 @@ namespace LibLAS
         /// <returns>minimum value of extent of Z coordinate.</returns>
         public double GetMinZ()
         {
-            return CAPI.LASHeader_GetMinZ(hHeader);
+            return NativeMethods.LASHeader_GetMinZ(hHeader);
         }
 
         /// <summary>
@@ -640,7 +623,7 @@ namespace LibLAS
         /// <param name="z">maximum value of extent of Z coordinate.</param>
         public void SetMax(double x, double y, double z)
         {
-            LASError error = CAPI.LASHeader_SetMax(hHeader, x, y, z);
+            LASError error = NativeMethods.LASHeader_SetMax(hHeader, x, y, z);
             if ((Int32)error != 0)
             {
                 LASException e = new LASException("Exception in Set Header SetMax.");
@@ -656,7 +639,7 @@ namespace LibLAS
         /// <param name="z">Set minimum value of extent of Z coordinate.</param>
         public void SetMin(double x, double y, double z)
         {
-            LASError error = CAPI.LASHeader_SetMin(hHeader, x, y, z);
+            LASError error = NativeMethods.LASHeader_SetMin(hHeader, x, y, z);
             if ((Int32)error != 0)
             {
                 LASException e = new LASException("Exception in Set Header SetMin.");
@@ -670,7 +653,7 @@ namespace LibLAS
         /// <param name="variableLengthRecord">variable Length record instance to add</param>
         public void AddVariableLengthRecord(LASVariableLengthRecord variableLengthRecord)
         {
-            LASError error = CAPI.LASHeader_AddVLR(hHeader, variableLengthRecord.GetPointer());
+            LASError error = NativeMethods.LASHeader_AddVLR(hHeader, variableLengthRecord.GetPointer());
             if ((Int32)error != 0)
             {
                 LASException e = new LASException("Exception in Header AddVariableLengthRecord.");
@@ -687,7 +670,7 @@ namespace LibLAS
         /// variable length records available on the header.</remarks>
         public LASVariableLengthRecord GetVariableLengthRecord(UInt32 i)
         {
-            LASVLRH vlrh = CAPI.LASHeader_GetVLR(hHeader, i);
+            LASVLRH vlrh = NativeMethods.LASHeader_GetVLR(hHeader, i);
             return new LASVariableLengthRecord(vlrh);
         }
 
@@ -697,7 +680,7 @@ namespace LibLAS
         /// <param name="index">the index starting from 0 of the variable length record to delete</param>
         public void DeleteVariableLengthRecord(UInt32 index)
         {
-            LASError error = CAPI.LASHeader_DeleteVLR(hHeader, index);
+            LASError error = NativeMethods.LASHeader_DeleteVLR(hHeader, index);
             if ((Int32)error != 0)
             {
                 LASException e = new LASException("Exception in Header DeleteVariableLengthRecord.");
@@ -713,13 +696,13 @@ namespace LibLAS
         {
             get
             {
-                LASGuidH guidh = CAPI.LASHeader_GetGUID(hHeader);
+                LASGuidH guidh = NativeMethods.LASHeader_GetGUID(hHeader);
                 return new LASGuid(guidh);
             }
             set
             {
 
-                LASError error = CAPI.LASHeader_SetGUID(hHeader, value.GetPointer());
+                LASError error = NativeMethods.LASHeader_SetGUID(hHeader, value.GetPointer());
                 if ((Int32)error != 0)
                 {
                     LASException e = new LASException("Exception in Set Header GUID.");
@@ -735,11 +718,11 @@ namespace LibLAS
         {
             get
             {
-                return CAPI.LASHeader_GetProj4(hHeader);
+                return NativeMethods.LASHeader_GetProj4(hHeader);
             }
             set
             {
-                LASError error = CAPI.LASHeader_SetProj4(hHeader, value);
+                LASError error = NativeMethods.LASHeader_SetProj4(hHeader, value);
                 if ((Int32)error != 0)
                 {
                     LASException e = new LASException("Exception in Set Header Proj4.");
diff --git a/csharp/dotnetLibLAS/LASPoint.cs b/csharp/dotnetLibLAS/LASPoint.cs
old mode 100755
new mode 100644
index ff5f485..3a55901
--- a/csharp/dotnetLibLAS/LASPoint.cs
+++ b/csharp/dotnetLibLAS/LASPoint.cs
@@ -95,12 +95,22 @@ namespace LibLAS
         private LASPointH hPoint;
 
         /// <summary>
+        /// A flag to denote whether or not the point owns itself and can Dispose
+        /// itself upon going out of scope. There are instances where LASReader 
+        /// may actually own the point as it is read from or written to files.
+        /// </summary>
+        private bool mustDestroy;
+
+        /// <summary>
         /// Create a new LASPoint from the LASPointH opaque structure
         /// </summary>
         /// <param name="hLASPoint">LASPointH opaque structure</param>
-        public LASPoint(LASPointH hLASPoint)
+        /// <param name="ownsCStructure">Indicates whether this instance is allowed 
+        /// to ownsCStructure the underlying C structure</param>
+        internal LASPoint(LASPointH hLASPoint, bool ownsCStructure)
         {
             hPoint = hLASPoint;
+            mustDestroy = ownsCStructure;
         }
 
         /// <summary>
@@ -108,7 +118,8 @@ namespace LibLAS
         /// </summary>
         public LASPoint()
         {
-            hPoint = CAPI.LASPoint_Create();
+            hPoint = NativeMethods.LASPoint_Create();
+            mustDestroy = true;
         }
 
         /// <summary>
@@ -134,7 +145,7 @@ namespace LibLAS
         /// <returns>true is is valid</returns>
         public bool IsValid()
         {
-            if (CAPI.LASPoint_IsValid(hPoint) == 1)
+            if (NativeMethods.LASPoint_IsValid(hPoint) == 1)
             {
                 return true;
             }
@@ -144,14 +155,30 @@ namespace LibLAS
             }
         }
 
+        protected virtual void Dispose(bool disposing)
+        {
+            // free native resources if there are any.
+            if (hPoint != IntPtr.Zero && mustDestroy)
+            {
+                NativeMethods.LASPoint_Destroy(hPoint);
+                hPoint = IntPtr.Zero;
+            }
+        }
+
         /// <summary>
-        /// The object user should call this method when they finished with the object. In .NET is magaged by the GC.
+        /// The object user should call this method when they finished with the object.
         /// </summary>
+        /// 
         public void Dispose()
         {
-            CAPI.LASPoint_Destroy(hPoint);
-            // Clean up unmanaged resources here.
-            // Dispose other contained disposable objects.
+            Dispose(true);
+            GC.SuppressFinalize(this);
+        }
+
+        ~LASPoint()
+        {
+            // Finalizer calls Dispose(false)
+            Dispose(false);
         }
 
         enum ClassificationType
@@ -193,8 +220,8 @@ namespace LibLAS
         /// <returns>a new LASPoint instance copied.</returns>
         public LASPoint Copy()
         {
-            LASPointH laspointhTemp = CAPI.LASPoint_Copy(hPoint);
-            return new LASPoint(laspointhTemp);
+            LASPointH laspointhTemp = NativeMethods.LASPoint_Copy(hPoint);
+            return new LASPoint(laspointhTemp, true);
         }
 
         /// <summary>
@@ -203,7 +230,7 @@ namespace LibLAS
         /// <returns></returns>
         public bool Validate()
         {
-            int error = CAPI.LASPoint_Validate(hPoint);
+            int error = NativeMethods.LASPoint_Validate(hPoint);
 
             if (error != 0)
             {
@@ -223,11 +250,11 @@ namespace LibLAS
         {
             get
             {
-                return CAPI.LASPoint_GetX(hPoint);
+                return NativeMethods.LASPoint_GetX(hPoint);
             }
             set
             {
-                LASError error = CAPI.LASPoint_SetX(hPoint, value);
+                LASError error = NativeMethods.LASPoint_SetX(hPoint, value);
                 if ((Int32)error != 0)
                 {
                     LASException e = new LASException("Exception in Set Point X.");
@@ -244,11 +271,11 @@ namespace LibLAS
         {
             get
             {
-                return CAPI.LASPoint_GetY(hPoint);
+                return NativeMethods.LASPoint_GetY(hPoint);
             }
             set
             {
-                LASError error = CAPI.LASPoint_SetY(hPoint, value);
+                LASError error = NativeMethods.LASPoint_SetY(hPoint, value);
                 if ((Int32)error != 0)
                 {
                     LASException e = new LASException("Exception in Set Point Y.");
@@ -266,11 +293,11 @@ namespace LibLAS
         {
             get
             {
-                return CAPI.LASPoint_GetZ(hPoint);
+                return NativeMethods.LASPoint_GetZ(hPoint);
             }
             set
             {
-                LASError error = CAPI.LASPoint_SetZ(hPoint, value);
+                LASError error = NativeMethods.LASPoint_SetZ(hPoint, value);
                 if ((Int32)error != 0)
                 {
                     LASException e = new LASException("Exception in Set Point Z.");
@@ -288,11 +315,11 @@ namespace LibLAS
         {
             get
             {
-                return CAPI.LASPoint_GetIntensity(hPoint);
+                return NativeMethods.LASPoint_GetIntensity(hPoint);
             }
             set
             {
-                LASError error = CAPI.LASPoint_SetIntensity(hPoint, value);
+                LASError error = NativeMethods.LASPoint_SetIntensity(hPoint, value);
                 if ((Int32)error != 0)
                 {
                     LASException e = new LASException("Exception in Set Point Intensity.");
@@ -309,11 +336,11 @@ namespace LibLAS
         {
             get
             {
-                return CAPI.LASPoint_GetScanFlags(hPoint);
+                return NativeMethods.LASPoint_GetScanFlags(hPoint);
             }
             set
             {
-                LASError error = CAPI.LASPoint_SetScanFlags(hPoint, value);
+                LASError error = NativeMethods.LASPoint_SetScanFlags(hPoint, value);
                 if ((Int32)error != 0)
                 {
                     LASException e = new LASException("Exception in Set Point ScanFlags.");
@@ -331,11 +358,11 @@ namespace LibLAS
         {
             get
             {
-                return CAPI.LASPoint_GetReturnNumber(hPoint);
+                return NativeMethods.LASPoint_GetReturnNumber(hPoint);
             }
             set
             {
-                LASError error = CAPI.LASPoint_SetReturnNumber(hPoint, value);
+                LASError error = NativeMethods.LASPoint_SetReturnNumber(hPoint, value);
                 if ((Int32)error != 0)
                 {
                     LASException e = new LASException("Exception in Set Point ReturnNumber.");
@@ -352,11 +379,11 @@ namespace LibLAS
         {
             get
             {
-                return CAPI.LASPoint_GetNumberOfReturns(hPoint);
+                return NativeMethods.LASPoint_GetNumberOfReturns(hPoint);
             }
             set
             {
-                LASError error = CAPI.LASPoint_SetNumberOfReturns(hPoint, value);
+                LASError error = NativeMethods.LASPoint_SetNumberOfReturns(hPoint, value);
                 if ((Int32)error != 0)
                 {
                     LASException e = new LASException("Exception in Set Point NumberOfReturns.");
@@ -373,11 +400,11 @@ namespace LibLAS
         {
             get
             {
-                return CAPI.LASPoint_GetScanDirection(hPoint);
+                return NativeMethods.LASPoint_GetScanDirection(hPoint);
             }
             set
             {
-                LASError error = CAPI.LASPoint_SetScanDirection(hPoint, value);
+                LASError error = NativeMethods.LASPoint_SetScanDirection(hPoint, value);
                 if ((Int32)error != 0)
                 {
                     LASException e = new LASException("Exception in Set Point ScanDirection.");
@@ -394,11 +421,11 @@ namespace LibLAS
         {
             get
             {
-                return CAPI.LASPoint_GetFlightLineEdge(hPoint);
+                return NativeMethods.LASPoint_GetFlightLineEdge(hPoint);
             }
             set
             {
-                LASError error = CAPI.LASPoint_SetFlightLineEdge(hPoint, value);
+                LASError error = NativeMethods.LASPoint_SetFlightLineEdge(hPoint, value);
                 if ((Int32)error != 0)
                 {
                     LASException e = new LASException("Exception in Set Point FlightLineEdge.");
@@ -414,11 +441,11 @@ namespace LibLAS
         {
             get
             {
-                return CAPI.LASPoint_GetClassification(hPoint);
+                return NativeMethods.LASPoint_GetClassification(hPoint);
             }
             set
             {
-                LASError error = CAPI.LASPoint_SetClassification(hPoint, value);
+                LASError error = NativeMethods.LASPoint_SetClassification(hPoint, value);
                 if ((Int32)error != 0)
                 {
                     LASException e = new LASException("Exception in Set Point Classification.");
@@ -434,12 +461,12 @@ namespace LibLAS
         {
             get
             {
-                return CAPI.LASPoint_GetScanAngleRank(hPoint);
+                return NativeMethods.LASPoint_GetScanAngleRank(hPoint);
             }
             set
             {
 
-                LASError error = CAPI.LASPoint_SetScanAngleRank(hPoint, value);
+                LASError error = NativeMethods.LASPoint_SetScanAngleRank(hPoint, value);
                 if ((Int32)error != 0)
                 {
                     LASException e = new LASException("Exception in Set Point ScanAngleRank.");
@@ -455,11 +482,11 @@ namespace LibLAS
         {
             get
             {
-                return CAPI.LASPoint_GetUserData(hPoint);
+                return NativeMethods.LASPoint_GetUserData(hPoint);
             }
             set
             {
-                LASError error = CAPI.LASPoint_SetUserData(hPoint, value);
+                LASError error = NativeMethods.LASPoint_SetUserData(hPoint, value);
                 if ((Int32)error != 0)
                 {
                     LASException e = new LASException("Exception in Set Point UserData.");
@@ -475,11 +502,11 @@ namespace LibLAS
         {
             get
             {
-                return CAPI.LASPoint_GetTime(hPoint);
+                return NativeMethods.LASPoint_GetTime(hPoint);
             }
             set
             {
-                LASError error = CAPI.LASPoint_SetTime(hPoint, value);
+                LASError error = NativeMethods.LASPoint_SetTime(hPoint, value);
                 if ((Int32)error != 0)
                 {
                     LASException e = new LASException("Exception in Set Point Time.");
diff --git a/csharp/dotnetLibLAS/LASReader.cs b/csharp/dotnetLibLAS/LASReader.cs
old mode 100755
new mode 100644
index 2ed095d..720adcb
--- a/csharp/dotnetLibLAS/LASReader.cs
+++ b/csharp/dotnetLibLAS/LASReader.cs
@@ -49,6 +49,7 @@ using LASPointH = System.IntPtr;
 using LASGuidH = System.IntPtr;
 using LASVLRH = System.IntPtr;
 using LASHeaderH = System.IntPtr;
+using System.IO;
 
 namespace LibLAS
 {
@@ -58,7 +59,8 @@ namespace LibLAS
     public class LASReader : IDisposable
     {
         private LASReaderH hReader;
-        private LASPoint laspoint;
+        private LASPointH hPoint;
+        private LASPoint point;
 
         /// <summary>
         /// Creates a LASReaderH object that can be used to read LASHeaderH and LASPointH objects with.
@@ -67,7 +69,16 @@ namespace LibLAS
         /// <param name="filename">filename to open for read</param>
         public LASReader(String filename)
         {
-            hReader = CAPI.LASReader_Create(filename);
+            // If file does not exist LASReader_Create(filename) throws a 
+            // "System.AccessViolationException: Attempted to read or write protected memory".
+            // This type of exception cannot be caught because it indicates a corrupted program state.
+            // So, check file existence up front.
+            if (!File.Exists(filename))
+            {
+                throw new FileNotFoundException("LASReader could not find the specified file", filename);
+            }
+
+            hReader = NativeMethods.LASReader_Create(filename);
         }
 
         /// <summary>
@@ -76,11 +87,12 @@ namespace LibLAS
         /// <returns>true if we have next point</returns>
         public bool GetNextPoint()
         {
-            IntPtr pointer = CAPI.LASReader_GetNextPoint(hReader);
+            IntPtr tmphPoint = NativeMethods.LASReader_GetNextPoint(hReader);
 
-            if (IntPtr.Zero != pointer)
+            if (IntPtr.Zero != tmphPoint)
             {
-                laspoint = new LASPoint(pointer);
+                hPoint = tmphPoint;
+                point = new LASPoint(hPoint, false);
                 return true;
             }
             else
@@ -95,7 +107,7 @@ namespace LibLAS
         /// <returns></returns>
         public string GetVersion()
         {
-            return CAPI.LAS_GetVersion();
+            return NativeMethods.LAS_GetVersion();
         }
        
         /// <summary>
@@ -104,7 +116,7 @@ namespace LibLAS
         /// <returns>current LASPoint object</returns>
         public LASPoint GetPoint()
         {
-            return laspoint;
+            return point;
         }
 
         /// <summary>
@@ -115,7 +127,13 @@ namespace LibLAS
         /// <returns>LASPoint object</returns>
         public LASPoint GetPointAt(UInt32 position)
         {
-            return new LASPoint(CAPI.LASReader_GetPointAt(hReader, position));
+            IntPtr tmphPoint = NativeMethods.LASReader_GetPointAt(hReader, position);
+            if (IntPtr.Zero != tmphPoint)
+            {
+                hPoint = tmphPoint;
+                return new LASPoint(hPoint, false);
+            }
+            return null;
         }
 
         /// <summary>
@@ -124,17 +142,48 @@ namespace LibLAS
         /// <returns>LASHeader representing the header for the file.</returns>
         public LASHeader GetHeader()
         {
-            return new LASHeader(CAPI.LASReader_GetHeader(hReader));
+            return new LASHeader(NativeMethods.LASReader_GetHeader(hReader));
+        }
+
+        protected virtual void Dispose(bool disposing)
+        {
+            if (disposing)
+            {
+                // free managed resources
+                if (point != null)
+                {
+                    point.Dispose();
+                    point = null;
+                }
+            }
+
+            // free native resources if there are any.
+            if (hReader != IntPtr.Zero)
+            {
+                NativeMethods.LASReader_Destroy(hReader);
+                hReader = IntPtr.Zero;
+            }
+            if(hPoint != IntPtr.Zero)
+            {
+                NativeMethods.LASPoint_Destroy(hPoint);
+                hPoint = IntPtr.Zero;
+            }
         }
 
         /// <summary>
-        /// The object user should call this method when they finished with the object. In .NET is magaged by the GC.
+        /// The object user should call this method when they finished with the object.
         /// </summary>
+        /// 
         public void Dispose()
         {
-            CAPI.LASReader_Destroy(hReader);
-            // Clean up unmanaged resources here.
-            // Dispose other contained disposable objects.
+            Dispose(true);
+            GC.SuppressFinalize(this);
+        }
+
+        ~LASReader()
+        {
+            // Finalizer calls Dispose(false)
+            Dispose(false);
         }
     }
 }
diff --git a/csharp/dotnetLibLAS/LASVariableLengthRecord.cs b/csharp/dotnetLibLAS/LASVariableLengthRecord.cs
old mode 100755
new mode 100644
index e77f13a..691370f
--- a/csharp/dotnetLibLAS/LASVariableLengthRecord.cs
+++ b/csharp/dotnetLibLAS/LASVariableLengthRecord.cs
@@ -59,14 +59,30 @@ namespace LibLAS
     {
         private LASVLRH hvlrh;
 
+        protected virtual void Dispose(bool disposing)
+        {
+            // free native resources if there are any.
+            if (hvlrh != IntPtr.Zero)
+            {
+                NativeMethods.LASVLR_Destroy(hvlrh);
+                hvlrh = IntPtr.Zero;
+            }
+        }
+
         /// <summary>
         /// The object user should call this method when they finished with the object.
         /// </summary>
+        /// 
         public void Dispose()
         {
-            CAPI.LASVLR_Destroy(hvlrh);
-            // Clean up unmanaged resources here.
-            // Dispose other contained disposable objects.
+            Dispose(true);
+            GC.SuppressFinalize(this);
+        }
+
+        ~LASVariableLengthRecord()
+        {
+            // Finalizer calls Dispose(false)
+            Dispose(false);
         }
 
         /// <summary>
@@ -74,7 +90,7 @@ namespace LibLAS
         /// </summary>
         public LASVariableLengthRecord()
         {
-            hvlrh = CAPI.LASVLR_Create();
+            hvlrh = NativeMethods.LASVLR_Create();
         }
 
         /// <summary>
@@ -88,7 +104,7 @@ namespace LibLAS
 
         //public override string ToString()
         //{
-        //    return CAPI.LASGuid_AsString(hguid);
+        //    return NativeMethods.LASGuid_AsString(hguid);
         //}
 
         /// <summary>
@@ -108,12 +124,12 @@ namespace LibLAS
         {
             get
             {
-                return CAPI.LASVLR_GetUserId(hvlrh);
+                return NativeMethods.LASVLR_GetUserId(hvlrh);
             }
 
             set
             {
-                LASError error = CAPI.LASVLR_SetUserId(hvlrh, value);
+                LASError error = NativeMethods.LASVLR_SetUserId(hvlrh, value);
                 if ((Int32)error != 0)
                 {
                     LASException e = new LASException("Exception in Set VLR UserId.");
@@ -130,12 +146,12 @@ namespace LibLAS
         {
             get
             {
-                return CAPI.LASVLR_GetDescription(hvlrh);
+                return NativeMethods.LASVLR_GetDescription(hvlrh);
             }
 
             set
             {
-                LASError error = CAPI.LASVLR_SetDescription(hvlrh, value);
+                LASError error = NativeMethods.LASVLR_SetDescription(hvlrh, value);
                 if ((Int32)error != 0)
                 {
                     LASException e = new LASException("Exception in Set VLR Description.");
@@ -151,12 +167,12 @@ namespace LibLAS
         {
             get
             {
-                return CAPI.LASVLR_GetRecordLength(hvlrh);
+                return NativeMethods.LASVLR_GetRecordLength(hvlrh);
             }
 
             set
             {
-                LASError error = CAPI.LASVLR_SetRecordLength(hvlrh, value);
+                LASError error = NativeMethods.LASVLR_SetRecordLength(hvlrh, value);
                 if ((Int32)error != 0)
                 {
                     LASException e = new LASException("Exception in Set VLR RecordLength.");
@@ -172,12 +188,12 @@ namespace LibLAS
         {
             get
             {
-                return CAPI.LASVLR_GetRecordId(hvlrh);
+                return NativeMethods.LASVLR_GetRecordId(hvlrh);
             }
 
             set
             {
-                LASError error = CAPI.LASVLR_SetRecordId(hvlrh, value);
+                LASError error = NativeMethods.LASVLR_SetRecordId(hvlrh, value);
                 if ((Int32)error != 0)
                 {
                     LASException e = new LASException("Exception in Set VLR RecordId.");
@@ -194,12 +210,12 @@ namespace LibLAS
         {
             get
             {
-                return CAPI.LASVLR_GetReserved(hvlrh);
+                return NativeMethods.LASVLR_GetReserved(hvlrh);
             }
 
             set
             {
-                LASError error = CAPI.LASVLR_SetReserved(hvlrh, value);
+                LASError error = NativeMethods.LASVLR_SetReserved(hvlrh, value);
                 if ((Int32)error != 0)
                 {
                     LASException e = new LASException("Exception in Set VLR Reserved.");
@@ -214,7 +230,7 @@ namespace LibLAS
         /// <param name="data">a empty array of bytes where place the array</param>
         public void GetData(out byte[] data)
         {
-            LASError error = CAPI.LASVLR_GetData(hvlrh, out data);
+            LASError error = NativeMethods.LASVLR_GetData(hvlrh, out data);
             if ((Int32)error != 0)
             {
                 LASException e = new LASException("Exception in VLR GetData.");
@@ -229,7 +245,7 @@ namespace LibLAS
         public void SetData(ref byte[] data)
         {
             UInt16 lenght = (UInt16)data.Length;
-            LASError error = CAPI.LASVLR_SetData(hvlrh, ref data, lenght);
+            LASError error = NativeMethods.LASVLR_SetData(hvlrh, ref data, lenght);
             if ((Int32)error != 0)
             {
                 LASException e = new LASException("Exception in VLR SetData.");
diff --git a/csharp/dotnetLibLAS/LASWriter.cs b/csharp/dotnetLibLAS/LASWriter.cs
old mode 100755
new mode 100644
index 16817d0..8fee178
--- a/csharp/dotnetLibLAS/LASWriter.cs
+++ b/csharp/dotnetLibLAS/LASWriter.cs
@@ -78,14 +78,30 @@ namespace LibLAS
     {
         private LASWriterH hwriter;
 
+        protected virtual void Dispose(bool disposing)
+        {
+            // free native resources if there are any.
+            if (hwriter != IntPtr.Zero)
+            {
+                NativeMethods.LASWriter_Destroy(hwriter);
+                hwriter = IntPtr.Zero;
+            }
+        }
+
         /// <summary>
         /// The object user should call this method when they finished with the object.
         /// </summary>
+        /// 
         public void Dispose()
         {
-            CAPI.LASWriter_Destroy(hwriter);
-            // Clean up unmanaged resources here.
-            // Dispose other contained disposable objects.
+            Dispose(true);
+            GC.SuppressFinalize(this);
+        }
+
+        ~LASWriter()
+        {
+            // Finalizer calls Dispose(false)
+            Dispose(false);
         }
 
         /// <summary>
@@ -96,7 +112,7 @@ namespace LibLAS
         /// <param name="mode">mode to use the file by LASReadWriteMode enumeration</param>
         public LASWriter(String filename, LASHeader hHeader, LASReadWriteMode mode)
         {
-            hwriter = CAPI.LASWriter_Create(filename, hHeader.GetPointer(), (int)mode);
+            hwriter = NativeMethods.LASWriter_Create(filename, hHeader.GetPointer(), (int)mode);
         }
 
         /// <summary>
@@ -105,7 +121,7 @@ namespace LibLAS
         /// <param name="point">LASPoint to write in the file</param>
         public void WritePoint(LASPoint point)
         {
-            LASError error = CAPI.LASWriter_WritePoint(hwriter, point.GetPointer());
+            LASError error = NativeMethods.LASWriter_WritePoint(hwriter, point.GetPointer());
 
             if ((Int32)error != 0)
             {
diff --git a/csharp/dotnetLibLAS/LibLASCAPI.cs b/csharp/dotnetLibLAS/NativeMethods.cs
old mode 100755
new mode 100644
similarity index 97%
rename from csharp/dotnetLibLAS/LibLASCAPI.cs
rename to csharp/dotnetLibLAS/NativeMethods.cs
index ddf7ef8..1e29276
--- a/csharp/dotnetLibLAS/LibLASCAPI.cs
+++ b/csharp/dotnetLibLAS/NativeMethods.cs
@@ -1,1033 +1,1035 @@
-/******************************************************************************
- * $Id$
- *
- * Project:  libLAS - http://liblas.org - A BSD library for LAS format data.
- * Purpose:  
- * Author:   Martin Vales, martin_gnu at mundo-r.com
- *
- ******************************************************************************
- * Copyright (c) 2008, Martin Vales
- *
- * All rights reserved.
- * 
- * Redistribution and use in source and binary forms, with or without 
- * modification, are permitted provided that the following 
- * conditions are met:
- * 
- *     * Redistributions of source code must retain the above copyright 
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above copyright 
- *       notice, this list of conditions and the following disclaimer in 
- *       the documentation and/or other materials provided 
- *       with the distribution.
- *     * Neither the name of the Martin Isenburg or Iowa Department 
- *       of Natural Resources nor the names of its contributors may be 
- *       used to endorse or promote products derived from this software 
- *       without specific prior written permission.
- * 
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
- * OF SUCH DAMAGE.
- ****************************************************************************/
-
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Runtime.InteropServices;
-using LASError = System.Int32;
-using LASWriterH = System.IntPtr;
-using LASReaderH = System.IntPtr;
-using LASPointH = System.IntPtr;
-using LASGuidH = System.IntPtr;
-using LASVLRH = System.IntPtr;
-using LASHeaderH = System.IntPtr;
-
-namespace LibLAS
-{
-    internal class CAPI
-    {
-        /** Returns the version string for this library.
-         * @return the version string for this library.
-         * 
-         * Name liblas1.dll is considered as unified across all builders on Windows platform.
-         * When building libLAS on Windows using NMAKE and makefile.vc, C API DLL is
-         * called liblas1.dll. The same name is used by Visual Studio solution liblas.sln.
-         */
-        public const string DLL_LAS_VERSION = "liblas1.dll";
-
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern String LAS_GetVersion();
-
-        /****************************************************************************/
-        /* Error handling                                                           */
-        /****************************************************************************/
-
-        /** Resets the error stack for the libLAS C API.  
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern void LASError_Reset();
-
-        /** Pops the top error off of the error stack for the libLAS C API.
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern void LASError_Pop();
-
-        /** Returns the error number of the last error on the error stack.
-        *  @return the error number of the last error on the error stack.
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern LASError LASError_GetLastErrorNum();
-
-        /** Returns the name of the method the last error message happened in.
-        *  @return the name of the method the last error message happened in.
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern String LASError_GetLastErrorMsg();
-
-        /** Returns the name of the method the last error message happened in.
-        *  @return the name of the method the last error message happened in.
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern String LASError_GetLastErrorMethod();
-
-        /** Returns the number of error messages on the error stack.
-        *  @return the number of error messages on the error stack.
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern int LASError_GetErrorCount();
-
-        /** Prints the last error message in the error stack to stderr.  If 
-        *  there is no error on the error stack, only the message is printed.
-        *  The function does not alter the error stack in any way.
-        *  @param message Message to include in the stderr output
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern void LASError_Print(String message);
-
-        /****************************************************************************/
-        /* Reader operations                                                        */
-        /****************************************************************************/
-
-        /** Creates a LASReaderH object that can be used to read LASHeaderH and 
-        *  LASPointH objects with.  The LASReaderH must not be created with a 
-        *  filename that is opened for read or write by any other API functions.
-        *  @return opaque pointer to a LASReaderH instance.
-        *  @param filename Filename to open for read 
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern LASReaderH LASReader_Create(String filename);
-
-        /** Reads the next available point on the LASReaderH instance.  If no point 
-        *  is available to read, NULL is returned.  If an error happens during 
-        *  the reading of the next available point, an error will be added to the 
-        *  error stack and can be returned with the LASError_GetLastError* methods.
-        *  @param hReader the opaque handle to the LASReaderH 
-        *  @return an opaque handle to a LASPointH object, or NULL if no point is 
-        *  available to read or an error occured.  Use the 
-        *  LASError_GetLastError* methods to confirm the existence of an error 
-        *  if NULL is returned.
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern LASPointH LASReader_GetNextPoint(LASReaderH hReader);
-
-        /** Reads a LASPointH from the given position in the LAS file represented 
-        *  by the LASReaderH instance.  If no point is available at that location, 
-        *  NULL is returned.  If an error happens during the reading of the point, 
-        *  an error will be added to the error stack and can be returned with the 
-        *  LASError_GetLastError* methods.
-        *  @param hReader the opaque handle to the LASReaderH
-        *  @param position the integer position of the point in the file to read.
-        *  @return an opaque handle to a LASPointH object, or NULL if no point is 
-        *  available at the given location or an error occured.  Use the 
-        *  LASError_GetLastError* methods to confirm the existence of an error 
-        *  if NULL is returned.
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern LASPointH LASReader_GetPointAt(LASReaderH hReader, UInt32 position);
-
-        /** Closes the file for reading operations represented by the LASReaderH instance.
-        *  @param hReader the opqaue handle to the LASReaderH
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern void LASReader_Destroy(LASReaderH hReader);
-
-        /** Returns a LASHeaderH representing the header for the file
-        *  @param hReader the LASReaderH instance
-        *  @return a LASHeaderH representing the header for the file.  NULL is returned 
-        *  in the event of an error.  Use the LASError_GetLastError* methods to check
-        *  in the event of a NULL return.
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern LASHeaderH LASReader_GetHeader(LASReaderH hReader);
-
-        /****************************************************************************/
-        /* Point operations                                                         */
-        /****************************************************************************/
-
-
-        /** Returns the X value for the point.  This value is not scaled or offset
-        *  by any header values and stands on its own.  If you need points to have 
-        *  a scale and/or offset applied, this must be done in conjunction with the 
-        *  header values after the value is read.
-        *  @param hPoint the opaque pointer to the LASPointH instance  
-        *  @return the X value for the LASPointH
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern double LASPoint_GetX(LASPointH hPoint);
-
-        /** Sets the X value for the point.  This value must be scaled or offset 
-        *  by any header values before being set.
-        *  @param hPoint the opaque pointer to the LASPointH instance
-        *  @param value the double value to set for the X value of the point
-        *  @return an error number if an error occured during the setting of the point.
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern LASError LASPoint_SetX(LASPointH hPoint, double value);
-
-        /** Returns the Y value for the point.  This value is not scaled or offset
-        *  by any header values and stands on its own.  If you need points to have 
-        *  a scale and/or offset applied, this must be done in conjunction with the 
-        *  header values after the value is read.
-        *  @param hPoint the opaque pointer to the LASPointH instance  
-        *  @return the Y value for the LASPointH
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern double LASPoint_GetY(LASPointH hPoint);
-
-        /** Sets the Y value for the point.  This value must be scaled or offset 
-        *  by any header values before being set.
-        *  @param hPoint the opaque pointer to the LASPointH instance
-        *  @param value the double value to set for the Y value of the point
-        *  @return an error number if an error occured during the setting of the point.
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern LASError LASPoint_SetY(LASPointH hPoint, double value);
-
-        /** Returns the Z value for the point.  This value is not scaled or offset
-        *  by any header values and stands on its own.  If you need points to have 
-        *  a scale and/or offset applied, this must be done in conjunction with the 
-        *  header values after the value is read.
-        *  @param hPoint the opaque pointer to the LASPointH instance  
-        *  @return the Z value for the LASPointH
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern double LASPoint_GetZ(LASPointH hPoint);
-
-        /** Sets the Z value for the point.  This value must be scaled or offset 
-        *  by any header values before being set.
-        *  @param hPoint the opaque pointer to the LASPointH instance
-        *  @param value the double value to set for the Z value of the point
-        *  @return an error number if an error occured during the setting of the point.
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern LASError LASPoint_SetZ(LASPointH hPoint, double value);
-
-        /** Returns the intensity value for the point.  This value is the pulse return 
-        *  magnitude, it is optional, and it is LiDAR system specific.
-        *  @return the intensity value for the point.
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern UInt16 LASPoint_GetIntensity(LASPointH hPoint);
-
-        /** Sets the intensity value for the point.
-        *  @param hPoint the opaque pointer to the LASPointH instance
-        *  @param value the value to set the intensity to
-        *  @return an error number if an error occured.
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern LASError LASPoint_SetIntensity(LASPointH hPoint, UInt16 value);
-
-        /** Returns the return number for the point.  The return number is "the pulse
-        *  return number for a given output pulse."  The first return number starts with
-        *  the value 1.
-        *  @param hPoint LASPointH instance
-        *  @return a return number, valid from 1-6, for the point.  Use the LASError 
-        *  methods to determine if an error occurred during this operation if 0 
-        *  is returned.
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern UInt16 LASPoint_GetReturnNumber(LASPointH hPoint);
-
-        /** Sets the return number for the point.  Valid values are from 1-6.
-        *  @param hPoint LASPointH instance
-        *  @param value the value to set for the return number
-        *  @return LASError value determine success or failure.
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern LASError LASPoint_SetReturnNumber(LASPointH hPoint, UInt16 value);
-
-        /** Returns the total number of returns for a given pulse.
-        *  @param hPoint LASPointH instance
-        *  @return total number of returns for this pulse.
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern UInt16 LASPoint_GetNumberOfReturns(LASPointH hPoint);
-
-        /** Sets the number of returns for the point.  Valid values are from 1-5.
-        *  @param hPoint LASPointH instance
-        *  @param value the value to set for the number of returns
-        *  @return LASError value determine success or failure.
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern LASError LASPoint_SetNumberOfReturns(LASPointH hPoint, UInt16 value);
-
-        /** Returns the scan direction for a given pulse.
-        *  @param hPoint LASPointH instance
-        *  @return the scan direction for a given pulse.
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern UInt16 LASPoint_GetScanDirection(LASPointH hPoint);
-
-        /** Sets the scan direction for a given pulse.  Valid values are 0 or 1, with 
-        *  1 being a positive scan direction and 0 being a negative scan direction.
-        *  @param hPoint LASPointH instance
-        *  @param value the value to set for scan direction
-        *  @return LASError value determine success or failure.
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern LASError LASPoint_SetScanDirection(LASPointH hPoint, UInt16 value);
-
-        /** Returns whether or not a given pulse is an edge point
-        *  @param hPoint LASPointH instance
-        *  @return whether or not a given pulse is an edge point.
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern UInt16 LASPoint_GetFlightLineEdge(LASPointH hPoint);
-
-        /** Sets the edge marker for a given pulse.  Valid values are 0 or 1, with 
-        *  1 being an edge point and 0 being interior.
-        *  @param hPoint LASPointH instance
-        *  @param value the value to set for flightline edge
-        *  @return LASError value determine success or failure.
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern LASError LASPoint_SetFlightLineEdge(LASPointH hPoint, UInt16 value);
-
-        /** Returns all of the scan flags for the point -- Return number, number of 
-        *  returns, flightline edge, scan direction, and scan angle rank.
-        *  @param hPoint LASPointH instance
-        *  @return all of the scan flags for the point
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern byte LASPoint_GetScanFlags(LASPointH hPoint);
-
-        /** Sets all of the scan flags for the point.  No validation is done. 
-        *  @param hPoint LASPointH instance
-        *  @param value the value to set for the flags
-        *  @return LASError value determine success or failure.
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern LASError LASPoint_SetScanFlags(LASPointH hPoint, byte value);
-
-        /** Returns the classification for the point
-        *  @param hPoint LASPointH instance
-        *  @return the classification for the point
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern byte LASPoint_GetClassification(LASPointH hPoint);
-
-        /** Sets the classification for the point.  No validation is done. 
-        *  @param hPoint LASPointH instance
-        *  @param value the value to set for the classification
-        *  @return LASError value determine success or failure.
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern LASError LASPoint_SetClassification(LASPointH hPoint, byte value);
-
-        /** Returns the time for the point
-        *  @param hPoint LASPointH instance
-        *  @return the time for the point
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern double LASPoint_GetTime(LASPointH hPoint);
-
-        /** Sets the time for the point.  No validation is done. 
-        *  @param hPoint LASPointH instance
-        *  @param value the value to set for the time
-        *  @return LASError value determine success or failure.
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern LASError LASPoint_SetTime(LASPointH hPoint, double value);
-
-        /** Returns the scan angle for the point
-        *  @param hPoint LASPointH instance
-        *  @return the scan angle for the point
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern SByte LASPoint_GetScanAngleRank(LASPointH hPoint);
-
-        /** Sets the scan angle for the point.  No validation is done. 
-        *  @param hPoint LASPointH instance
-        *  @param value the value to set for the scan angle
-        *  @return LASError value determine success or failure.
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern LASError LASPoint_SetScanAngleRank(LASPointH hPoint, SByte value);
-
-        /** Returns the arbitrary user data for the point
-        *  @param hPoint LASPointH instance
-        *  @return the arbitrary user data for the point
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern byte LASPoint_GetUserData(LASPointH hPoint);
-
-        /** Sets the arbitrary user data for the point.  No validation is done. 
-        *  @param hPoint LASPointH instance
-        *  @param value the value to set for the arbitrary user data
-        *  @return LASError value determine success or failure.
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern LASError LASPoint_SetUserData(LASPointH hPoint, byte value);
-
-        /** Returns a bitfield representing the validity of various members
-        *  enum DataMemberFlag
-        {
-        eReturnNumber = 1,
-        eNumberOfReturns = 2,
-        eScanDirection = 4,
-        eFlightLineEdge = 8,
-        eClassification = 16,
-        eScanAngleRank = 32,
-        eTime = 64
-        };
-        *  @param hPoint LASPointH instance
-        *  @return bitfield representing the validity of various members.
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern int LASPoint_Validate(LASPointH hPoint);
-
-        /** Returns a boolean whether or not the point is valid
-        *  @param hPoint LASPointH instance
-        *  @return a boolean (1 or 0) whether or not the point is valid.
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern int LASPoint_IsValid(LASPointH hPoint);
-
-        /** Creates a new empty LASPointH instance 
-        *  @return LASPointH instance.  If the value is NULL use the 
-        *  LASError_GetLastError* methods to determine the problem
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern LASPointH LASPoint_Create();
-
-        /** Creates a copy of a LASPointH instance
-        *  @param hPoint the LASPointH instance to copy 
-        *  @return new LASPointH instance.  If the value is NULL use the 
-        *  LASError_GetLastError* methods to determine the problem
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern LASPointH LASPoint_Copy(LASPointH hPoint);
-
-        /** Destroys/deletes a LASPointH instance
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern void LASPoint_Destroy(LASPointH hPoint);
-
-        /****************************************************************************/
-        /* Header operations                                                        */
-        /****************************************************************************/
-
-        /** Copies a LASHeaderH instance
-        *  @param hHeader the LASHeaderH to copy
-        *  @return a LASHeaderH instance or NULL on error
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern LASHeaderH LASHeader_Copy(LASHeaderH hHeader);
-
-        /** Creates an empty LASHeaderH with default values
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern LASHeaderH LASHeader_Create();
-
-        /** Destroys/deletes a LASHeader instance
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern void LASHeader_Destroy(LASHeaderH hHeader);
-
-        /** Returns the file signature the the file.  This should always be 'LASF'
-        *  @param hHeader LASHeaderH instance
-        *  @return the file signature the the file.  This should always be 'LASF'
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern String LASHeader_GetFileSignature(LASHeaderH hHeader);
-
-        /** Returns the file source id for the file.  It is a number from 1-65535
-        *  @param hHeader LASHeaderH instance
-        *  @return the file source id for the file.
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern UInt16 LASHeader_GetFileSourceId(LASHeaderH hHeader);
-
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern LASError LASHeader_SetFileSourceId(LASHeaderH hHeader, UInt16 value);
-
-        /** Returns the project id for the header as a GUID string
-        *  @return the project id for the header as a GUID string
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern String LASHeader_GetProjectId(LASHeaderH hHeader);
-
-        /** Sets the project id/GUID for the header
-        *  @param hHeader LASHeaderH instance
-        *  @param hId LASGuidH instance to set the GUID for the header to
-        *  @return LASError enum
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern LASError LASHeader_SetGUID(LASHeaderH hHeader, LASGuidH hId);
-
-        /** Returns the major version number for the header.  This value is expected 
-        *  to always be 1.
-        *  @param hHeader LASHeaderH instance
-        *  @return major version number for the header.
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern byte LASHeader_GetVersionMajor(LASHeaderH hHeader);
-
-        /** Sets the major version number for the header.  All values other than 1 
-        *  are invalid.
-        *  @param hHeader LASHeaderH instance
-        *  @param value integer value to set the major version to (only the value 1 is valid)
-        *  @return LASError enum
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern LASError LASHeader_SetVersionMajor(LASHeaderH hHeader, byte value);
-
-        /** Returns the min version number for the header.  This value is expected 
-        *  to be 1 or 0 representing LAS 1.1 or LAS 1.0
-        *  @param hHeader LASHeaderH instance
-        *  @return minor version number for the header.
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern byte LASHeader_GetVersionMinor(LASHeaderH hHeader);
-
-        /** Sets the minor version number for the header.  All values other than 1 or 0 
-        *  are invalid.
-        *  @param hHeader LASHeaderH instance
-        *  @param value integer value to set the minor version to (only the values 1 or 0 are valid)
-        *  @return LASError enum
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern LASError LASHeader_SetVersionMinor(LASHeaderH hHeader, byte value);
-
-        /** Returns the System ID for the header.  The caller assumes ownership of the returned string
-        *  @return the system id for the header as a character array
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern String LASHeader_GetSystemId(LASHeaderH hHeader);
-
-        /** Sets the System ID for the header.  By default, this value is "libLAS" if it 
-        *  is not explicitly set.  See the LAS specification for details on what this
-        *  value should logically be set to.
-        *  @param hHeader LASHeaderH instance
-        *  @param value the value to set as the System ID for the header
-        *  @return LASError enum
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern LASError LASHeader_SetSystemId(LASHeaderH hHeader, String value);
-
-        /** Returns the Software ID for the header.  The caller assumes ownership of the returned string
-        *  @return the software id for the header as a character array
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern String LASHeader_GetSoftwareId(LASHeaderH hHeader);
-
-        /** Sets the Software ID for the header.  By default, this value is "libLAS 1.0" if it 
-        *  is not explicitly set.  See the LAS specification for details on what this
-        *  value should logically be set to.
-        *  @param hHeader LASHeaderH instance
-        *  @param value the value to set as the Software ID for the header
-        *  @return LASError enum
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern LASError LASHeader_SetSoftwareId(LASHeaderH hHeader, String value);
-
-        /** Returns the reserved value for the header.  This should aways be 0.
-        *  @return the reserved value for the header.
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern Int16 LASHeader_GetReserved(LASHeaderH hHeader);
-
-        /** Returns the file creation day of the year.  The values start from 1, being January 1st, 
-        *  and end at 365 or 366 being December 31st, depending on leap year.
-        *  @return the day of the year as an integer starting from 1 for the file creation.
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern UInt16 LASHeader_GetCreationDOY(LASHeaderH hHeader);
-
-        /** Sets the file creation day of the year.  The values start from 1, being January 1st.  No
-        *  date validation is done
-        *  @param hHeader LASHeaderH instance
-        *  @param value the value to set as the creation day
-        *  @return LASError enum
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern LASError LASHeader_SetCreationDOY(LASHeaderH hHeader, UInt16 value);
-
-        /** Returns the file creation year.  This is a four digit number representing the 
-        *  year for the file, ie 2003, 2008, etc.
-        *  @return the creation year for the file or 0 if none is set
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern UInt16 LASHeader_GetCreationYear(LASHeaderH hHeader);
-
-        /** Sets the file creation year.  This should be a four digit number representing
-        *  the year for the file, ie 2003, 2008, etc.  No validation on the value is done
-        *  @param hHeader LASHeaderH instance
-        *  @param value the value to set for the creation year
-        *  @return LASError enum
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern LASError LASHeader_SetCreationYear(LASHeaderH hHeader, UInt16 value);
-
-        /** Returns the size of the header for the file in bytes.
-        *  @return the size of the header for the file in bytes.
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern UInt16 LASHeader_GetHeaderSize(LASHeaderH hHeader);
-
-        /** Returns the byte offset to the start of actual point data for the file
-        *  @param hHeader LASHeaderH instance
-        *  @return the type offset to the start of actual point data for the file
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern UInt32 LASHeader_GetDataOffset(LASHeaderH hHeader);
-
-        /** Returns the number of variable length records in the header
-        *  @param hHeader LASHeaderH instance
-        *  @return the number of variable length records in the header
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern UInt32 LASHeader_GetRecordsCount(LASHeaderH hHeader);
-
-        /** Returns the record length for the points based on their data format id in bytes
-        *  @param hHeader LASHeaderH instance
-        *  @return the record length for the points based on their data format id in bytes
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern UInt16 LASHeader_GetDataRecordLength(LASHeaderH hHeader);
-
-        /** Returns the data format id.  If this value is 1, the point data have time values
-        *  associated with them.  If it is 0, the point data do not have time values.  
-        *  @param hHeader LASHeaderH instance
-        *  @return the data format id for the file.
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern byte LASHeader_GetDataFormatId(LASHeaderH hHeader);
-
-        /** Sets the data format id for the file.  The value should be 1 or 0, with 1 being
-        *  points that contain time values and 0 being points that do not.
-        *  @param hHeader LASHeaderH instance
-        *  @param value the value for the data format id, 1 or 0 are valid values.
-        *  @return LASError enum
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern LASError LASHeader_SetDataFormatId(LASHeaderH hHeader, byte value);
-
-        /** Returns the number of point records in the file.  This value may not reflect the actual 
-        *  number of point records in the file.
-        *  @param hHeader LASHeaderH instance
-        *  @return the number of point records in the file
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern UInt32 LASHeader_GetPointRecordsCount(LASHeaderH hHeader);
-
-        /** Sets the number of point records for the file.
-        *  @param hHeader LASHeaderH instance
-        *  @param value the long integer to set for the number of point records in the file
-        *  @return LASError enum
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern LASError LASHeader_SetPointRecordsCount(LASHeaderH hHeader, UInt32 value);
-
-        /** Returns the number of point records by return.
-        *  @param hHeader LASHeaderH instance
-        *  @param index the return number to fetch the count for
-        *  @return the number of point records for a given return
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern UInt32 LASHeader_GetPointRecordsByReturnCount(LASHeaderH hHeader, int index);
-
-        /** Sets the number of point records for a given return
-        *  @param hHeader LASHeaderH instance
-        *  @param index the return number to set the count for
-        *  @param value the number of point records for the return 
-        *  @return LASError enum
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern LASError LASHeader_SetPointRecordsByReturnCount(LASHeaderH hHeader, int index, UInt32 value);
-
-        /** Return the X scale factor
-        *  @param hHeader LASHeaderH instance
-        *  @return the X scale factor
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern double LASHeader_GetScaleX(LASHeaderH hHeader);
-
-        /** Return the Y scale factor
-        *  @param hHeader LASHeaderH instance
-        *  @return the Y scale factor
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern double LASHeader_GetScaleY(LASHeaderH hHeader);
-
-        /** Return the Z scale factor
-        *  @param hHeader LASHeaderH instance
-        *  @return the Z scale factor
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern double LASHeader_GetScaleZ(LASHeaderH hHeader);
-
-        /** Sets the scale factors
-        *  @param hHeader LASHeaderH instance
-        *  @param x the x scale factor
-        *  @param y the y scale factor
-        *  @param z the z scale factor
-        *  @return LASError enum
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern LASError LASHeader_SetScale(LASHeaderH hHeader, double x, double y, double z);
-
-        /** Return the X offset
-        *  @param hHeader LASHeaderH instance
-        *  @return the X offset
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern double LASHeader_GetOffsetX(LASHeaderH hHeader);
-
-        /** Return the Y offset
-        *  @param hHeader LASHeaderH instance
-        *  @return the Y offset
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern double LASHeader_GetOffsetY(LASHeaderH hHeader);
-
-        /** Return the Z offset
-        *  @param hHeader LASHeaderH instance
-        *  @return the Z offset
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern double LASHeader_GetOffsetZ(LASHeaderH hHeader);
-
-        /** Sets the offset values
-        *  @param hHeader LASHeaderH instance
-        *  @param x the x offset
-        *  @param y the y offset
-        *  @param z the z offset
-        *  @return LASError enum
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern LASError LASHeader_SetOffset(LASHeaderH hHeader, double x, double y, double z);
-
-        /** Return the minimum x value
-        *  @param hHeader LASHeaderH instance
-        *  @return the minimum x value
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern double LASHeader_GetMinX(LASHeaderH hHeader);
-
-        /** Return the minimum y value
-        *  @param hHeader LASHeaderH instance
-        *  @return the minimum y value
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern double LASHeader_GetMinY(LASHeaderH hHeader);
-
-        /** Return the minimum z value
-        *  @param hHeader LASHeaderH instance
-        *  @return the minimum z value
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern double LASHeader_GetMinZ(LASHeaderH hHeader);
-
-        /** Sets the minimum values
-        *  @param hHeader LASHeaderH instance
-        *  @param x the x minimum
-        *  @param y the y minimum
-        *  @param z the z minimum
-        *  @return LASError enum
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern LASError LASHeader_SetMin(LASHeaderH hHeader, double x, double y, double z);
-
-        /** Return the maximum x value
-        *  @param hHeader LASHeaderH instance
-        *  @return the maximum x value
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern double LASHeader_GetMaxX(LASHeaderH hHeader);
-
-        /** Return the maximum y value
-        *  @param hHeader LASHeaderH instance
-        *  @return the maximum y value
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern double LASHeader_GetMaxY(LASHeaderH hHeader);
-
-        /** Return the maximum z value
-        *  @param hHeader LASHeaderH instance
-        *  @return the maximum z value
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern double LASHeader_GetMaxZ(LASHeaderH hHeader);
-
-        /** Sets the maximum values
-        *  @param hHeader LASHeaderH instance
-        *  @param x the x maximum
-        *  @param y the y maximum
-        *  @param z the z maximum
-        *  @return LASError enum
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern LASError LASHeader_SetMax(LASHeaderH hHeader, double x, double y, double z);
-
-        /** Returns the proj.4 string describing the spatial reference of the 
-        *  header if it is available
-        *  @param hHeader LASHeaderH instance
-        *  @return the proj.4 string or NULL if none is available.  The caller
-        *  owns the string.
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern String LASHeader_GetProj4(LASHeaderH hHeader);
-
-        /** Sets the proj4 stirng describing the spatial reference of the header.
-        *  @param hHeader LASHeaderH instance
-        *  @param value the proj4 string to set for the header
-        *  @return LASError enum
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern LASError LASHeader_SetProj4(LASHeaderH hHeader, String value);
-
-        /** Returns the VLR record for the given index.  Use LASHeader_GetRecordsCount to 
-        *  determine the number of VLR records available on the header.
-        *  @param hHeader the LASHeaderH instance
-        *  @param i the index starting from 0 of the VLR to fetch
-        *  @return LASVLRH instance that models the Variable Length Record
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern LASVLRH LASHeader_GetVLR(LASHeaderH hHeader, UInt32 i);
-
-        /** Deletes a VLR record from the header for the given index.
-        *  @param hHeader the LASHeaderH instance
-        *  @param index the index starting from 0 of the VLR to delete
-        *  @return LASErrorEnum
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern LASError LASHeader_DeleteVLR(LASHeaderH hHeader, UInt32 index);
-
-        /** Adds a VLR record to the header. 
-        *  @param hHeader the LASHeaderH instance
-        *  @param hVLR the VLR to add to the header
-        *  @return LASErrorEnum
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern LASError LASHeader_AddVLR(LASHeaderH hHeader, LASVLRH hVLR);
-
-        /****************************************************************************/
-        /* Writer Operations                                                        */
-        /****************************************************************************/
-
-        /** Creates a new LASWriterH for write operations on LAS files.  The file may 
-        *  be opened in either LAS_MODE_APPEND or LAS_MODE_WRITE, but the file cannot 
-        *  be open by another other operations (another LASReaderH or LASWriterH).  
-        *  @param filename The filename to open to write
-        *  @param hHeader an opaque pointer to a LASHeaderH that will be written to 
-        *  the file as part of the opening for write operation.
-        *  @param mode a mode value to denote whether to open for write or append 
-        *  operations.  Valid values are LAS_MODE_APPEND and LAS_MODE_WRITE.
-        */
-
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern LASWriterH LASWriter_Create(String filename, LASHeaderH hHeader, int mode);
-
-        /** Writes a point to the file.  The location of where the point is writen is 
-        *  determined by the mode the file is opened in, and what the last operation was.  
-        *  For example, if the file was opened for append, the next point would be written 
-        *  at the end of the file.  Likewise, if the file is opened in write mode, even 
-        *  if the file already existed, the next WritePoint operation will happen at the 
-        *  end of the header and all of the existing points in the file will be overwritten.
-        *  @param hWriter opaque pointer to the LASWriterH instance
-        *  @param hPoint the opaque LASPointH pointer to write
-        *  @return LE_None if no error occurred during the write operation.
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern LASError LASWriter_WritePoint(LASWriterH hWriter, LASPointH hPoint);
-
-        /** Overwrites the header for the file represented by the LASWriterH.  It does 
-        *  not matter if the file is opened for append or for write.
-        *  @param hWriter opaque pointer to the LASWriterH instance
-        *  @param hHeader LASHeaderH instance to write into the file
-        *  @return LE_None if no error occurred during the operation.
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern LASError LASWriter_WriteHeader(LASWriterH hWriter, LASHeaderH hHeader);
-
-        /** Destroys the LASWriterH instance, effectively closing the file and performing 
-        *  housekeeping operations.
-        *  @param hWriter LASWriterH instance to close
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern void LASWriter_Destroy(LASWriterH hWriter);
-
-        /****************************************************************************/
-        /* GUID Operations                                                          */
-        /****************************************************************************/
-
-        /** Returns the GUID value for the header as an opaque LASGuidH pointer.
-        *  @param hHeader the opaque pointer to the LASHeaderH
-        *  @return the GUID value for the header as an opaque LASGuidH pointer.
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern LASGuidH LASHeader_GetGUID(LASHeaderH hHeader);
-
-        /** Returns a new random GUID.
-        *  @return a new random GUID
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern LASGuidH LASGuid_Create();
-
-        /** Creates a new GUID opaque pointer using the given string.  
-        *  @param string A GUID string in the form "00000000-0000-0000-0000-000000000000"
-        *  An example GUID might be something like '8388F1B8-AA1B-4108-BCA3-6BC68E7B062E'
-        *  @return the GUID value as an opaque LASGuidH pointer.
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern LASGuidH LASGuid_CreateFromString(String string_);
-
-        /** Destroys a GUID opaque pointer and removes it from the heap
-        *  @param hId the GUID value to destroy as an opaque LASGuidH pointer.
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern void LASGuid_Destroy(LASGuidH hId);
-
-        /** Determines if two GUIDs are equal.
-        *  @param hId1 the first GUID
-        *  @param hId2 the second GUID
-        *  @return 0 if false, 1 if true.  Use the LASError_GetLastError* methods to 
-        *  determine if an error occured during the operation of this function.
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern int LASGuid_Equals(LASGuidH hId1, LASGuidH hId2);
-
-        /** Returns a string representation of the GUID opqaue pointer.  The caller 
-        *  owns the string.
-        *  @param hId the LASGuidH pointer
-        *  @return a string representation of the GUID opaque pointer.
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern String LASGuid_AsString(LASGuidH hId);
-
-        /****************************************************************************/
-        /* VLR Operations                                                           */
-        /****************************************************************************/
-
-        /** Creates a new VLR record
-        *  @return a new VLR record
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern LASVLRH LASVLR_Create();
-
-        /** Destroys a VLR record and removes it from the heap
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern void LASVLR_Destroy(LASVLRH hVLR);
-
-        /** Returns the User Id for the VLR 
-        *  @param hVLR the LASVLRH instance
-        *  @return the User Id for the VLR
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern String LASVLR_GetUserId(LASVLRH hVLR);
-
-        /** Sets the User Id for the VLR
-        *  @param hVLR the LASVLRH instance
-        *  @param value the value to set for the User Id.  It will be clipped to fit 
-        *  within 16 characters
-        *  @return LASErrorEnum
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern LASError LASVLR_SetUserId(LASVLRH hVLR, String value);
-
-        /** Gets the description for the VLR
-        *  @param hVLR the LASVLRH instance
-        *  @return the description for the VLR
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern String LASVLR_GetDescription(LASVLRH hVLR);
-
-        /** Sets the description for the VLR
-        *  @param hVLR the LASVLRH instance
-        *  @param value the value to set for the description.  It will be clipped to fit 
-        *  within 32 characters
-        *  @return LASErrorEnum
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern LASError LASVLR_SetDescription(LASVLRH hVLR, String value);
-
-        /** Returns the record length of the data stored in the VLR
-        *  @param hVLR the LASVLRH instance
-        *  @return the record length of the data stored in the VLR
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern UInt16 LASVLR_GetRecordLength(LASVLRH hVLR);
-
-        /** Sets the record length of the data stored in the VLR
-        *  @param hVLR the LASVLRH instance
-        *  @param value the length to set for the VLR data length
-        *  @return LASErrorEnum
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern LASError LASVLR_SetRecordLength(LASVLRH hVLR, UInt16 value);
-
-        /** Gets the record id for the VLR
-        *  @param hVLR the LASVLRH instance
-        *  @return the record id for the VLR
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern UInt16 LASVLR_GetRecordId(LASVLRH hVLR);
-
-        /** Sets the record id for the VLR
-        *  @param hVLR the LASVLRH instance
-        *  @param value the record id to set
-        *  @return LASErrorEnum
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern LASError LASVLR_SetRecordId(LASVLRH hVLR, UInt16 value);
-
-        /** Gets the reserved value of the VLR.  This should be 0 and should aways be 0.
-        *  @param hVLR the LASVLRH instance
-        *  @return the reserved value of the VLR.
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern UInt16 LASVLR_GetReserved(LASVLRH hVLR);
-
-        /** Sets the reserved value of the VLR.  This should be 0 and you should not 
-        *  have to ever monkey with this value according to the spec.
-        *  @param hVLR the LASVLRH instance
-        *  @param value the value to set for the reserved value
-        *  @return LASErrorEnum
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern LASError LASVLR_SetReserved(LASVLRH hVLR, UInt16 value);
-
-        /** Gets the data stream for the VLR as an array of bytes
-        *  @param hVLR the LASVLRH instance
-        *  @param data a pointer to where place the array
-        *  @param length a pointer to where to place the length of the array
-        *  @return LASErrorEnum
-        */
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern LASError LASVLR_GetData(LASVLRH hVLR, out byte[] data);//, ref int length);
-
-        [DllImport(DLL_LAS_VERSION)]
-        public static extern LASError LASVLR_SetData(LASVLRH hVLR, ref byte[] data, int length);
-    }
-}
+/******************************************************************************
+ * $Id$
+ *
+ * Project:  libLAS - http://liblas.org - A BSD library for LAS format data.
+ * Purpose:  
+ * Author:   Martin Vales, martin_gnu at mundo-r.com
+ *
+ ******************************************************************************
+ * Copyright (c) 2008, Martin Vales
+ *
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without 
+ * modification, are permitted provided that the following 
+ * conditions are met:
+ * 
+ *     * Redistributions of source code must retain the above copyright 
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright 
+ *       notice, this list of conditions and the following disclaimer in 
+ *       the documentation and/or other materials provided 
+ *       with the distribution.
+ *     * Neither the name of the Martin Isenburg or Iowa Department 
+ *       of Natural Resources nor the names of its contributors may be 
+ *       used to endorse or promote products derived from this software 
+ *       without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
+ * OF SUCH DAMAGE.
+ ****************************************************************************/
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Runtime.InteropServices;
+using LASError = System.Int32;
+using LASWriterH = System.IntPtr;
+using LASReaderH = System.IntPtr;
+using LASPointH = System.IntPtr;
+using LASGuidH = System.IntPtr;
+using LASVLRH = System.IntPtr;
+using LASHeaderH = System.IntPtr;
+
+namespace LibLAS
+{
+    internal class NativeMethods
+    {
+        /** Returns the version string for this library.
+         * @return the version string for this library.
+         * 
+         * Name liblas1.dll is considered as unified across all builders on Windows platform.
+         * When building libLAS on Windows using NMAKE and makefile.vc, C API DLL is
+         * called liblas1.dll. The same name is used by Visual Studio solution liblas.sln.
+         */
+        public const string DLL_LAS_VERSION = "liblas_c.dll";
+        public const CharSet CHARSET = CharSet.Ansi;
+        public const bool BESTFITMAPPING = false;
+
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern String LAS_GetVersion();
+
+        /****************************************************************************/
+        /* Error handling                                                           */
+        /****************************************************************************/
+
+        /** Resets the error stack for the libLAS C API.  
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern void LASError_Reset();
+
+        /** Pops the top error off of the error stack for the libLAS C API.
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern void LASError_Pop();
+
+        /** Returns the error number of the last error on the error stack.
+        *  @return the error number of the last error on the error stack.
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern LASError LASError_GetLastErrorNum();
+
+        /** Returns the name of the method the last error message happened in.
+        *  @return the name of the method the last error message happened in.
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern String LASError_GetLastErrorMsg();
+
+        /** Returns the name of the method the last error message happened in.
+        *  @return the name of the method the last error message happened in.
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern String LASError_GetLastErrorMethod();
+
+        /** Returns the number of error messages on the error stack.
+        *  @return the number of error messages on the error stack.
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern int LASError_GetErrorCount();
+
+        /** Prints the last error message in the error stack to stderr.  If 
+        *  there is no error on the error stack, only the message is printed.
+        *  The function does not alter the error stack in any way.
+        *  @param message Message to include in the stderr output
+        */
+        [DllImport(DLL_LAS_VERSION, CharSet = CHARSET, BestFitMapping = BESTFITMAPPING)]
+        public static extern void LASError_Print(String message);
+
+        /****************************************************************************/
+        /* Reader operations                                                        */
+        /****************************************************************************/
+
+        /** Creates a LASReaderH object that can be used to read LASHeaderH and 
+        *  LASPointH objects with.  The LASReaderH must not be created with a 
+        *  filename that is opened for read or write by any other API functions.
+        *  @return opaque pointer to a LASReaderH instance.
+        *  @param filename Filename to open for read 
+        */
+        [DllImport(DLL_LAS_VERSION, CharSet = CHARSET, BestFitMapping = BESTFITMAPPING)]
+        public static extern LASReaderH LASReader_Create(String filename);
+
+        /** Reads the next available point on the LASReaderH instance.  If no point 
+        *  is available to read, NULL is returned.  If an error happens during 
+        *  the reading of the next available point, an error will be added to the 
+        *  error stack and can be returned with the LASError_GetLastError* methods.
+        *  @param hReader the opaque handle to the LASReaderH 
+        *  @return an opaque handle to a LASPointH object, or NULL if no point is 
+        *  available to read or an error occured.  Use the 
+        *  LASError_GetLastError* methods to confirm the existence of an error 
+        *  if NULL is returned.
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern LASPointH LASReader_GetNextPoint(LASReaderH hReader);
+
+        /** Reads a LASPointH from the given position in the LAS file represented 
+        *  by the LASReaderH instance.  If no point is available at that location, 
+        *  NULL is returned.  If an error happens during the reading of the point, 
+        *  an error will be added to the error stack and can be returned with the 
+        *  LASError_GetLastError* methods.
+        *  @param hReader the opaque handle to the LASReaderH
+        *  @param position the integer position of the point in the file to read.
+        *  @return an opaque handle to a LASPointH object, or NULL if no point is 
+        *  available at the given location or an error occured.  Use the 
+        *  LASError_GetLastError* methods to confirm the existence of an error 
+        *  if NULL is returned.
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern LASPointH LASReader_GetPointAt(LASReaderH hReader, UInt32 position);
+
+        /** Closes the file for reading operations represented by the LASReaderH instance.
+        *  @param hReader the opqaue handle to the LASReaderH
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern void LASReader_Destroy(LASReaderH hReader);
+
+        /** Returns a LASHeaderH representing the header for the file
+        *  @param hReader the LASReaderH instance
+        *  @return a LASHeaderH representing the header for the file.  NULL is returned 
+        *  in the event of an error.  Use the LASError_GetLastError* methods to check
+        *  in the event of a NULL return.
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern LASHeaderH LASReader_GetHeader(LASReaderH hReader);
+
+        /****************************************************************************/
+        /* Point operations                                                         */
+        /****************************************************************************/
+
+
+        /** Returns the X value for the point.  This value is not scaled or offset
+        *  by any header values and stands on its own.  If you need points to have 
+        *  a scale and/or offset applied, this must be done in conjunction with the 
+        *  header values after the value is read.
+        *  @param hPoint the opaque pointer to the LASPointH instance  
+        *  @return the X value for the LASPointH
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern double LASPoint_GetX(LASPointH hPoint);
+
+        /** Sets the X value for the point.  This value must be scaled or offset 
+        *  by any header values before being set.
+        *  @param hPoint the opaque pointer to the LASPointH instance
+        *  @param value the double value to set for the X value of the point
+        *  @return an error number if an error occured during the setting of the point.
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern LASError LASPoint_SetX(LASPointH hPoint, double value);
+
+        /** Returns the Y value for the point.  This value is not scaled or offset
+        *  by any header values and stands on its own.  If you need points to have 
+        *  a scale and/or offset applied, this must be done in conjunction with the 
+        *  header values after the value is read.
+        *  @param hPoint the opaque pointer to the LASPointH instance  
+        *  @return the Y value for the LASPointH
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern double LASPoint_GetY(LASPointH hPoint);
+
+        /** Sets the Y value for the point.  This value must be scaled or offset 
+        *  by any header values before being set.
+        *  @param hPoint the opaque pointer to the LASPointH instance
+        *  @param value the double value to set for the Y value of the point
+        *  @return an error number if an error occured during the setting of the point.
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern LASError LASPoint_SetY(LASPointH hPoint, double value);
+
+        /** Returns the Z value for the point.  This value is not scaled or offset
+        *  by any header values and stands on its own.  If you need points to have 
+        *  a scale and/or offset applied, this must be done in conjunction with the 
+        *  header values after the value is read.
+        *  @param hPoint the opaque pointer to the LASPointH instance  
+        *  @return the Z value for the LASPointH
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern double LASPoint_GetZ(LASPointH hPoint);
+
+        /** Sets the Z value for the point.  This value must be scaled or offset 
+        *  by any header values before being set.
+        *  @param hPoint the opaque pointer to the LASPointH instance
+        *  @param value the double value to set for the Z value of the point
+        *  @return an error number if an error occured during the setting of the point.
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern LASError LASPoint_SetZ(LASPointH hPoint, double value);
+
+        /** Returns the intensity value for the point.  This value is the pulse return 
+        *  magnitude, it is optional, and it is LiDAR system specific.
+        *  @return the intensity value for the point.
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern UInt16 LASPoint_GetIntensity(LASPointH hPoint);
+
+        /** Sets the intensity value for the point.
+        *  @param hPoint the opaque pointer to the LASPointH instance
+        *  @param value the value to set the intensity to
+        *  @return an error number if an error occured.
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern LASError LASPoint_SetIntensity(LASPointH hPoint, UInt16 value);
+
+        /** Returns the return number for the point.  The return number is "the pulse
+        *  return number for a given output pulse."  The first return number starts with
+        *  the value 1.
+        *  @param hPoint LASPointH instance
+        *  @return a return number, valid from 1-6, for the point.  Use the LASError 
+        *  methods to determine if an error occurred during this operation if 0 
+        *  is returned.
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern UInt16 LASPoint_GetReturnNumber(LASPointH hPoint);
+
+        /** Sets the return number for the point.  Valid values are from 1-6.
+        *  @param hPoint LASPointH instance
+        *  @param value the value to set for the return number
+        *  @return LASError value determine success or failure.
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern LASError LASPoint_SetReturnNumber(LASPointH hPoint, UInt16 value);
+
+        /** Returns the total number of returns for a given pulse.
+        *  @param hPoint LASPointH instance
+        *  @return total number of returns for this pulse.
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern UInt16 LASPoint_GetNumberOfReturns(LASPointH hPoint);
+
+        /** Sets the number of returns for the point.  Valid values are from 1-5.
+        *  @param hPoint LASPointH instance
+        *  @param value the value to set for the number of returns
+        *  @return LASError value determine success or failure.
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern LASError LASPoint_SetNumberOfReturns(LASPointH hPoint, UInt16 value);
+
+        /** Returns the scan direction for a given pulse.
+        *  @param hPoint LASPointH instance
+        *  @return the scan direction for a given pulse.
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern UInt16 LASPoint_GetScanDirection(LASPointH hPoint);
+
+        /** Sets the scan direction for a given pulse.  Valid values are 0 or 1, with 
+        *  1 being a positive scan direction and 0 being a negative scan direction.
+        *  @param hPoint LASPointH instance
+        *  @param value the value to set for scan direction
+        *  @return LASError value determine success or failure.
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern LASError LASPoint_SetScanDirection(LASPointH hPoint, UInt16 value);
+
+        /** Returns whether or not a given pulse is an edge point
+        *  @param hPoint LASPointH instance
+        *  @return whether or not a given pulse is an edge point.
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern UInt16 LASPoint_GetFlightLineEdge(LASPointH hPoint);
+
+        /** Sets the edge marker for a given pulse.  Valid values are 0 or 1, with 
+        *  1 being an edge point and 0 being interior.
+        *  @param hPoint LASPointH instance
+        *  @param value the value to set for flightline edge
+        *  @return LASError value determine success or failure.
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern LASError LASPoint_SetFlightLineEdge(LASPointH hPoint, UInt16 value);
+
+        /** Returns all of the scan flags for the point -- Return number, number of 
+        *  returns, flightline edge, scan direction, and scan angle rank.
+        *  @param hPoint LASPointH instance
+        *  @return all of the scan flags for the point
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern byte LASPoint_GetScanFlags(LASPointH hPoint);
+
+        /** Sets all of the scan flags for the point.  No validation is done. 
+        *  @param hPoint LASPointH instance
+        *  @param value the value to set for the flags
+        *  @return LASError value determine success or failure.
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern LASError LASPoint_SetScanFlags(LASPointH hPoint, byte value);
+
+        /** Returns the classification for the point
+        *  @param hPoint LASPointH instance
+        *  @return the classification for the point
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern byte LASPoint_GetClassification(LASPointH hPoint);
+
+        /** Sets the classification for the point.  No validation is done. 
+        *  @param hPoint LASPointH instance
+        *  @param value the value to set for the classification
+        *  @return LASError value determine success or failure.
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern LASError LASPoint_SetClassification(LASPointH hPoint, byte value);
+
+        /** Returns the time for the point
+        *  @param hPoint LASPointH instance
+        *  @return the time for the point
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern double LASPoint_GetTime(LASPointH hPoint);
+
+        /** Sets the time for the point.  No validation is done. 
+        *  @param hPoint LASPointH instance
+        *  @param value the value to set for the time
+        *  @return LASError value determine success or failure.
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern LASError LASPoint_SetTime(LASPointH hPoint, double value);
+
+        /** Returns the scan angle for the point
+        *  @param hPoint LASPointH instance
+        *  @return the scan angle for the point
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern SByte LASPoint_GetScanAngleRank(LASPointH hPoint);
+
+        /** Sets the scan angle for the point.  No validation is done. 
+        *  @param hPoint LASPointH instance
+        *  @param value the value to set for the scan angle
+        *  @return LASError value determine success or failure.
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern LASError LASPoint_SetScanAngleRank(LASPointH hPoint, SByte value);
+
+        /** Returns the arbitrary user data for the point
+        *  @param hPoint LASPointH instance
+        *  @return the arbitrary user data for the point
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern byte LASPoint_GetUserData(LASPointH hPoint);
+
+        /** Sets the arbitrary user data for the point.  No validation is done. 
+        *  @param hPoint LASPointH instance
+        *  @param value the value to set for the arbitrary user data
+        *  @return LASError value determine success or failure.
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern LASError LASPoint_SetUserData(LASPointH hPoint, byte value);
+
+        /** Returns a bitfield representing the validity of various members
+        *  enum DataMemberFlag
+        {
+        eReturnNumber = 1,
+        eNumberOfReturns = 2,
+        eScanDirection = 4,
+        eFlightLineEdge = 8,
+        eClassification = 16,
+        eScanAngleRank = 32,
+        eTime = 64
+        };
+        *  @param hPoint LASPointH instance
+        *  @return bitfield representing the validity of various members.
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern int LASPoint_Validate(LASPointH hPoint);
+
+        /** Returns a boolean whether or not the point is valid
+        *  @param hPoint LASPointH instance
+        *  @return a boolean (1 or 0) whether or not the point is valid.
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern int LASPoint_IsValid(LASPointH hPoint);
+
+        /** Creates a new empty LASPointH instance 
+        *  @return LASPointH instance.  If the value is NULL use the 
+        *  LASError_GetLastError* methods to determine the problem
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern LASPointH LASPoint_Create();
+
+        /** Creates a copy of a LASPointH instance
+        *  @param hPoint the LASPointH instance to copy 
+        *  @return new LASPointH instance.  If the value is NULL use the 
+        *  LASError_GetLastError* methods to determine the problem
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern LASPointH LASPoint_Copy(LASPointH hPoint);
+
+        /** Destroys/deletes a LASPointH instance
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern void LASPoint_Destroy(LASPointH hPoint);
+
+        /****************************************************************************/
+        /* Header operations                                                        */
+        /****************************************************************************/
+
+        /** Copies a LASHeaderH instance
+        *  @param hHeader the LASHeaderH to copy
+        *  @return a LASHeaderH instance or NULL on error
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern LASHeaderH LASHeader_Copy(LASHeaderH hHeader);
+
+        /** Creates an empty LASHeaderH with default values
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern LASHeaderH LASHeader_Create();
+
+        /** Destroys/deletes a LASHeader instance
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern void LASHeader_Destroy(LASHeaderH hHeader);
+
+        /** Returns the file signature the the file.  This should always be 'LASF'
+        *  @param hHeader LASHeaderH instance
+        *  @return the file signature the the file.  This should always be 'LASF'
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern String LASHeader_GetFileSignature(LASHeaderH hHeader);
+
+        /** Returns the file source id for the file.  It is a number from 1-65535
+        *  @param hHeader LASHeaderH instance
+        *  @return the file source id for the file.
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern UInt16 LASHeader_GetFileSourceId(LASHeaderH hHeader);
+
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern LASError LASHeader_SetFileSourceId(LASHeaderH hHeader, UInt16 value);
+
+        /** Returns the project id for the header as a GUID string
+        *  @return the project id for the header as a GUID string
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern String LASHeader_GetProjectId(LASHeaderH hHeader);
+
+        /** Sets the project id/GUID for the header
+        *  @param hHeader LASHeaderH instance
+        *  @param hId LASGuidH instance to set the GUID for the header to
+        *  @return LASError enum
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern LASError LASHeader_SetGUID(LASHeaderH hHeader, LASGuidH hId);
+
+        /** Returns the major version number for the header.  This value is expected 
+        *  to always be 1.
+        *  @param hHeader LASHeaderH instance
+        *  @return major version number for the header.
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern byte LASHeader_GetVersionMajor(LASHeaderH hHeader);
+
+        /** Sets the major version number for the header.  All values other than 1 
+        *  are invalid.
+        *  @param hHeader LASHeaderH instance
+        *  @param value integer value to set the major version to (only the value 1 is valid)
+        *  @return LASError enum
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern LASError LASHeader_SetVersionMajor(LASHeaderH hHeader, byte value);
+
+        /** Returns the min version number for the header.  This value is expected 
+        *  to be 1 or 0 representing LAS 1.1 or LAS 1.0
+        *  @param hHeader LASHeaderH instance
+        *  @return minor version number for the header.
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern byte LASHeader_GetVersionMinor(LASHeaderH hHeader);
+
+        /** Sets the minor version number for the header.  All values other than 1 or 0 
+        *  are invalid.
+        *  @param hHeader LASHeaderH instance
+        *  @param value integer value to set the minor version to (only the values 1 or 0 are valid)
+        *  @return LASError enum
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern LASError LASHeader_SetVersionMinor(LASHeaderH hHeader, byte value);
+
+        /** Returns the System ID for the header.  The caller assumes ownership of the returned string
+        *  @return the system id for the header as a character array
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern String LASHeader_GetSystemId(LASHeaderH hHeader);
+
+        /** Sets the System ID for the header.  By default, this value is "libLAS" if it 
+        *  is not explicitly set.  See the LAS specification for details on what this
+        *  value should logically be set to.
+        *  @param hHeader LASHeaderH instance
+        *  @param value the value to set as the System ID for the header
+        *  @return LASError enum
+        */
+        [DllImport(DLL_LAS_VERSION, CharSet = CHARSET, BestFitMapping = BESTFITMAPPING)]
+        public static extern LASError LASHeader_SetSystemId(LASHeaderH hHeader, String value);
+
+        /** Returns the Software ID for the header.  The caller assumes ownership of the returned string
+        *  @return the software id for the header as a character array
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern String LASHeader_GetSoftwareId(LASHeaderH hHeader);
+
+        /** Sets the Software ID for the header.  By default, this value is "libLAS 1.0" if it 
+        *  is not explicitly set.  See the LAS specification for details on what this
+        *  value should logically be set to.
+        *  @param hHeader LASHeaderH instance
+        *  @param value the value to set as the Software ID for the header
+        *  @return LASError enum
+        */
+        [DllImport(DLL_LAS_VERSION, CharSet = CHARSET, BestFitMapping = BESTFITMAPPING)]
+        public static extern LASError LASHeader_SetSoftwareId(LASHeaderH hHeader, String value);
+
+        /** Returns the reserved value for the header.  This should aways be 0.
+        *  @return the reserved value for the header.
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern Int16 LASHeader_GetReserved(LASHeaderH hHeader);
+
+        /** Returns the file creation day of the year.  The values start from 1, being January 1st, 
+        *  and end at 365 or 366 being December 31st, depending on leap year.
+        *  @return the day of the year as an integer starting from 1 for the file creation.
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern UInt16 LASHeader_GetCreationDOY(LASHeaderH hHeader);
+
+        /** Sets the file creation day of the year.  The values start from 1, being January 1st.  No
+        *  date validation is done
+        *  @param hHeader LASHeaderH instance
+        *  @param value the value to set as the creation day
+        *  @return LASError enum
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern LASError LASHeader_SetCreationDOY(LASHeaderH hHeader, UInt16 value);
+
+        /** Returns the file creation year.  This is a four digit number representing the 
+        *  year for the file, ie 2003, 2008, etc.
+        *  @return the creation year for the file or 0 if none is set
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern UInt16 LASHeader_GetCreationYear(LASHeaderH hHeader);
+
+        /** Sets the file creation year.  This should be a four digit number representing
+        *  the year for the file, ie 2003, 2008, etc.  No validation on the value is done
+        *  @param hHeader LASHeaderH instance
+        *  @param value the value to set for the creation year
+        *  @return LASError enum
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern LASError LASHeader_SetCreationYear(LASHeaderH hHeader, UInt16 value);
+
+        /** Returns the size of the header for the file in bytes.
+        *  @return the size of the header for the file in bytes.
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern UInt16 LASHeader_GetHeaderSize(LASHeaderH hHeader);
+
+        /** Returns the byte offset to the start of actual point data for the file
+        *  @param hHeader LASHeaderH instance
+        *  @return the type offset to the start of actual point data for the file
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern UInt32 LASHeader_GetDataOffset(LASHeaderH hHeader);
+
+        /** Returns the number of variable length records in the header
+        *  @param hHeader LASHeaderH instance
+        *  @return the number of variable length records in the header
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern UInt32 LASHeader_GetRecordsCount(LASHeaderH hHeader);
+
+        /** Returns the record length for the points based on their data format id in bytes
+        *  @param hHeader LASHeaderH instance
+        *  @return the record length for the points based on their data format id in bytes
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern UInt16 LASHeader_GetDataRecordLength(LASHeaderH hHeader);
+
+        /** Returns the data format id.  If this value is 1, the point data have time values
+        *  associated with them.  If it is 0, the point data do not have time values.  
+        *  @param hHeader LASHeaderH instance
+        *  @return the data format id for the file.
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern byte LASHeader_GetDataFormatId(LASHeaderH hHeader);
+
+        /** Sets the data format id for the file.  The value should be 1 or 0, with 1 being
+        *  points that contain time values and 0 being points that do not.
+        *  @param hHeader LASHeaderH instance
+        *  @param value the value for the data format id, 1 or 0 are valid values.
+        *  @return LASError enum
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern LASError LASHeader_SetDataFormatId(LASHeaderH hHeader, byte value);
+
+        /** Returns the number of point records in the file.  This value may not reflect the actual 
+        *  number of point records in the file.
+        *  @param hHeader LASHeaderH instance
+        *  @return the number of point records in the file
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern UInt32 LASHeader_GetPointRecordsCount(LASHeaderH hHeader);
+
+        /** Sets the number of point records for the file.
+        *  @param hHeader LASHeaderH instance
+        *  @param value the long integer to set for the number of point records in the file
+        *  @return LASError enum
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern LASError LASHeader_SetPointRecordsCount(LASHeaderH hHeader, UInt32 value);
+
+        /** Returns the number of point records by return.
+        *  @param hHeader LASHeaderH instance
+        *  @param index the return number to fetch the count for
+        *  @return the number of point records for a given return
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern UInt32 LASHeader_GetPointRecordsByReturnCount(LASHeaderH hHeader, int index);
+
+        /** Sets the number of point records for a given return
+        *  @param hHeader LASHeaderH instance
+        *  @param index the return number to set the count for
+        *  @param value the number of point records for the return 
+        *  @return LASError enum
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern LASError LASHeader_SetPointRecordsByReturnCount(LASHeaderH hHeader, int index, UInt32 value);
+
+        /** Return the X scale factor
+        *  @param hHeader LASHeaderH instance
+        *  @return the X scale factor
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern double LASHeader_GetScaleX(LASHeaderH hHeader);
+
+        /** Return the Y scale factor
+        *  @param hHeader LASHeaderH instance
+        *  @return the Y scale factor
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern double LASHeader_GetScaleY(LASHeaderH hHeader);
+
+        /** Return the Z scale factor
+        *  @param hHeader LASHeaderH instance
+        *  @return the Z scale factor
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern double LASHeader_GetScaleZ(LASHeaderH hHeader);
+
+        /** Sets the scale factors
+        *  @param hHeader LASHeaderH instance
+        *  @param x the x scale factor
+        *  @param y the y scale factor
+        *  @param z the z scale factor
+        *  @return LASError enum
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern LASError LASHeader_SetScale(LASHeaderH hHeader, double x, double y, double z);
+
+        /** Return the X offset
+        *  @param hHeader LASHeaderH instance
+        *  @return the X offset
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern double LASHeader_GetOffsetX(LASHeaderH hHeader);
+
+        /** Return the Y offset
+        *  @param hHeader LASHeaderH instance
+        *  @return the Y offset
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern double LASHeader_GetOffsetY(LASHeaderH hHeader);
+
+        /** Return the Z offset
+        *  @param hHeader LASHeaderH instance
+        *  @return the Z offset
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern double LASHeader_GetOffsetZ(LASHeaderH hHeader);
+
+        /** Sets the offset values
+        *  @param hHeader LASHeaderH instance
+        *  @param x the x offset
+        *  @param y the y offset
+        *  @param z the z offset
+        *  @return LASError enum
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern LASError LASHeader_SetOffset(LASHeaderH hHeader, double x, double y, double z);
+
+        /** Return the minimum x value
+        *  @param hHeader LASHeaderH instance
+        *  @return the minimum x value
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern double LASHeader_GetMinX(LASHeaderH hHeader);
+
+        /** Return the minimum y value
+        *  @param hHeader LASHeaderH instance
+        *  @return the minimum y value
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern double LASHeader_GetMinY(LASHeaderH hHeader);
+
+        /** Return the minimum z value
+        *  @param hHeader LASHeaderH instance
+        *  @return the minimum z value
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern double LASHeader_GetMinZ(LASHeaderH hHeader);
+
+        /** Sets the minimum values
+        *  @param hHeader LASHeaderH instance
+        *  @param x the x minimum
+        *  @param y the y minimum
+        *  @param z the z minimum
+        *  @return LASError enum
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern LASError LASHeader_SetMin(LASHeaderH hHeader, double x, double y, double z);
+
+        /** Return the maximum x value
+        *  @param hHeader LASHeaderH instance
+        *  @return the maximum x value
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern double LASHeader_GetMaxX(LASHeaderH hHeader);
+
+        /** Return the maximum y value
+        *  @param hHeader LASHeaderH instance
+        *  @return the maximum y value
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern double LASHeader_GetMaxY(LASHeaderH hHeader);
+
+        /** Return the maximum z value
+        *  @param hHeader LASHeaderH instance
+        *  @return the maximum z value
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern double LASHeader_GetMaxZ(LASHeaderH hHeader);
+
+        /** Sets the maximum values
+        *  @param hHeader LASHeaderH instance
+        *  @param x the x maximum
+        *  @param y the y maximum
+        *  @param z the z maximum
+        *  @return LASError enum
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern LASError LASHeader_SetMax(LASHeaderH hHeader, double x, double y, double z);
+
+        /** Returns the proj.4 string describing the spatial reference of the 
+        *  header if it is available
+        *  @param hHeader LASHeaderH instance
+        *  @return the proj.4 string or NULL if none is available.  The caller
+        *  owns the string.
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern String LASHeader_GetProj4(LASHeaderH hHeader);
+
+        /** Sets the proj4 stirng describing the spatial reference of the header.
+        *  @param hHeader LASHeaderH instance
+        *  @param value the proj4 string to set for the header
+        *  @return LASError enum
+        */
+        [DllImport(DLL_LAS_VERSION, CharSet = CHARSET, BestFitMapping = BESTFITMAPPING)]
+        public static extern LASError LASHeader_SetProj4(LASHeaderH hHeader, String value);
+
+        /** Returns the VLR record for the given index.  Use LASHeader_GetRecordsCount to 
+        *  determine the number of VLR records available on the header.
+        *  @param hHeader the LASHeaderH instance
+        *  @param i the index starting from 0 of the VLR to fetch
+        *  @return LASVLRH instance that models the Variable Length Record
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern LASVLRH LASHeader_GetVLR(LASHeaderH hHeader, UInt32 i);
+
+        /** Deletes a VLR record from the header for the given index.
+        *  @param hHeader the LASHeaderH instance
+        *  @param index the index starting from 0 of the VLR to delete
+        *  @return LASErrorEnum
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern LASError LASHeader_DeleteVLR(LASHeaderH hHeader, UInt32 index);
+
+        /** Adds a VLR record to the header. 
+        *  @param hHeader the LASHeaderH instance
+        *  @param hVLR the VLR to add to the header
+        *  @return LASErrorEnum
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern LASError LASHeader_AddVLR(LASHeaderH hHeader, LASVLRH hVLR);
+
+        /****************************************************************************/
+        /* Writer Operations                                                        */
+        /****************************************************************************/
+
+        /** Creates a new LASWriterH for write operations on LAS files.  The file may 
+        *  be opened in either LAS_MODE_APPEND or LAS_MODE_WRITE, but the file cannot 
+        *  be open by another other operations (another LASReaderH or LASWriterH).  
+        *  @param filename The filename to open to write
+        *  @param hHeader an opaque pointer to a LASHeaderH that will be written to 
+        *  the file as part of the opening for write operation.
+        *  @param mode a mode value to denote whether to open for write or append 
+        *  operations.  Valid values are LAS_MODE_APPEND and LAS_MODE_WRITE.
+        */
+
+        [DllImport(DLL_LAS_VERSION, CharSet = CHARSET, BestFitMapping = BESTFITMAPPING)]
+        public static extern LASWriterH LASWriter_Create(String filename, LASHeaderH hHeader, int mode);
+
+        /** Writes a point to the file.  The location of where the point is writen is 
+        *  determined by the mode the file is opened in, and what the last operation was.  
+        *  For example, if the file was opened for append, the next point would be written 
+        *  at the end of the file.  Likewise, if the file is opened in write mode, even 
+        *  if the file already existed, the next WritePoint operation will happen at the 
+        *  end of the header and all of the existing points in the file will be overwritten.
+        *  @param hWriter opaque pointer to the LASWriterH instance
+        *  @param hPoint the opaque LASPointH pointer to write
+        *  @return LE_None if no error occurred during the write operation.
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern LASError LASWriter_WritePoint(LASWriterH hWriter, LASPointH hPoint);
+
+        /** Overwrites the header for the file represented by the LASWriterH.  It does 
+        *  not matter if the file is opened for append or for write.
+        *  @param hWriter opaque pointer to the LASWriterH instance
+        *  @param hHeader LASHeaderH instance to write into the file
+        *  @return LE_None if no error occurred during the operation.
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern LASError LASWriter_WriteHeader(LASWriterH hWriter, LASHeaderH hHeader);
+
+        /** Destroys the LASWriterH instance, effectively closing the file and performing 
+        *  housekeeping operations.
+        *  @param hWriter LASWriterH instance to close
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern void LASWriter_Destroy(LASWriterH hWriter);
+
+        /****************************************************************************/
+        /* GUID Operations                                                          */
+        /****************************************************************************/
+
+        /** Returns the GUID value for the header as an opaque LASGuidH pointer.
+        *  @param hHeader the opaque pointer to the LASHeaderH
+        *  @return the GUID value for the header as an opaque LASGuidH pointer.
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern LASGuidH LASHeader_GetGUID(LASHeaderH hHeader);
+
+        /** Returns a new random GUID.
+        *  @return a new random GUID
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern LASGuidH LASGuid_Create();
+
+        /** Creates a new GUID opaque pointer using the given string.  
+        *  @param string A GUID string in the form "00000000-0000-0000-0000-000000000000"
+        *  An example GUID might be something like '8388F1B8-AA1B-4108-BCA3-6BC68E7B062E'
+        *  @return the GUID value as an opaque LASGuidH pointer.
+        */
+        [DllImport(DLL_LAS_VERSION, CharSet = CHARSET, BestFitMapping = BESTFITMAPPING)]
+        public static extern LASGuidH LASGuid_CreateFromString(String string_);
+
+        /** Destroys a GUID opaque pointer and removes it from the heap
+        *  @param hId the GUID value to destroy as an opaque LASGuidH pointer.
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern void LASGuid_Destroy(LASGuidH hId);
+
+        /** Determines if two GUIDs are equal.
+        *  @param hId1 the first GUID
+        *  @param hId2 the second GUID
+        *  @return 0 if false, 1 if true.  Use the LASError_GetLastError* methods to 
+        *  determine if an error occured during the operation of this function.
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern int LASGuid_Equals(LASGuidH hId1, LASGuidH hId2);
+
+        /** Returns a string representation of the GUID opqaue pointer.  The caller 
+        *  owns the string.
+        *  @param hId the LASGuidH pointer
+        *  @return a string representation of the GUID opaque pointer.
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern String LASGuid_AsString(LASGuidH hId);
+
+        /****************************************************************************/
+        /* VLR Operations                                                           */
+        /****************************************************************************/
+
+        /** Creates a new VLR record
+        *  @return a new VLR record
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern LASVLRH LASVLR_Create();
+
+        /** Destroys a VLR record and removes it from the heap
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern void LASVLR_Destroy(LASVLRH hVLR);
+
+        /** Returns the User Id for the VLR 
+        *  @param hVLR the LASVLRH instance
+        *  @return the User Id for the VLR
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern String LASVLR_GetUserId(LASVLRH hVLR);
+
+        /** Sets the User Id for the VLR
+        *  @param hVLR the LASVLRH instance
+        *  @param value the value to set for the User Id.  It will be clipped to fit 
+        *  within 16 characters
+        *  @return LASErrorEnum
+        */
+        [DllImport(DLL_LAS_VERSION, CharSet = CHARSET, BestFitMapping = BESTFITMAPPING)]
+        public static extern LASError LASVLR_SetUserId(LASVLRH hVLR, String value);
+
+        /** Gets the description for the VLR
+        *  @param hVLR the LASVLRH instance
+        *  @return the description for the VLR
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern String LASVLR_GetDescription(LASVLRH hVLR);
+
+        /** Sets the description for the VLR
+        *  @param hVLR the LASVLRH instance
+        *  @param value the value to set for the description.  It will be clipped to fit 
+        *  within 32 characters
+        *  @return LASErrorEnum
+        */
+        [DllImport(DLL_LAS_VERSION, CharSet = CHARSET, BestFitMapping = BESTFITMAPPING)]
+        public static extern LASError LASVLR_SetDescription(LASVLRH hVLR, String value);
+
+        /** Returns the record length of the data stored in the VLR
+        *  @param hVLR the LASVLRH instance
+        *  @return the record length of the data stored in the VLR
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern UInt16 LASVLR_GetRecordLength(LASVLRH hVLR);
+
+        /** Sets the record length of the data stored in the VLR
+        *  @param hVLR the LASVLRH instance
+        *  @param value the length to set for the VLR data length
+        *  @return LASErrorEnum
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern LASError LASVLR_SetRecordLength(LASVLRH hVLR, UInt16 value);
+
+        /** Gets the record id for the VLR
+        *  @param hVLR the LASVLRH instance
+        *  @return the record id for the VLR
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern UInt16 LASVLR_GetRecordId(LASVLRH hVLR);
+
+        /** Sets the record id for the VLR
+        *  @param hVLR the LASVLRH instance
+        *  @param value the record id to set
+        *  @return LASErrorEnum
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern LASError LASVLR_SetRecordId(LASVLRH hVLR, UInt16 value);
+
+        /** Gets the reserved value of the VLR.  This should be 0 and should aways be 0.
+        *  @param hVLR the LASVLRH instance
+        *  @return the reserved value of the VLR.
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern UInt16 LASVLR_GetReserved(LASVLRH hVLR);
+
+        /** Sets the reserved value of the VLR.  This should be 0 and you should not 
+        *  have to ever monkey with this value according to the spec.
+        *  @param hVLR the LASVLRH instance
+        *  @param value the value to set for the reserved value
+        *  @return LASErrorEnum
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern LASError LASVLR_SetReserved(LASVLRH hVLR, UInt16 value);
+
+        /** Gets the data stream for the VLR as an array of bytes
+        *  @param hVLR the LASVLRH instance
+        *  @param data a pointer to where place the array
+        *  @param length a pointer to where to place the length of the array
+        *  @return LASErrorEnum
+        */
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern LASError LASVLR_GetData(LASVLRH hVLR, out byte[] data);//, ref int length);
+
+        [DllImport(DLL_LAS_VERSION)]
+        public static extern LASError LASVLR_SetData(LASVLRH hVLR, ref byte[] data, int length);
+    }
+}
diff --git a/csharp/dotnetLibLAS/dotnetLibLAS.csproj b/csharp/dotnetLibLAS/dotnetLibLAS.csproj
old mode 100755
new mode 100644
index 57e9849..42e5a81
--- a/csharp/dotnetLibLAS/dotnetLibLAS.csproj
+++ b/csharp/dotnetLibLAS/dotnetLibLAS.csproj
@@ -45,7 +45,7 @@
     <Compile Include="LASPoint.cs" />
     <Compile Include="LASReader.cs" />
     <Compile Include="LASWriter.cs" />
-    <Compile Include="LibLASCAPI.cs" />
+    <Compile Include="NativeMethods.cs" />
   </ItemGroup>
   <ItemGroup>
     <None Include="liblas.snk" />
@@ -61,4 +61,4 @@
   <Target Name="AfterBuild">
   </Target>
   -->
-</Project>
\ No newline at end of file
+</Project>
diff --git a/csharp/dotnetLibLAS/dotnetLibLAS.dll.config b/csharp/dotnetLibLAS/dotnetLibLAS.dll.config
old mode 100755
new mode 100644
diff --git a/csharp/dotnetLibLAS/dotnetLibLAS_Express.csproj b/csharp/dotnetLibLAS/dotnetLibLAS_Express.csproj
old mode 100755
new mode 100644
diff --git a/csharp/dotnetLibLAS/dotnetLibLas.xml b/csharp/dotnetLibLAS/dotnetLibLas.xml
old mode 100755
new mode 100644
diff --git a/csharp/dotnetLibLAS/liblas.snk b/csharp/dotnetLibLAS/liblas.snk
old mode 100755
new mode 100644
diff --git a/csharp/dotnetLibLAS_xpress.sln b/csharp/dotnetLibLAS_xpress.sln
old mode 100755
new mode 100644
diff --git a/csharp/makefile.vc b/csharp/makefile.vc
old mode 100755
new mode 100644
diff --git a/doc/_static/liblas-color-pallette.css b/doc/_static/liblas-color-pallette.css
old mode 100755
new mode 100644
diff --git a/doc/_static/liblaslogo.png b/doc/_static/liblaslogo.png
old mode 100755
new mode 100644
diff --git a/doc/_static/pdf.png b/doc/_static/pdf.png
old mode 100755
new mode 100644
diff --git a/doc/_static/sphinx.css b/doc/_static/sphinx.css
old mode 100755
new mode 100644
diff --git a/doc/_templates/indexsidebar.html b/doc/_templates/indexsidebar.html
old mode 100755
new mode 100644
diff --git a/doc/_templates/layout.html b/doc/_templates/layout.html
old mode 100755
new mode 100644
diff --git a/doc/api/TracFooter.html b/doc/api/TracFooter.html
old mode 100755
new mode 100644
diff --git a/doc/api/TracHeader.html b/doc/api/TracHeader.html
old mode 100755
new mode 100644
diff --git a/doc/api/doxygen.conf b/doc/api/doxygen.conf
old mode 100755
new mode 100644
diff --git a/doc/api/doxygen.css b/doc/api/doxygen.css
old mode 100755
new mode 100644
diff --git a/doc/api/doxygen_dev.conf b/doc/api/doxygen_dev.conf
old mode 100755
new mode 100644
diff --git a/doc/community.txt b/doc/community.txt
old mode 100755
new mode 100644
diff --git a/doc/compilation.txt b/doc/compilation.txt
old mode 100755
new mode 100644
index f0b4127..895e745
--- a/doc/compilation.txt
+++ b/doc/compilation.txt
@@ -16,26 +16,26 @@ Compilation
 
 .. warning::
     This document is only for the 1.6 libLAS release.  Unfortunately,
-    there is no documentation for building earlier libLAS releases at this time, though 
-    it is a straightforward `Autoconf`_ setup for unix and nmake files for 
+    there is no documentation for building earlier libLAS releases at this time, though
+    it is a straightforward `Autoconf`_ setup for unix and nmake files for
     windows.
-    
-As of libLAS 1.6, `CMake`_ 2.8.1+ is the prescribed tool for building 
-libLAS from source as well as running unit tests. `CMake`_ is a cross-platform 
-build system that provides a number of benefits, and its usage ensures a 
-single, up-to-date build system for all libLAS-supported operating systems 
-and compiler platforms.  
+
+As of libLAS 1.6, `CMake`_ 2.8.1+ is the prescribed tool for building
+libLAS from source as well as running unit tests. `CMake`_ is a cross-platform
+build system that provides a number of benefits, and its usage ensures a
+single, up-to-date build system for all libLAS-supported operating systems
+and compiler platforms.
 
 Like a combination of autoconf/autotools, except that it actually works on
 Windows (and works without eye-stabbing pain in general), `CMake`_ is somewhat
 of a meta-building tool. It can be used to generate MSVC project files, GNU
 Makefiles, NMake files for MSVC, XCode projects on Mac OS X, and Eclipse
-projects (as well as many others).  This functionality allows the libLAS project 
+projects (as well as many others).  This functionality allows the libLAS project
 to avoid maintaining these build options by hand and target a single configuration
 and build platform.
 
-This tutorial will describe how to build libLAS using CMake on both a 
-Unix platform and a Windows platform.  
+This tutorial will describe how to build libLAS using CMake on both a
+Unix platform and a Windows platform.
 
 .. note::
     The only supported build environment libLAS moving forward from the 1.6
@@ -47,7 +47,7 @@ Unix platform and a Windows platform.
 Prerequisites
 ..............................................................................
 
-In addition to `CMake`_ 2.8.1+, you also need a C/C++ compiler.  The 
+In addition to `CMake`_ 2.8.1+, you also need a C/C++ compiler.  The
 following compilers are known to work:
 
 * MSVC 2003 (VC 7.1) (not all optional libraries work with 2003)
@@ -61,8 +61,8 @@ following compilers are known to work:
 `Boost`_
 ------------------------------------------------------------------------------
 
-`Boost`_ is required to build libLAS 1.6.  Set ``Boost_INCLUDE_DIR`` if 
-CMake cannot find it in a default location.  Additionally, set ``Boost_LIBRARY_DIRS`` 
+`Boost`_ is required to build libLAS 1.6.  Set ``Boost_INCLUDE_DIR`` if
+CMake cannot find it in a default location.  Additionally, set ``Boost_LIBRARY_DIRS``
 if it cannot find your libraries.
 
 .. warning::
@@ -75,7 +75,7 @@ if it cannot find your libraries.
     and you will need to scroll down and select "Boost ProgramOptions", "Boost Thread", and
     "Boost Serialization" components, and select static + multithreaded as the
     types. If you want to link in a different way, you will have to change
-    your CMake cache variables ``Boost_USE_STATIC_LIBS`` and ``Boost_USE_MULTITHREADED`` 
+    your CMake cache variables ``Boost_USE_STATIC_LIBS`` and ``Boost_USE_MULTITHREADED``
     accordingly.
 
     .. figure:: ./images/boostpro-options.png
@@ -95,19 +95,19 @@ libLAS can be used to load LAS data into `Oracle Point Cloud`_ -enabled Oracle
 tables.
 
 Building these libraries is beyond the scope of this document, but all except
-`OCI`_ can be built from source and installed at your leisure.  
+`OCI`_ can be built from source and installed at your leisure.
 
 `GDAL`_
 ------------------------------------------------------------------------------
 
-Obtain `GDAL`_ via whatever method is convenient.  Linux platforms such as 
-`Debian`_ have `DebianGIS`_, Mac OS X has the `KyngChaos`_ software frameworks, 
-and Windows has the `OSGeo4W`_ platform.  
+Obtain `GDAL`_ via whatever method is convenient.  Linux platforms such as
+`Debian`_ have `DebianGIS`_, Mac OS X has the `KyngChaos`_ software frameworks,
+and Windows has the `OSGeo4W`_ platform.
 
 * GDAL 1.7+ is required.
 
 .. note::
-    If you are using `OSGeo4W`_ as your provider of GDAL, you must use the 
+    If you are using `OSGeo4W`_ as your provider of GDAL, you must use the
     ``gdal-dev`` package, which is GDAL 1.8 as of 11/19/2010.
 
 
@@ -119,14 +119,14 @@ Obtain `libgeotiff`_ from the same place you got `GDAL`_.
 * libgeotiff 1.3.0+ is required
 
 .. note::
-    `GDAL` surreptitiously embeds a copy of `libgeotiff`_ in its library build 
-    but there is no way for you to know this.  In addition to embedding 
-    libgeotiff, it also strips away the library symbols that libLAS needs, 
-    meaning that libLAS can't simply link against `GDAL`_.  If you are 
-    building both of these libraries yourself, make sure you build GDAL 
-    using the "External libgeotiff" option, which will prevent the 
-    insanity that can ensue on some platforms.  `OSGeo4W`_ users, including 
-    those using that platform to link and build libLAS themselves, do 
+    `GDAL` surreptitiously embeds a copy of `libgeotiff`_ in its library build
+    but there is no way for you to know this.  In addition to embedding
+    libgeotiff, it also strips away the library symbols that libLAS needs,
+    meaning that libLAS can't simply link against `GDAL`_.  If you are
+    building both of these libraries yourself, make sure you build GDAL
+    using the "External libgeotiff" option, which will prevent the
+    insanity that can ensue on some platforms.  `OSGeo4W`_ users, including
+    those using that platform to link and build libLAS themselves, do
     not need to worry about this issue.
 
 `OCI`_
@@ -138,10 +138,10 @@ Be sure to install both the "Basic" and the "SDK" modules. Set your
 location so the CMake configuration can find your install.
 
 .. warning::
-    `OCI`_'s libraries are inconsistently named.  You may need to create 
-    symbolic links for some library names in order for the `CMake`_ to find 
+    `OCI`_'s libraries are inconsistently named.  You may need to create
+    symbolic links for some library names in order for the `CMake`_ to find
     them::
-        
+
         cd $ORACLE_HOME
         ln -s libocci.so.11.1 libocci.so
         ln -s libclntsh.so.11.1 libclntsh.so
@@ -149,7 +149,7 @@ location so the CMake configuration can find your install.
 
 .. note::
     MSVC should only require the oci.lib and oci.dll library and dlls.
-    
+
 * Oracle 11g is recommended, but OCI for 10g will work.
 
 .. _`libgeotiff`: http://www.remotesensing.org/geotiff/geotiff.html
@@ -185,7 +185,7 @@ example, we are going to generate a "Unix Makefiles" builder
 for libLAS on Mac OS X.
 
 ::
-    
+
     $ cd liblas
     $ mkdir makefiles
     $ cd makefiles
@@ -250,12 +250,12 @@ Run ``make install`` and test your installation with a :ref:`lasinfo` command
 ------------------------------------------------------------------------------
 
 ``make install`` will install the :ref:`utilities <utilities>` in the location
-that was specified for 'CMAKE_INSTALL_PREFIX'.  Once installed, ensure that 
+that was specified for 'CMAKE_INSTALL_PREFIX'.  Once installed, ensure that
 you can run lasinfo.
 
 ::
 
-    $ lasinfo ../test/data/TO_core_last_clip.las 
+    $ lasinfo ../test/data/TO_core_last_clip.las
 
     ---------------------------------------------------------
       Header Summary
@@ -279,7 +279,7 @@ you can run lasinfo.
       Offset X Y Z               -0.000000 -0.000000 -0.000000
       Min X Y Z                  630250.000000 4834500.000000 46.830000
       Max X Y Z                  630500.000000 4834750.000000 170.650000
-     Spatial Reference           
+     Spatial Reference
     Geotiff_Information:
        Version: 1
        Key_Revision: 1.0
@@ -348,7 +348,7 @@ substituting accordingly, to values that match your system layout.
     "","ORACLE_OCCI_LIBRARY","/home/oracle/libocci.so"
     "","ORACLE_OCIEI_LIBRARY","/home/oracle/libociei.so"
     "","ORACLE_OCI_LIBRARY","/home/oracle/libclntsh.so"
-  
+
 
 
 CCMake and cmake-gui
@@ -361,27 +361,27 @@ help us configure the rest of the optional components of the library. Run
 ``ccmake ../`` for the `Curses`_ interface or ``cmake-gui ../`` for a GUI
 version.
 
-  
+
 .. figure:: ./images/ccmake-osx-start.png
     :alt: Running CCMake in OS X
 
-    Running the `Curses`_ `CMake`_ interface.  This interface is available to 
-    all unix-like operating systems. 
-    
+    Running the `Curses`_ `CMake`_ interface.  This interface is available to
+    all unix-like operating systems.
+
 .. note::
-    If your arrow keys are not working with in CCMake, use CTRL-N and 
+    If your arrow keys are not working with in CCMake, use CTRL-N and
     CTRL-P to move back and forth between the options.
 
 .. figure:: ./images/cmake-gui-osx-start.png
     :alt: Running cmake-gui in OS X
 
-    Running the cmake-gui `CMake`_ interface.  This interface is available 
+    Running the cmake-gui `CMake`_ interface.  This interface is available
     on Linux, Windows, and Mac OS X.
 
-Build and install 
+Build and install
 ------------------------------------------------------------------------------
 
-Once you have configured your additional libraries, you can install the 
+Once you have configured your additional libraries, you can install the
 software.  The main pieces that will be installed are:
 
 * libLAS headers (typically in a location ./include/liblas/...)
@@ -408,7 +408,7 @@ Prepare a build directory
 
 CMake allows you to generate different builders for a project, and in this
 example, we are going to generate an "Xcode" builder for libLAS on Mac OS X.
-Additionally, we're going to use an alternative compiler -- `LLVM`_ -- which 
+Additionally, we're going to use an alternative compiler -- `LLVM`_ -- which
 under certain situations can produce much faster code on Mac OS X.
 
 ::
@@ -458,9 +458,9 @@ Alternatively, if you have `KyngChaos`_ frameworks for `GDAL`_ and `libgeotiff`_
       -D GEOTIFF_LIBRARY=/Library/Frameworks/UnixImageIO.framework/unix/lib/libgeotiff.dylib \
       ..
 
-    
-:: 
-    
+
+::
+
     $ open libLAS.xcodeproj/
 
 .. figure:: ./images/xcode-start.png
@@ -469,9 +469,9 @@ Alternatively, if you have `KyngChaos`_ frameworks for `GDAL`_ and `libgeotiff`_
 Set default command for XCode
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-Set the default executable for the project to be ``lasinfo`` by opening the 
-"Executables" tree, choosing "lasinfo," and clicking the bubble next to 
-the "Executable name" in the right-hand panel.  
+Set the default executable for the project to be ``lasinfo`` by opening the
+"Executables" tree, choosing "lasinfo," and clicking the bubble next to
+the "Executable name" in the right-hand panel.
 
 .. figure:: ./images/xcode-set-default-executable.png
     :alt: Setting the default executable
@@ -490,7 +490,7 @@ location of our test file. This is similar to the :ref:`same command
 Build and run the :ref:`lasinfo` command
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-Open the console by pressing CMD-SHIFT-R or by navigating to the Run-Console 
+Open the console by pressing CMD-SHIFT-R or by navigating to the Run-Console
 menu and press the `Build and Run` button.
 
 
@@ -501,15 +501,15 @@ menu and press the `Build and Run` button.
 Configure `Optional Libraries`_
 ------------------------------------------------------------------------------
 
-As :ref:`before <configure_optional_libraries>`, use ``ccmake ../`` or ``cmake-gui ../`` to 
+As :ref:`before <configure_optional_libraries>`, use ``ccmake ../`` or ``cmake-gui ../`` to
 configure your :ref:`optional_libraries`.
 
 
 .. figure:: ./images/cmake-gui-osx-configured.png
     :alt: Configuring optional libraries with CMake GUI
-    
+
     Configuring `Optional Libraries`_ with CMake GUI
-    
+
 
 
 Using "Visual Studio 9 2008" on Windows
@@ -522,30 +522,30 @@ See :ref:`source` for how to obtain the latest development version or visit
 :ref:`download` to get the latest released version.
 
 .. _msvc_prerequisites:
-    
+
 Prerequisites
 ------------------------------------------------------------------------------
 
 * Ensure that you have `CMake 2.8.0+`_ installed on your system.
-  
 
-* Install `OSGeo4W`_ on your system to get `Optional Libraries`_ in 
-  pre-compiled form.  You can build these from source yourself, but it is 
-  much more convenient to get them from OSGeo4W.  
-  
+
+* Install `OSGeo4W`_ on your system to get `Optional Libraries`_ in
+  pre-compiled form.  You can build these from source yourself, but it is
+  much more convenient to get them from OSGeo4W.
+
   * gdal-dev
   * libtiff
   * libgeotiff
-  
+
   .. figure:: ./images/windows-osgeo4w-advanced-install.png
             :alt: OSGeo4W installation
-  
-            Choose the "Advanced install" to be able to pick the libraries 
+
+            Choose the "Advanced install" to be able to pick the libraries
             and their headers that you need.
 
   .. figure:: ./images/windows-osgeo4w-choosing-packages.png
             :alt: Choosing libraries
-  
+
             Open up the "Libs" tree and choose the libraries you need
 
 
@@ -562,9 +562,9 @@ Run ``cmake-gui.exe``
 
 .. figure:: ./images/windows-cmake-start.png
     :alt: Starting CMake
-    
+
     Upon opening cmake-gui, nothing will be configured.
-              
+
     .. note::
         The Visual Studio Prompt can be found by navigating through the start
         bar to "Start" -- "Microsoft Visual Studio 2008" -- "Visual Studio
@@ -572,13 +572,13 @@ Run ``cmake-gui.exe``
         sets a number of environment variables necessary for Visual Studio to
         run, and `CMake`_ must have these variables set in order for it to
         work properly.
-        
+
         .. figure:: ./images/windows-command-prompt.png
             :alt: Visual Studio Command prompt
 
 .. figure:: ./images/windows-cmake-generator-visual-studio-9.png
     :alt: Generating a project
-  
+
 * Click "Configure" and a window will pop up asking what type of build to
   generate. Choose "Visual Studio 9 2008."
 
@@ -597,14 +597,14 @@ these libraries, but in case it does not, set the following variables,
 substituting accordingly, to values that match your system layout.
 
 .. note::
-    If you are building using `OSGeo4W`_ libraries, you must use the "gdal-dev" 
-    version, not the base `GDAL`_ build.  libLAS requires GDAL 1.7+ to 
+    If you are building using `OSGeo4W`_ libraries, you must use the "gdal-dev"
+    version, not the base `GDAL`_ build.  libLAS requires GDAL 1.7+ to
     operate, and this is provided by the "gdal-dev" `OSGeo4W`_ version.
 
 .. note::
-    You will need to choose "Advanced View" and select the location of the 
+    You will need to choose "Advanced View" and select the location of the
     libTIFF library explicitly.
-    
+
 .. csv-table::
 
     "`GDAL`_","GDAL_INCLUDE_DIR", "c:\\osgeo4w\\apps\\gdal-dev\\include"
@@ -614,15 +614,13 @@ substituting accordingly, to values that match your system layout.
     "`libtiff`_","TIFF_INCLUDE_DIR","c:\\osgeo4w\\include"
     "","TIFF_LIBRARY","c:\\osgeo4w\\lib\\libtiff_i.lib"
 
-    
+
 ------------------------------------------------------------------------------
 
 .. _`CMake`: http://www.cmake.org/
 .. _`CTest`: http://cmake.org/cmake/help/ctest-2-8-docs.html
 .. _`CMake 2.8.0+`: http://www.cmake.org/cmake/help/cmake-2-8-docs.html
-.. _`CDash`: http://www.cdash.org/
 .. _`continuous integration`: http://en.wikipedia.org/wiki/Continuous_integration
-.. _`libLAS CDash`: http://my.cdash.org/index.php?project=libLAS
 .. _`Curses`: http://en.wikipedia.org/wiki/Curses_%28programming_library%29
 .. _`Autoconf`: http://www.gnu.org/software/autoconf/
 .. _`LLVM`: http://llvm.org/
diff --git a/doc/conf.py b/doc/conf.py
old mode 100755
new mode 100644
diff --git a/doc/copyright.txt b/doc/copyright.txt
old mode 100755
new mode 100644
diff --git a/doc/development/annual_report_2010.txt b/doc/development/annual_report_2010.txt
old mode 100755
new mode 100644
diff --git a/doc/development/buildbot.txt b/doc/development/buildbot.txt
old mode 100755
new mode 100644
index e0dcf56..f2249da
--- a/doc/development/buildbot.txt
+++ b/doc/development/buildbot.txt
@@ -5,7 +5,7 @@ Test Suite
 ******************************************************************************
 
 Liblas includes a test suite written in C++ that can be fairly easily run
-to ensure that the library is working properly.  
+to ensure that the library is working properly.
 
 
 make test
@@ -20,22 +20,22 @@ If the liblas_test binary does not exist it may be necessary to do::
   make liblas_test test
 
 This should produce a brief report indicating the number of tests that failed,
-if any.  A detailed report will be generated in 
-liblas/Testing/Temporary/LastTest.log.  Failure reports may look something 
+if any.  A detailed report will be generated in
+liblas/Testing/Temporary/LastTest.log.  Failure reports may look something
 like::
 
   ---> group: liblas::SpatialReference, test: test<6>
        problem: assertion failed
        failed assertion: `VLR count: expected `3` actual `4``
 
-Tests failures diagnosis may require inspecting the test code in the 
+Tests failures diagnosis may require inspecting the test code in the
 liblas/test/unit directory.  In the above case searching for "test<6>" in
 the file liblas/test/unit/lasspatialreference_test.cpp would be appropriate.
 
-The tests can also be run directly in the liblas/test/unit directory by 
+The tests can also be run directly in the liblas/test/unit directory by
 running the liblas/bin/liblas_test executable.   In this case the report is
 written to stderr.  Be careful to write it in the right directory or some
-tests will fail for reasons that are not clear. 
+tests will fail for reasons that are not clear.
 
 
 Continuous Integration - TravisCI
@@ -43,7 +43,7 @@ Continuous Integration - TravisCI
 
 
 The libLAS project uses `Travis <https://travis-ci.org/libLAS/libLAS>`__ to perform
-automated builds and continuous integration. 
+automated builds and continuous integration.
 
 
 Building libLAS and running unit tests using CMake on Unix
@@ -57,15 +57,12 @@ dedicated `CDash`_ - utility dashboard hosted by the http://cdash.org website:
 The CDash is another tool liblAS uses to perform `continuous integration`_
 during development process.
 
-.. note::
-    In order to enable `CTest`_ support, `CMake 2.8.0+`_
-    version is required.
 
-* Configure libLAS core library with unit tests and CTest enabled
+* Configure libLAS core library with unit tests enabled
 
 ::
 
-    $ cmake ../main -DWITH_TESTS=ON -DENABLE_CTEST=ON
+    $ cmake ../main -DWITH_TESTS=ON
     -- The C compiler identification is GNU
     -- The CXX compiler identification is GNU
     -- Check for working C compiler: /usr/bin/gcc
@@ -78,8 +75,6 @@ during development process.
     -- Detecting CXX compiler ABI info - done
     -- Enable libLAS utilities to build - done
     -- Enable libLAS unit tests to build - done
-    -- Enable CTest to support submissions of results to CDash at http://cdash.org
-    -- Enable CTest to support submissions of results to CDash at http://cdash.org - done
     -- Configuring done
     -- Generating done
     -- Build files have been written to: /home/mloskot/dev/liblas/_hg/build
@@ -188,17 +183,15 @@ during development process.
 Ammending and Extending the Test Suite
 ..............................................................................
 
-The tests for the test suite are implemented as a set of C++ files in the 
-liblas/test/unit directory.  New tests for existing classes can be added 
+The tests for the test suite are implemented as a set of C++ files in the
+liblas/test/unit directory.  New tests for existing classes can be added
 based on the existing examples.  New files can be introduced for additional
 classes or categories of testing, but the source filename(s) will also need
 to be added in liblas/test/unit/CMakeLists.txt.
 
 
 .. _`CMake`: http://www.cmake.org/
-.. _`CTest`: http://cmake.org/cmake/help/ctest-2-8-docs.html
 .. _`CMake 2.8.0+`: http://www.cmake.org/cmake/help/cmake-2-8-docs.html
-.. _`CDash`: http://www.cdash.org/
 .. _`continuous integration`: http://en.wikipedia.org/wiki/Continuous_integration
 .. _`libLAS CDash`: http://my.cdash.org/index.php?project=libLAS
 
diff --git a/doc/development/format_elements.txt b/doc/development/format_elements.txt
old mode 100755
new mode 100644
diff --git a/doc/development/index.txt b/doc/development/index.txt
old mode 100755
new mode 100644
diff --git a/doc/development/rfc/index.txt b/doc/development/rfc/index.txt
old mode 100755
new mode 100644
diff --git a/doc/development/rfc/rfc_1_verticalcs.txt b/doc/development/rfc/rfc_1_verticalcs.txt
old mode 100755
new mode 100644
diff --git a/doc/development/rfc/rfc_2_spatialreference.txt b/doc/development/rfc/rfc_2_spatialreference.txt
old mode 100755
new mode 100644
diff --git a/doc/development/source.txt b/doc/development/source.txt
old mode 100755
new mode 100644
diff --git a/doc/development/specifications.txt b/doc/development/specifications.txt
old mode 100755
new mode 100644
diff --git a/doc/development/wkt.txt b/doc/development/wkt.txt
old mode 100755
new mode 100644
diff --git a/doc/docs.txt b/doc/docs.txt
old mode 100755
new mode 100644
diff --git a/doc/download.txt b/doc/download.txt
old mode 100755
new mode 100644
index 4f5fb1b..4c41830
--- a/doc/download.txt
+++ b/doc/download.txt
@@ -8,16 +8,13 @@ Download
 Current Release(s)
 ------------------------------------------------------------------------------
 
-* **2012-01-06** 
+* **2014-08-01**
 
-  - `libLAS-1.7.0-src.tar.gz  <http://download.osgeo.org/liblas/libLAS-1.7.0.tar.gz>`__ 
-    `(md5) <http://download2.osgeo.org/liblas/libLAS-1.7.0.tar.gz.md5>`__ 
-
-  - `libLAS-1.7.0-src.zip <http://download.osgeo.org/liblas/libLAS-1.7.0.zip>`_ 
-    `(md5) <http://download2.osgeo.org/liblas/libLAS-1.7.0.zip.md5>`__
+  - `libLAS-1.8.0-src.tar.bz2 <http://download.osgeo.org/liblas/libLAS-1.8.0.tar.bz2>`__
+    `(md5) <http://download2.osgeo.org/liblas/libLAS-1.8.0.tar.bz2.md5>`__
 
   - See `OSGeo4W <http://trac.osgeo.org/osgeo4w>`__ for Windows release.
-  
+
 
 
 .. note::
@@ -27,11 +24,11 @@ Current Release(s)
     :ref:`source`
 
 .. seealso::
-    A `sample library <http://liblas.org/samples>`__ is also available to provide 
+    A `sample library <http://liblas.org/samples>`__ is also available to provide
     data to test your tools.
 
 .. seealso::
-    See :ref:`start` for information 
+    See :ref:`start` for information
     how to get started using the tools once they are installed.
 
 
@@ -68,20 +65,14 @@ Windows
 `OSGeo4W`_
     OSGeo4W is a binary distribution of a broad set of Open Source geospatial
     software for Win32 environments (Windows XP, Vista, etc). OSGeo4W includes
-    GDAL/OGR, GRASS, MapServer, OpenEV, uDig, as well as many other packages
-    (about 70 as of summer 2008).
-    
-    .. note::
-        OSGeo4W is the preferred and only supported way to get a binary 
-        of libLAS as of the 1.6 release.  The OSGeo4W libLAS build contains 
-        a fully-featured set of utilities including support for GDAL, 
-        :ref:`las2oci <las2oci>`, and reprojection.  
-    
+    GDAL/OGR, GRASS, MapServer, and QGIS. Choose the OSGeo4W64 platform, and
+    libLAS 1.8.0+ is only available on OSGeo4W64.
+
     .. seealso::
-        :ref:`osgeo4w_install` contains information how to install and configure 
-        your OSGeo4W build to utilize libLAS.  
+        :ref:`osgeo4w_install` contains information how to install and configure
+        your OSGeo4W build to utilize libLAS.
+
 
-    
 .. _`OSGeo4W`: http://trac.osgeo.org/osgeo4w/
 
 Mac
@@ -97,11 +88,11 @@ Linux
 
 
 `DebianGIS`_
-    DebianGIS provides a number of packages including MapServer, PostGIS, 
-    GDAL, QGIS, GEOS, and libLAS.  It sometimes lags a little bit behind the absolute 
-    latest release, but DebianGIS provides a solid integration environment 
+    DebianGIS provides a number of packages including MapServer, PostGIS,
+    GDAL, QGIS, GEOS, and libLAS.  It sometimes lags a little bit behind the absolute
+    latest release, but DebianGIS provides a solid integration environment
     for a giant slug of Open Source GIS software.
-    
+
 .. _`DebianGIS`: http://wiki.debian.org/DebianGis
 
 
diff --git a/doc/faq.txt b/doc/faq.txt
old mode 100755
new mode 100644
diff --git a/doc/features.txt b/doc/features.txt
old mode 100755
new mode 100644
diff --git a/doc/images/boostpro-options.png b/doc/images/boostpro-options.png
old mode 100755
new mode 100644
diff --git a/doc/images/ccmake-osx-start.png b/doc/images/ccmake-osx-start.png
old mode 100755
new mode 100644
diff --git a/doc/images/cmake-gui-osx-configured.png b/doc/images/cmake-gui-osx-configured.png
old mode 100755
new mode 100644
diff --git a/doc/images/cmake-gui-osx-start.png b/doc/images/cmake-gui-osx-start.png
old mode 100755
new mode 100644
diff --git a/doc/images/lasblock_big.png b/doc/images/lasblock_big.png
old mode 100755
new mode 100644
diff --git a/doc/images/lasblock_small.png b/doc/images/lasblock_small.png
old mode 100755
new mode 100644
diff --git a/doc/images/liblas-logo.svg b/doc/images/liblas-logo.svg
old mode 100755
new mode 100644
diff --git a/doc/images/liblas-twitter-logo.png b/doc/images/liblas-twitter-logo.png
old mode 100755
new mode 100644
diff --git a/doc/images/osgeo4w-advanced-install.png b/doc/images/osgeo4w-advanced-install.png
old mode 100755
new mode 100644
diff --git a/doc/images/osgeo4w-las2las-reproject.png b/doc/images/osgeo4w-las2las-reproject.png
old mode 100755
new mode 100644
diff --git a/doc/images/osgeo4w-lasinfo-output.png b/doc/images/osgeo4w-lasinfo-output.png
old mode 100755
new mode 100644
diff --git a/doc/images/osgeo4w-lasinfo-point.png b/doc/images/osgeo4w-lasinfo-point.png
old mode 100755
new mode 100644
diff --git a/doc/images/osgeo4w-run-liblas-shell.png b/doc/images/osgeo4w-run-liblas-shell.png
old mode 100755
new mode 100644
diff --git a/doc/images/osgeo4w-select-liblas.png b/doc/images/osgeo4w-select-liblas.png
old mode 100755
new mode 100644
diff --git a/doc/images/windows-cmake-generator-makefiles.png b/doc/images/windows-cmake-generator-makefiles.png
old mode 100755
new mode 100644
diff --git a/doc/images/windows-cmake-generator-visual-studio-9.png b/doc/images/windows-cmake-generator-visual-studio-9.png
old mode 100755
new mode 100644
diff --git a/doc/images/windows-cmake-start.png b/doc/images/windows-cmake-start.png
old mode 100755
new mode 100644
diff --git a/doc/images/windows-command-prompt.png b/doc/images/windows-command-prompt.png
old mode 100755
new mode 100644
diff --git a/doc/images/windows-msvc-build.png b/doc/images/windows-msvc-build.png
old mode 100755
new mode 100644
diff --git a/doc/images/windows-osgeo4w-advanced-install.png b/doc/images/windows-osgeo4w-advanced-install.png
old mode 100755
new mode 100644
diff --git a/doc/images/windows-osgeo4w-choosing-packages.png b/doc/images/windows-osgeo4w-choosing-packages.png
old mode 100755
new mode 100644
diff --git a/doc/images/xcode-lasinfo-arguments.png b/doc/images/xcode-lasinfo-arguments.png
old mode 100755
new mode 100644
diff --git a/doc/images/xcode-lasinfo-output.png b/doc/images/xcode-lasinfo-output.png
old mode 100755
new mode 100644
diff --git a/doc/images/xcode-set-default-executable.png b/doc/images/xcode-set-default-executable.png
old mode 100755
new mode 100644
diff --git a/doc/images/xcode-start.png b/doc/images/xcode-start.png
old mode 100755
new mode 100644
diff --git a/doc/index.txt b/doc/index.txt
old mode 100755
new mode 100644
diff --git a/doc/lastools.txt b/doc/lastools.txt
old mode 100755
new mode 100644
diff --git a/doc/liblas.json b/doc/liblas.json
old mode 100755
new mode 100644
diff --git a/doc/make.bat b/doc/make.bat
old mode 100755
new mode 100644
diff --git a/doc/osgeo4w.txt b/doc/osgeo4w.txt
old mode 100755
new mode 100644
index 2e0f265..934b231
--- a/doc/osgeo4w.txt
+++ b/doc/osgeo4w.txt
@@ -7,7 +7,7 @@ Installing libLAS using OSGeo4W
 
 :Author: Howard Butler
 :Contact: hobu.inc at gmail dot com
-:Date: 2/17/2011
+:Date: 8/1/2015
 
 This document describes how to install libLAS and its related :ref:`utilities <utilities>` 
 using `OSGeo4W`_.  `OSGeo4W`_ is a collection of Windows packages that uses the `Cygwin`_ 
@@ -19,9 +19,9 @@ requires a number of dependencies, and these are all available via the OSGeo4W i
    
     .. note::
         OSGeo4W does not currently provide any options to install in any other
-        locations besides ``C:\osgeo4w``.
+        locations besides ``C:\OSGeo4W64``.
 
-.. `OSGeo4W Installer`: http://download.osgeo.org/osgeo4w/osgeo4w-setup.exe
+.. `OSGeo4W Installer`: http://download.osgeo.org/osgeo4w/osgeo4w-setup-x86_64.exe
 
 2) Choose "Advanced Install".  
 
diff --git a/doc/python.txt b/doc/python.txt
old mode 100755
new mode 100644
diff --git a/doc/start.txt b/doc/start.txt
old mode 100755
new mode 100644
index 3dc986a..2dbc971
--- a/doc/start.txt
+++ b/doc/start.txt
@@ -13,36 +13,36 @@ Getting Started with libLAS
 :Author: Howard Butler
 :Contact: hobu.inc at gmail dot com
 
-    
+
 Overview
 ------------------------------------------------------------------------------
 
-libLAS is two things: a library for embedding read and write support of the 
-ASPRS LAS format into your own C/C++ applications, and a suite of command-line 
-utilities based on :ref:`LASTools <lastools_liblas>` for inspecting, manipulating, 
+libLAS is two things: a library for embedding read and write support of the
+ASPRS LAS format into your own C/C++ applications, and a suite of command-line
+utilities based on :ref:`LASTools <lastools_liblas>` for inspecting, manipulating,
 transforming, and processing LAS LiDAR data.
 
-This document is an entry point into the world of libLAS, and will give a 
-general overview of the types of operations you can do with the :ref:`libLAS utilities <utilities>` 
-as well as point you to other information for developing your own applications 
-with libLAS.  
+This document is an entry point into the world of libLAS, and will give a
+general overview of the types of operations you can do with the :ref:`libLAS utilities <utilities>`
+as well as point you to other information for developing your own applications
+with libLAS.
 
 Installation
 ------------------------------------------------------------------------------
 
-:ref:`download` contains the canonical location for obtaining libLAS in 
-both source and binary forms.  
+:ref:`download` contains the canonical location for obtaining libLAS in
+both source and binary forms.
 
 Windows
 ..............................................................................
 
-:ref:`osgeo4w_install` contains information how to install libLAS on Windows.  
+:ref:`osgeo4w_install` contains information how to install libLAS on Windows.
 
 Unix
 ..............................................................................
 
-Packages are available for `DebianGIS`_, but in most other cases you are 
-going to have to compile libLAS yourself. :ref:`compilation` provides an 
+Packages are available for `DebianGIS`_, but in most other cases you are
+going to have to compile libLAS yourself. :ref:`compilation` provides an
 extensive synopsis of how to do so.
 
 OSX
@@ -63,55 +63,55 @@ Compilation
 ..............................................................................
 
 :ref:`compilation` shows how to compile libLAS for your own use on Windows,
-Mac OSX, and Linux. 
-    
+Mac OSX, and Linux.
+
 Processing
 ------------------------------------------------------------------------------
 
-The libLAS :ref:`command-line utilities <utilities>` provide the bulk of 
-user-facing operational software for libLAS, although the underlying libLAS 
-library is what powers them.  Below is a listing of common operations that 
-you might want to do on LAS data, and the utilities and approaches to 
+The libLAS :ref:`command-line utilities <utilities>` provide the bulk of
+user-facing operational software for libLAS, although the underlying libLAS
+library is what powers them.  Below is a listing of common operations that
+you might want to do on LAS data, and the utilities and approaches to
 take to complete those tasks.
 
 Reprojecting an LAS file
 ..............................................................................
 
-All LAS data are in some sort of coordinate system, even if that coordinate 
-system is not described in the LAS file.  For terrestrial LAS data, these 
-coordinate system descriptions often map to coordinate systems described 
-by the `EPSG`_ database.  Another source of information about coordinate 
-systems in http://spatialreference.org.  
+All LAS data are in some sort of coordinate system, even if that coordinate
+system is not described in the LAS file.  For terrestrial LAS data, these
+coordinate system descriptions often map to coordinate systems described
+by the `EPSG`_ database.  Another source of information about coordinate
+systems in http://spatialreference.org.
 
-The :ref:`las2las <las2las>` utility is the tool you will want to use to 
-reproject LAS data.  :ref:`las2las <las2las>` can take advantage of the 
-existing coordinate system description that might already be specified in the 
-LAS file, or you may override the coordinate system description (or supply 
+The :ref:`las2las <las2las>` utility is the tool you will want to use to
+reproject LAS data.  :ref:`las2las <las2las>` can take advantage of the
+existing coordinate system description that might already be specified in the
+LAS file, or you may override the coordinate system description (or supply
 one if none was specified).
 
-We're going to use an example file at http://liblas.org/samples/srs.las which 
-contains only 10 points and has a coordinate system defined.  Please 
+We're going to use an example file at http://liblas.org/samples/srs.las which
+contains only 10 points and has a coordinate system defined.  Please
 download this file if you want to follow along.
 
-:ref:`las2las <las2las>` is very similar in behavior to another data 
-translation utility for raster data -- `gdal_translate`_.  To reproject data, 
-we must have a description of both the coordinate system we are starting with 
-and a description of the coordinate system we are going to.  To find out what 
+:ref:`las2las <las2las>` is very similar in behavior to another data
+translation utility for raster data -- `gdal_translate`_.  To reproject data,
+we must have a description of both the coordinate system we are starting with
+and a description of the coordinate system we are going to.  To find out what
 you are starting with, issue a :ref:`lasinfo <lasinfo>` command:
 
 ::
-    
+
     lasinfo --no-check srs.las
 
 .. note::
 
-    The --no-check option tells lasinfo to only print the header information 
-    for the file and to not scan through all of the points.  For a 10 point file, 
-    this of course isn't much of a concern, but with a 50 or 500 million point 
-    file, it isn't worth waiting for a full scan of the data if all you 
+    The --no-check option tells lasinfo to only print the header information
+    for the file and to not scan through all of the points.  For a 10 point file,
+    this of course isn't much of a concern, but with a 50 or 500 million point
+    file, it isn't worth waiting for a full scan of the data if all you
     want is header information.
 
-Our :ref:`lasinfo <lasinfo>` invocation tells us that the ``srs.las`` file 
+Our :ref:`lasinfo <lasinfo>` invocation tells us that the ``srs.las`` file
 is in a UTM North Zone 17 coordinate system:
 
 ::
@@ -135,15 +135,15 @@ is in a UTM North Zone 17 coordinate system:
             AUTHORITY["EPSG","9001"]],
         AUTHORITY["EPSG","32617"]]
 
-Now that we know our input coordinate system, we can make a decision about 
-what to reproject the data to.  In our first example, we're going to use 
+Now that we know our input coordinate system, we can make a decision about
+what to reproject the data to.  In our first example, we're going to use
 the venerable plate carrée non-coordinate system, `EPSG:4326`_.
 
 ::
 
     las2las srs.las --t_srs EPSG:4326
 
-Our process succeeds, but after a quick inspection of the data with 
+Our process succeeds, but after a quick inspection of the data with
 ``lasinfo output.las`` we see a problem:
 
 ::
@@ -152,7 +152,7 @@ Our process succeeds, but after a quick inspection of the data with
     Scale Factor X Y Z:          0.01 0.01 0.01
     Offset X Y Z:                -0.00 -0.00 -0.00
     ...
-    Min X, Y, Z: 		-83.43, 39.01, 170.58, 
+    Min X, Y, Z: 		-83.43, 39.01, 170.58,
     Max X, Y, Z: 		-83.43, 39.01, 170.76,
 
 The ``srs.las`` file had a scale of 0.01, or two decimal places of precision
@@ -166,7 +166,7 @@ case:
 
     las2las --t_srs EPSG:4326 srs.las --scale 0.000001 0.000001 0.01
 
-Another quick inspection with :ref:`lasinfo <lasinfo>` gives us something 
+Another quick inspection with :ref:`lasinfo <lasinfo>` gives us something
 we're more comfortable with:
 
 ::
@@ -176,12 +176,12 @@ we're more comfortable with:
     Offset X Y Z:                -0.000000 -0.000000 -0.00
     ...
     Min X, Y, Z: 		-83.427598, 39.012599, 170.58
-    Max X, Y, Z: 		-83.427548, 39.012618, 170.76    
+    Max X, Y, Z: 		-83.427548, 39.012618, 170.76
 
 Vertical datum transformation of an LAS file
 ..............................................................................
 
-We're going to continue what we were doing in `Reprojecting an LAS file`_ but 
+We're going to continue what we were doing in `Reprojecting an LAS file`_ but
 add a twist -- we want to change the vertical datum on the data from WGS84
 to NAVD88.
 
@@ -194,8 +194,8 @@ to NAVD88.
    :ref:`osgeo4w_install`, you already have all of this installed when you
    installed libLAS. For Linux or other Unix platforms, you should be aware of
    these requirements.
-    
-Assuming you have all of the prerequisites in place, we can do the vertical 
+
+Assuming you have all of the prerequisites in place, we can do the vertical
 datum transformation quite simply (again, worrying about precision as well):
 
 
@@ -203,9 +203,9 @@ datum transformation quite simply (again, worrying about precision as well):
 
     las2las srs.las --t_srs EPSG:4326+5703 --scale 0.000001 0.000001 0.01
 
-The key point there is adding `+5703` to the coordinate system description 
-tells the GDAL/Proj.4 machinery to do a vertical transformation.  There are 
-other ways to have these operations happen using `WKT`_ and even GeoTIFF 
+The key point there is adding `+5703` to the coordinate system description
+tells the GDAL/Proj.4 machinery to do a vertical transformation.  There are
+other ways to have these operations happen using `WKT`_ and even GeoTIFF
 keys, but this is the most simple way to do things via command line.
 
 Assigning color information to a LAS file
@@ -217,15 +217,15 @@ Assigning color information to a LAS file
     example file that is available from the http://liblas.org/sample sample
     library.
 
-   
-Frequent availability of combined terrestrial LiDAR and image captures means 
-that its now possible to obtain .las files that you can stylize with RGB 
-imagery.  The LAS 1.2 specification provides two different point data 
-types that allow storing RGB data as 16 bit integers, but the tools to 
-do the actual intersection operation have been somewhat limited.  
 
-libLAS 1.6+ allows you to assign color information to a .las file if `GDAL`_ 
-is linked in at compile-time.  
+Frequent availability of combined terrestrial LiDAR and image captures means
+that its now possible to obtain .las files that you can stylize with RGB
+imagery.  The LAS 1.2 specification provides two different point data
+types that allow storing RGB data as 16 bit integers, but the tools to
+do the actual intersection operation have been somewhat limited.
+
+libLAS 1.6+ allows you to assign color information to a .las file if `GDAL`_
+is linked in at compile-time.
 
 .. note::
     The :ref:`LAS specifications <specifications>` only allow two different
@@ -238,19 +238,19 @@ is linked in at compile-time.
 
 
 1. Unzip the `Autzen Stadium <Autzen_Stadium>`_ data.
-    
+
     ::
-    
+
         $ unzip Autzen_Stadium.zip
         Archive:  Autzen_Stadium.zip
          creating: Autzen_Stadium/
-         inflating: Autzen_Stadium/image.tif  
-         inflating: Autzen_Stadium/lidar.las 
+         inflating: Autzen_Stadium/image.tif
+         inflating: Autzen_Stadium/lidar.las
 
 2. Issue the :ref:`las2las <las2las>` call
 
     ::
-    
+
         $   las2las -i lidar.las \
                     --color-source image.tif \
                     -o output.las \
@@ -259,7 +259,7 @@ is linked in at compile-time.
                     -v
 
     ::
-    
+
         Opening lidar.las to fetch Header
         Setting format to: 1.2
         Setting point format to: 3
@@ -268,16 +268,16 @@ is linked in at compile-time.
          - : output.las
         0...10...20...30...40...50...60...70...80...90...100 - done.
 
-3.  Inspect the :ref:`lasinfo <lasinfo>` output and see color information 
+3.  Inspect the :ref:`lasinfo <lasinfo>` output and see color information
     attached.
 
     ::
-        
+
         lasinfo output.las
-        
+
         ...
-        
-          Minimum Color:	39 56 56 
+
+          Minimum Color:	39 56 56
           Maximum Color:	252 254 251
 
 .. note::
@@ -286,7 +286,7 @@ is linked in at compile-time.
 Compressing an LAS file with `LASzip`_
 ..............................................................................
 
-libLAS provides the ability to compress data using the fantastic `LASzip`_ 
+libLAS provides the ability to compress data using the fantastic `LASzip`_
 compression library.
 
 
@@ -295,9 +295,7 @@ compression library.
 .. _`CMake`: http://www.cmake.org/
 .. _`CTest`: http://cmake.org/cmake/help/ctest-2-8-docs.html
 .. _`CMake 2.8.0+`: http://www.cmake.org/cmake/help/cmake-2-8-docs.html
-.. _`CDash`: http://www.cdash.org/
 .. _`continuous integration`: http://en.wikipedia.org/wiki/Continuous_integration
-.. _`libLAS CDash`: http://my.cdash.org/index.php?project=libLAS
 .. _`Curses`: http://en.wikipedia.org/wiki/Curses_%28programming_library%29
 .. _`Autoconf`: http://www.gnu.org/software/autoconf/
 .. _`LLVM`: http://llvm.org/
diff --git a/doc/tutorial/boo.txt b/doc/tutorial/boo.txt
old mode 100755
new mode 100644
diff --git a/doc/tutorial/cpp.txt b/doc/tutorial/cpp.txt
old mode 100755
new mode 100644
index 6a0cdd6..f916a9b
--- a/doc/tutorial/cpp.txt
+++ b/doc/tutorial/cpp.txt
@@ -16,7 +16,7 @@ C++ Tutorial
 .. contents::
     :depth: 2
     :backlinks: none
-    
+
 This basic tutorial explains how to use libLAS to read and write LIDAR data
 encoded in LAS File Format. For more examples in C++, check source of `unit
 tests package`_ for libLAS.
@@ -41,7 +41,7 @@ Reading LAS data using ``liblas::Reader``
         std::ifstream ifs;
         ifs.open("file.las", std::ios::in | std::ios::binary);
 
-3. Create a ReaderFactory and instantiate a new liblas::Reader using 
+3. Create a ReaderFactory and instantiate a new liblas::Reader using
    the stream.
 
     .. code-block:: cpp
@@ -50,9 +50,9 @@ Reading LAS data using ``liblas::Reader``
         liblas::Reader reader = f.CreateWithStream(ifs);
 
     .. note::
-        It is possible to use the basic liblas::Reader constructor that 
-        takes in a std::istream, but it will not be able to account for the fact 
-        that the file might be compressed.  Using the ReaderFactory will take 
+        It is possible to use the basic liblas::Reader constructor that
+        takes in a std::istream, but it will not be able to account for the fact
+        that the file might be compressed.  Using the ReaderFactory will take
         care of all of this for you.
 
 4. After the reader has been created, you can access members of the Public
@@ -91,20 +91,20 @@ Reading LAS data using ``liblas::Reader``
 
     .. note::
         A `ReadPointAt` method call implies an individual seek in the file per
-        point read.  Use ``liblas::Reader::Seek`` if you wish to read a run 
+        point read.  Use ``liblas::Reader::Seek`` if you wish to read a run
         of points starting at a specified location in the file.
 
 
     .. warning::
-        If the file is a compressed LAS file, ReadPointAt is going to be much 
-        slower than randomly reading through an uncompressed file.  The `LASzip`_ 
-        compression as of LASzip 1.0.1 is sequential in nature, and asking for the 
+        If the file is a compressed LAS file, ReadPointAt is going to be much
+        slower than randomly reading through an uncompressed file.  The `LASzip`_
+        compression as of LASzip 1.0.1 is sequential in nature, and asking for the
         2nd point in the file means decompressing both the 0th and 1st points.
 
-7. Seek to the 10th point to start reading.  A ``liblas::Reader`` provides a 
-   `Seek` method to allow you to start reading from a specified location for 
-   however many points you wish.  This functionality is useful for reading 
-   strips out of files.  
+7. Seek to the 10th point to start reading.  A ``liblas::Reader`` provides a
+   `Seek` method to allow you to start reading from a specified location for
+   however many points you wish.  This functionality is useful for reading
+   strips out of files.
 
 
     .. code-block:: cpp
@@ -112,7 +112,7 @@ Reading LAS data using ``liblas::Reader``
         reader.Seek(10);
         while (reader.ReadNextPoint())
         ...
-    
+
 ==============================================================================
 Writing using ``liblas::Writer``
 ==============================================================================
@@ -133,14 +133,14 @@ Writing using ``liblas::Writer``
 
         std::ofstream ofs;
         ofs.open("file.las", ios::out | ios::binary);
-    
+
     .. note::
-        It is also possible to open the stream in append mode to add data 
-        to an existing file.  You should first instantiate a ``liblas::Reader`` 
-        and fetch the ``liblas::Header`` from the file, and then create the 
-        ``liblas::Writer`` with that header and the ofstream opened in append 
+        It is also possible to open the stream in append mode to add data
+        to an existing file.  You should first instantiate a ``liblas::Reader``
+        and fetch the ``liblas::Header`` from the file, and then create the
+        ``liblas::Writer`` with that header and the ofstream opened in append
         mode.
-        
+
         .. code-block:: cpp
 
             liblas::Header header = reader.GetHeader();
@@ -148,7 +148,7 @@ Writing using ``liblas::Writer``
             std::ios::openmode m = std::ios::out | std::ios::in | std::ios::binary | std::ios::ate;
             ofs.open("file.las", m);
             liblas::Writer writer(ofs, header);
-        
+
 
 3. Create instance of ``liblas::Header`` class to define Public Header Block and set some values
 
@@ -156,13 +156,13 @@ Writing using ``liblas::Writer``
 
         liblas::Header header;
         header.SetDataFormatId(liblas::ePointFormat1); // Time only
-        
+
         // Set coordinate system using GDAL support
         liblas::SpatialReference srs;
         srs.SetFromUserInput("EPSG:4326");
-        
+
         header.SetSRS(srs);
-        
+
         // fill other header members
 
 
@@ -173,7 +173,7 @@ Writing using ``liblas::Writer``
         user to specify the proper file name extension, `.laz`, when writing the
         file.
 
-    .. note:: 
+    .. note::
         The default constructed header object can be used as perfectly valid
         header. It will define LAS file according to LAS 1.2 and Point Data Format
         3.
@@ -190,7 +190,7 @@ Writing using ``liblas::Writer``
 
     .. code-block:: cpp
 
-     liblas::Point point;
+     liblas::Point point(&header);
      point.SetCoordinates(10, 20, 30);
      // fill other properties of point record
 
@@ -215,7 +215,7 @@ Using interface of Reader and Writer classes
  #include <liblas/laswriter.hpp>
  #include <exception>
  #include <iostream>
- 
+
  int main()
  {
     try
@@ -259,7 +259,7 @@ Template Library <http://en.wikipedia.org/wiki/C%2B%2B_standard_library>`__.
     #include <algorithm>
     #include <exception>
     #include <iostream>
-    
+
     using namespace liblas;
 
     int main()
@@ -285,21 +285,21 @@ Template Library <http://en.wikipedia.org/wiki/C%2B%2B_standard_library>`__.
 Creating a compressed .laz file from a .las file
 ==============================================================================
 
-Using the `LASzip`_ library in combination with libLAS, you can write compressed 
-data that will be much smaller in size than regular LAS data. Of course, there 
+Using the `LASzip`_ library in combination with libLAS, you can write compressed
+data that will be much smaller in size than regular LAS data. Of course, there
 is some CPU cost to doing so, but its use can be a big win in the right situations.
 
-The following example reads a file, `file.las`, and writes a file, `file.laz`, 
+The following example reads a file, `file.las`, and writes a file, `file.laz`,
 that is an exact copy of the file except for it contains compressed data.
 
 .. code-block:: cpp
 
     #include <liblas/liblas.hpp>
-    
+
     #include <fstream>  // std::ofstream
     #include <algorithm> // std::copy
     #include <exception> // std::exception
-    
+
     int main()
     {
         try
@@ -312,7 +312,7 @@ that is an exact copy of the file except for it contains compressed data.
 
             liblas::Header header = reader.GetHeader();
             header.SetCompressed(true);
-            
+
             liblas::Writer writer(ofs, header);
 
             std::copy(lasreader_iterator(reader),  lasreader_iterator(),
@@ -329,16 +329,16 @@ that is an exact copy of the file except for it contains compressed data.
 Applying filters to a reader to extract specified classes
 ==============================================================================
 
-The following example demonstrates how to use the built-in ClassificationFilter 
-to filter for classes that match the specified values.  You can also provide 
-your own filters by subclassing liblas::FilterI and providing a filter() 
-function.  
+The following example demonstrates how to use the built-in ClassificationFilter
+to filter for classes that match the specified values.  You can also provide
+your own filters by subclassing liblas::FilterI and providing a filter()
+function.
 
 
 .. note::
     Filters are applied in the order they are read from the vector that is
     given to the Reader/Writer in the SetFilters call.
- 
+
 .. code-block:: cpp
 
     #include <liblas/liblas.hpp>
@@ -348,7 +348,7 @@ function.
 
     class LastReturnFilter: public liblas::FilterI
     {
-    public:    
+    public:
         LastReturnFilter();
         bool filter(const liblas::Point& point);
 
@@ -361,18 +361,18 @@ function.
 
     bool LastReturnFilter::filter(const liblas::Point& p)
     {
-    
+
         // If the GetReturnNumber equals the GetNumberOfReturns,
         // we're a last return
-        
-        bool output = false; 
-        if (p.GetReturnNumber() == p.GetNumberOfReturns()) 
+
+        bool output = false;
+        if (p.GetReturnNumber() == p.GetNumberOfReturns())
         {
             output = true;
-        } 
+        }
 
         // If the type is switched to eExclusion, we'll throw out all last returns.
-        if (GetType() == eExclusion && output == true) 
+        if (GetType() == eExclusion && output == true)
         {
             output = false;
         } else {
@@ -387,33 +387,33 @@ function.
 
         if (argc < 3)
          {
-            std::cerr << "not all arguments specified.  Usage: 'filter input.las output.las'" 
+            std::cerr << "not all arguments specified.  Usage: 'filter input.las output.las'"
                       << std::endl;
-            exit(1);        
+            exit(1);
         }
-        
+
         std::string in_file(argv[1]);
         std::string out_file(argv[2]);
-        
+
         if (!liblas::Open(ifs, in_file.c_str()))
         {
             std::cout << "Can not open file" << std::endl;;
             exit(1);
         }
-        
+
         std::vector<liblas::Classification> classes;
         classes.push_back(liblas::Classification(2)); // ground
         classes.push_back(liblas::Classification(9)); // water
         classes.push_back(liblas::Classification(6)); // building
-    
+
         std::vector<liblas::FilterPtr> filters;
         liblas::FilterPtr class_filter = liblas::FilterPtr(new liblas::ClassificationFilter(classes));
-    
-        // eInclusion means to keep the classes that match.  eExclusion would 
+
+        // eInclusion means to keep the classes that match.  eExclusion would
         // throw out those that matched
         class_filter->SetType(liblas::FilterI::eInclusion);
-        filters.push_back(class_filter);    
-    
+        filters.push_back(class_filter);
+
         liblas::FilterPtr return_filter = liblas::FilterPtr(new LastReturnFilter());
         filters.push_back(return_filter);
 
@@ -426,13 +426,13 @@ function.
         {
             std::cout <<std::string("Can not create \'") + out_file + "\'" << std::endl;;
             exit(1);
-        }        
+        }
         liblas::Writer writer(ofs, reader.GetHeader());
 
         while (reader.ReadNextPoint())
         {
-            liblas::Point const& p = reader.GetPoint(); 
-            writer.WritePoint(p);  
+            liblas::Point const& p = reader.GetPoint();
+            writer.WritePoint(p);
         }
     }
 
diff --git a/doc/tutorial/csharp.txt b/doc/tutorial/csharp.txt
old mode 100755
new mode 100644
diff --git a/doc/tutorial/index.txt b/doc/tutorial/index.txt
old mode 100755
new mode 100644
diff --git a/doc/tutorial/ironpython.txt b/doc/tutorial/ironpython.txt
old mode 100755
new mode 100644
diff --git a/doc/tutorial/python.txt b/doc/tutorial/python.txt
old mode 100755
new mode 100644
diff --git a/doc/tutorial/qhull.txt b/doc/tutorial/qhull.txt
old mode 100755
new mode 100644
diff --git a/doc/tutorial/vbnet.txt b/doc/tutorial/vbnet.txt
old mode 100755
new mode 100644
diff --git a/doc/utilities/index.txt b/doc/utilities/index.txt
old mode 100755
new mode 100644
index cc35eb2..de657b0
--- a/doc/utilities/index.txt
+++ b/doc/utilities/index.txt
@@ -8,14 +8,9 @@
    :maxdepth: 1
 
    lasinfo
-   lasinfo-old
    las2las
-   las2las-old
    las2txt
-   lasmerge
-   lasdiff
    las2ogr
    txt2las
    lasblock
    ts2las
-   las2tindex
\ No newline at end of file
diff --git a/doc/utilities/las2las-old.txt b/doc/utilities/las2las-old.txt
old mode 100755
new mode 100644
diff --git a/doc/utilities/las2las.txt b/doc/utilities/las2las.txt
old mode 100755
new mode 100644
diff --git a/doc/utilities/las2ogr.txt b/doc/utilities/las2ogr.txt
old mode 100755
new mode 100644
diff --git a/doc/utilities/las2tindex.txt b/doc/utilities/las2tindex.txt
old mode 100755
new mode 100644
diff --git a/doc/utilities/las2txt.txt b/doc/utilities/las2txt.txt
old mode 100755
new mode 100644
diff --git a/doc/utilities/lasblock.txt b/doc/utilities/lasblock.txt
old mode 100755
new mode 100644
diff --git a/doc/utilities/lasdiff.txt b/doc/utilities/lasdiff.txt
old mode 100755
new mode 100644
diff --git a/doc/utilities/lasinfo-old.txt b/doc/utilities/lasinfo-old.txt
old mode 100755
new mode 100644
diff --git a/doc/utilities/lasinfo.txt b/doc/utilities/lasinfo.txt
old mode 100755
new mode 100644
diff --git a/doc/utilities/lasmerge.txt b/doc/utilities/lasmerge.txt
old mode 100755
new mode 100644
diff --git a/doc/utilities/ts2las.txt b/doc/utilities/ts2las.txt
old mode 100755
new mode 100644
diff --git a/doc/utilities/txt2las.txt b/doc/utilities/txt2las.txt
old mode 100755
new mode 100644
diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
old mode 100755
new mode 100644
diff --git a/include/liblas/bounds.hpp b/include/liblas/bounds.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/capi/las_config.h b/include/liblas/capi/las_config.h
old mode 100755
new mode 100644
diff --git a/include/liblas/capi/las_version.h b/include/liblas/capi/las_version.h
old mode 100755
new mode 100644
index c6c61c2..d66f657
--- a/include/liblas/capi/las_version.h
+++ b/include/liblas/capi/las_version.h
@@ -9,33 +9,33 @@
  * Copyright (c) 2008, Howard Butler
  *
  * All rights reserved.
- * 
- * Redistribution and use in source and binary forms, with or without 
- * modification, are permitted provided that the following 
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following
  * conditions are met:
- * 
- *     * Redistributions of source code must retain the above copyright 
+ *
+ *     * Redistributions of source code must retain the above copyright
  *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above copyright 
- *       notice, this list of conditions and the following disclaimer in 
- *       the documentation and/or other materials provided 
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided
  *       with the distribution.
- *     * Neither the name of the Martin Isenburg or Iowa Department 
- *       of Natural Resources nor the names of its contributors may be 
- *       used to endorse or promote products derived from this software 
+ *     * Neither the name of the Martin Isenburg or Iowa Department
+ *       of Natural Resources nor the names of its contributors may be
+ *       used to endorse or promote products derived from this software
  *       without specific prior written permission.
- * 
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
  * OF SUCH DAMAGE.
  ****************************************************************************/
 
@@ -45,7 +45,7 @@
 #ifndef LIBLAS_VERSION_MAJOR
 #define LIBLAS_VERSION_MAJOR    1
 #define LIBLAS_VERSION_MINOR    8
-#define LIBLAS_VERSION_REV      0
+#define LIBLAS_VERSION_REV      1
 #define LIBLAS_VERSION_BUILD    0
 #endif
 
@@ -54,11 +54,11 @@
 #endif
 
 #ifndef LIBLAS_RELEASE_DATE
-#define LIBLAS_RELEASE_DATE     20140801
+#define LIBLAS_RELEASE_DATE     20160822
 #endif
 
 #ifndef LIBLAS_RELEASE_NAME
-#define LIBLAS_RELEASE_NAME     "1.8.0"
+#define LIBLAS_RELEASE_NAME     "1.8.1"
 #endif
 
 #endif /* LAS_VERSION_H_INCLUDED */
diff --git a/include/liblas/capi/liblas.h b/include/liblas/capi/liblas.h
old mode 100755
new mode 100644
diff --git a/include/liblas/chipper.hpp b/include/liblas/chipper.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/classification.hpp b/include/liblas/classification.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/color.hpp b/include/liblas/color.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/compatibility.hpp b/include/liblas/compatibility.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/detail/binary.hpp b/include/liblas/detail/binary.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/detail/endian.hpp b/include/liblas/detail/endian.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/detail/file_ptr_stream.hpp b/include/liblas/detail/file_ptr_stream.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/detail/fwd.hpp b/include/liblas/detail/fwd.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/detail/index/indexcell.hpp b/include/liblas/detail/index/indexcell.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/detail/index/indexoutput.hpp b/include/liblas/detail/index/indexoutput.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/detail/opt_allocator.hpp b/include/liblas/detail/opt_allocator.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/detail/pointrecord.hpp b/include/liblas/detail/pointrecord.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/detail/private_utility.hpp b/include/liblas/detail/private_utility.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/detail/reader/cachedreader.hpp b/include/liblas/detail/reader/cachedreader.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/detail/reader/header.hpp b/include/liblas/detail/reader/header.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/detail/reader/reader.hpp b/include/liblas/detail/reader/reader.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/detail/reader/zipreader.hpp b/include/liblas/detail/reader/zipreader.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/detail/sha1.hpp b/include/liblas/detail/sha1.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/detail/singleton.hpp b/include/liblas/detail/singleton.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/detail/timer.hpp b/include/liblas/detail/timer.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/detail/writer/header.hpp b/include/liblas/detail/writer/header.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/detail/writer/point.hpp b/include/liblas/detail/writer/point.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/detail/writer/writer.hpp b/include/liblas/detail/writer/writer.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/detail/writer/zipwriter.hpp b/include/liblas/detail/writer/zipwriter.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/detail/zippoint.hpp b/include/liblas/detail/zippoint.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/dimension.hpp b/include/liblas/dimension.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/error.hpp b/include/liblas/error.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/exception.hpp b/include/liblas/exception.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/export.hpp b/include/liblas/export.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/external/property_tree/detail/exception_implementation.hpp b/include/liblas/external/property_tree/detail/exception_implementation.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/external/property_tree/detail/file_parser_error.hpp b/include/liblas/external/property_tree/detail/file_parser_error.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/external/property_tree/detail/info_parser_error.hpp b/include/liblas/external/property_tree/detail/info_parser_error.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/external/property_tree/detail/info_parser_read.hpp b/include/liblas/external/property_tree/detail/info_parser_read.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/external/property_tree/detail/info_parser_utils.hpp b/include/liblas/external/property_tree/detail/info_parser_utils.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/external/property_tree/detail/info_parser_write.hpp b/include/liblas/external/property_tree/detail/info_parser_write.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/external/property_tree/detail/info_parser_writer_settings.hpp b/include/liblas/external/property_tree/detail/info_parser_writer_settings.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/external/property_tree/detail/json_parser_error.hpp b/include/liblas/external/property_tree/detail/json_parser_error.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/external/property_tree/detail/json_parser_read.hpp b/include/liblas/external/property_tree/detail/json_parser_read.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/external/property_tree/detail/json_parser_write.hpp b/include/liblas/external/property_tree/detail/json_parser_write.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/external/property_tree/detail/ptree_implementation.hpp b/include/liblas/external/property_tree/detail/ptree_implementation.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/external/property_tree/detail/ptree_utils.hpp b/include/liblas/external/property_tree/detail/ptree_utils.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/external/property_tree/detail/rapidxml.hpp b/include/liblas/external/property_tree/detail/rapidxml.hpp
old mode 100755
new mode 100644
index e70360a..a6e9cd4
--- a/include/liblas/external/property_tree/detail/rapidxml.hpp
+++ b/include/liblas/external/property_tree/detail/rapidxml.hpp
@@ -377,7 +377,7 @@ namespace liblas { namespace property_tree { namespace detail {namespace rapidxm
         }
 
         //! Allocates a new node from the pool, and optionally assigns name and value to it. 
-        //! If the allocation request cannot be accomodated, this function will throw <code>std::bad_alloc</code>.
+        //! If the allocation request cannot be accommodated, this function will throw <code>std::bad_alloc</code>.
         //! If exceptions are disabled by defining RAPIDXML_NO_EXCEPTIONS, this function
         //! will call rapidxml::parse_error_handler() function.
         //! \param type Type of node to create.
@@ -410,7 +410,7 @@ namespace liblas { namespace property_tree { namespace detail {namespace rapidxm
         }
 
         //! Allocates a new attribute from the pool, and optionally assigns name and value to it.
-        //! If the allocation request cannot be accomodated, this function will throw <code>std::bad_alloc</code>.
+        //! If the allocation request cannot be accommodated, this function will throw <code>std::bad_alloc</code>.
         //! If exceptions are disabled by defining RAPIDXML_NO_EXCEPTIONS, this function
         //! will call rapidxml::parse_error_handler() function.
         //! \param name Name to assign to the attribute, or 0 to assign no name.
@@ -441,7 +441,7 @@ namespace liblas { namespace property_tree { namespace detail {namespace rapidxm
         }
 
         //! Allocates a char array of given size from the pool, and optionally copies a given string to it.
-        //! If the allocation request cannot be accomodated, this function will throw <code>std::bad_alloc</code>.
+        //! If the allocation request cannot be accommodated, this function will throw <code>std::bad_alloc</code>.
         //! If exceptions are disabled by defining RAPIDXML_NO_EXCEPTIONS, this function
         //! will call rapidxml::parse_error_handler() function.
         //! \param source String to initialize the allocated memory with, or 0 to not initialize it.
diff --git a/include/liblas/external/property_tree/detail/xml_parser_error.hpp b/include/liblas/external/property_tree/detail/xml_parser_error.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/external/property_tree/detail/xml_parser_flags.hpp b/include/liblas/external/property_tree/detail/xml_parser_flags.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/external/property_tree/detail/xml_parser_read_rapidxml.hpp b/include/liblas/external/property_tree/detail/xml_parser_read_rapidxml.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/external/property_tree/detail/xml_parser_utils.hpp b/include/liblas/external/property_tree/detail/xml_parser_utils.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/external/property_tree/detail/xml_parser_write.hpp b/include/liblas/external/property_tree/detail/xml_parser_write.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/external/property_tree/detail/xml_parser_writer_settings.hpp b/include/liblas/external/property_tree/detail/xml_parser_writer_settings.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/external/property_tree/exceptions.hpp b/include/liblas/external/property_tree/exceptions.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/external/property_tree/id_translator.hpp b/include/liblas/external/property_tree/id_translator.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/external/property_tree/info_parser.hpp b/include/liblas/external/property_tree/info_parser.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/external/property_tree/ini_parser.hpp b/include/liblas/external/property_tree/ini_parser.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/external/property_tree/json_parser.hpp b/include/liblas/external/property_tree/json_parser.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/external/property_tree/ptree.hpp b/include/liblas/external/property_tree/ptree.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/external/property_tree/ptree_fwd.hpp b/include/liblas/external/property_tree/ptree_fwd.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/external/property_tree/ptree_serialization.hpp b/include/liblas/external/property_tree/ptree_serialization.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/external/property_tree/stream_translator.hpp b/include/liblas/external/property_tree/stream_translator.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/external/property_tree/string_path.hpp b/include/liblas/external/property_tree/string_path.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/external/property_tree/xml_parser.hpp b/include/liblas/external/property_tree/xml_parser.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/factory.hpp b/include/liblas/factory.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/filter.hpp b/include/liblas/filter.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/header.hpp b/include/liblas/header.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/index.hpp b/include/liblas/index.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/iterator.hpp b/include/liblas/iterator.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/liblas.hpp b/include/liblas/liblas.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/point.hpp b/include/liblas/point.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/reader.hpp b/include/liblas/reader.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/schema.hpp b/include/liblas/schema.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/spatialreference.hpp b/include/liblas/spatialreference.hpp
old mode 100755
new mode 100644
index 3a31865..4392ed3
--- a/include/liblas/spatialreference.hpp
+++ b/include/liblas/spatialreference.hpp
@@ -56,10 +56,10 @@
 #include <string>
 
 // Fake out the compiler if we don't have libgeotiff includes already
-#if !defined(__geotiff_h_)
+#if !defined(__geotiff_h_) && !defined(LIBGEOTIFF_GEOTIFF_H_)
 typedef struct GTIFS *GTIF;
 #endif
-#if !defined(__geo_simpletags_h_)
+#if !defined(__geo_simpletags_h_) && !defined(LIBGEOTIFF_GEO_SIMPLETAGS_H_)
 typedef struct ST_TIFFS *ST_TIFF;
 #endif
 
@@ -199,7 +199,7 @@ private:
 LAS_DLL std::ostream& operator<<(std::ostream& ostr, const liblas::SpatialReference& srs);
 
 LAS_C_START
-#if defined(__geotiff_h_)
+#if defined(__geotiff_h_) || defined(LIBGEOTIFF_GEOTIFF_H_)
 #if defined(GEO_NORMALIZE_H_INCLUDED)
 char LAS_DLL * GTIFGetOGISDefn(GTIF*, GTIFDefn*);
 #endif
@@ -210,7 +210,7 @@ void SetLinearUnitCitation(GTIF* psGTIF, char* pszLinearUOMName);
 #if defined(_OGR_SRS_API_H_INCLUDED)
 void SetGeogCSCitation(GTIF* psGTIF, OGRSpatialReference* poSRS, char* angUnitName, int nDatum, short nSpheroid);
 #endif // defined _OGR_SRS_API_H_INCLUDED
-#endif // defined __geotiff_h_
+#endif // defined __geotiff_h_ || defined LIBGEOTIFF_GEOTIFF_H_
 
 LAS_C_END
 
diff --git a/include/liblas/transform.hpp b/include/liblas/transform.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/utility.hpp b/include/liblas/utility.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/variablerecord.hpp b/include/liblas/variablerecord.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/version.hpp b/include/liblas/version.hpp
old mode 100755
new mode 100644
diff --git a/include/liblas/writer.hpp b/include/liblas/writer.hpp
old mode 100755
new mode 100644
diff --git a/python/examples/add_vlr.py b/python/examples/add_vlr.py
old mode 100755
new mode 100644
diff --git a/python/examples/grab_classes.py b/python/examples/grab_classes.py
old mode 100755
new mode 100644
diff --git a/python/examples/oci_pc.py b/python/examples/oci_pc.py
old mode 100755
new mode 100644
diff --git a/python/liblas/__init__.py b/python/liblas/__init__.py
old mode 100755
new mode 100644
diff --git a/python/liblas/color.py b/python/liblas/color.py
old mode 100755
new mode 100644
diff --git a/python/liblas/core.py b/python/liblas/core.py
old mode 100755
new mode 100644
index a7c08da..97d142f
--- a/python/liblas/core.py
+++ b/python/liblas/core.py
@@ -48,7 +48,8 @@ import sys
 import ctypes
 from ctypes.util import find_library
 
-from ctypes import PyDLL
+if not 'pypy' in sys.executable:
+    from ctypes import PyDLL
 
 
 class LASException(Exception):
@@ -108,7 +109,7 @@ def check_value_free(result, func, cargs):
         raise LASException(msg)
 
     retval = ctypes.string_at(result)[:]
-    
+
     return retval
 
 
@@ -152,8 +153,8 @@ elif os.name == 'posix':
         lib_name = 'liblas_c.dylib'
         free = ctypes.CDLL(find_library('libc')).free
     else:
-        lib_name = 'liblas_c.so'
-        free = ctypes.CDLL(find_library('libc.so.6')).free
+        lib_name = 'liblas_c.so.3'
+        free = ctypes.CDLL(find_library('c')).free
     las = ctypes.CDLL(lib_name)
 else:
     raise LASException('Unsupported OS "%s"' % os.name)
@@ -798,7 +799,7 @@ las.LASHeader_SetCompressed.errcheck = check_return
 las.LASHeader_SetCompressed.restype = ctypes.c_int
 
 las.LASSchema_Create.argtypes = [ctypes.c_uint32]
-                                        
+
 las.LASSchema_Create.errcheck = check_void
 las.LASSchema_Create.restype = ctypes.c_void_p
 
diff --git a/python/liblas/file.py b/python/liblas/file.py
old mode 100755
new mode 100644
index f160ecf..0bab52f
--- a/python/liblas/file.py
+++ b/python/liblas/file.py
@@ -132,9 +132,9 @@ class File(object):
     def open(self):
         """Open the file for processing, called by __init__
         """
-        
+
         if self._mode == 'r' or self._mode == 'rb':
-            
+
             if not os.path.exists(self.filename):
                 raise OSError("No such file or directory: '%s'" % self.filename)
 
@@ -211,7 +211,7 @@ class File(object):
         """Closes the LAS file
         """
         if self.mode == 0:
-            try: 
+            try:
                 files['read'][self.filename] -= 1
                 if files['read'][self.filename] == 0:
                     files['read'].pop(self.filename)
@@ -225,10 +225,10 @@ class File(object):
             except:
                 files['write'].remove(self.filename)
             core.las.LASWriter_Destroy(self.handle)
-        
+
         if (self._header):
             core.las.LASHeader_Destroy(self._header)
-            
+
         self._header = None
         self.handle = None
 
@@ -270,7 +270,7 @@ class File(object):
         """Returns the liblas.header.Header for the file"""
         if not self.handle:
             return None
-        
+
         if self.mode == 0:
             return lasheader.Header(handle=core.las.LASReader_GetHeader(self.handle), owned=True)
         else:
@@ -282,7 +282,7 @@ class File(object):
         """Sets the liblas.header.Header for the file.  If the file is in \
         append mode, the header will be overwritten in the file."""
         # append mode
-        if mode == 2:
+        if self.mode == 2:
             core.las.LASWriter_Destroy(self.handle)
             self.handle = core.las.LASWriter_Create(self.handle, header, 2)
             self._header = core.las.LASHeader_Copy(header.handle)
@@ -309,7 +309,7 @@ class File(object):
             copy=True)
             p.set_header(lasheader.Header(handle=self._header, copy=False))
             return p
-            
+
     def seek(self, index):
         """Seeks to the point at the given index.  Subsequent calls \
 	   to :meth:`next` will then start at that point."""
@@ -385,16 +385,16 @@ class File(object):
                                     'be of type liblas.point.Point' % pt)
         if self.mode == 1 or self.mode == 2:
             core.las.LASWriter_WritePoint(self.handle, pt.handle)
-            
+
     def get_xmlsummary(self):
         """Returns an XML string summarizing all of the points in the reader
-        
+
         .. note::
-            This method will reset the reader's read position to the 0th 
-            point to summarize the entire file, and it will again reset the 
+            This method will reset the reader's read position to the 0th
+            point to summarize the entire file, and it will again reset the
             read position to the 0th point upon completion."""
         if self.mode != 0:
             raise core.LASException("file must be in read mode, not append or write mode to provide xml summary")
         return  core.las.LASReader_GetSummaryXML(self.handle)
-        
-    summary = property(get_xmlsummary, None, None, None)
\ No newline at end of file
+
+    summary = property(get_xmlsummary, None, None, None)
diff --git a/python/liblas/guid.py b/python/liblas/guid.py
old mode 100755
new mode 100644
diff --git a/python/liblas/header.py b/python/liblas/header.py
old mode 100755
new mode 100644
diff --git a/python/liblas/point.py b/python/liblas/point.py
old mode 100755
new mode 100644
diff --git a/python/liblas/schema.py b/python/liblas/schema.py
old mode 100755
new mode 100644
diff --git a/python/liblas/srs.py b/python/liblas/srs.py
old mode 100755
new mode 100644
diff --git a/python/liblas/vlr.py b/python/liblas/vlr.py
old mode 100755
new mode 100644
diff --git a/python/scripts/las2tindex.py b/python/scripts/las2tindex.py
old mode 100755
new mode 100644
diff --git a/python/setup.py b/python/setup.py
old mode 100755
new mode 100644
index 5c5dd1e..bcac982
--- a/python/setup.py
+++ b/python/setup.py
@@ -6,7 +6,7 @@ try:
     from setuptools import setup, Extension
 except ImportError:
     from distutils.core import setup, Extension
-    
+
 from sys import version_info
 
 try:
@@ -18,7 +18,7 @@ install_requires = ['setuptools']
 
 import os
 
-version = '1.8.0'
+version = '1.8.1'
 
 import socket
 
@@ -28,7 +28,7 @@ if socket.gethostname() == 'fire-windows':
                          r'D:\liblas\bin\RelWithDebInfo\liblas.dll',]),]
 else:
     data_files = None
-        
+
 setup(name          = 'libLAS',
       version       = version,
       description   = 'LAS 1.0/1.1/1.2 LiDAR data format translation',
diff --git a/python/tests/Color.txt b/python/tests/Color.txt
old mode 100755
new mode 100644
diff --git a/python/tests/File.txt b/python/tests/File.txt
old mode 100755
new mode 100644
diff --git a/python/tests/GUID.txt b/python/tests/GUID.txt
old mode 100755
new mode 100644
diff --git a/python/tests/Header.txt b/python/tests/Header.txt
old mode 100755
new mode 100644
diff --git a/python/tests/Point.txt b/python/tests/Point.txt
old mode 100755
new mode 100644
diff --git a/python/tests/SRS-GDAL.txt b/python/tests/SRS-GDAL.txt
old mode 100755
new mode 100644
diff --git a/python/tests/SRS-GeoTIFF.txt b/python/tests/SRS-GeoTIFF.txt
old mode 100755
new mode 100644
diff --git a/python/tests/SRS.txt b/python/tests/SRS.txt
old mode 100755
new mode 100644
diff --git a/python/tests/Schema.txt b/python/tests/Schema.txt
old mode 100755
new mode 100644
diff --git a/python/tests/VLR.txt b/python/tests/VLR.txt
old mode 100755
new mode 100644
diff --git a/python/tests/__init__.py b/python/tests/__init__.py
old mode 100755
new mode 100644
diff --git a/python/tests/test_doctests.py b/python/tests/test_doctests.py
old mode 100755
new mode 100644
diff --git a/rpm/libLAS.spec b/rpm/libLAS.spec
old mode 100755
new mode 100644
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
old mode 100755
new mode 100644
index e4f6ba2..8f9b2a6
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -244,11 +244,11 @@ if (APPLE)
   set_target_properties(
     ${LIBLAS_C_LIB_NAME}
     PROPERTIES
-    INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib" BUILD_WITH_INSTALL_RPATH OFF)
+    INSTALL_NAME_DIR "@rpath" BUILD_WITH_INSTALL_RPATH ON)
   set_target_properties(
     ${LIBLAS_LIB_NAME}
     PROPERTIES
-    INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib" BUILD_WITH_INSTALL_RPATH OFF)
+    INSTALL_NAME_DIR "@rpath" BUILD_WITH_INSTALL_RPATH ON)
 endif()
 
 ###############################################################################
diff --git a/src/Version.rc b/src/Version.rc
old mode 100755
new mode 100644
diff --git a/src/c_api.cpp b/src/c_api.cpp
old mode 100755
new mode 100644
diff --git a/src/chipper.cpp b/src/chipper.cpp
old mode 100755
new mode 100644
diff --git a/src/classification.cpp b/src/classification.cpp
old mode 100755
new mode 100644
diff --git a/src/color.cpp b/src/color.cpp
old mode 100755
new mode 100644
diff --git a/src/detail/index/indexcell.cpp b/src/detail/index/indexcell.cpp
old mode 100755
new mode 100644
diff --git a/src/detail/index/indexoutput.cpp b/src/detail/index/indexoutput.cpp
old mode 100755
new mode 100644
diff --git a/src/detail/reader/cachedreader.cpp b/src/detail/reader/cachedreader.cpp
old mode 100755
new mode 100644
diff --git a/src/detail/reader/header.cpp b/src/detail/reader/header.cpp
old mode 100755
new mode 100644
index f396091..4773bd2
--- a/src/detail/reader/header.cpp
+++ b/src/detail/reader/header.cpp
@@ -370,9 +370,11 @@ void Header::ReadVLRs()
         uint16_t length = vlrh.recordLengthAfterHeader;
 
         std::vector<uint8_t> data(length);
-
-        read_n(data.front(), m_ifs, length);
-         
+        if (length > 0)
+        {
+            read_n(data.front(), m_ifs, length);
+        }
+        
         VariableRecord vlr;
         vlr.SetReserved(vlrh.reserved);
         vlr.SetUserId(std::string(vlrh.userId, VariableRecord::eUserIdSize));
diff --git a/src/detail/reader/reader.cpp b/src/detail/reader/reader.cpp
old mode 100755
new mode 100644
diff --git a/src/detail/reader/zipreader.cpp b/src/detail/reader/zipreader.cpp
old mode 100755
new mode 100644
diff --git a/src/detail/sha1.cpp b/src/detail/sha1.cpp
old mode 100755
new mode 100644
diff --git a/src/detail/utility.cpp b/src/detail/utility.cpp
old mode 100755
new mode 100644
diff --git a/src/detail/writer/header.cpp b/src/detail/writer/header.cpp
old mode 100755
new mode 100644
index db92971..bf2d251
--- a/src/detail/writer/header.cpp
+++ b/src/detail/writer/header.cpp
@@ -360,7 +360,10 @@ void Header::WriteVLRs()
         detail::write_n(m_ofs, vlr.GetDescription(true).c_str(), 32);
         std::vector<uint8_t> const& data = vlr.GetData();
         std::streamsize const size = static_cast<std::streamsize>(data.size());
-        detail::write_n(m_ofs, data.front(), size);
+        if(size > 0)
+        {
+            detail::write_n(m_ofs, data.front(), size);
+        }
     }
 
 
diff --git a/src/detail/writer/point.cpp b/src/detail/writer/point.cpp
old mode 100755
new mode 100644
diff --git a/src/detail/writer/writer.cpp b/src/detail/writer/writer.cpp
old mode 100755
new mode 100644
diff --git a/src/detail/writer/zipwriter.cpp b/src/detail/writer/zipwriter.cpp
old mode 100755
new mode 100644
index 1625bd0..8c69467
--- a/src/detail/writer/zipwriter.cpp
+++ b/src/detail/writer/zipwriter.cpp
@@ -2,40 +2,40 @@
  * $Id$
  *
  * Project:  libLAS - http://liblas.org - A BSD library for LAS format data.
- * Purpose:  laszip writer implementation for C++ libLAS 
+ * Purpose:  laszip writer implementation for C++ libLAS
  * Author:   Michael P. Gerlek (mpg at flaxen.com)
  *
  ******************************************************************************
  * Copyright (c) 2010, Michael P. Gerlek
  *
  * All rights reserved.
- * 
- * Redistribution and use in source and binary forms, with or without 
- * modification, are permitted provided that the following 
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following
  * conditions are met:
- * 
- *     * Redistributions of source code must retain the above copyright 
+ *
+ *     * Redistributions of source code must retain the above copyright
  *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above copyright 
- *       notice, this list of conditions and the following disclaimer in 
- *       the documentation and/or other materials provided 
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided
  *       with the distribution.
- *     * Neither the name of the Martin Isenburg or Iowa Department 
- *       of Natural Resources nor the names of its contributors may be 
- *       used to endorse or promote products derived from this software 
+ *     * Neither the name of the Martin Isenburg or Iowa Department
+ *       of Natural Resources nor the names of its contributors may be
+ *       used to endorse or promote products derived from this software
  *       without specific prior written permission.
- * 
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
  * OF SUCH DAMAGE.
  ****************************************************************************/
 
@@ -57,12 +57,12 @@
 #include <cstdlib> // std::size_t
 #include <cassert>
 
-namespace liblas { namespace detail { 
+namespace liblas { namespace detail {
 
 ZipWriterImpl::ZipWriterImpl(std::ostream& ofs) :
-    m_ofs(ofs), 
-    //m_point_writer(PointWriterPtr( )), 
-    m_header_writer(HeaderWriterPtr()), 
+    m_ofs(ofs),
+    //m_point_writer(PointWriterPtr( )),
+    m_header_writer(HeaderWriterPtr()),
     m_pointCount(0),
     m_zipper(NULL),
     m_zipPoint(NULL)
@@ -74,9 +74,9 @@ ZipWriterImpl::ZipWriterImpl(std::ostream& ofs) :
 void ZipWriterImpl::WriteHeader()
 {
     m_header_writer = HeaderWriterPtr(new writer::Header(m_ofs, m_pointCount, *m_header) );
-    
+
     m_header_writer->write();
-    
+
     m_header = HeaderPtr(new liblas::Header(m_header_writer->GetHeader()));
 
     if (!m_zipper)
@@ -94,7 +94,7 @@ void ZipWriterImpl::WriteHeader()
             throw liblas_error(oss.str());
         }
     }
-    
+
 }
 
 void ZipWriterImpl::UpdatePointCount(boost::uint32_t count)
@@ -102,12 +102,12 @@ void ZipWriterImpl::UpdatePointCount(boost::uint32_t count)
     std::streamoff orig_pos = m_ofs.tellp();
 
     boost::uint32_t out = m_pointCount;
-    
+
     if ( count != 0 ) { out = count; }
-    
+
     if (!m_ofs.good() ) return;
     // Skip to first byte of number of point records data member
-    std::streamsize const dataPos = 107; 
+    std::streamsize const dataPos = 107;
     m_ofs.seekp(dataPos, std::ios::beg);
     detail::write_n(m_ofs, out , sizeof(out));
 
@@ -119,8 +119,15 @@ void ZipWriterImpl::WritePoint(liblas::Point const& point)
 {
 
     bool ok = false;
-    const std::vector<boost::uint8_t>* data = &point.GetData();
-    assert(data->size() == m_zipPoint->m_lz_point_size);
+    const std::vector<boost::uint8_t>* data(0);
+    data = &point.GetData();
+
+    liblas::Point resized(point);
+    if (data->size() != m_zipPoint->m_lz_point_size)
+    {
+        resized.SetHeader(m_header.get());
+        data = &resized.GetData();
+    }
 
     for (unsigned int i=0; i<m_zipPoint->m_lz_point_size; i++)
     {
@@ -187,7 +194,7 @@ void ZipWriterImpl::SetHeader(liblas::Header const& header)
 
     if (!m_zipPoint)
     {
-            
+
         PointFormatName format = m_header->GetDataFormatId();
 
         boost::scoped_ptr<ZipPoint> z(new ZipPoint(format, m_header->GetVLRs()));
diff --git a/src/detail/zippoint.cpp b/src/detail/zippoint.cpp
old mode 100755
new mode 100644
diff --git a/src/dimension.cpp b/src/dimension.cpp
old mode 100755
new mode 100644
diff --git a/src/error.cpp b/src/error.cpp
old mode 100755
new mode 100644
diff --git a/src/factory.cpp b/src/factory.cpp
old mode 100755
new mode 100644
diff --git a/src/filter.cpp b/src/filter.cpp
old mode 100755
new mode 100644
diff --git a/src/gt_citation.cpp b/src/gt_citation.cpp
old mode 100755
new mode 100644
diff --git a/src/gt_citation.h b/src/gt_citation.h
old mode 100755
new mode 100644
diff --git a/src/gt_wkt_srs.cpp b/src/gt_wkt_srs.cpp
index ca31677..4ef3c42 100755
--- a/src/gt_wkt_srs.cpp
+++ b/src/gt_wkt_srs.cpp
@@ -433,7 +433,7 @@ char *GTIFGetOGISDefn( GTIF *hGTIF, GTIFDefn * psDefn )
                     && psDefn->UOMLengthInMeters != 1.0 )
                 {
                     psDefn->ProjParm[iParm] /= psDefn->UOMLengthInMeters;
-                    CPLDebug( "GTIFF", "converting geokey to accomodate old broken file due to GTIFF_LINEAR_UNITS=BROKEN setting." );
+                    CPLDebug( "GTIFF", "converting geokey to accommodate old broken file due to GTIFF_LINEAR_UNITS=BROKEN setting." );
                 }
                 break;
 
diff --git a/src/gt_wkt_srs.h b/src/gt_wkt_srs.h
old mode 100755
new mode 100644
diff --git a/src/gt_wkt_srs_for_gdal.h b/src/gt_wkt_srs_for_gdal.h
old mode 100755
new mode 100644
diff --git a/src/header.cpp b/src/header.cpp
old mode 100755
new mode 100644
index 45bafd7..9987ce1
--- a/src/header.cpp
+++ b/src/header.cpp
@@ -1,914 +1,914 @@
-/******************************************************************************
- * $Id$
- *
- * Project:  libLAS - http://liblas.org - A BSD library for LAS format data.
- * Purpose:  LAS header class 
- * Author:   Mateusz Loskot, mateusz at loskot.net
- *
- ******************************************************************************
- * Copyright (c) 2008, Mateusz Loskot
- * Copyright (c) 2008, Phil Vachon
- *
- * All rights reserved.
- * 
- * Redistribution and use in source and binary forms, with or without 
- * modification, are permitted provided that the following 
- * conditions are met:
- * 
- *     * Redistributions of source code must retain the above copyright 
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above copyright 
- *       notice, this list of conditions and the following disclaimer in 
- *       the documentation and/or other materials provided 
- *       with the distribution.
- *     * Neither the name of the Martin Isenburg or Iowa Department 
- *       of Natural Resources nor the names of its contributors may be 
- *       used to endorse or promote products derived from this software 
- *       without specific prior written permission.
- * 
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
- * OF SUCH DAMAGE.
- ****************************************************************************/
-
-#include <liblas/header.hpp>
-#include <liblas/spatialreference.hpp>
-#include <liblas/schema.hpp>
-#include <liblas/detail/private_utility.hpp>
-#include <liblas/utility.hpp>
-
-#ifdef HAVE_LASZIP
-#include <liblas/detail/zippoint.hpp>
-#include <laszip/laszip.hpp>
-#endif
-
-// boost
-#include <boost/cstdint.hpp>
-#include <boost/lambda/lambda.hpp>
-
-//std
-#include <algorithm>
-#include <fstream>
-#include <stdexcept>
-#include <string>
-#include <vector>
-#include <cstring> // std::memset, std::memcpy, std::strncpy
-#include <cassert>
-#include <ctime>
-
-using namespace boost;
-
-namespace liblas {
-
-char const* const Header::FileSignature = "LASF";
-char const* const Header::SystemIdentifier = "libLAS";
-char const* const Header::SoftwareIdentifier = "libLAS 1.8.0";
-
-
-Header::Header() : m_schema(ePointFormat3)
-{
-    Init();
-}
-
-Header::Header(Header const& other) :
-    m_sourceId(other.m_sourceId),
-    m_reserved(other.m_reserved),
-    m_projectGuid(other.m_projectGuid),
-    m_versionMajor(other.m_versionMajor),
-    m_versionMinor(other.m_versionMinor),
-    m_createDOY(other.m_createDOY),
-    m_createYear(other.m_createYear),
-    m_headerSize(other.m_headerSize),
-    m_dataOffset(other.m_dataOffset),
-    m_recordsCount(other.m_recordsCount),
-    // m_dataFormatId(other.m_dataFormatId),
-    // m_dataRecordLen(other.m_dataRecordLen),
-    m_pointRecordsCount(other.m_pointRecordsCount),
-    m_scales(other.m_scales),
-    m_offsets(other.m_offsets),
-    m_extent(other.m_extent),
-    m_srs(other.m_srs),
-    m_schema(other.m_schema),
-    m_isCompressed(other.m_isCompressed),
-    m_headerPadding(other.m_headerPadding)
-{
-    void* p = 0;
-
-    p = std::memcpy(m_signature, other.m_signature, eFileSignatureSize);
-    assert(p == m_signature);
-    p = std::memcpy(m_systemId, other.m_systemId, eSystemIdSize);
-    assert(p == m_systemId);
-    p = std::memcpy(m_softwareId, other.m_softwareId, eSoftwareIdSize);
-    assert(p == m_softwareId);
-    std::vector<uint32_t>(other.m_pointRecordsByReturn).swap(m_pointRecordsByReturn);
-    assert(ePointsByReturnSize >= m_pointRecordsByReturn.size());
-    
-    std::vector<VariableRecord>(other.m_vlrs).swap(m_vlrs);
-
-}
-
-Header& Header::operator=(Header const& rhs)
-{
-    if (&rhs != this)
-    {
-        void* p = 0;
-        p = std::memcpy(m_signature, rhs.m_signature, eFileSignatureSize);
-        assert(p == m_signature);
-        m_sourceId = rhs.m_sourceId;
-        m_reserved = rhs.m_reserved;
-        m_projectGuid = rhs.m_projectGuid;
-        m_versionMajor = rhs.m_versionMajor;
-        m_versionMinor = rhs.m_versionMinor;
-        p = std::memcpy(m_systemId, rhs.m_systemId, eSystemIdSize);
-        assert(p == m_systemId);
-        p = std::memcpy(m_softwareId, rhs.m_softwareId, eSoftwareIdSize);
-        assert(p == m_softwareId);
-        m_createDOY = rhs.m_createDOY;
-        m_createYear = rhs.m_createYear;
-        m_headerSize = rhs.m_headerSize;
-        m_dataOffset = rhs.m_dataOffset;
-        m_recordsCount = rhs.m_recordsCount;
-        m_pointRecordsCount = rhs.m_pointRecordsCount;
-        
-        std::vector<uint32_t>(rhs.m_pointRecordsByReturn).swap(m_pointRecordsByReturn);
-        assert(ePointsByReturnSize >= m_pointRecordsByReturn.size());
-
-        std::vector<VariableRecord>(rhs.m_vlrs).swap(m_vlrs);
-        m_scales = rhs.m_scales;
-        m_offsets = rhs.m_offsets;
-        m_extent = rhs.m_extent;
-        m_srs = rhs.m_srs;
-        m_schema = rhs.m_schema;
-        m_isCompressed = rhs.m_isCompressed;
-        m_headerPadding = rhs.m_headerPadding;
-
-    }
-    return *this;
-}
-
-bool Header::operator==(Header const& other) const
-{
-    if (&other == this) return true;
-
-    if (m_scales != other.m_scales) return false;
-    if (m_offsets != other.m_offsets) return false;
-    
-    if (m_signature != other.m_signature) return false;
-    if (m_sourceId != other.m_sourceId) return false;
-    if (m_reserved != other.m_reserved) return false;
-    if (m_projectGuid != other.m_projectGuid) return false;
-    if (m_versionMajor != other.m_versionMajor) return false;
-    if (m_versionMinor != other.m_versionMinor) return false;
-    if (m_systemId != other.m_systemId) return false;
-    if (m_softwareId != other.m_softwareId) return false;
-    if (m_createDOY != other.m_createDOY) return false;
-    if (m_createYear != other.m_createYear) return false;
-    if (m_headerSize != other.m_headerSize) return false;
-    if (m_dataOffset != other.m_dataOffset) return false;
-    if (m_recordsCount != other.m_recordsCount) return false;
-    if (m_pointRecordsCount != other.m_pointRecordsCount) return false;
-    if (m_pointRecordsByReturn != other.m_pointRecordsByReturn) return false;
-    if (m_extent != other.m_extent) return false;
-    if (m_isCompressed != other.m_isCompressed) return false;
-    if (m_headerPadding != other.m_headerPadding) return false;
-    if (m_schema != other.m_schema) return false;
-    return true;
-}
-
-
-std::string Header::GetFileSignature() const
-{
-    return std::string(m_signature, eFileSignatureSize);
-}
-
-void Header::SetFileSignature(std::string const& v)
-{
-    if (0 != v.compare(0, eFileSignatureSize, FileSignature))
-        throw std::invalid_argument("invalid file signature");
-
-    std::strncpy(m_signature, v.c_str(), eFileSignatureSize);
-}
-
-uint16_t Header::GetFileSourceId() const
-{
-    return m_sourceId;
-}
-
-void Header::SetFileSourceId(uint16_t v)
-{
-    // TODO: Should we warn or throw about type overflow occuring when
-    //       user passes 65535 + 1 = 0
-    m_sourceId = v;
-}
-
-uint16_t Header::GetReserved() const
-{
-    return m_reserved;
-}
-
-void Header::SetReserved(uint16_t v)
-{
-    // TODO: Should we warn or throw about type overflow occuring when
-    //       user passes 65535 + 1 = 0
-    m_reserved = v;
-}
-
-boost::uuids::uuid Header::GetProjectId() const
-{
-    return m_projectGuid;
-}
-
-void Header::SetProjectId(boost::uuids::uuid const& v)
-{
-    m_projectGuid = v;
-}
-
-uint8_t Header::GetVersionMajor() const
-{
-    return m_versionMajor;
-}
-
-void Header::SetVersionMajor(uint8_t v)
-{
-    if (eVersionMajorMin > v || v > eVersionMajorMax)
-        throw std::out_of_range("version major out of range");
-
-    m_versionMajor = v;
-}
-
-uint8_t Header::GetVersionMinor() const
-{
-    return m_versionMinor;
-}
-
-void Header::SetVersionMinor(uint8_t v)
-{
-    if (v > eVersionMinorMax)
-        throw std::out_of_range("version minor out of range");
-    
-    m_versionMinor = v;
-
-
-}
-
-std::string Header::GetSystemId(bool pad /*= false*/) const
-{
-    // copy array of chars and trim zeros if smaller than 32 bytes
-    std::string tmp(std::string(m_systemId, eSystemIdSize).c_str());
-
-    // pad right side with spaces
-    if (pad && tmp.size() < eSystemIdSize)
-    {
-        tmp.resize(eSystemIdSize, 0);
-        assert(tmp.size() == eSystemIdSize);
-    }
-
-    assert(tmp.size() <= eSystemIdSize);
-    return tmp;
-}
-
-void Header::SetSystemId(std::string const& v)
-{
-    if (v.size() > eSystemIdSize)
-        throw std::invalid_argument("system id too long");
-
-    std::fill(m_systemId, m_systemId + eSystemIdSize, 0);
-    std::strncpy(m_systemId, v.c_str(), eSystemIdSize);
-}
-
-std::string Header::GetSoftwareId(bool pad /*= false*/) const
-{
-    std::string tmp(std::string(m_softwareId, eSoftwareIdSize).c_str());
-
-    // pad right side with spaces
-    if (pad && tmp.size() < eSoftwareIdSize)
-    {
-        tmp.resize(eSoftwareIdSize, 0);
-        assert(tmp.size() == eSoftwareIdSize);
-    }
-
-    assert(tmp.size() <= eSoftwareIdSize);
-    return tmp;
-}
-
-void Header::SetSoftwareId(std::string const& v)
-{
-    if (v.size() > eSoftwareIdSize)
-        throw std::invalid_argument("generating software id too long");
-    
-//    m_softwareId = v;
-    std::fill(m_softwareId, m_softwareId + eSoftwareIdSize, 0);
-    std::strncpy(m_softwareId, v.c_str(), eSoftwareIdSize);
-}
-
-uint16_t Header::GetCreationDOY() const
-{
-    return m_createDOY;
-}
-
-void Header::SetCreationDOY(uint16_t v)
-{
-    m_createDOY = v;
-}
-
-uint16_t Header::GetCreationYear() const
-{
-    return m_createYear;
-}
-
-void Header::SetCreationYear(uint16_t v)
-{
-    m_createYear = v;
-}
-
-uint16_t Header::GetHeaderSize() const
-{
-    return m_headerSize;
-}
-
-void Header::SetHeaderSize(uint16_t v)
-{
-
-    m_headerSize = v;
-}
-
-uint32_t Header::GetDataOffset() const
-{
-    return m_dataOffset;
-}
-
-void Header::SetDataOffset(uint32_t v)
-{
-    m_dataOffset = v;
-}
-
-uint32_t Header::GetHeaderPadding() const
-{
-    return m_headerPadding;
-}
-
-uint32_t Header::GetVLRBlockSize() const
-{
-    uint32_t vlr_total_size = 0;
-
-    for (uint32_t i = 0; i < GetRecordsCount(); ++i)
-    {
-        VariableRecord const & vlr = GetVLR(i);
-        vlr_total_size += static_cast<uint32_t>(vlr.GetTotalSize());
-    }
-
-    return vlr_total_size;
-}
-
-void Header::SetHeaderPadding(uint32_t v)
-{
-    m_headerPadding = v;
-}
-
-uint32_t Header::GetRecordsCount() const
-{
-    return m_recordsCount;
-}
-
-void Header::SetRecordsCount(uint32_t v)
-{
-    m_recordsCount = v;
-}
-
-liblas::PointFormatName Header::GetDataFormatId() const
-{
-    return m_schema.GetDataFormatId();
-
-}
-
-void Header::SetDataFormatId(liblas::PointFormatName v)
-{
-    m_schema.SetDataFormatId(v);
-}
-
-uint16_t Header::GetDataRecordLength() const
-{
-    // No matter what the schema says, this must be a a short in size.
-    return static_cast<uint16_t>(m_schema.GetByteSize());
-}
-
-uint32_t Header::GetPointRecordsCount() const
-{
-    return m_pointRecordsCount;
-}
-
-void Header::SetPointRecordsCount(uint32_t v)
-{
-    m_pointRecordsCount = v;
-}
-
-Header::RecordsByReturnArray const& Header::GetPointRecordsByReturnCount() const
-{
-    return m_pointRecordsByReturn;
-}
-
-void Header::SetPointRecordsByReturnCount(std::size_t index, uint32_t v)
-{
-    assert(m_pointRecordsByReturn.size() == Header::ePointsByReturnSize);
-
-    uint32_t& t = m_pointRecordsByReturn.at(index);
-    t = v;
-}
-
-
-double Header::GetScaleX() const
-{
-    return m_scales.x;
-}
-
-double Header::GetScaleY() const
-{
-    return m_scales.y;
-}
-
-double Header::GetScaleZ() const
-{
-    return m_scales.z;
-}
-
-void Header::SetScale(double x, double y, double z)
-{
-
-    // double const minscale = 0.01;
-    m_scales.x = x;
-    m_scales.y = y;
-    m_scales.z = z;
-}
-
-double Header::GetOffsetX() const
-{
-    return m_offsets.x;
-}
-
-double Header::GetOffsetY() const
-{
-    return m_offsets.y;
-}
-
-double Header::GetOffsetZ() const
-{
-    return m_offsets.z;
-}
-
-void Header::SetOffset(double x, double y, double z)
-{
-    m_offsets = PointOffsets(x, y, z);
-}
-
-double Header::GetMaxX() const
-{
-    return (m_extent.max)(0);
-}
-
-double Header::GetMinX() const
-{
-    return (m_extent.min)(0);
-}
-
-double Header::GetMaxY() const
-{
-    return (m_extent.max)(1);
-}
-
-double Header::GetMinY() const
-{
-    return (m_extent.min)(1);
-}
-
-double Header::GetMaxZ() const
-{
-    return (m_extent.max)(2);
-}
-
-double Header::GetMinZ() const
-{
-    return (m_extent.min)(2);
-}
-
-void Header::SetMax(double x, double y, double z)
-{
-    // m_extent = Bounds(m_extent.min(0), m_extent.min(1), m_extent.max(0), m_extent.max(1), m_extent.min(2), m_extent.max(2));
-    // Bounds(minx, miny, minz, maxx, maxy, maxz)
-    m_extent = Bounds<double>((m_extent.min)(0), (m_extent.min)(1), (m_extent.min)(2), x, y, z);
-}
-
-void Header::SetMin(double x, double y, double z)
-{
-    m_extent = Bounds<double>(x, y, z, (m_extent.max)(0), (m_extent.max)(1), (m_extent.max)(2));
-}
-
-void Header::SetExtent(Bounds<double> const& extent)
-{
-    m_extent = extent;
-}
-
-const Bounds<double>& Header::GetExtent() const
-{
-    return m_extent;
-}
-
-void Header::AddVLR(VariableRecord const& v) 
-{
-    m_vlrs.push_back(v);
-    m_recordsCount += 1;
-}
-
-VariableRecord const& Header::GetVLR(uint32_t index) const 
-{
-    return m_vlrs[index];
-}
-
-const std::vector<VariableRecord>& Header::GetVLRs() const
-{
-    return m_vlrs;
-}
-
-void Header::DeleteVLR(uint32_t index) 
-{    
-    if (index >= m_vlrs.size())
-        throw std::out_of_range("index is out of range");
-
-    std::vector<VariableRecord>::iterator i = m_vlrs.begin() + index;
-
-    m_vlrs.erase(i);
-    m_recordsCount = static_cast<uint32_t>(m_vlrs.size());
-
-}
-
-
-void Header::Init()
-{
-    // Initialize public header block with default
-    // values according to LAS 1.2
-
-    m_versionMajor = 1;
-    m_versionMinor = 2;
-    
-    m_createDOY = m_createYear = 0;
-    std::time_t now;
-    std::time(&now);
-    std::tm* ptm = std::gmtime(&now);
-    if (0 != ptm)
-    {
-        m_createDOY = static_cast<uint16_t>(ptm->tm_yday);
-        m_createYear = static_cast<uint16_t>(ptm->tm_year + 1900);
-    }
-
-    m_headerSize = eHeaderSize;
-    
-    m_projectGuid = boost::uuids::nil_uuid();
-    m_sourceId = m_reserved = uint16_t();
-
-    m_dataOffset = eHeaderSize; // excluding 2 bytes of Point Data Start Signature
-    m_headerPadding = 0;
-    m_recordsCount = 0;
-    m_pointRecordsCount = 0;
-
-    std::memset(m_signature, 0, eFileSignatureSize);
-    std::strncpy(m_signature, FileSignature, eFileSignatureSize);
-
-    std::memset(m_systemId, 0, eSystemIdSize);
-    std::strncpy(m_systemId, SystemIdentifier, eSystemIdSize);
-
-    std::memset(m_softwareId, 0, eSoftwareIdSize);
-    std::strncpy(m_softwareId, SoftwareIdentifier, eSoftwareIdSize);
-
-    m_pointRecordsByReturn.resize(ePointsByReturnSize);
-
-    SetScale(1.0, 1.0, 1.0);
-
-    m_isCompressed = false;
-}
-
-bool SameVLRs(std::string const& name, uint16_t id, liblas::VariableRecord const& record)
-{
-    if (record.GetUserId(false) == name) {
-        if (record.GetRecordId() == id) {
-            return true;
-        }
-    }
-    return false;
-}
-
-
-void Header::DeleteVLRs(std::string const& name, uint16_t id)
-{
-
-    m_vlrs.erase( std::remove_if( m_vlrs.begin(), 
-                                  m_vlrs.end(),
-                                  boost::bind( &SameVLRs, name, id, _1 ) ),
-                  m_vlrs.end());
-
-    m_recordsCount = static_cast<uint32_t>(m_vlrs.size());        
-
-}
-
-
-
-void Header::SetGeoreference() 
-{    
-    std::vector<VariableRecord> vlrs = m_srs.GetVLRs();
-
-    // Wipe the GeoTIFF-related VLR records off of the Header
-    DeleteVLRs("LASF_Projection", 34735);
-    DeleteVLRs("LASF_Projection", 34736);
-    DeleteVLRs("LASF_Projection", 34737);
-
-    std::vector<VariableRecord>::const_iterator i;
-
-    for (i = vlrs.begin(); i != vlrs.end(); ++i) 
-    {
-        AddVLR(*i);
-    }
-}
-
-SpatialReference Header::GetSRS() const
-{
-    return m_srs;
-}
-
-void Header::SetSRS(SpatialReference& srs)
-{
-    m_srs = srs;
-}
-
-Schema const& Header::GetSchema() const
-{
-    
-    return m_schema;
-}
-
-void Header::SetSchema(const Schema& format)
-{
-
-    m_schema = format;
-    
-    // Reset the X, Y, Z dimensions with offset and scale values
-    boost::optional< Dimension const& > x_c = m_schema.GetDimension("X");
-    if (!x_c)
-        throw liblas_error("X dimension not on schema, you\'ve got big problems!");
-    liblas::Dimension x(*x_c);
-    x.SetScale(m_scales.x);
-    x.IsFinitePrecision(true);
-    x.SetOffset(m_offsets.x);
-    m_schema.AddDimension(x);
-    
-    boost::optional< Dimension const& > y_c = m_schema.GetDimension("Y");
-    liblas::Dimension y(*y_c);
-    y.SetScale(m_scales.y);
-    y.IsFinitePrecision(true);
-    y.SetOffset(m_offsets.y);
-    m_schema.AddDimension(y);
-    
-    boost::optional< Dimension const& > z_c = m_schema.GetDimension("Z");
-
-    liblas::Dimension z(*z_c);
-    z.SetScale(m_scales.z);
-    z.IsFinitePrecision(true);
-    z.SetOffset(m_offsets.z);
-    m_schema.AddDimension(z);
-    
-} 
-
-void Header::SetCompressed(bool b)
-{
-    m_isCompressed = b;
-}
-
-bool Header::Compressed() const
-{
-    return m_isCompressed;
-}
-
-liblas::property_tree::ptree Header::GetPTree( ) const
-{
-    using liblas::property_tree::ptree;
-    ptree pt;
-    
-    pt.put("filesignature", GetFileSignature());
-    pt.put("projectdid", GetProjectId());
-
-    pt.put("systemid", GetSystemId());
-    pt.put("softwareid", GetSoftwareId());
-    
-    
-    std::ostringstream version;
-    version << static_cast<int>(GetVersionMajor());
-    version <<".";
-    version << static_cast<int>(GetVersionMinor());
-    pt.put("version", version.str());
-    
-    pt.put("filesourceid", GetFileSourceId());
-    pt.put("reserved", GetReserved());
-
-    ptree srs = GetSRS().GetPTree();
-    pt.add_child("srs", srs);
-    
-    std::ostringstream date;
-    date << GetCreationDOY() << "/" << GetCreationYear();
-    pt.put("date", date.str());
-    
-    pt.put("size", GetHeaderSize());
-    pt.put("dataoffset", GetDataOffset());
-    pt.put("header_padding", GetHeaderPadding());
-
-    pt.put("count", GetPointRecordsCount());
-    pt.put("dataformatid", GetDataFormatId());
-    pt.put("datarecordlength", GetDataRecordLength());
-    pt.put("compressed", Compressed());
-
-#ifdef HAVE_LASZIP
-    liblas::detail::ZipPoint zp(GetDataFormatId(), GetVLRs());
-    LASzip* laszip = zp.GetZipper();
-    std::ostringstream zip_version;
-    zip_version <<"LASzip Version " 
-                << (int)laszip->version_major << "." 
-                << (int)laszip->version_minor << "r"
-                << (int)laszip->version_revision << " c" 
-                << (int)laszip->compressor;
-    if (laszip->compressor == LASZIP_COMPRESSOR_CHUNKED) 
-        zip_version << " "<< (int)laszip->chunk_size << ":";
-    else
-        zip_version << ":";
-    for (int i = 0; i < (int)laszip->num_items; i++) 
-        zip_version <<" "<< laszip->items[i].get_name()<<" "<<  (int)laszip->items[i].version;
-
-    pt.put("compression_info", zip_version.str());
-#endif
-
-    ptree return_count;
-    liblas::Header::RecordsByReturnArray returns = GetPointRecordsByReturnCount();
-    for (uint32_t i=0; i< 5; i++){
-        ptree r;
-        r.put("id", i);
-        r.put("count", returns[i]);
-        return_count.add_child("return", r);
-    }
-    pt.add_child("returns", return_count);
-    
-    pt.put("scale.x", GetScaleX());
-    pt.put("scale.y", GetScaleY());
-    pt.put("scale.z", GetScaleZ());
-    
-    pt.put("offset.x", GetOffsetX());
-    pt.put("offset.y", GetOffsetY());
-    pt.put("offset.z", GetOffsetZ());
-    
-    pt.put("minimum.x", GetMinX());
-    pt.put("minimum.y", GetMinY());
-    pt.put("minimum.z", GetMinZ());
-    
-    pt.put("maximum.x", GetMaxX());
-    pt.put("maximum.y", GetMaxY());
-    pt.put("maximum.z", GetMaxZ());
-
-    
-    for (uint32_t i=0; i< GetRecordsCount(); i++) {
-        pt.add_child("vlrs.vlr", GetVLR(i).GetPTree());
-    }    
-
-    liblas::Schema const& schema = GetSchema(); 
-    ptree t = schema.GetPTree(); 
-    pt.add_child("schema",  t);
-    
-    return pt;
-}
-
-void Header::to_rst(std::ostream& os) const
-{
-
-    using liblas::property_tree::ptree;
-    ptree tree = GetPTree();
-
-    os << "---------------------------------------------------------" << std::endl;
-    os << "  Header Summary" << std::endl;
-    os << "---------------------------------------------------------" << std::endl;
-    os << std::endl;
-
-    os << "  Version:                     " << tree.get<std::string>("version") << std::endl;
-    os << "  Source ID:                   " << tree.get<uint32_t>("filesourceid") << std::endl;
-    os << "  Reserved:                    " << tree.get<std::string>("reserved") << std::endl;
-    os << "  Project ID/GUID:             '" << tree.get<std::string>("projectdid") << "'" << std::endl;
-    os << "  System ID:                   '" << tree.get<std::string>("systemid") << "'" << std::endl;
-    os << "  Generating Software:         '" << tree.get<std::string>("softwareid") << "'" << std::endl;
-    os << "  File Creation Day/Year:      " << tree.get<std::string>("date") << std::endl;
-    os << "  Header Byte Size             " << tree.get<uint32_t>("size") << std::endl;
-    os << "  Data Offset:                 " << tree.get<uint32_t>("dataoffset") << std::endl;
-    os << "  Header Padding:              " << tree.get<uint32_t>("header_padding") << std::endl;
-
-    os << "  Number Var. Length Records:  ";
-    try {
-      os << tree.get_child("vlrs").size();
-    }
-    catch (liblas::property_tree::ptree_bad_path const& e) {
-      ::boost::ignore_unused_variable_warning(e);
-      os << "None";
-    }
-    os << std::endl;
-
-    os << "  Point Data Format:           " << tree.get<uint32_t>("dataformatid") << std::endl;
-    os << "  Number of Point Records:     " << tree.get<uint32_t>("count") << std::endl;
-    os << "  Compressed:                  " << (tree.get<bool>("compressed")?"True":"False") << std::endl;
-    if (tree.get<bool>("compressed"))
-    {
-    os << "  Compression Info:            " << tree.get<std::string>("compression_info") << std::endl;
-    }
-
-    os << "  Number of Points by Return:  " ;
-    BOOST_FOREACH(ptree::value_type &v,
-          tree.get_child("returns"))
-    {
-          os << v.second.get<uint32_t>("count")<< " ";
-
-    }      
-    os << std::endl;
-
-    os.setf(std::ios_base::fixed, std::ios_base::floatfield);
-    double x_scale = tree.get<double>("scale.x");
-    double y_scale = tree.get<double>("scale.y");
-    double z_scale = tree.get<double>("scale.z");
-
-    uint32_t x_precision = 6;
-    uint32_t y_precision = 6;
-    uint32_t z_precision = 6;
-    
-    x_precision = 14;//GetStreamPrecision(x_scale);
-    y_precision = 14; //GetStreamPrecision(y_scale);
-    z_precision = 14; //GetStreamPrecision(z_scale);
-
-    os << "  Scale Factor X Y Z:          ";
-    os.precision(x_precision);
-    os << tree.get<double>("scale.x") << " "; 
-    os.precision(y_precision);
-    os << tree.get<double>("scale.y") << " "; 
-    os.precision(z_precision);
-    os << tree.get<double>("scale.z") << std::endl;
-
-    x_precision = GetStreamPrecision(x_scale);
-    y_precision = GetStreamPrecision(y_scale);
-    z_precision = GetStreamPrecision(z_scale);
-
-    os << "  Offset X Y Z:                ";
-    os.precision(x_precision);
-    os << tree.get<double>("offset.x") << " ";
-    os.precision(y_precision);
-    os << tree.get<double>("offset.y") << " ";
-    os.precision(z_precision);
-    os << tree.get<double>("offset.z") << std::endl;
-
-    os << "  Min X Y Z:                   ";
-    os.precision(x_precision);
-    os << tree.get<double>("minimum.x") << " "; 
-    os.precision(y_precision);
-    os << tree.get<double>("minimum.y") << " ";
-    os.precision(z_precision);
-    os << tree.get<double>("minimum.z") << std::endl;
-
-    os << "  Max X Y Z:                   ";
-    os.precision(x_precision);
-    os << tree.get<double>("maximum.x") << " ";
-    os.precision(y_precision);
-    os << tree.get<double>("maximum.y") << " ";
-    os.precision(z_precision);
-    os << tree.get<double>("maximum.z") << std::endl;         
-
-    
-    os << "  Spatial Reference:           ";
-#ifdef HAVE_GDAL
-    if (tree.get<std::string>("srs.prettywkt").size() > 0)
-#else
-    if (tree.get<std::string>("srs.gtiff").size() > 0)
-#endif
-    {
-        os << std::endl << tree.get<std::string>("srs.prettywkt") << std::endl;
-        os << std::endl << tree.get<std::string>("srs.gtiff") << std::endl; 
-    } else 
-    {
-        os << "None" << std::endl;
-    }
-
-
-}
-std::ostream& operator<<(std::ostream& os, liblas::Header const& h)
-{
-
-    
-    h.to_rst(os);
-    return os;
-    
-}
-} // namespace liblas
+/******************************************************************************
+ * $Id$
+ *
+ * Project:  libLAS - http://liblas.org - A BSD library for LAS format data.
+ * Purpose:  LAS header class
+ * Author:   Mateusz Loskot, mateusz at loskot.net
+ *
+ ******************************************************************************
+ * Copyright (c) 2008, Mateusz Loskot
+ * Copyright (c) 2008, Phil Vachon
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following
+ * conditions are met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided
+ *       with the distribution.
+ *     * Neither the name of the Martin Isenburg or Iowa Department
+ *       of Natural Resources nor the names of its contributors may be
+ *       used to endorse or promote products derived from this software
+ *       without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ ****************************************************************************/
+
+#include <liblas/header.hpp>
+#include <liblas/spatialreference.hpp>
+#include <liblas/schema.hpp>
+#include <liblas/detail/private_utility.hpp>
+#include <liblas/utility.hpp>
+
+#ifdef HAVE_LASZIP
+#include <liblas/detail/zippoint.hpp>
+#include <laszip/laszip.hpp>
+#endif
+
+// boost
+#include <boost/cstdint.hpp>
+#include <boost/lambda/lambda.hpp>
+
+//std
+#include <algorithm>
+#include <fstream>
+#include <stdexcept>
+#include <string>
+#include <vector>
+#include <cstring> // std::memset, std::memcpy, std::strncpy
+#include <cassert>
+#include <ctime>
+
+using namespace boost;
+
+namespace liblas {
+
+char const* const Header::FileSignature = "LASF";
+char const* const Header::SystemIdentifier = "libLAS";
+char const* const Header::SoftwareIdentifier = "libLAS 1.8.1";
+
+
+Header::Header() : m_schema(ePointFormat3)
+{
+    Init();
+}
+
+Header::Header(Header const& other) :
+    m_sourceId(other.m_sourceId),
+    m_reserved(other.m_reserved),
+    m_projectGuid(other.m_projectGuid),
+    m_versionMajor(other.m_versionMajor),
+    m_versionMinor(other.m_versionMinor),
+    m_createDOY(other.m_createDOY),
+    m_createYear(other.m_createYear),
+    m_headerSize(other.m_headerSize),
+    m_dataOffset(other.m_dataOffset),
+    m_recordsCount(other.m_recordsCount),
+    // m_dataFormatId(other.m_dataFormatId),
+    // m_dataRecordLen(other.m_dataRecordLen),
+    m_pointRecordsCount(other.m_pointRecordsCount),
+    m_scales(other.m_scales),
+    m_offsets(other.m_offsets),
+    m_extent(other.m_extent),
+    m_srs(other.m_srs),
+    m_schema(other.m_schema),
+    m_isCompressed(other.m_isCompressed),
+    m_headerPadding(other.m_headerPadding)
+{
+    void* p = 0;
+
+    p = std::memcpy(m_signature, other.m_signature, eFileSignatureSize);
+    assert(p == m_signature);
+    p = std::memcpy(m_systemId, other.m_systemId, eSystemIdSize);
+    assert(p == m_systemId);
+    p = std::memcpy(m_softwareId, other.m_softwareId, eSoftwareIdSize);
+    assert(p == m_softwareId);
+    std::vector<uint32_t>(other.m_pointRecordsByReturn).swap(m_pointRecordsByReturn);
+    assert(ePointsByReturnSize >= m_pointRecordsByReturn.size());
+
+    std::vector<VariableRecord>(other.m_vlrs).swap(m_vlrs);
+
+}
+
+Header& Header::operator=(Header const& rhs)
+{
+    if (&rhs != this)
+    {
+        void* p = 0;
+        p = std::memcpy(m_signature, rhs.m_signature, eFileSignatureSize);
+        assert(p == m_signature);
+        m_sourceId = rhs.m_sourceId;
+        m_reserved = rhs.m_reserved;
+        m_projectGuid = rhs.m_projectGuid;
+        m_versionMajor = rhs.m_versionMajor;
+        m_versionMinor = rhs.m_versionMinor;
+        p = std::memcpy(m_systemId, rhs.m_systemId, eSystemIdSize);
+        assert(p == m_systemId);
+        p = std::memcpy(m_softwareId, rhs.m_softwareId, eSoftwareIdSize);
+        assert(p == m_softwareId);
+        m_createDOY = rhs.m_createDOY;
+        m_createYear = rhs.m_createYear;
+        m_headerSize = rhs.m_headerSize;
+        m_dataOffset = rhs.m_dataOffset;
+        m_recordsCount = rhs.m_recordsCount;
+        m_pointRecordsCount = rhs.m_pointRecordsCount;
+
+        std::vector<uint32_t>(rhs.m_pointRecordsByReturn).swap(m_pointRecordsByReturn);
+        assert(ePointsByReturnSize >= m_pointRecordsByReturn.size());
+
+        std::vector<VariableRecord>(rhs.m_vlrs).swap(m_vlrs);
+        m_scales = rhs.m_scales;
+        m_offsets = rhs.m_offsets;
+        m_extent = rhs.m_extent;
+        m_srs = rhs.m_srs;
+        m_schema = rhs.m_schema;
+        m_isCompressed = rhs.m_isCompressed;
+        m_headerPadding = rhs.m_headerPadding;
+
+    }
+    return *this;
+}
+
+bool Header::operator==(Header const& other) const
+{
+    if (&other == this) return true;
+
+    if (m_scales != other.m_scales) return false;
+    if (m_offsets != other.m_offsets) return false;
+
+    if (m_signature != other.m_signature) return false;
+    if (m_sourceId != other.m_sourceId) return false;
+    if (m_reserved != other.m_reserved) return false;
+    if (m_projectGuid != other.m_projectGuid) return false;
+    if (m_versionMajor != other.m_versionMajor) return false;
+    if (m_versionMinor != other.m_versionMinor) return false;
+    if (m_systemId != other.m_systemId) return false;
+    if (m_softwareId != other.m_softwareId) return false;
+    if (m_createDOY != other.m_createDOY) return false;
+    if (m_createYear != other.m_createYear) return false;
+    if (m_headerSize != other.m_headerSize) return false;
+    if (m_dataOffset != other.m_dataOffset) return false;
+    if (m_recordsCount != other.m_recordsCount) return false;
+    if (m_pointRecordsCount != other.m_pointRecordsCount) return false;
+    if (m_pointRecordsByReturn != other.m_pointRecordsByReturn) return false;
+    if (m_extent != other.m_extent) return false;
+    if (m_isCompressed != other.m_isCompressed) return false;
+    if (m_headerPadding != other.m_headerPadding) return false;
+    if (m_schema != other.m_schema) return false;
+    return true;
+}
+
+
+std::string Header::GetFileSignature() const
+{
+    return std::string(m_signature, eFileSignatureSize);
+}
+
+void Header::SetFileSignature(std::string const& v)
+{
+    if (0 != v.compare(0, eFileSignatureSize, FileSignature))
+        throw std::invalid_argument("invalid file signature");
+
+    std::strncpy(m_signature, v.c_str(), eFileSignatureSize);
+}
+
+uint16_t Header::GetFileSourceId() const
+{
+    return m_sourceId;
+}
+
+void Header::SetFileSourceId(uint16_t v)
+{
+    // TODO: Should we warn or throw about type overflow occuring when
+    //       user passes 65535 + 1 = 0
+    m_sourceId = v;
+}
+
+uint16_t Header::GetReserved() const
+{
+    return m_reserved;
+}
+
+void Header::SetReserved(uint16_t v)
+{
+    // TODO: Should we warn or throw about type overflow occuring when
+    //       user passes 65535 + 1 = 0
+    m_reserved = v;
+}
+
+boost::uuids::uuid Header::GetProjectId() const
+{
+    return m_projectGuid;
+}
+
+void Header::SetProjectId(boost::uuids::uuid const& v)
+{
+    m_projectGuid = v;
+}
+
+uint8_t Header::GetVersionMajor() const
+{
+    return m_versionMajor;
+}
+
+void Header::SetVersionMajor(uint8_t v)
+{
+    if (eVersionMajorMin > v || v > eVersionMajorMax)
+        throw std::out_of_range("version major out of range");
+
+    m_versionMajor = v;
+}
+
+uint8_t Header::GetVersionMinor() const
+{
+    return m_versionMinor;
+}
+
+void Header::SetVersionMinor(uint8_t v)
+{
+    if (v > eVersionMinorMax)
+        throw std::out_of_range("version minor out of range");
+
+    m_versionMinor = v;
+
+
+}
+
+std::string Header::GetSystemId(bool pad /*= false*/) const
+{
+    // copy array of chars and trim zeros if smaller than 32 bytes
+    std::string tmp(std::string(m_systemId, eSystemIdSize).c_str());
+
+    // pad right side with spaces
+    if (pad && tmp.size() < eSystemIdSize)
+    {
+        tmp.resize(eSystemIdSize, 0);
+        assert(tmp.size() == eSystemIdSize);
+    }
+
+    assert(tmp.size() <= eSystemIdSize);
+    return tmp;
+}
+
+void Header::SetSystemId(std::string const& v)
+{
+    if (v.size() > eSystemIdSize)
+        throw std::invalid_argument("system id too long");
+
+    std::fill(m_systemId, m_systemId + eSystemIdSize, 0);
+    std::strncpy(m_systemId, v.c_str(), eSystemIdSize);
+}
+
+std::string Header::GetSoftwareId(bool pad /*= false*/) const
+{
+    std::string tmp(std::string(m_softwareId, eSoftwareIdSize).c_str());
+
+    // pad right side with spaces
+    if (pad && tmp.size() < eSoftwareIdSize)
+    {
+        tmp.resize(eSoftwareIdSize, 0);
+        assert(tmp.size() == eSoftwareIdSize);
+    }
+
+    assert(tmp.size() <= eSoftwareIdSize);
+    return tmp;
+}
+
+void Header::SetSoftwareId(std::string const& v)
+{
+    if (v.size() > eSoftwareIdSize)
+        throw std::invalid_argument("generating software id too long");
+
+//    m_softwareId = v;
+    std::fill(m_softwareId, m_softwareId + eSoftwareIdSize, 0);
+    std::strncpy(m_softwareId, v.c_str(), eSoftwareIdSize);
+}
+
+uint16_t Header::GetCreationDOY() const
+{
+    return m_createDOY;
+}
+
+void Header::SetCreationDOY(uint16_t v)
+{
+    m_createDOY = v;
+}
+
+uint16_t Header::GetCreationYear() const
+{
+    return m_createYear;
+}
+
+void Header::SetCreationYear(uint16_t v)
+{
+    m_createYear = v;
+}
+
+uint16_t Header::GetHeaderSize() const
+{
+    return m_headerSize;
+}
+
+void Header::SetHeaderSize(uint16_t v)
+{
+
+    m_headerSize = v;
+}
+
+uint32_t Header::GetDataOffset() const
+{
+    return m_dataOffset;
+}
+
+void Header::SetDataOffset(uint32_t v)
+{
+    m_dataOffset = v;
+}
+
+uint32_t Header::GetHeaderPadding() const
+{
+    return m_headerPadding;
+}
+
+uint32_t Header::GetVLRBlockSize() const
+{
+    uint32_t vlr_total_size = 0;
+
+    for (uint32_t i = 0; i < GetRecordsCount(); ++i)
+    {
+        VariableRecord const & vlr = GetVLR(i);
+        vlr_total_size += static_cast<uint32_t>(vlr.GetTotalSize());
+    }
+
+    return vlr_total_size;
+}
+
+void Header::SetHeaderPadding(uint32_t v)
+{
+    m_headerPadding = v;
+}
+
+uint32_t Header::GetRecordsCount() const
+{
+    return m_recordsCount;
+}
+
+void Header::SetRecordsCount(uint32_t v)
+{
+    m_recordsCount = v;
+}
+
+liblas::PointFormatName Header::GetDataFormatId() const
+{
+    return m_schema.GetDataFormatId();
+
+}
+
+void Header::SetDataFormatId(liblas::PointFormatName v)
+{
+    m_schema.SetDataFormatId(v);
+}
+
+uint16_t Header::GetDataRecordLength() const
+{
+    // No matter what the schema says, this must be a a short in size.
+    return static_cast<uint16_t>(m_schema.GetByteSize());
+}
+
+uint32_t Header::GetPointRecordsCount() const
+{
+    return m_pointRecordsCount;
+}
+
+void Header::SetPointRecordsCount(uint32_t v)
+{
+    m_pointRecordsCount = v;
+}
+
+Header::RecordsByReturnArray const& Header::GetPointRecordsByReturnCount() const
+{
+    return m_pointRecordsByReturn;
+}
+
+void Header::SetPointRecordsByReturnCount(std::size_t index, uint32_t v)
+{
+    assert(m_pointRecordsByReturn.size() == Header::ePointsByReturnSize);
+
+    uint32_t& t = m_pointRecordsByReturn.at(index);
+    t = v;
+}
+
+
+double Header::GetScaleX() const
+{
+    return m_scales.x;
+}
+
+double Header::GetScaleY() const
+{
+    return m_scales.y;
+}
+
+double Header::GetScaleZ() const
+{
+    return m_scales.z;
+}
+
+void Header::SetScale(double x, double y, double z)
+{
+
+    // double const minscale = 0.01;
+    m_scales.x = x;
+    m_scales.y = y;
+    m_scales.z = z;
+}
+
+double Header::GetOffsetX() const
+{
+    return m_offsets.x;
+}
+
+double Header::GetOffsetY() const
+{
+    return m_offsets.y;
+}
+
+double Header::GetOffsetZ() const
+{
+    return m_offsets.z;
+}
+
+void Header::SetOffset(double x, double y, double z)
+{
+    m_offsets = PointOffsets(x, y, z);
+}
+
+double Header::GetMaxX() const
+{
+    return (m_extent.max)(0);
+}
+
+double Header::GetMinX() const
+{
+    return (m_extent.min)(0);
+}
+
+double Header::GetMaxY() const
+{
+    return (m_extent.max)(1);
+}
+
+double Header::GetMinY() const
+{
+    return (m_extent.min)(1);
+}
+
+double Header::GetMaxZ() const
+{
+    return (m_extent.max)(2);
+}
+
+double Header::GetMinZ() const
+{
+    return (m_extent.min)(2);
+}
+
+void Header::SetMax(double x, double y, double z)
+{
+    // m_extent = Bounds(m_extent.min(0), m_extent.min(1), m_extent.max(0), m_extent.max(1), m_extent.min(2), m_extent.max(2));
+    // Bounds(minx, miny, minz, maxx, maxy, maxz)
+    m_extent = Bounds<double>((m_extent.min)(0), (m_extent.min)(1), (m_extent.min)(2), x, y, z);
+}
+
+void Header::SetMin(double x, double y, double z)
+{
+    m_extent = Bounds<double>(x, y, z, (m_extent.max)(0), (m_extent.max)(1), (m_extent.max)(2));
+}
+
+void Header::SetExtent(Bounds<double> const& extent)
+{
+    m_extent = extent;
+}
+
+const Bounds<double>& Header::GetExtent() const
+{
+    return m_extent;
+}
+
+void Header::AddVLR(VariableRecord const& v)
+{
+    m_vlrs.push_back(v);
+    m_recordsCount += 1;
+}
+
+VariableRecord const& Header::GetVLR(uint32_t index) const
+{
+    return m_vlrs[index];
+}
+
+const std::vector<VariableRecord>& Header::GetVLRs() const
+{
+    return m_vlrs;
+}
+
+void Header::DeleteVLR(uint32_t index)
+{
+    if (index >= m_vlrs.size())
+        throw std::out_of_range("index is out of range");
+
+    std::vector<VariableRecord>::iterator i = m_vlrs.begin() + index;
+
+    m_vlrs.erase(i);
+    m_recordsCount = static_cast<uint32_t>(m_vlrs.size());
+
+}
+
+
+void Header::Init()
+{
+    // Initialize public header block with default
+    // values according to LAS 1.2
+
+    m_versionMajor = 1;
+    m_versionMinor = 2;
+
+    m_createDOY = m_createYear = 0;
+    std::time_t now;
+    std::time(&now);
+    std::tm* ptm = std::gmtime(&now);
+    if (0 != ptm)
+    {
+        m_createDOY = static_cast<uint16_t>(ptm->tm_yday);
+        m_createYear = static_cast<uint16_t>(ptm->tm_year + 1900);
+    }
+
+    m_headerSize = eHeaderSize;
+
+    m_projectGuid = boost::uuids::nil_uuid();
+    m_sourceId = m_reserved = uint16_t();
+
+    m_dataOffset = eHeaderSize; // excluding 2 bytes of Point Data Start Signature
+    m_headerPadding = 0;
+    m_recordsCount = 0;
+    m_pointRecordsCount = 0;
+
+    std::memset(m_signature, 0, eFileSignatureSize);
+    std::strncpy(m_signature, FileSignature, eFileSignatureSize);
+
+    std::memset(m_systemId, 0, eSystemIdSize);
+    std::strncpy(m_systemId, SystemIdentifier, eSystemIdSize);
+
+    std::memset(m_softwareId, 0, eSoftwareIdSize);
+    std::strncpy(m_softwareId, SoftwareIdentifier, eSoftwareIdSize);
+
+    m_pointRecordsByReturn.resize(ePointsByReturnSize);
+
+    SetScale(1.0, 1.0, 1.0);
+
+    m_isCompressed = false;
+}
+
+bool SameVLRs(std::string const& name, uint16_t id, liblas::VariableRecord const& record)
+{
+    if (record.GetUserId(false) == name) {
+        if (record.GetRecordId() == id) {
+            return true;
+        }
+    }
+    return false;
+}
+
+
+void Header::DeleteVLRs(std::string const& name, uint16_t id)
+{
+
+    m_vlrs.erase( std::remove_if( m_vlrs.begin(),
+                                  m_vlrs.end(),
+                                  boost::bind( &SameVLRs, name, id, _1 ) ),
+                  m_vlrs.end());
+
+    m_recordsCount = static_cast<uint32_t>(m_vlrs.size());
+
+}
+
+
+
+void Header::SetGeoreference()
+{
+    std::vector<VariableRecord> vlrs = m_srs.GetVLRs();
+
+    // Wipe the GeoTIFF-related VLR records off of the Header
+    DeleteVLRs("LASF_Projection", 34735);
+    DeleteVLRs("LASF_Projection", 34736);
+    DeleteVLRs("LASF_Projection", 34737);
+
+    std::vector<VariableRecord>::const_iterator i;
+
+    for (i = vlrs.begin(); i != vlrs.end(); ++i)
+    {
+        AddVLR(*i);
+    }
+}
+
+SpatialReference Header::GetSRS() const
+{
+    return m_srs;
+}
+
+void Header::SetSRS(SpatialReference& srs)
+{
+    m_srs = srs;
+}
+
+Schema const& Header::GetSchema() const
+{
+
+    return m_schema;
+}
+
+void Header::SetSchema(const Schema& format)
+{
+
+    m_schema = format;
+
+    // Reset the X, Y, Z dimensions with offset and scale values
+    boost::optional< Dimension const& > x_c = m_schema.GetDimension("X");
+    if (!x_c)
+        throw liblas_error("X dimension not on schema, you\'ve got big problems!");
+    liblas::Dimension x(*x_c);
+    x.SetScale(m_scales.x);
+    x.IsFinitePrecision(true);
+    x.SetOffset(m_offsets.x);
+    m_schema.AddDimension(x);
+
+    boost::optional< Dimension const& > y_c = m_schema.GetDimension("Y");
+    liblas::Dimension y(*y_c);
+    y.SetScale(m_scales.y);
+    y.IsFinitePrecision(true);
+    y.SetOffset(m_offsets.y);
+    m_schema.AddDimension(y);
+
+    boost::optional< Dimension const& > z_c = m_schema.GetDimension("Z");
+
+    liblas::Dimension z(*z_c);
+    z.SetScale(m_scales.z);
+    z.IsFinitePrecision(true);
+    z.SetOffset(m_offsets.z);
+    m_schema.AddDimension(z);
+
+}
+
+void Header::SetCompressed(bool b)
+{
+    m_isCompressed = b;
+}
+
+bool Header::Compressed() const
+{
+    return m_isCompressed;
+}
+
+liblas::property_tree::ptree Header::GetPTree( ) const
+{
+    using liblas::property_tree::ptree;
+    ptree pt;
+
+    pt.put("filesignature", GetFileSignature());
+    pt.put("projectdid", GetProjectId());
+
+    pt.put("systemid", GetSystemId());
+    pt.put("softwareid", GetSoftwareId());
+
+
+    std::ostringstream version;
+    version << static_cast<int>(GetVersionMajor());
+    version <<".";
+    version << static_cast<int>(GetVersionMinor());
+    pt.put("version", version.str());
+
+    pt.put("filesourceid", GetFileSourceId());
+    pt.put("reserved", GetReserved());
+
+    ptree srs = GetSRS().GetPTree();
+    pt.add_child("srs", srs);
+
+    std::ostringstream date;
+    date << GetCreationDOY() << "/" << GetCreationYear();
+    pt.put("date", date.str());
+
+    pt.put("size", GetHeaderSize());
+    pt.put("dataoffset", GetDataOffset());
+    pt.put("header_padding", GetHeaderPadding());
+
+    pt.put("count", GetPointRecordsCount());
+    pt.put("dataformatid", GetDataFormatId());
+    pt.put("datarecordlength", GetDataRecordLength());
+    pt.put("compressed", Compressed());
+
+#ifdef HAVE_LASZIP
+    liblas::detail::ZipPoint zp(GetDataFormatId(), GetVLRs());
+    LASzip* laszip = zp.GetZipper();
+    std::ostringstream zip_version;
+    zip_version <<"LASzip Version "
+                << (int)laszip->version_major << "."
+                << (int)laszip->version_minor << "r"
+                << (int)laszip->version_revision << " c"
+                << (int)laszip->compressor;
+    if (laszip->compressor == LASZIP_COMPRESSOR_CHUNKED)
+        zip_version << " "<< (int)laszip->chunk_size << ":";
+    else
+        zip_version << ":";
+    for (int i = 0; i < (int)laszip->num_items; i++)
+        zip_version <<" "<< laszip->items[i].get_name()<<" "<<  (int)laszip->items[i].version;
+
+    pt.put("compression_info", zip_version.str());
+#endif
+
+    ptree return_count;
+    liblas::Header::RecordsByReturnArray returns = GetPointRecordsByReturnCount();
+    for (uint32_t i=0; i< 5; i++){
+        ptree r;
+        r.put("id", i);
+        r.put("count", returns[i]);
+        return_count.add_child("return", r);
+    }
+    pt.add_child("returns", return_count);
+
+    pt.put("scale.x", GetScaleX());
+    pt.put("scale.y", GetScaleY());
+    pt.put("scale.z", GetScaleZ());
+
+    pt.put("offset.x", GetOffsetX());
+    pt.put("offset.y", GetOffsetY());
+    pt.put("offset.z", GetOffsetZ());
+
+    pt.put("minimum.x", GetMinX());
+    pt.put("minimum.y", GetMinY());
+    pt.put("minimum.z", GetMinZ());
+
+    pt.put("maximum.x", GetMaxX());
+    pt.put("maximum.y", GetMaxY());
+    pt.put("maximum.z", GetMaxZ());
+
+
+    for (uint32_t i=0; i< GetRecordsCount(); i++) {
+        pt.add_child("vlrs.vlr", GetVLR(i).GetPTree());
+    }
+
+    liblas::Schema const& schema = GetSchema();
+    ptree t = schema.GetPTree();
+    pt.add_child("schema",  t);
+
+    return pt;
+}
+
+void Header::to_rst(std::ostream& os) const
+{
+
+    using liblas::property_tree::ptree;
+    ptree tree = GetPTree();
+
+    os << "---------------------------------------------------------" << std::endl;
+    os << "  Header Summary" << std::endl;
+    os << "---------------------------------------------------------" << std::endl;
+    os << std::endl;
+
+    os << "  Version:                     " << tree.get<std::string>("version") << std::endl;
+    os << "  Source ID:                   " << tree.get<uint32_t>("filesourceid") << std::endl;
+    os << "  Reserved:                    " << tree.get<std::string>("reserved") << std::endl;
+    os << "  Project ID/GUID:             '" << tree.get<std::string>("projectdid") << "'" << std::endl;
+    os << "  System ID:                   '" << tree.get<std::string>("systemid") << "'" << std::endl;
+    os << "  Generating Software:         '" << tree.get<std::string>("softwareid") << "'" << std::endl;
+    os << "  File Creation Day/Year:      " << tree.get<std::string>("date") << std::endl;
+    os << "  Header Byte Size             " << tree.get<uint32_t>("size") << std::endl;
+    os << "  Data Offset:                 " << tree.get<uint32_t>("dataoffset") << std::endl;
+    os << "  Header Padding:              " << tree.get<uint32_t>("header_padding") << std::endl;
+
+    os << "  Number Var. Length Records:  ";
+    try {
+      os << tree.get_child("vlrs").size();
+    }
+    catch (liblas::property_tree::ptree_bad_path const& e) {
+      ::boost::ignore_unused_variable_warning(e);
+      os << "None";
+    }
+    os << std::endl;
+
+    os << "  Point Data Format:           " << tree.get<uint32_t>("dataformatid") << std::endl;
+    os << "  Number of Point Records:     " << tree.get<uint32_t>("count") << std::endl;
+    os << "  Compressed:                  " << (tree.get<bool>("compressed")?"True":"False") << std::endl;
+    if (tree.get<bool>("compressed"))
+    {
+    os << "  Compression Info:            " << tree.get<std::string>("compression_info") << std::endl;
+    }
+
+    os << "  Number of Points by Return:  " ;
+    BOOST_FOREACH(ptree::value_type &v,
+          tree.get_child("returns"))
+    {
+          os << v.second.get<uint32_t>("count")<< " ";
+
+    }
+    os << std::endl;
+
+    os.setf(std::ios_base::fixed, std::ios_base::floatfield);
+    double x_scale = tree.get<double>("scale.x");
+    double y_scale = tree.get<double>("scale.y");
+    double z_scale = tree.get<double>("scale.z");
+
+    uint32_t x_precision = 6;
+    uint32_t y_precision = 6;
+    uint32_t z_precision = 6;
+
+    x_precision = 14;//GetStreamPrecision(x_scale);
+    y_precision = 14; //GetStreamPrecision(y_scale);
+    z_precision = 14; //GetStreamPrecision(z_scale);
+
+    os << "  Scale Factor X Y Z:          ";
+    os.precision(x_precision);
+    os << tree.get<double>("scale.x") << " ";
+    os.precision(y_precision);
+    os << tree.get<double>("scale.y") << " ";
+    os.precision(z_precision);
+    os << tree.get<double>("scale.z") << std::endl;
+
+    x_precision = GetStreamPrecision(x_scale);
+    y_precision = GetStreamPrecision(y_scale);
+    z_precision = GetStreamPrecision(z_scale);
+
+    os << "  Offset X Y Z:                ";
+    os.precision(x_precision);
+    os << tree.get<double>("offset.x") << " ";
+    os.precision(y_precision);
+    os << tree.get<double>("offset.y") << " ";
+    os.precision(z_precision);
+    os << tree.get<double>("offset.z") << std::endl;
+
+    os << "  Min X Y Z:                   ";
+    os.precision(x_precision);
+    os << tree.get<double>("minimum.x") << " ";
+    os.precision(y_precision);
+    os << tree.get<double>("minimum.y") << " ";
+    os.precision(z_precision);
+    os << tree.get<double>("minimum.z") << std::endl;
+
+    os << "  Max X Y Z:                   ";
+    os.precision(x_precision);
+    os << tree.get<double>("maximum.x") << " ";
+    os.precision(y_precision);
+    os << tree.get<double>("maximum.y") << " ";
+    os.precision(z_precision);
+    os << tree.get<double>("maximum.z") << std::endl;
+
+
+    os << "  Spatial Reference:           ";
+#ifdef HAVE_GDAL
+    if (tree.get<std::string>("srs.prettywkt").size() > 0)
+#else
+    if (tree.get<std::string>("srs.gtiff").size() > 0)
+#endif
+    {
+        os << std::endl << tree.get<std::string>("srs.prettywkt") << std::endl;
+        os << std::endl << tree.get<std::string>("srs.gtiff") << std::endl;
+    } else
+    {
+        os << "None" << std::endl;
+    }
+
+
+}
+std::ostream& operator<<(std::ostream& os, liblas::Header const& h)
+{
+
+
+    h.to_rst(os);
+    return os;
+
+}
+} // namespace liblas
diff --git a/src/index.cpp b/src/index.cpp
old mode 100755
new mode 100644
diff --git a/src/point.cpp b/src/point.cpp
old mode 100755
new mode 100644
diff --git a/src/reader.cpp b/src/reader.cpp
old mode 100755
new mode 100644
diff --git a/src/schema.cpp b/src/schema.cpp
old mode 100755
new mode 100644
diff --git a/src/spatialreference.cpp b/src/spatialreference.cpp
old mode 100755
new mode 100644
index 4ad2dfe..a4acb83
--- a/src/spatialreference.cpp
+++ b/src/spatialreference.cpp
@@ -2,7 +2,7 @@
  * $Id: lasspatialreference.cpp 1104 2009-03-17 04:15:19Z hobu $
  *
  * Project:  libLAS - http://liblas.org - A BSD library for LAS format data.
- * Purpose:  LAS Spatial Reference class 
+ * Purpose:  LAS Spatial Reference class
  * Author:   Howard Butler, hobu.inc at gmail.com
  *           Frank Warmerdam, warmerdam at pobox.com
  *
@@ -10,33 +10,33 @@
  * Copyright (c) 2009, Howard Butler
  *
  * All rights reserved.
- * 
- * Redistribution and use in source and binary forms, with or without 
- * modification, are permitted provided that the following 
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following
  * conditions are met:
- * 
- *     * Redistributions of source code must retain the above copyright 
+ *
+ *     * Redistributions of source code must retain the above copyright
  *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above copyright 
- *       notice, this list of conditions and the following disclaimer in 
- *       the documentation and/or other materials provided 
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided
  *       with the distribution.
- *     * Neither the name of the Martin Isenburg or Iowa Department 
- *       of Natural Resources nor the names of its contributors may be 
- *       used to endorse or promote products derived from this software 
+ *     * Neither the name of the Martin Isenburg or Iowa Department
+ *       of Natural Resources nor the names of its contributors may be
+ *       used to endorse or promote products derived from this software
  *       without specific prior written permission.
- * 
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
  * OF SUCH DAMAGE.
  ****************************************************************************/
 
@@ -94,7 +94,7 @@ SpatialReference::SpatialReference()
     assert(0 == m_tiff);
 }
 
-SpatialReference::SpatialReference(std::vector<VariableRecord> const& vlrs) 
+SpatialReference::SpatialReference(std::vector<VariableRecord> const& vlrs)
     : m_gtiff(0)
     , m_tiff(0)
 {
@@ -102,7 +102,7 @@ SpatialReference::SpatialReference(std::vector<VariableRecord> const& vlrs)
     GetGTIF();
 }
 
-SpatialReference::SpatialReference(SpatialReference const& other) 
+SpatialReference::SpatialReference(SpatialReference const& other)
     : m_gtiff(0)
     , m_tiff(0)
     , m_wkt(other.m_wkt)
@@ -133,9 +133,9 @@ bool SpatialReference::operator==(const SpatialReference& input) const
 
     OSRDestroySpatialReference( current );
     OSRDestroySpatialReference( other );
-    
+
     return bool(output == 1);
-    
+
 #else
     boost::ignore_unused_variable_warning(input);
     throw std::runtime_error ("SpatialReference equality testing not available without GDAL+libgeotiff support");
@@ -143,7 +143,7 @@ bool SpatialReference::operator==(const SpatialReference& input) const
 
 }
 
-SpatialReference::~SpatialReference() 
+SpatialReference::~SpatialReference()
 {
 #ifdef HAVE_LIBGEOTIFF
     if (m_gtiff != 0)
@@ -162,12 +162,12 @@ SpatialReference::~SpatialReference()
 /// Keep a copy of the VLRs that are related to GeoTIFF SRS information.
 void SpatialReference::SetVLRs(std::vector<VariableRecord> const& vlrs)
 {
-    
+
     std::string const uid("LASF_Projection");
-    
+
     // Wipe out any existing VLRs that might exist on the SpatialReference
     m_vlrs.clear();
-    
+
     // We only copy VLR records from the list which are related to GeoTIFF keys.
     // They must have an id of "LASF_Projection" and a record id that's related.
     std::vector<VariableRecord>::const_iterator it;
@@ -181,7 +181,7 @@ void SpatialReference::SetVLRs(std::vector<VariableRecord> const& vlrs)
     }
 }
 
-void SpatialReference::AddVLR(VariableRecord const& vlr) 
+void SpatialReference::AddVLR(VariableRecord const& vlr)
 {
     if (IsGeoVLR(vlr))
     {
@@ -193,19 +193,19 @@ bool SpatialReference::IsGeoVLR(VariableRecord const& vlr) const
 {
     std::string const las_projid("LASF_Projection");
     std::string const liblas_id("liblas");
-    
+
     // GTIFF_GEOKEYDIRECTORY == 34735
     if (las_projid == vlr.GetUserId(true).c_str() && 34735 == vlr.GetRecordId())
     {
         return true;
     }
-    
+
     // GTIFF_DOUBLEPARAMS == 34736
     if (las_projid == vlr.GetUserId(true).c_str() && 34736 == vlr.GetRecordId())
     {
         return true;
     }
-    
+
     // GTIFF_ASCIIPARAMS == 34737
     if (las_projid == vlr.GetUserId(true).c_str() && 34737 == vlr.GetRecordId())
     {
@@ -231,19 +231,19 @@ void SpatialReference::ClearVLRs( GeoVLRType eType )
 {
     std::vector<VariableRecord>::iterator it;
     std::string const liblas_id("liblas");
-    
+
     for (it = m_vlrs.begin(); it != m_vlrs.end(); )
     {
         VariableRecord const& vlr = *it;
         bool wipe = false;
 
         // for now we can assume all m_vlrs records are LASF_Projection.
-        if( eType == eOGRWKT && 
-            2112 == vlr.GetRecordId() && 
+        if( eType == eOGRWKT &&
+            2112 == vlr.GetRecordId() &&
             liblas_id == vlr.GetUserId(true).c_str() )
             wipe = true;
 
-        else if( eType == eGeoTIFF 
+        else if( eType == eGeoTIFF
                  && (34735 == vlr.GetRecordId()
                      || 34736 == vlr.GetRecordId()
                      || 34737 == vlr.GetRecordId()) )
@@ -294,7 +294,7 @@ void SpatialReference::ResetVLRs()
     int kcount = 0;
     int acount = 0;
     int atype =0;
-    
+
     if (!m_tiff)
         throw std::invalid_argument("m_tiff was null, cannot reset VLRs without m_tiff");
 
@@ -304,7 +304,7 @@ void SpatialReference::ResetVLRs()
     //GTIFF_GEOKEYDIRECTORY == 34735
     ret = ST_GetKey(m_tiff, 34735, &kcount, &ktype, (void**)&kdata);
     if (ret)
-    {    
+    {
         VariableRecord record;
         int i = 0;
         record.SetRecordId(34735);
@@ -315,14 +315,14 @@ void SpatialReference::ResetVLRs()
         // Shorts are 2 bytes in length
         uint16_t length = 2 * static_cast<uint16_t>(kcount);
         record.SetRecordLength(length);
-        
+
         // Copy the data into the data vector
         for (i = 0; i < kcount; i++)
         {
             kvalue = kdata[i];
-            
-            uint8_t* v = reinterpret_cast<uint8_t*>(&kvalue); 
-            
+
+            uint8_t* v = reinterpret_cast<uint8_t*>(&kvalue);
+
             data.push_back(v[0]);
             data.push_back(v[1]);
         }
@@ -334,26 +334,26 @@ void SpatialReference::ResetVLRs()
     // GTIFF_DOUBLEPARAMS == 34736
     ret = ST_GetKey(m_tiff, 34736, &dcount, &dtype, (void**)&ddata);
     if (ret)
-    {    
+    {
         VariableRecord record;
         int i = 0;
         record.SetRecordId(34736);
         record.SetUserId("LASF_Projection");
         record.SetDescription("GeoTIFF GeoDoubleParamsTag");
-        
+
         std::vector<uint8_t> data;
 
         // Doubles are 8 bytes in length
         uint16_t length = 8 * static_cast<uint16_t>(dcount);
         record.SetRecordLength(length);
-        
+
         // Copy the data into the data vector
         for (i=0; i<dcount;i++)
         {
             dvalue = ddata[i];
-            
+
             uint8_t* v =  reinterpret_cast<uint8_t*>(&dvalue);
-            
+
             data.push_back(v[0]);
             data.push_back(v[1]);
             data.push_back(v[2]);
@@ -361,38 +361,38 @@ void SpatialReference::ResetVLRs()
             data.push_back(v[4]);
             data.push_back(v[5]);
             data.push_back(v[6]);
-            data.push_back(v[7]);   
-        }        
+            data.push_back(v[7]);
+        }
         record.SetData(data);
         m_vlrs.push_back(record);
     }
-    
+
     // GTIFF_ASCIIPARAMS == 34737
     ret = ST_GetKey(m_tiff, 34737, &acount, &atype, (void**)&adata);
-    if (ret) 
-    {                    
+    if (ret)
+    {
          VariableRecord record;
          int i = 0;
          record.SetRecordId(34737);
          record.SetUserId("LASF_Projection");
-         record.SetDescription("GeoTIFF GeoAsciiParamsTag");         
+         record.SetDescription("GeoTIFF GeoAsciiParamsTag");
          std::vector<uint8_t> data;
 
-         // whoa.  If the returned count was 0, it is because there 
-         // was a bug in libgeotiff that existed before r1531 where it 
+         // whoa.  If the returned count was 0, it is because there
+         // was a bug in libgeotiff that existed before r1531 where it
          // didn't calculate the string length for an ASCII geotiff tag.
          // We need to throw an exception in this case because we're
          // screwed, and if we don't we'll end up writing bad GeoTIFF keys.
          if (!acount)
          {
-             throw std::runtime_error("GeoTIFF ASCII key with no returned size. " 
+             throw std::runtime_error("GeoTIFF ASCII key with no returned size. "
                                       "Upgrade your libgeotiff to a version greater "
                                       "than r1531 (libgeotiff 1.2.6)");
          }
 
          uint16_t length = static_cast<uint16_t>(acount);
          record.SetRecordLength(length);
-         
+
          // Copy the data into the data vector
          for (i=0; i<acount;i++)
          {
@@ -406,8 +406,8 @@ void SpatialReference::ResetVLRs()
         {
             std::ostringstream oss;
             std::vector<uint8_t>::size_type overrun = data.size() - static_cast<std::vector<uint8_t>::size_type>(std::numeric_limits<uint16_t>::max());
-            oss << "The size of the GeoTIFF GeoAsciiParamsTag, " << data.size() << ", is " << overrun 
-                << " bytes too large to fit inside the maximum size of a VLR which is " 
+            oss << "The size of the GeoTIFF GeoAsciiParamsTag, " << data.size() << ", is " << overrun
+                << " bytes too large to fit inside the maximum size of a VLR which is "
                 << (std::numeric_limits<uint16_t>::max()) << " bytes.";
             throw std::runtime_error(oss.str());
 
@@ -443,8 +443,8 @@ void SpatialReference::ResetVLRs()
         {
             std::ostringstream oss;
             std::vector<uint8_t>::size_type overrun = data.size() - static_cast<std::vector<uint8_t>::size_type>(std::numeric_limits<uint16_t>::max());
-            oss << "The size of the wkt, " << data.size() << ", is " << overrun 
-                << " bytes too large to fit inside the maximum size of a VLR which is " 
+            oss << "The size of the wkt, " << data.size() << ", is " << overrun
+                << " bytes too large to fit inside the maximum size of a VLR which is "
                 << std::numeric_limits<uint16_t>::max() << " bytes.";
             throw std::runtime_error(oss.str());
 
@@ -459,7 +459,7 @@ void SpatialReference::ResetVLRs()
     }
 }
 
-void SpatialReference::SetGTIF(GTIF* pgtiff, ST_TIFF* ptiff) 
+void SpatialReference::SetGTIF(GTIF* pgtiff, ST_TIFF* ptiff)
 {
     m_gtiff = (GTIF*)pgtiff;
     m_tiff = (ST_TIFF*)ptiff;
@@ -473,9 +473,9 @@ const GTIF* SpatialReference::GetGTIF()
     return 0;
 #else
 
-    // If we already have m_gtiff and m_tiff, that is because we have 
-    // already called GetGTIF once before.  VLRs ultimately drive how the 
-    // SpatialReference is defined, not the GeoTIFF keys.  
+    // If we already have m_gtiff and m_tiff, that is because we have
+    // already called GetGTIF once before.  VLRs ultimately drive how the
+    // SpatialReference is defined, not the GeoTIFF keys.
     if (m_tiff != 0 )
     {
         ST_Destroy(m_tiff);
@@ -487,42 +487,49 @@ const GTIF* SpatialReference::GetGTIF()
         GTIFFree(m_gtiff);
         m_gtiff = 0;
     }
-    
+
     m_tiff = ST_Create();
     std::string const uid("LASF_Projection");
-    
+
     // Nothing is going to happen here if we don't have any VLRs describing
-    // SRS information on the SpatialReference.  
+    // SRS information on the SpatialReference.
     for (uint16_t i = 0; i < m_vlrs.size(); ++i)
     {
         VariableRecord record = m_vlrs[i];
         std::vector<uint8_t> data = record.GetData();
-        if (uid == record.GetUserId(true).c_str() && 34735 == record.GetRecordId())
-        {
-            int count = data.size()/sizeof(int16_t);
-            short *data_s = reinterpret_cast<short *>( &(data[0]));
 
-            // discard invalid "zero" geotags some software emits.
-            while( count > 4 
-                   && data_s[count-1] == 0
-                   && data_s[count-2] == 0
-                   && data_s[count-3] == 0
-                   && data_s[count-4] == 0 )
+        if (uid == record.GetUserId(true).c_str() &&
+            34735 == record.GetRecordId())
+        {
+#pragma pack(push)
+#pragma pack(1)
+            struct ShortKeyHeader
             {
-                count -= 4;
-                data_s[3] -= 1;
-            }
+                uint16_t dirVersion;
+                uint16_t keyRev;
+                uint16_t minorRev;
+                uint16_t numKeys;
+            };
+#pragma pack(pop)
+
+            ShortKeyHeader *header = (ShortKeyHeader *)data.data();
+            // Calculate the number of shorts in the VLR data.
+            // The '+ 1' accounts for the header itself.
+            int count = (header->numKeys + 1) * 4;
+            short *data_s = reinterpret_cast<short *>( &(data[0]));
 
             ST_SetKey(m_tiff, record.GetRecordId(), count, STT_SHORT, data_s);
         }
 
-        if (uid == record.GetUserId(true).c_str() && 34736 == record.GetRecordId())
+        if (uid == record.GetUserId(true).c_str() &&
+            34736 == record.GetRecordId())
         {
             int count = data.size() / sizeof(double);
             ST_SetKey(m_tiff, record.GetRecordId(), count, STT_DOUBLE, &(data[0]));
-        }        
+        }
 
-        if (uid == record.GetUserId(true).c_str() && 34737 == record.GetRecordId())
+        if (uid == record.GetUserId(true).c_str() &&
+            34737 == record.GetRecordId())
         {
             int count = data.size()/sizeof(uint8_t);
             ST_SetKey(m_tiff, record.GetRecordId(), count, STT_ASCII, &(data[0]));
@@ -530,20 +537,20 @@ const GTIF* SpatialReference::GetGTIF()
     }
 
     m_gtiff = GTIFNewSimpleTags(m_tiff);
-    if (!m_gtiff) 
+    if (!m_gtiff)
         throw std::runtime_error("The geotiff keys could not be read from VLR records");
-    
+
     return m_gtiff;
 #endif
 }
 
-std::string SpatialReference::GetWKT( WKTModeFlag mode_flag) const 
+std::string SpatialReference::GetWKT( WKTModeFlag mode_flag) const
 {
     return GetWKT(mode_flag, false);
 }
 
 /// Fetch the SRS as WKT
-std::string SpatialReference::GetWKT(WKTModeFlag mode_flag , bool pretty) const 
+std::string SpatialReference::GetWKT(WKTModeFlag mode_flag , bool pretty) const
 {
 #ifndef HAVE_GDAL
     boost::ignore_unused_variable_warning(mode_flag);
@@ -558,8 +565,8 @@ std::string SpatialReference::GetWKT(WKTModeFlag mode_flag , bool pretty) const
     if( m_wkt != "" )
     {
         std::string result_wkt = m_wkt;
-        
-        if( (mode_flag == eHorizontalOnly 
+
+        if( (mode_flag == eHorizontalOnly
              && strstr(result_wkt.c_str(),"COMPD_CS") != NULL)
             || pretty )
         {
@@ -569,11 +576,11 @@ std::string SpatialReference::GetWKT(WKTModeFlag mode_flag , bool pretty) const
             if( mode_flag == eHorizontalOnly )
                 poSRS->StripVertical();
 
-            if (pretty) 
+            if (pretty)
                 poSRS->exportToPrettyWkt(&pszWKT, FALSE );
             else
                 poSRS->exportToWkt( &pszWKT );
-            
+
             OSRDestroySpatialReference( poSRS );
 
             result_wkt = pszWKT;
@@ -583,7 +590,7 @@ std::string SpatialReference::GetWKT(WKTModeFlag mode_flag , bool pretty) const
         return result_wkt;
     }
 
-    // Otherwise build WKT from GeoTIFF VLRs. 
+    // Otherwise build WKT from GeoTIFF VLRs.
 
     GTIFDefn sGTIFDefn;
     char* pszWKT = 0;
@@ -600,7 +607,7 @@ std::string SpatialReference::GetWKT(WKTModeFlag mode_flag , bool pretty) const
             OGRSpatialReference* poSRS = (OGRSpatialReference*) OSRNewSpatialReference(NULL);
             char *pszOrigWKT = pszWKT;
             poSRS->importFromWkt( &pszOrigWKT );
-            
+
             CPLFree( pszWKT );
             pszWKT = NULL;
             poSRS->exportToPrettyWkt(&pszWKT, false);
@@ -614,8 +621,8 @@ std::string SpatialReference::GetWKT(WKTModeFlag mode_flag , bool pretty) const
         // Older versions of GDAL lack StripVertical(), but should never
         // actually return COMPD_CS anyways.
 #if (GDAL_VERSION_NUM >= 1700) && (GDAL_RELEASE_DATE >= 20100110)
-        if( pszWKT 
-            && mode_flag == eHorizontalOnly 
+        if( pszWKT
+            && mode_flag == eHorizontalOnly
             && strstr(pszWKT,"COMPD_CS") != NULL )
         {
             OGRSpatialReference* poSRS = (OGRSpatialReference*) OSRNewSpatialReference(NULL);
@@ -626,11 +633,11 @@ std::string SpatialReference::GetWKT(WKTModeFlag mode_flag , bool pretty) const
             pszWKT = NULL;
 
             poSRS->StripVertical();
-            if (pretty) 
+            if (pretty)
                 poSRS->exportToPrettyWkt(&pszWKT, false);
             else
                 poSRS->exportToWkt( &pszWKT );
-            
+
             OSRDestroySpatialReference( poSRS );
         }
 #else
@@ -654,19 +661,19 @@ void SpatialReference::SetFromUserInput(std::string const& v)
 
     char* poWKT = 0;
     const char* input = v.c_str();
-    
+
     // OGRSpatialReference* poSRS = (OGRSpatialReference*) OSRNewSpatialReference(NULL);
     OGRSpatialReference srs(NULL);
     if (OGRERR_NONE != srs.SetFromUserInput(const_cast<char *> (input)))
     {
         throw std::invalid_argument("could not import coordinate system into OSRSpatialReference SetFromUserInput");
     }
-    
+
     srs.exportToWkt(&poWKT);
-    
+
     std::string tmp(poWKT);
     CPLFree(poWKT);
-    
+
     SetWKT(tmp);
 #else
     boost::ignore_unused_variable_warning(v);
@@ -680,19 +687,19 @@ void SpatialReference::SetWKT(std::string const& v)
 
     if (!m_gtiff)
     {
-        GetGTIF(); 
+        GetGTIF();
     }
 
 #ifdef HAVE_GDAL
     int ret = 0;
     ret = GTIFSetFromOGISDefn( m_gtiff, v.c_str() );
-    if (!ret) 
+    if (!ret)
     {
         throw std::invalid_argument("could not set m_gtiff from WKT");
     }
 
     ret = GTIFWriteKeys(m_gtiff);
-    if (!ret) 
+    if (!ret)
     {
         throw std::runtime_error("The geotiff keys could not be written");
     }
@@ -703,14 +710,14 @@ void SpatialReference::SetWKT(std::string const& v)
     ResetVLRs();
 }
 
-void SpatialReference::SetVerticalCS(boost::int32_t verticalCSType, 
+void SpatialReference::SetVerticalCS(boost::int32_t verticalCSType,
                                      std::string const& citation,
                                      boost::int32_t verticalDatum,
                                      boost::int32_t verticalUnits)
 {
     if (!m_gtiff)
     {
-        GetGTIF(); 
+        GetGTIF();
     }
 
 #ifdef HAVE_LIBGEOTIFF
@@ -719,26 +726,26 @@ void SpatialReference::SetVerticalCS(boost::int32_t verticalCSType,
                     verticalCSType );
 
     if( citation != "" )
-        GTIFKeySet( m_gtiff, VerticalCitationGeoKey, TYPE_ASCII, 0, 
-                    citation.c_str() );			       
+        GTIFKeySet( m_gtiff, VerticalCitationGeoKey, TYPE_ASCII, 0,
+                    citation.c_str() );
 
     if( verticalDatum > 0 && verticalDatum != KvUserDefined )
         GTIFKeySet( m_gtiff, VerticalDatumGeoKey, TYPE_SHORT, 1,
                     verticalDatum );
-        
+
     if( verticalUnits > 0 && verticalUnits != KvUserDefined )
         GTIFKeySet( m_gtiff, VerticalUnitsGeoKey, TYPE_SHORT, 1,
                     verticalUnits );
 
     int ret = GTIFWriteKeys(m_gtiff);
-    if (!ret) 
+    if (!ret)
     {
         throw std::runtime_error("The geotiff keys could not be written");
     }
 
-    // Clear WKT so it gets regenerated 
+    // Clear WKT so it gets regenerated
     m_wkt = std::string("");
-    
+
     ResetVLRs();
 #else
     boost::ignore_unused_variable_warning(citation);
@@ -747,35 +754,35 @@ void SpatialReference::SetVerticalCS(boost::int32_t verticalCSType,
     boost::ignore_unused_variable_warning(verticalCSType);
 #endif /* def HAVE_LIBGEOTIFF */
 }
-                                         
-std::string SpatialReference::GetProj4() const 
+
+std::string SpatialReference::GetProj4() const
 {
 #ifdef HAVE_GDAL
-    
+
     std::string wkt = GetWKT(eCompoundOK);
     const char* poWKT = wkt.c_str();
-    
+
     OGRSpatialReference srs(NULL);
     if (OGRERR_NONE != srs.importFromWkt(const_cast<char **> (&poWKT)))
     {
         return std::string();
     }
-    
+
     char* proj4 = 0;
     srs.exportToProj4(&proj4);
     std::string tmp(proj4);
     CPLFree(proj4);
-    
+
     return tmp;
 #endif
 
-// if we have libgeotiff but not GDAL, we'll use the 
+// if we have libgeotiff but not GDAL, we'll use the
 // simple method in libgeotiff
 #if defined(HAVE_LIBGEOTIFF) && !defined(HAVE_GDAL)
 
     GTIFDefn defn;
 
-    if (m_gtiff && GTIFGetDefn(m_gtiff, &defn)) 
+    if (m_gtiff && GTIFGetDefn(m_gtiff, &defn))
     {
         char* proj4def = GTIFGetProj4Defn(&defn);
         std::string tmp(proj4def);
@@ -797,7 +804,7 @@ void SpatialReference::SetProj4(std::string const& v)
         GetGTIF();
         ResetVLRs();
     }
-   
+
 #ifdef HAVE_GDAL
     char* poWKT = 0;
     const char* poProj4 = v.c_str();
@@ -807,12 +814,12 @@ void SpatialReference::SetProj4(std::string const& v)
     {
         throw std::invalid_argument("could not import proj4 into OSRSpatialReference SetProj4");
     }
-    
+
     srs.exportToWkt(&poWKT);
-    
+
     std::string tmp(poWKT);
     CPLFree(poWKT);
-        
+
     int ret = 0;
     ret = GTIFSetFromOGISDefn( m_gtiff, tmp.c_str() );
     if (!ret)
@@ -821,14 +828,14 @@ void SpatialReference::SetProj4(std::string const& v)
     }
 
     ret = GTIFWriteKeys(m_gtiff);
-    if (!ret) 
+    if (!ret)
     {
         throw std::runtime_error("The geotiff keys could not be written");
     }
 
     GTIFDefn defn;
 
-    if (m_gtiff && GTIFGetDefn(m_gtiff, &defn)) 
+    if (m_gtiff && GTIFGetDefn(m_gtiff, &defn))
     {
         char* proj4def = GTIFGetProj4Defn(&defn);
         std::string tmp(proj4def);
@@ -838,22 +845,22 @@ void SpatialReference::SetProj4(std::string const& v)
     boost::ignore_unused_variable_warning(v);
 #endif
 
-// if we have libgeotiff but not GDAL, we'll use the 
+// if we have libgeotiff but not GDAL, we'll use the
 // simple method in libgeotiff
 #if defined(HAVE_LIBGEOTIFF) && !defined(HAVE_GDAL)
 
     int ret = 0;
     ret = GTIFSetFromProj4( m_gtiff, v.c_str());
-    if (!ret) 
+    if (!ret)
     {
         throw std::invalid_argument("PROJ.4 string is invalid or unsupported");
     }
 
     ret = GTIFWriteKeys(m_gtiff);
-    if (!ret) 
+    if (!ret)
     {
         throw std::runtime_error("The geotiff keys could not be written");
-    }    
+    }
 #endif
 
     ResetVLRs();
@@ -905,9 +912,9 @@ liblas::property_tree::ptree SpatialReference::GetPTree( ) const
     srs.put("prettycompoundwkt", message);
     srs.put("gtiff", message);
 #endif
-    
+
     return srs;
-    
+
 }
 
 std::string SpatialReference::GetGTIFFText() const
@@ -931,7 +938,7 @@ std::string SpatialReference::GetGTIFFText() const
 std::ostream& operator<<(std::ostream& ostr, const liblas::SpatialReference& srs)
 {
 
-#ifdef HAVE_GDAL 
+#ifdef HAVE_GDAL
     liblas::property_tree::ptree tree;
     std::string name ("spatialreference");
     tree.put_child(name, srs.GetPTree());
diff --git a/src/tifvsi.cpp b/src/tifvsi.cpp
old mode 100755
new mode 100644
diff --git a/src/tifvsi.h b/src/tifvsi.h
old mode 100755
new mode 100644
diff --git a/src/transform.cpp b/src/transform.cpp
old mode 100755
new mode 100644
diff --git a/src/utility.cpp b/src/utility.cpp
old mode 100755
new mode 100644
diff --git a/src/variablerecord.cpp b/src/variablerecord.cpp
old mode 100755
new mode 100644
diff --git a/src/version.cpp b/src/version.cpp
old mode 100755
new mode 100644
diff --git a/src/writer.cpp b/src/writer.cpp
old mode 100755
new mode 100644
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
old mode 100755
new mode 100644
diff --git a/test/data/1.0_0.las b/test/data/1.0_0.las
old mode 100755
new mode 100644
diff --git a/test/data/1.0_1.las b/test/data/1.0_1.las
old mode 100755
new mode 100644
diff --git a/test/data/1.1_0.las b/test/data/1.1_0.las
old mode 100755
new mode 100644
diff --git a/test/data/1.1_1.las b/test/data/1.1_1.las
old mode 100755
new mode 100644
diff --git a/test/data/1.2-with-color.las b/test/data/1.2-with-color.las
old mode 100755
new mode 100644
diff --git a/test/data/1.2-with-color.laz b/test/data/1.2-with-color.laz
old mode 100755
new mode 100644
diff --git a/test/data/1.2_0.las b/test/data/1.2_0.las
old mode 100755
new mode 100644
diff --git a/test/data/1.2_1.las b/test/data/1.2_1.las
old mode 100755
new mode 100644
diff --git a/test/data/1.2_2.las b/test/data/1.2_2.las
old mode 100755
new mode 100644
diff --git a/test/data/1.2_3.las b/test/data/1.2_3.las
old mode 100755
new mode 100644
diff --git a/test/data/TO_core_last_clip.las b/test/data/TO_core_last_clip.las
old mode 100755
new mode 100644
diff --git a/test/data/autzen.jpg b/test/data/autzen.jpg
old mode 100755
new mode 100644
diff --git a/test/data/autzen.jpg.aux.xml b/test/data/autzen.jpg.aux.xml
old mode 100755
new mode 100644
diff --git a/test/data/autzen.las b/test/data/autzen.las
old mode 100755
new mode 100644
diff --git a/test/data/autzen.wld b/test/data/autzen.wld
old mode 100755
new mode 100644
diff --git a/test/data/bad_points_1.1.las b/test/data/bad_points_1.1.las
old mode 100755
new mode 100644
diff --git a/test/data/certainty3d-color-utm-feet-navd88.las b/test/data/certainty3d-color-utm-feet-navd88.las
old mode 100755
new mode 100644
diff --git a/test/data/lots_of_vlr.las b/test/data/lots_of_vlr.las
old mode 100755
new mode 100644
diff --git a/test/data/make_bad_points.py b/test/data/make_bad_points.py
old mode 100755
new mode 100644
diff --git a/test/data/srs.las b/test/data/srs.las
old mode 100755
new mode 100644
diff --git a/test/data/srs_utm17.las b/test/data/srs_utm17.las
old mode 100755
new mode 100644
diff --git a/test/data/srs_vertcs.las b/test/data/srs_vertcs.las
old mode 100755
new mode 100644
diff --git a/test/sample/CMakeLists.txt b/test/sample/CMakeLists.txt
old mode 100755
new mode 100644
diff --git a/test/sample/files.cpp b/test/sample/files.cpp
old mode 100755
new mode 100644
diff --git a/test/sample/files.vcproj b/test/sample/files.vcproj
old mode 100755
new mode 100644
diff --git a/test/sample/liblas.vsprops b/test/sample/liblas.vsprops
old mode 100755
new mode 100644
diff --git a/test/sample/liblas_sample.sln b/test/sample/liblas_sample.sln
old mode 100755
new mode 100644
diff --git a/test/sample/read.cpp b/test/sample/read.cpp
old mode 100755
new mode 100644
diff --git a/test/sample/read.vcproj b/test/sample/read.vcproj
old mode 100755
new mode 100644
diff --git a/test/sample/update.cpp b/test/sample/update.cpp
old mode 100755
new mode 100644
diff --git a/test/sample/update.vcproj b/test/sample/update.vcproj
old mode 100755
new mode 100644
diff --git a/test/sample/utility.hpp b/test/sample/utility.hpp
old mode 100755
new mode 100644
diff --git a/test/sample/write.cpp b/test/sample/write.cpp
old mode 100755
new mode 100644
diff --git a/test/sample/write.vcproj b/test/sample/write.vcproj
old mode 100755
new mode 100644
diff --git a/test/unit/CMakeLists.txt b/test/unit/CMakeLists.txt
old mode 100755
new mode 100644
diff --git a/test/unit/bounds_test.cpp b/test/unit/bounds_test.cpp
old mode 100755
new mode 100644
diff --git a/test/unit/classification_test.cpp b/test/unit/classification_test.cpp
old mode 100755
new mode 100644
diff --git a/test/unit/common.cpp b/test/unit/common.cpp
old mode 100755
new mode 100644
diff --git a/test/unit/common.hpp b/test/unit/common.hpp
old mode 100755
new mode 100644
diff --git a/test/unit/error_test.cpp b/test/unit/error_test.cpp
old mode 100755
new mode 100644
diff --git a/test/unit/header_test.cpp b/test/unit/header_test.cpp
old mode 100755
new mode 100644
diff --git a/test/unit/liblas_test.hpp b/test/unit/liblas_test.hpp
old mode 100755
new mode 100644
diff --git a/test/unit/liblas_test_suite.cpp b/test/unit/liblas_test_suite.cpp
old mode 100755
new mode 100644
diff --git a/test/unit/point_test.cpp b/test/unit/point_test.cpp
old mode 100755
new mode 100644
diff --git a/test/unit/reader_iterator_test.cpp b/test/unit/reader_iterator_test.cpp
old mode 100755
new mode 100644
diff --git a/test/unit/reader_test.cpp b/test/unit/reader_test.cpp
old mode 100755
new mode 100644
diff --git a/test/unit/spatialreference_test.cpp b/test/unit/spatialreference_test.cpp
old mode 100755
new mode 100644
diff --git a/test/unit/transform_test.cpp b/test/unit/transform_test.cpp
old mode 100755
new mode 100644
diff --git a/test/unit/tut/tut.hpp b/test/unit/tut/tut.hpp
old mode 100755
new mode 100644
diff --git a/test/unit/tut/tut_assert.hpp b/test/unit/tut/tut_assert.hpp
old mode 100755
new mode 100644
diff --git a/test/unit/tut/tut_config.hpp b/test/unit/tut/tut_config.hpp
old mode 100755
new mode 100644
diff --git a/test/unit/tut/tut_console_reporter.hpp b/test/unit/tut/tut_console_reporter.hpp
old mode 100755
new mode 100644
diff --git a/test/unit/tut/tut_exception.hpp b/test/unit/tut/tut_exception.hpp
old mode 100755
new mode 100644
diff --git a/test/unit/tut/tut_posix.hpp b/test/unit/tut/tut_posix.hpp
old mode 100755
new mode 100644
diff --git a/test/unit/tut/tut_reporter.hpp b/test/unit/tut/tut_reporter.hpp
old mode 100755
new mode 100644
diff --git a/test/unit/tut/tut_restartable.hpp b/test/unit/tut/tut_restartable.hpp
old mode 100755
new mode 100644
diff --git a/test/unit/tut/tut_result.hpp b/test/unit/tut/tut_result.hpp
old mode 100755
new mode 100644
diff --git a/test/unit/tut/tut_runner.hpp b/test/unit/tut/tut_runner.hpp
old mode 100755
new mode 100644
diff --git a/test/unit/variablerecord_test.cpp b/test/unit/variablerecord_test.cpp
old mode 100755
new mode 100644
diff --git a/test/unit/writer_test.cpp b/test/unit/writer_test.cpp
old mode 100755
new mode 100644
diff --git a/test/unit/zipreader_test.cpp b/test/unit/zipreader_test.cpp
old mode 100755
new mode 100644
diff --git a/test/unit/zipwriter_test.cpp b/test/unit/zipwriter_test.cpp
old mode 100755
new mode 100644

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/liblas.git



More information about the Pkg-grass-devel mailing list