[Git][debian-gis-team/laszip][master] 5 commits: New upstream version 3.4.3

Bas Couwenberg gitlab at salsa.debian.org
Tue Nov 12 04:58:39 GMT 2019



Bas Couwenberg pushed to branch master at Debian GIS Project / laszip


Commits:
838d6621 by Bas Couwenberg at 2019-11-12T04:39:47Z
New upstream version 3.4.3
- - - - -
b85c51d0 by Bas Couwenberg at 2019-11-12T04:39:49Z
Update upstream source from tag 'upstream/3.4.3'

Update to upstream version '3.4.3'
with Debian dir 4661aac23913266fad319d50bad3f7bdfe4d4bca
- - - - -
a0246ef6 by Bas Couwenberg at 2019-11-12T04:40:03Z
New upstream release.

- - - - -
42b927e0 by Bas Couwenberg at 2019-11-12T04:54:15Z
Add lintian override for shared-lib-without-dependency-information.

- - - - -
2365b10d by Bas Couwenberg at 2019-11-12T04:54:15Z
Set distribution to unstable.

- - - - -


24 changed files:

- CHANGES.txt
- CMakeLists.txt
- debian/changelog
- debian/liblaszip-api8.lintian-overrides
- dll/laszip_api.c
- docs/source/conf.py
- docs/source/index.rst
- src/CMakeLists.txt
- src/lasindex.cpp
- src/lasindex.hpp
- src/lasinterval.cpp
- src/laspoint.hpp
- src/lasquadtree.hpp
- src/lasquantizer.hpp
- src/lasreaditemcompressed_v3.cpp
- src/lasreaditemcompressed_v4.cpp
- src/lasreadpoint.cpp
- src/laswriteitemcompressed_v3.cpp
- src/laswriteitemcompressed_v4.cpp
- src/laszip.cpp
- src/laszip.hpp
- src/laszip_dll.cpp
- + src/mydefs.cpp
- src/mydefs.hpp


Changes:

=====================================
CHANGES.txt
=====================================
@@ -1,3 +1,8 @@
+ 9 November 2019 -- upped version to 3.4 revision 3 for selective decompression extra bytes fix
+ 9 November 2019 -- fix for selective decompression of more than 16 extra bytes in new point types 6 or higher
+ 9 November 2019 -- moved UTF8toUTF16() function from laszip.hpp to mydefs.hpp and added new mydefs.cpp
+16 October 2019 -- unicode support added for Windows LASzip.dll via in new UTF8toUTF16() function
+11 August 2019 -- added CMake for DLL build and minor fixes to allow 64 bit Windows compile of LASzip.dll
 11 April 2019 -- increase AC_BUFFER_SIZE from 1024 to 4096 to lower chance of ultra-rare propagate_carry() overflow
 10 April 2019 -- fix potential memory leaks found by Connor Manning using valgrind
 31 March 2019 -- better license terms for core arithmetic coder thanks to Amir Said. upgrade to version 3.4 rev 0


=====================================
CMakeLists.txt
=====================================
@@ -7,7 +7,7 @@ set(ROOT_DIR "${PROJECT_SOURCE_DIR}")
 
 # the next line is the ONLY place in the entire laszip system where
 # the version info is hard-coded
-set(LASZIP_API_VERSION_STRING "3.4.1" CACHE STRING "LASzip version" FORCE)
+set(LASZIP_API_VERSION_STRING "3.4.3" CACHE STRING "LASzip version" FORCE)
 
 include (CheckIncludeFileCXX)
 include(${ROOT_DIR}/cmake/common.cmake NO_POLICY_SCOPE)
@@ -41,7 +41,7 @@ set(LASZIP_API_VERSION ${LASZIP_API_VERSION_MAJOR}.${LASZIP_API_VERSION_MINOR}.$
 # libtool SO version naming
 # 8.0.0 for 3.2.1
 # 9.0.0 for 4.0+
-set(LASZIP_SO_VERSION "8.0.4")
+set(LASZIP_SO_VERSION "8.0.5")
 set(LASZIP_COMPATIBILITY_VERSION 8)
 
 check_include_file_cxx ("unordered_map" HAVE_UNORDERED_MAP)


=====================================
debian/changelog
=====================================
@@ -1,9 +1,11 @@
-laszip (3.4.1-3) UNRELEASED; urgency=medium
+laszip (3.4.3-1) unstable; urgency=medium
 
+  * New upstream release.
   * Update Homepage URL to use HTTPS.
   * Bump Standards-Version to 4.4.1, no changes.
+  * Add lintian override for shared-lib-without-dependency-information.
 
- -- Bas Couwenberg <sebastic at debian.org>  Mon, 29 Jul 2019 06:56:51 +0200
+ -- Bas Couwenberg <sebastic at debian.org>  Tue, 12 Nov 2019 05:41:08 +0100
 
 laszip (3.4.1-2) unstable; urgency=medium
 


=====================================
debian/liblaszip-api8.lintian-overrides
=====================================
@@ -1,3 +1,6 @@
 # symbols are problematic for C++ libraries.
 no-symbols-control-file *
 
+# API library
+shared-lib-without-dependency-information *
+


=====================================
dll/laszip_api.c
=====================================
@@ -957,7 +957,11 @@ laszip_I32 laszip_load_dll()
   }
   // Load DLL file
 #ifdef _WIN32
