Skip to content

Commit

Permalink
Updated CRC Castagnoli to 1.2.0.0, pulled changes from master branch
Browse files Browse the repository at this point in the history
  • Loading branch information
madduci committed Jan 26, 2024
1 parent 0d83dee commit 88a3c6e
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 11 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,5 @@ bin/*
.devcontainer/
.vscode/

test_package/CMakeUserPresets.json
test_package/CMakeUserPresets.json
CMakeUserPresets.json
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ cmake_minimum_required(VERSION 3.15.0 FATAL_ERROR)
# Enables the CMAKE_MSVC_RUNTIME_LIBRARY property on targets
cmake_policy(SET CMP0091 NEW)

project(openE57 VERSION 1.6.4 LANGUAGES C CXX DESCRIPTION "openE57 is a library for handling E57 files")
project(openE57 VERSION 1.6.6 LANGUAGES C CXX DESCRIPTION "openE57 is a library for handling E57 files")

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Building with Position indipendent code on Unix can be activated with the option
git clone https://github.com/madduci/openE57.git
cd open57
mkdir build && cd build
conan install .. --build=missing
conan install --output-folder . --build=missing -o with_tests=True -o with_tools=True -o with_docs=True ..
cmake .. -DCMAKE_BUILD_TYPE=Release
cmake --build . --config Release --target install
```
Expand All @@ -80,7 +80,7 @@ cmake --build . --config Release --target install
git clone https://github.com/madduci/openE57.git
cd open57
md build && cd build
conan install .. --build=missing
conan install --output-folder . --build=missing -o with_tests=True -o with_tools=True -o with_docs=True ..
cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_WITH_MT=ON
cmake --build . --config Release --target install
```
Expand Down
33 changes: 31 additions & 2 deletions src/lib/include/openE57/impl/crc.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/**
@file CRC.h
@author Daniel Bahr
@version 1.1.0.0
@version 1.2.0.0
@copyright
@parblock
CRC++
Copyright (c) 2021, Daniel Bahr
Copyright (c) 2022, Daniel Bahr
All rights reserved.
Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -127,6 +127,12 @@
# define crcpp_constexpr const
#endif

#if defined(WIN32) || defined(_WIN32) || defined(WINCE)
/* Disable warning C4127: conditional expression is constant. */
#pragma warning(push)
#pragma warning(disable : 4127)
#endif

#ifdef CRCPP_USE_NAMESPACE
namespace CRCPP
{
Expand Down Expand Up @@ -230,6 +236,7 @@ class CRC
static const Parameters< crcpp_uint8, 8> & CRC_8();
#ifdef CRCPP_INCLUDE_ESOTERIC_CRC_DEFINITIONS
static const Parameters< crcpp_uint8, 8> & CRC_8_EBU();
static const Parameters< crcpp_uint8, 8> & CRC_8_HDLC();
static const Parameters< crcpp_uint8, 8> & CRC_8_MAXIM();
static const Parameters< crcpp_uint8, 8> & CRC_8_WCDMA();
static const Parameters< crcpp_uint8, 8> & CRC_8_LTE();
Expand Down Expand Up @@ -1216,6 +1223,24 @@ inline const CRC::Parameters<crcpp_uint8, 8> & CRC::CRC_8_EBU()
return parameters;
}

/**
@brief Returns a set of parameters for CRC-8 HDLC (ISO/IEC 13239:2002).
@note The parameters are static and are delayed-constructed to reduce memory footprint.
@note CRC-8 HDLC has the following parameters and check value:
- polynomial = 0x07
- initial value = 0xFF
- final XOR = 0xFF
- reflect input = true
- reflect output = true
- check value = 0x2F
@return CRC-8 HDLC parameters
*/
inline const CRC::Parameters<crcpp_uint8, 8> & CRC::CRC_8_HDLC()
{
static const Parameters<crcpp_uint8, 8> parameters = { 0x07, 0xFF, 0xFF, true, true };
return parameters;
}

/**
@brief Returns a set of parameters for CRC-8 MAXIM (aka CRC-8 DOW-CRC).
@note The parameters are static and are delayed-constructed to reduce memory footprint.
Expand Down Expand Up @@ -2082,4 +2107,8 @@ inline const CRC::Parameters<crcpp_uint64, 64> & CRC::CRC_64()
}
#endif

#if defined(WIN32) || defined(_WIN32) || defined(WINCE)
#pragma warning(pop)
#endif

#endif // CRCPP_CRC_H_
10 changes: 5 additions & 5 deletions src/lib/src/time_conversion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,27 +101,27 @@ constexpr const int DAYS_IN_DEC = 31;
struct timeb timebuffer;
#endif

#ifdef _CRT_SECURE_NO_DEPRECATE
#if defined(_CRT_SECURE_NO_DEPRECATE)
if (_ftime_s(&timebuffer) != 0)
{
ERROR_MESSAGE("if( _ftime_s( &timebuffer ) != 0 )");
return false;
}
#else

# if defined(WIN32) && !defined(__GNUC__)
if (_ftime64_s(&timebuffer); != 0)
#if defined(WIN32) && !defined(__GNUC__)
if (_ftime64_s(&timebuffer) != 0)
{
ERROR_MESSAGE("ftime returned a non-zero result code");
return false;
};
# else
#else
if (ftime(&timebuffer) != 0)
{
ERROR_MESSAGE("ftime returned a non-zero result code");
return false;
};
# endif
#endif

#endif
const double timebuffer_time_in_seconds = timebuffer.time + timebuffer.millitm / 1000.0; // [s] with ms resolution
Expand Down

0 comments on commit 88a3c6e

Please sign in to comment.