Package: lib3mf1
Version: 1.8.1+ds-3
Severity: important
Tags: patch upstream

Dear Maintainer,

   * running CGAL Demos
   * Recompiled lib from sources, after debugging and patching
     NB : wouldn't build as was
   * cgal-demo runs and can r/w *.3mf files
   * had expected cgal demo to work;



-- System Information:
Debian Release: bullseye/sid
  APT prefers focal-security
  APT policy: (650, 'focal-security'), (500, 'focal-updates'), (500, 'focal'), 
(100, 'focal-backports')
Architecture: amd64 (x86_64)

Kernel: Linux 5.8.0-44-lowlatency (SMP w/2 CPU cores; PREEMPT)
Kernel taint flags: TAINT_WARN
Locale: LANG=en_IE.UTF-8, LC_CTYPE=en_IE.UTF-8 (charmap=UTF-8) (ignored: LC_ALL 
set to en_IE.UTF-8), LANGUAGE=en_IE (charmap=UTF-8) (ignored: LC_ALL set to 
en_IE.UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages lib3mf1 depends on:
ii  libc6       2.31-0ubuntu9.2
ii  libgcc-s1   10.2.0-5ubuntu1~20.04
ii  libstdc++6  10.2.0-5ubuntu1~20.04
ii  libuuid1    2.34-0.1ubuntu9.1

lib3mf1 recommends no packages.

lib3mf1 suggests no packages.

-- no debconf information
--- lib3mf-1.8.1+ds/CMakeLists.txt  2019-01-08 12:36:18.000000000 +0000
+++ ./l2/CMakeLists.txt 2021-03-25 16:41:10.790119112 +0000
@@ -18,14 +18,20 @@
 # use the cmake option -DNMR_COM_NATIVE:BOOL=ON to build the COM interface
 option(NMR_COM_NATIVE "Implement a COM interface" OFF)

+## `uname -s`
+if ("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Linux")
+    option(USE_INCLUDED_ZLIB "Use included zlib" OFF)
+    option(USE_INCLUDED_LIBZIP "Use included libzip" OFF)
+else()
 option(USE_INCLUDED_ZLIB "Use included zlib" ON)
 option(USE_INCLUDED_LIBZIP "Use included libzip" ON)
+endif()

 if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
   # using GCC
   add_definitions(-DBUILD_DLL)
   add_compile_options(-Wall)
-  SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -O2")
+  SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -O2 -Wall")
 elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
   # using GCC
   add_definitions(-DBUILD_DLL)
@@ -114,6 +120,26 @@
        endif()
        target_link_libraries(${PROJECT_NAME}_s ${LIBUUID_PATH})
    endif()
+    if (NOT USE_INCLUDED_LIBZIP)
+        #### ZIP
+        find_library(LIBZIP_PATH zip)
+        if(NOT LIBZIP_PATH)
+            message(FATAL_ERROR "libzip not found")
+        endif()
+        message("USE_INCLUDED_LIBZIP ... " ${USE_INCLUDED_LIBZIP})
+        message("LIBZIP_PATH ... " ${LIBZIP_PATH})
+        target_link_libraries(${PROJECT_NAME}_s ${LIBZIP_PATH})
+    endif()
+    if (NOT USE_INCLUDED_ZLIB)
+        #### ZLIB
+        find_library(ZLIB_PATH zip)
+        if(NOT ZLIB_PATH)
+            message(FATAL_ERROR "zlib not found")
+        endif()
+        message("USE_INCLUDED_ZLIB ... " ${USE_INCLUDED_ZLIB})
+        message("ZLIB_PATH ... " ${ZLIB_PATH})
+        target_link_libraries(${PROJECT_NAME}_s ${ZLIB_PATH})
+    endif()
 else()
    # wd4996 masks the deprecated-warning
    target_compile_options(${PROJECT_NAME}_s PUBLIC 
"$<$<CONFIG:DEBUG>:/Od;/Ob0;/Gm;/sdl;/W3;/WX;/FC;/wd4996>")
@@ -148,9 +174,9 @@
 install(FILES ${CMAKE_BINARY_DIR}/lib3MF.pc DESTINATION 
${CMAKE_INSTALL_LIBDIR}/pkgconfig)

 #########################################################
-option(LIB3MF_TESTS "Switch whether the tests of Lib3MF should be build" ON)
+option(LIB3MF_TESTS "Switch whether the tests of Lib3MF should be build" OFF)
+### extra dependency package googletests
 if(NOT DEFINED LIB3MF_TESTS)
-   set(LIB3MF_TESTS TRUE)
+   set(LIB3MF_TESTS FALSE)
 endif()
 message("LIB3MF_TESTS ... " ${LIB3MF_TESTS})
 if(LIB3MF_TESTS)
# prevent: warning: catching polymorphic type ‘class std::bad_alloc’ by value 
[-Wcatch-value=]

diff -rU 3 lib3mf-1.8.1+ds/Source/Common/Platform/NMR_ImportStream_Memory.cpp 
l2/Source/Common/Platform/NMR_ImportStream_Memory.cpp
--- lib3mf-1.8.1+ds/Source/Common/Platform/NMR_ImportStream_Memory.cpp  
2019-01-08 12:36:18.000000000 +0000
+++ l2/Source/Common/Platform/NMR_ImportStream_Memory.cpp       2021-03-25 
15:59:44.169063834 +0000
@@ -62,7 +62,7 @@
                try {
                        m_Buffer.resize((size_t)cbCapacity);
                }
-               catch (std::bad_alloc) {
+               catch (std::bad_alloc &x) {
                        throw CNMRException(NMR_ERROR_INVALIDBUFFERSIZE);
                }
 

# prevent: warning: this ‘if’ clause does not guard... 
[-Wmisleading-indentation]

diff -rU 3 lib3mf-1.8.1+ds/Source/Model/Reader/NMR_ModelReaderNode.cpp 
l2/Source/Model/Reader/NMR_ModelReaderNode.cpp
--- lib3mf-1.8.1+ds/Source/Model/Reader/NMR_ModelReaderNode.cpp 2019-01-08 
12:36:18.000000000 +0000
+++ l2/Source/Model/Reader/NMR_ModelReaderNode.cpp      2021-03-25 
15:59:21.067063320 +0000
@@ -161,21 +161,23 @@
                        switch (NodeType) {
                        case XMLREADERNODETYPE_STARTELEMENT:
                                pXMLReader->GetLocalName(&pszLocalName, 
&nCount);
-                               if (!pszLocalName)
+                               if (!pszLocalName) {
                                        throw 
CNMRException(NMR_ERROR_COULDNOTGETLOCALXMLNAME);
+                }
 
                                pXMLReader->GetNamespaceURI(&pszNameSpaceURI, 
&nNameSpaceCount);
-                               if (!pszNameSpaceURI)
+                               if (!pszNameSpaceURI) {
                                        throw 
CNMRException(NMR_ERROR_COULDNOTGETNAMESPACE);
+                }
 
-                                       if (nCount > 0) {
-                                               if (pszNameSpaceURI == nullptr) 
{
-                                                       
OnNSChildElement(pszLocalName, "", pXMLReader);
-                                               }
-                                               else {
-                                                       
OnNSChildElement(pszLocalName, pszNameSpaceURI, pXMLReader);
-                                               }
-                                       }
+                               if (nCount > 0) {
+                                       if (pszNameSpaceURI == nullptr) {
+                                               OnNSChildElement(pszLocalName, 
"", pXMLReader);
+                                       }
+                                       else {
+                                               OnNSChildElement(pszLocalName, 
pszNameSpaceURI, pXMLReader);
+                                       }
+                               }
                                break;
 
                        case XMLREADERNODETYPE_TEXT:

# prevent: warning: enum constant in boolean context [-Wint-in-bool-context]

diff -rU 3 
lib3mf-1.8.1+ds/Source/Model/Reader/v100/NMR_ModelReaderNode100_Object.cpp 
l2/Source/Model/Reader/v100/NMR_ModelReaderNode100_Object.cpp
--- lib3mf-1.8.1+ds/Source/Model/Reader/v100/NMR_ModelReaderNode100_Object.cpp  
2019-01-08 12:36:18.000000000 +0000
+++ l2/Source/Model/Reader/v100/NMR_ModelReaderNode100_Object.cpp       
2021-03-25 15:55:28.214058144 +0000
@@ -300,7 +300,7 @@
                                PModelResource pResource = 
m_pModel->findResource(pID->getUniqueID());
                                CModelSliceStackResource* pSliceStackResource = 
dynamic_cast<CModelSliceStackResource*>(pResource.get());
                                if (pSliceStackResource) {
-                                       if ((m_pObject->getObjectType() == 
MODELOBJECTTYPE_MODEL) || (MODELOBJECTTYPE_SOLIDSUPPORT)) {
+                                       if ((m_pObject->getObjectType() == 
MODELOBJECTTYPE_MODEL) || (m_pObject->getObjectType() == 
MODELOBJECTTYPE_SOLIDSUPPORT)) {
                                                if 
(!pSliceStackResource->getSliceStack()->areAllPolygonsClosed()) {
                                                        throw 
CNMRException(NMR_ERROR_SLICEPOLYGONNOTCLOSED);
                                                }

Reply via email to