+#ifdef _WIN64
+  laszip_HINSTANCE = LoadLibrary(TEXT("LASzip64.dll"));
+#else
   laszip_HINSTANCE = LoadLibrary(TEXT("LASzip.dll"));
+#endif // _WIN64
 #elif __APPLE__
   laszip_HINSTANCE = LoadLibrary("liblaszip.dylib", RTLD_NOW);
 #else


=====================================
docs/source/conf.py
=====================================
@@ -41,16 +41,16 @@ master_doc = 'index'
 
 # General information about the project.
 project = u'LASzip'
-copyright = u'2018, Martin Isenburg'
+copyright = u'2019, Martin Isenburg'
 
 # The version info for the project you're documenting, acts as replacement for
 # |version| and |release|, also used in various other places throughout the
 # built documents.
 #
 # The short X.Y version.
-version = '3.2.8'
+version = '3.4.3'
 # The full version, including alpha/beta/rc tags.
-release = '3.2.8'
+release = '3.4.3'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.


=====================================
docs/source/index.rst
=====================================
@@ -9,15 +9,20 @@ LASzip - a free open source product of `rapidlasso GmbH <http://rapidlasso.com/>
 Source
 ..............................................................................
 
-* **2019-04-12**
+* **2019-11-11**
 
-  - `laszip-3.4.1.tar.gz <https://github.com/LASzip/LASzip/releases/download/3.4.1/laszip-src-3.4.1.tar.gz>`_
-    `(md5) <https://github.com/LASzip/LASzip/releases/download/3.4.1/laszip-src-3.4.1.tar.gz.sha256sum>`__
+  - `laszip-3.4.3.tar.gz <https://github.com/LASzip/LASzip/releases/download/3.4.3/laszip-src-3.4.3.tar.gz>`_
+    `(md5) <https://github.com/LASzip/LASzip/releases/download/3.4.3/laszip-src-3.4.3.tar.gz.sha256sum>`__
 
 
 Past Release(s)
 ~~~~~~~~~~~~~~~~~~~~~~~~~
 
+* **2019-04-12**
+
+  - `laszip-3.4.1.tar.gz <https://github.com/LASzip/LASzip/releases/download/3.4.1/laszip-src-3.4.1.tar.gz>`_
+    `(md5) <https://github.com/LASzip/LASzip/releases/download/3.4.1/laszip-src-3.4.1.tar.gz.sha256sum>`__
+
 * **2018-12-27**
 
   - `laszip-3.2.9.tar.gz <https://github.com/LASzip/LASzip/releases/download/3.2.9/laszip-src-3.2.9.tar.gz>`_


=====================================
src/CMakeLists.txt
=====================================
@@ -18,7 +18,6 @@ set(LASZIP_SOURCES
     lasreaditemcompressed_v3.cpp
     lasreaditemcompressed_v4.cpp
     lasreadpoint.cpp
-    #lasunzipper.cpp
     laswriteitemcompressed_v1.cpp
     laswriteitemcompressed_v2.cpp
     laswriteitemcompressed_v3.cpp
@@ -26,6 +25,7 @@ set(LASZIP_SOURCES
     laswritepoint.cpp
     laszip.cpp
     laszip_dll.cpp
+    mydefs.cpp
 )
 
 add_definitions(-DLASZIPDLL_EXPORTS)


=====================================
src/lasindex.cpp
=====================================
@@ -342,7 +342,13 @@ BOOL LASindex::read(const char* file_name)
     name[strlen(name)-2] = 'a';
     name[strlen(name)-1] = 'x';
   }
+#ifdef _MSC_VER
+  wchar_t* utf16_name = UTF8toUTF16(name);
+  FILE* file = _wfopen(utf16_name, L"rb");
+  delete [] utf16_name;
+#else
   FILE* file = fopen(name, "rb");
