Skip to content

Commit

Permalink
Lib3MF Linux fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
netfabb committed Jul 18, 2024
1 parent e2ed3a9 commit 21aa856
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 33 deletions.
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ SOURCE_GROUP("Source Files\\Autogenerated" FILES ${ACT_GENERATED_SOURCE})
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR_AUTOGENERATED}/Source)
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/Include/API)
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/Include)
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/Include/Libraries/lzma)


if (USE_INCLUDED_LIBZIP)
Expand Down
3 changes: 0 additions & 3 deletions Source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ if (USE_INCLUDED_LIBZIP)
endif()


file(GLOB LIBLZMA_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "Source/Libraries/lzma/*.c")

if (USE_INCLUDED_ZLIB)
file(GLOB ZLIB_FILES ./Source/Libraries/zlib/*.c)
endif()
Expand All @@ -21,7 +19,6 @@ file (GLOB CPPBASE64_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "Source/Librarie
set(SRCS_PLATFORM
${LIBZIP_FILES}
${LIBZIP_FILES_PLATFORM}
${LIBLZMA_FILES}
Source/Common/Platform/NMR_Platform.cpp
Source/Common/Platform/NMR_ImportStream_Native.cpp
Source/Common/Platform/NMR_ExportStream_Native.cpp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "Common/Platform/NMR_ImportStream_Shared_Memory.h"
#include "Common/NMR_Exception.h"

#include "Libraries/lzma/LzmaLib.h"
#include "Common/Platform/NMR_XmlWriter_Native.h"
#include "Model/Classes/NMR_ModelConstants.h"
#include <vector>
#include <cmath>


namespace NMR {
Expand Down Expand Up @@ -120,32 +120,8 @@ namespace NMR {

if (m_bEnableLZMA) {

int error;
error = LzmaCompress(
outBuffer.data(), &outBufferSize,
pInputBuffer, inputSize,
outProps.data(), &outPropsSize,

// 7, /* 0 <= level <= 9, default = 5 */
// 64 * 1024 * 1024, /* use (1 << N) or (3 << N). 4 KB < dictSize <= 128 MB */
// 5, /* 0 <= lc <= 8, default = 3 */
// 2, /* 0 <= lp <= 4, default = 0 */
// 3, /* 0 <= pb <= 4, default = 2 */
// 64, /* 5 <= fb <= 273, default = 32 */
// 1 /* 1 or 2, default = 2 */

m_nLZMALevel, /* 0 <= level <= 9, default = 5 */
8 * 1024 * 1024, /* use (1 << N) or (3 << N). 4 KB < dictSize <= 128 MB */
5, /* 0 <= lc <= 8, default = 3 */
2, /* 0 <= lp <= 4, default = 0 */
3, /* 0 <= pb <= 4, default = 2 */
64, /* 5 <= fb <= 273, default = 32 */
1 /* 1 or 2, default = 2 */

);

if (error != SZ_OK)
throw CNMRException(NMR_ERROR_COULDNOTCOMPRESSDATA);
// TODO
throw CNMRException(NMR_ERROR_COULDNOTCOMPRESSDATA);

}
else {
Expand Down
2 changes: 2 additions & 0 deletions Source/Model/Classes/NMR_CustomXMLNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "Common/NMR_Exception.h"
#include "Common/NMR_StringUtils.h"

#include <algorithm>

namespace NMR {

CCustomXMLNode::CCustomXMLNode(CCustomXMLNode * pParentNode, const std::string& sName)
Expand Down
2 changes: 1 addition & 1 deletion Source/Model/Classes/NMR_CustomXMLTree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "Model/Classes/NMR_CustomXMLNode.h"
#include "Model/Classes/NMR_ModelConstants.h"
#include "Common/NMR_Exception.h"
#include "Common/Platform/NMR_XMLWriter_Native.h"
#include "Common/Platform/NMR_XmlWriter_Native.h"
#include "Common/Platform/NMR_ExportStream_Memory.h"

namespace NMR {
Expand Down
2 changes: 1 addition & 1 deletion Source/Model/Classes/NMR_ModelToolpathLayerReadData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ namespace NMR {

size_t nNumberOfAttributes = m_SegmentAttributeDefinitions.size();

m_pCurrentSegment->m_pAttributeData = allocAttributeBuffer((uint32_t)(nNumberOfAttributes));
m_pCurrentSegment->m_pAttributeData = (NMR::nfInt64*) allocAttributeBuffer((uint32_t)(nNumberOfAttributes));

for (size_t nIndex = 0; nIndex < nNumberOfAttributes; nIndex++)
m_pCurrentSegment->m_pAttributeData[nIndex] = m_AttributesOfNextSegment.at(nIndex);
Expand Down

0 comments on commit 21aa856

Please sign in to comment.