+#endif
   if (file == 0)
   {
     free(name);
@@ -379,7 +385,13 @@ BOOL LASindex::append(const char* file_name) const
 
   lasreader->close();
 
+#ifdef _MSC_VER
+  wchar_t* utf16_file_name = UTF8toUTF16(file_name);
+  FILE* file = _wfopen(utf16_file_name, L"rb");
+  delete [] utf16_file_name;
+#else
   FILE* file = fopen(file_name, "rb");
+#endif
   ByteStreamIn* bytestreamin = 0;
   if (IS_LITTLE_ENDIAN())
     bytestreamin = new ByteStreamInFileLE(file);
@@ -443,7 +455,13 @@ BOOL LASindex::append(const char* file_name) const
   fclose(file);
 
   ByteStreamOut* bytestreamout;
+#ifdef _MSC_VER
+  utf16_file_name = UTF8toUTF16(file_name);
+  file = _wfopen(utf16_file_name, L"rb+");
+  delete [] utf16_file_name;
+#else
   file = fopen(file_name, "rb+");
+#endif
   if (IS_LITTLE_ENDIAN())
     bytestreamout = new ByteStreamOutFileLE(file);
   else
@@ -517,7 +535,13 @@ BOOL LASindex::write(const char* file_name) const
     name[strlen(name)-2] = 'a';
     name[strlen(name)-1] = 'x';
   }
+#ifdef _MSC_VER
+  wchar_t* utf16_name = UTF8toUTF16(name);
+  FILE* file = _wfopen(utf16_name, L"wb");
+  delete [] utf16_name;
+#else
   FILE* file = fopen(name, "wb");
+#endif
   if (file == 0)
   {
     fprintf(stderr,"ERROR (LASindex): cannot open '%s' for write\n", name);


=====================================
src/lasindex.hpp
=====================================
@@ -53,7 +53,7 @@ class LASreader;
 class ByteStreamIn;
 class ByteStreamOut;
 
-class LASindex
+class LASLIB_DLL LASindex
 {
 public:
   LASindex();


=====================================
src/lasinterval.cpp
=====================================
@@ -301,7 +301,7 @@ void LASinterval::merge_intervals(U32 maximum_intervals, const BOOL verbose)
     }
     map_element++;
   }
-  fprintf(stderr,"largest interval gap increased to %u\n", diff);
+  if (verbose) fprintf(stderr,"largest interval gap increased to %u\n", diff);
 
   // update totals
 


=====================================
src/laspoint.hpp
=====================================
@@ -25,6 +25,7 @@
   
   CHANGE HISTORY:
   
+    10 May 2019 -- checking for overflows in X, Y, Z of I32 of fixed-point LAS 
     15 June 2018 -- fix in flag copy from legacy (0-5) to extended (6-10) type
     10 March 2017 -- fix in copy_to() and copy_from() new LAS 1.4 point types
     10 October 2016 -- small fixes for NIR and extended scanner channel
@@ -560,7 +561,9 @@ public:
   inline U16 get_point_source_ID() const { return point_source_ID; };
   inline U8 get_deleted_flag() const { return deleted_flag; };
   inline F64 get_gps_time() const { return gps_time; };
-  inline const U16* get_rgb() const { return rgb; };
+  inline const U16* get_RGB() const { return rgb; };
+  inline const U16* get_RGBI() const { return rgb; };
+  inline U16 get_RGBI(const U32 band) const { return rgb[band]; };
   inline U16 get_R() const { return rgb[0]; };
   inline U16 get_G() const { return rgb[1]; };
   inline U16 get_B() const { return rgb[2]; };
@@ -586,6 +589,7 @@ public:
   inline void set_gps_time(const F64 gps_time) { this->gps_time = gps_time; };
   inline void set_RGB(const U16* rgb) { memcpy(this->rgb, rgb, sizeof(U16) * 3); };
   inline void set_RGBI(const U16* rgb) { memcpy(this->rgb, rgb, sizeof(U16) * 4); };
+  inline void set_RGBI(const U32 band, const U16 value) { rgb[band] = value; };
   inline void set_R(const U16 R) { this->rgb[0] = R; };
   inline void set_G(const U16 G) { this->rgb[1] = G; };
   inline void set_B(const U16 B) { this->rgb[2] = B; };
@@ -596,9 +600,9 @@ public:
   inline F64 get_y() const { return quantizer->get_y(Y); };
   inline F64 get_z() const { return quantizer->get_z(Z); };
 
-  inline void set_x(const F64 x) { this->X = quantizer->get_X(x); };
-  inline void set_y(const F64 y) { this->Y = quantizer->get_Y(y); };
-  inline void set_z(const F64 z) { this->Z = quantizer->get_Z(z); };
+  inline BOOL set_x(const F64 x) { I64 X = quantizer->get_X(x); this->X = (I32)(X); return I32_FITS_IN_RANGE(X); };
+  inline BOOL set_y(const F64 y) { I64 Y = quantizer->get_Y(y); this->Y = (I32)(Y); return I32_FITS_IN_RANGE(Y); };
+  inline BOOL set_z(const F64 z) { I64 Z = quantizer->get_Z(z); this->Z = (I32)(Z); return I32_FITS_IN_RANGE(Z); };
 
   inline BOOL is_extended_point_type() const { return extended_point_type; };
 
@@ -628,18 +632,23 @@ public:
     coordinates[2] = get_z();
   };
 
-  inline void compute_XYZ()
+  inline BOOL compute_XYZ()
   {
-    set_x(coordinates[0]);
-    set_y(coordinates[1]);
-    set_z(coordinates[2]);
+    BOOL retX = set_x(coordinates[0]);
+    BOOL retY = set_y(coordinates[1]);
+    BOOL retZ = set_z(coordinates[2]);
+    return (retX && retY && retZ);
   };
 
-  inline void compute_XYZ(const LASquantizer* quantizer)
+  inline BOOL compute_XYZ(const LASquantizer* quantizer)
   {
-    X = quantizer->get_X(coordinates[0]);
-    Y = quantizer->get_Y(coordinates[1]);
-    Z = quantizer->get_Z(coordinates[2]);
+    I64 X = quantizer->get_X(coordinates[0]);
+    I64 Y = quantizer->get_Y(coordinates[1]);
+    I64 Z = quantizer->get_Z(coordinates[2]);
+    this->X = (I32)(X);
+    this->Y = (I32)(Y);
+    this->Z = (I32)(Z);
+    return (I32_FITS_IN_RANGE(X) && I32_FITS_IN_RANGE(Y) && I32_FITS_IN_RANGE(Z));
   };
 
   // generic functions for attributes in extra bytes


=====================================
src/lasquadtree.hpp
=====================================
@@ -42,7 +42,7 @@ class ByteStreamOut;
 
 #define LAS_SPATIAL_QUAD_TREE 0
 
-class LASquadtree
+class LASLIB_DLL LASquadtree
 {
 public:
   LASquadtree();


=====================================
src/lasquantizer.hpp
=====================================
@@ -51,9 +51,9 @@ public:
   inline F64 get_y(const I32 Y) const { return y_scale_factor*Y+y_offset; };
   inline F64 get_z(const I32 Z) const { return z_scale_factor*Z+z_offset; };
 
-  inline I32 get_X(const F64 x) const { if (x >= x_offset) return (I32)((x-x_offset)/x_scale_factor+0.5); else return (I32)((x-x_offset)/x_scale_factor-0.5); };
-  inline I32 get_Y(const F64 y) const { if (y >= y_offset) return (I32)((y-y_offset)/y_scale_factor+0.5); else return (I32)((y-y_offset)/y_scale_factor-0.5); };
-  inline I32 get_Z(const F64 z) const { if (z >= z_offset) return (I32)((z-z_offset)/z_scale_factor+0.5); else return (I32)((z-z_offset)/z_scale_factor-0.5); };
+  inline I64 get_X(const F64 x) const { if (x >= x_offset) return (I64)(((x-x_offset)/x_scale_factor)+0.5); else return (I64)(((x-x_offset)/x_scale_factor)-0.5); };
+  inline I64 get_Y(const F64 y) const { if (y >= y_offset) return (I64)(((y-y_offset)/y_scale_factor)+0.5); else return (I64)(((y-y_offset)/y_scale_factor)-0.5); };
+  inline I64 get_Z(const F64 z) const { if (z >= z_offset) return (I64)(((z-z_offset)/z_scale_factor)+0.5); else return (I64)(((z-z_offset)/z_scale_factor)-0.5); };
 
   LASquantizer()
   {


=====================================
src/lasreaditemcompressed_v3.cpp
=====================================
@@ -2133,7 +2133,14 @@ LASreadItemCompressed_BYTE14_v3::LASreadItemCompressed_BYTE14_v3(ArithmeticDecod
 
     changed_Bytes[i] = FALSE;
 
-    requested_Bytes[i] = (decompress_selective & (LASZIP_DECOMPRESS_SELECTIVE_BYTE0 << i) ? TRUE : FALSE);
+    if (i > 15) // currently only the first 16 extra bytes can be selectively decompressed
+    {
+      requested_Bytes[i] = TRUE;
+    }
+    else
+    {
+      requested_Bytes[i] = (decompress_selective & (LASZIP_DECOMPRESS_SELECTIVE_BYTE0 << i) ? TRUE : FALSE);
+    }
   }
 
   /* init the bytes buffer to zero */


=====================================
src/lasreaditemcompressed_v4.cpp
=====================================
@@ -2133,7 +2133,14 @@ LASreadItemCompressed_BYTE14_v4::LASreadItemCompressed_BYTE14_v4(ArithmeticDecod
 
     changed_Bytes[i] = FALSE;
 
-    requested_Bytes[i] = (decompress_selective & (LASZIP_DECOMPRESS_SELECTIVE_BYTE0 << i) ? TRUE : FALSE);
+    if (i > 15) // currently only the first 16 extra bytes can be selectively decompressed
+    {
+      requested_Bytes[i] = TRUE;
+    }
+    else
+    {
+      requested_Bytes[i] = (decompress_selective & (LASZIP_DECOMPRESS_SELECTIVE_BYTE0 << i) ? TRUE : FALSE);
+    }
   }
 
   /* init the bytes buffer to zero */


=====================================
src/lasreadpoint.cpp
=====================================
@@ -545,11 +545,11 @@ BOOL LASreadPoint::check_end()
       if (current_chunk < tabled_chunks)
       {
         I64 here = instream->tell();
-        if (chunk_starts[current_chunk] != here)
+        if (chunk_starts[current_chunk] != here) // then last chunk was corrupt
         {
           // create error string
           if (last_error == 0) last_error = new CHAR[128];
-          // last chunk was corrupt
+          // report error
           sprintf(last_error, "chunk with index %u of %u is corrupt", current_chunk, tabled_chunks);
           return FALSE;
         }
@@ -603,6 +603,10 @@ BOOL LASreadPoint::read_chunk_table()
     // no choice but to fail if adaptive chunking was used
     if (chunk_size == U32_MAX)
     {
+      // create error string
+      if (last_error == 0) last_error = new CHAR[128];
+      // report error
+      sprintf(last_error, "compressor was interrupted before writing adaptive chunk table of LAZ file");
       return FALSE;
     }
     // otherwise we build the chunk table as we read the file
@@ -614,6 +618,10 @@ BOOL LASreadPoint::read_chunk_table()
     }
     chunk_starts[0] = chunks_start;
     tabled_chunks = 1;
+    // create warning string
+    if (last_warning == 0) last_warning = new CHAR[128];
+    // report warning
+    sprintf(last_warning, "compressor was interrupted before writing chunk table of LAZ file");
     return TRUE;
   }
 
@@ -733,8 +741,32 @@ BOOL LASreadPoint::read_chunk_table()
     }
     // create warning string
     if (last_warning == 0) last_warning = new CHAR[128];
-    // report warning
-    sprintf(last_warning, "corrupt chunk table");
+    // first seek to the end of the file
+    instream->seekEnd();
+    // get position of last byte
+    I64 last_position = instream->tell();
+    // warn if last byte position is before chunk table start position
+    if (last_position <= chunk_table_start_position)
+    {
+      // report warning
+      if (last_position == chunk_table_start_position)
+      {
+        sprintf(last_warning, "chunk table is missing. improper use of LAZ compressor?");
+      }
+      else
+      {
+#ifdef _WIN32
+        sprintf(last_warning, "chunk table and %I64d bytes are missing. LAZ file truncated during copy or transfer?", chunk_table_start_position - last_position);
+#else
+        sprintf(last_warning, "chunk table and %lld bytes are missing. LAZ file truncated during copy or transfer?", chunk_table_start_position - last_position);
+#endif
+      }
+    }
+    else
+    {
+      // report warning
+      sprintf(last_warning, "corrupt chunk table");
+    }
   }
   if (!instream->seek(chunks_start))
   {


=====================================
src/laswriteitemcompressed_v3.cpp
=====================================
@@ -52,9 +52,7 @@ typedef struct LASpoint14
   U8 scan_direction_flag : 1;
   U8 edge_of_flight_line : 1;
   U8 legacy_classification : 5;
-  U8 legacy_synthetic_flag : 1;
-  U8 legacy_keypoint_flag  : 1;
-  U8 legacy_withheld_flag  : 1;
+  U8 legacy_flags : 3;
   I8 legacy_scan_angle_rank;
   U8 user_data;
   U16 point_source_ID;
@@ -206,6 +204,8 @@ LASwriteItemCompressed_POINT14_v3::~LASwriteItemCompressed_POINT14_v3()
     delete outstream_point_source;
     delete outstream_gps_time;
   }
+
+//  fprintf(stderr, "%u %u %u %u %u %u %u %u %u\n", num_bytes_channel_returns_XY, num_bytes_Z, num_bytes_classification, num_bytes_flags, num_bytes_intensity, num_bytes_scan_angle, num_bytes_user_data, num_bytes_point_source, num_bytes_gps_time);
 }
 
 inline BOOL LASwriteItemCompressed_POINT14_v3::createAndInitModelsAndCompressors(U32 context, const U8* item)


=====================================
src/laswriteitemcompressed_v4.cpp
=====================================
@@ -52,9 +52,7 @@ typedef struct LASpoint14
   U8 scan_direction_flag : 1;
   U8 edge_of_flight_line : 1;
   U8 legacy_classification : 5;
-  U8 legacy_synthetic_flag : 1;
-  U8 legacy_keypoint_flag  : 1;
-  U8 legacy_withheld_flag  : 1;
+  U8 legacy_flags : 3;
   I8 legacy_scan_angle_rank;
   U8 user_data;
   U16 point_source_ID;


=====================================
src/laszip.cpp
=====================================
@@ -13,7 +13,7 @@
 
   COPYRIGHT:
 
-    (c) 2007-2013, martin isenburg, rapidlasso - fast tools to catch reality
+    (c) 2007-2019, martin isenburg, rapidlasso - fast tools to catch reality
 
     This is free software; you can redistribute and/or modify it under the
     terms of the GNU Lesser General Licence as published by the Free Software
@@ -29,7 +29,9 @@
 ===============================================================================
 */
 #include "laszip.hpp"
+
 #include "mydefs.hpp"
+
 #include <assert.h>
 
 #include <string.h>
@@ -1001,3 +1003,4 @@ const char* LASitem::get_name() const
   }
   return 0;
 }
+


=====================================
src/laszip.hpp
=====================================
@@ -65,8 +65,7 @@ typedef __int64   SIGNED_INT64;
 typedef long long SIGNED_INT64;
 #endif
 
-#if defined(_MSC_VER) && \
-    (_MSC_FULL_VER >= 150000000)
+#if defined(_MSC_VER) && (_MSC_FULL_VER >= 150000000)
 #define LASCopyString _strdup
 #else
 #define LASCopyString strdup
@@ -74,8 +73,8 @@ typedef long long SIGNED_INT64;
 
 #define LASZIP_VERSION_MAJOR                3
 #define LASZIP_VERSION_MINOR                4
-#define LASZIP_VERSION_REVISION             1
-#define LASZIP_VERSION_BUILD_DATE      190411
+#define LASZIP_VERSION_REVISION             3
+#define LASZIP_VERSION_BUILD_DATE      191111
 
 #define LASZIP_COMPRESSOR_NONE              0
 #define LASZIP_COMPRESSOR_POINTWISE         1


=====================================
src/laszip_dll.cpp
=====================================
@@ -24,6 +24,7 @@
 
   CHANGE HISTORY:
 
+    15 October 2019 -- support reading from and writing to unicode file names under Windows
     20 March 2019 -- check consistent legacy and extended classification in laszip_write_point()
      7 November 2018 -- assure identical legacy and extended flags in laszip_write_point()
     20 October 2018 -- changed (U8*) to (const U8*) for all out->put___() calls
@@ -1200,7 +1201,7 @@ laszip_set_geokeys(
 
     // add the VLR
 
-    if (laszip_add_vlr(laszip_dll, "LASF_Projection", 34735, 8 + number*8, 0, (laszip_U8*)key_entries_plus_one))
+    if (laszip_add_vlr(laszip_dll, "LASF_Projection", 34735, (laszip_U16)(8 + number*8), 0, (laszip_U8*)key_entries_plus_one))
     {
       sprintf(laszip_dll->error, "setting %u geodouble_params", number);
       return 1;
@@ -1255,7 +1256,7 @@ laszip_set_geodouble_params(
 
     // add the VLR
 
-    if (laszip_add_vlr(laszip_dll, "LASF_Projection", 34736, number*8, 0, (laszip_U8*)geodouble_params))
+    if (laszip_add_vlr(laszip_dll, "LASF_Projection", 34736, (laszip_U16)(number*8), 0, (laszip_U8*)geodouble_params))
     {
       sprintf(laszip_dll->error, "setting %u geodouble_params", number);
       return 1;
@@ -1310,7 +1311,7 @@ laszip_set_geoascii_params(
 
     // add the VLR
 
-    if (laszip_add_vlr(laszip_dll, "LASF_Projection", 34737, number, 0, (laszip_U8*)geoascii_params))
+    if (laszip_add_vlr(laszip_dll, "LASF_Projection", 34737, (laszip_U16)(number), 0, (laszip_U8*)geoascii_params))
     {
       sprintf(laszip_dll->error, "setting %u geoascii_params", number);
       return 1;
@@ -1386,7 +1387,7 @@ laszip_add_attribute(
       return 1;
     }
 
-    if (laszip_add_vlr(laszip_dll, "LASF_Spec\0\0\0\0\0\0", 4, laszip_dll->attributer->number_attributes*sizeof(LASattribute), 0, (laszip_U8*)laszip_dll->attributer->attributes))
+    if (laszip_add_vlr(laszip_dll, "LASF_Spec\0\0\0\0\0\0", 4, (laszip_U16)(laszip_dll->attributer->number_attributes*sizeof(LASattribute)), 0, (laszip_U8*)laszip_dll->attributer->attributes))
     {
       sprintf(laszip_dll->error, "adding the new extra bytes VLR with the additional attribute '%s'", name);
       return 1;
@@ -2045,7 +2046,7 @@ laszip_prepare_point_for_write(
 
       // add the compatibility VLR
 
-      if (laszip_add_vlr(laszip_dll, "lascompatible\0\0", 22204, 2+2+4+148, 0, (laszip_U8*)out->takeData()))
+      if (laszip_add_vlr(laszip_dll, "lascompatible\0\0", 22204, (laszip_U16)(2+2+4+148), 0, (laszip_U8*)out->takeData()))
       {
         sprintf(laszip_dll->error, "adding the compatibility VLR");
         return 1;
@@ -2139,7 +2140,7 @@ laszip_prepare_point_for_write(
 
       // add the extra bytes VLR with the additional attributes
 
-      if (laszip_add_vlr(laszip_dll, "LASF_Spec\0\0\0\0\0\0", 4, laszip_dll->attributer->number_attributes*sizeof(LASattribute), 0, (laszip_U8*)laszip_dll->attributer->attributes))
+      if (laszip_add_vlr(laszip_dll, "LASF_Spec\0\0\0\0\0\0", 4, (laszip_U16)(laszip_dll->attributer->number_attributes*sizeof(LASattribute)), 0, (laszip_U8*)laszip_dll->attributer->attributes))
       {
         sprintf(laszip_dll->error, "adding the extra bytes VLR with the additional attributes");
         return 1;
@@ -2775,7 +2776,7 @@ setup_laszip_items(
   laszip_U8 point_type = laszip_dll->header.point_data_format;
   laszip_U16 point_size = laszip_dll->header.point_data_record_length;
 
-  if (compress && (point_type > 5) && laszip_dll->request_compatibility_mode)
+  if ((point_type > 5) && laszip_dll->request_compatibility_mode)
   {
     if (!laszip->request_compatibility_mode(1))
     {
@@ -2914,7 +2915,13 @@ laszip_open_writer(
 
     // open the file
 
-    laszip_dll->file = fopen(file_name, "wb");
+#ifdef _MSC_VER
+    wchar_t* utf16_file_name = UTF8toUTF16(file_name);
+    laszip_dll->file = _wfopen(utf16_file_name, L"wb");
+    delete [] utf16_file_name;
+#else
+	laszip_dll->file = fopen(file_name, "wb");
+#endif
 
     if (laszip_dll->file == 0)
     {
@@ -4164,7 +4171,7 @@ laszip_read_header(
 
           if (attributer.number_attributes)
           {
-            if (laszip_add_vlr(laszip_dll, "LASF_Spec\0\0\0\0\0\0", 4, attributer.number_attributes*sizeof(LASattribute), 0, (laszip_U8*)attributer.attributes))
+            if (laszip_add_vlr(laszip_dll, "LASF_Spec\0\0\0\0\0\0", 4, (laszip_U16)(attributer.number_attributes*sizeof(LASattribute)), 0, (laszip_U8*)attributer.attributes))
             {
               sprintf(laszip_dll->error, "rewriting the extra bytes VLR without 'LAS 1.4 compatibility mode' attributes");
               return 1;
@@ -4323,7 +4330,13 @@ laszip_open_reader(
 
     // open the file
 
-    laszip_dll->file = fopen(file_name, "rb");
+#ifdef _MSC_VER
+    wchar_t* utf16_file_name = UTF8toUTF16(file_name);
+    laszip_dll->file = _wfopen(utf16_file_name, L"rb");
+    delete [] utf16_file_name;
+#else
+	laszip_dll->file = fopen(file_name, "rb");
+#endif
 
     if (laszip_dll->file == 0)
     {


=====================================
src/mydefs.cpp
=====================================
@@ -0,0 +1,46 @@
+/*
+===============================================================================
+
+  FILE:  mydefs.cpp
+
+  CONTENTS:
+
+    see corresponding header file
+
+  PROGRAMMERS:
+
+    martin.isenburg at rapidlasso.com  -  http://rapidlasso.com
+
+  COPYRIGHT:
+
+    (c) 2011-2019, martin isenburg, rapidlasso - fast tools to catch reality
+
+    This is free software; you can redistribute and/or modify it under the
+    terms of the GNU Lesser General Licence as published by the Free Software
+    Foundation. See the LICENSE.txt file for more information.
+
+    This software is distributed WITHOUT ANY WARRANTY and without even the
+    implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+  CHANGE HISTORY:
+
+    see corresponding header file
+
+===============================================================================
+*/
+#include "mydefs.hpp"
+
+#if defined(_MSC_VER)
+#include <windows.h>
+wchar_t* UTF8toUTF16(const char* utf8)
+{
+  wchar_t* utf16 = 0;
+  int len = MultiByteToWideChar(CP_UTF8, 0, utf8, -1, 0, 0);
+  if (len > 0)
+  {
+    utf16 = new wchar_t[len];
+    MultiByteToWideChar(CP_UTF8, 0, utf8, -1, utf16, len);
+  }
+  return utf16;
+}
+#endif


=====================================
src/mydefs.hpp
=====================================
@@ -124,17 +124,17 @@ typedef union I64U32I32F32 { I64 i64; U32 u32[2]; I32 i32[2]; F32 f32[2]; } I64U
 #define I32_CLAMP(n)    (((n) <= I32_MIN) ? I32_MIN : (((n) >= I32_MAX) ? I32_MAX : ((I32)(n))))
 #define U32_CLAMP(n)    (((n) <= U32_MIN) ? U32_MIN : (((n) >= U32_MAX) ? U32_MAX : ((U32)(n))))
 
-#define I8_QUANTIZE(n) (((n) >= 0) ? (I8)((n)+0.5f) : (I8)((n)-0.5f))
-#define U8_QUANTIZE(n) (((n) >= 0) ? (U8)((n)+0.5f) : (U8)(0))
+#define I8_QUANTIZE(n) (((n) >= 0) ? (I8)((n)+0.5) : (I8)((n)-0.5))
+#define U8_QUANTIZE(n) (((n) >= 0) ? (U8)((n)+0.5) : (U8)(0))
 
-#define I16_QUANTIZE(n) (((n) >= 0) ? (I16)((n)+0.5f) : (I16)((n)-0.5f))
-#define U16_QUANTIZE(n) (((n) >= 0) ? (U16)((n)+0.5f) : (U16)(0))
+#define I16_QUANTIZE(n) (((n) >= 0) ? (I16)((n)+0.5) : (I16)((n)-0.5))
+#define U16_QUANTIZE(n) (((n) >= 0) ? (U16)((n)+0.5) : (U16)(0))
 
-#define I32_QUANTIZE(n) (((n) >= 0) ? (I32)((n)+0.5f) : (I32)((n)-0.5f))
-#define U32_QUANTIZE(n) (((n) >= 0) ? (U32)((n)+0.5f) : (U32)(0))
+#define I32_QUANTIZE(n) (((n) >= 0) ? (I32)((n)+0.5) : (I32)((n)-0.5))
+#define U32_QUANTIZE(n) (((n) >= 0) ? (U32)((n)+0.5) : (U32)(0))
 
-#define I64_QUANTIZE(n) (((n) >= 0) ? (I64)((n)+0.5f) : (I64)((n)-0.5f))
-#define U64_QUANTIZE(n) (((n) >= 0) ? (U64)((n)+0.5f) : (U64)(0))
+#define I64_QUANTIZE(n) (((n) >= 0) ? (I64)((n)+0.5) : (I64)((n)-0.5))
+#define U64_QUANTIZE(n) (((n) >= 0) ? (U64)((n)+0.5) : (U64)(0))
 
 #define I16_FLOOR(n) ((((I16)(n)) > (n)) ? (((I16)(n))-1) : ((I16)(n)))
 #define I32_FLOOR(n) ((((I32)(n)) > (n)) ? (((I32)(n))-1) : ((I32)(n)))
@@ -246,4 +246,9 @@ inline void ENDIAN_SWAP_64(const U8* from, U8* to)
   to[7] = from[0];
 }
 
+#if defined(_MSC_VER)
+#include <windows.h>
+wchar_t* UTF8toUTF16(const char* utf8);
+#endif
+
 #endif



View it on GitLab: https://salsa.debian.org/debian-gis-team/laszip/compare/fcb547f13c2c47462ea35266b21e1415ff4a19e5...2365b10d2033321bfa87622a367d69cfa4a06cca

-- 
View it on GitLab: https://salsa.debian.org/debian-gis-team/laszip/compare/fcb547f13c2c47462ea35266b21e1415ff4a19e5...2365b10d2033321bfa87622a367d69cfa4a06cca
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20191112/61775820/attachment-0001.html>


More information about the Pkg-grass-devel mailing list