Commit 57ac5f01 by Maarten L. Hekkelman

Fix for 32bit, version bump

parent d5a71b0b
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
cmake_minimum_required(VERSION 3.16) cmake_minimum_required(VERSION 3.16)
# set the project name # set the project name
project(cifpp VERSION 5.0.4 LANGUAGES CXX) project(cifpp VERSION 5.0.5 LANGUAGES CXX)
list(PREPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") list(PREPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
......
Version 5.0.5
- Fix code to work on 32 bit machines
Version 5.0.4 Version 5.0.4
- Revert removal of CIFPP_SHARE_DIR export - Revert removal of CIFPP_SHARE_DIR export
......
...@@ -194,6 +194,7 @@ struct item_value ...@@ -194,6 +194,7 @@ struct item_value
/// \brief constructor /// \brief constructor
item_value(std::string_view text) item_value(std::string_view text)
: m_length(text.length()) : m_length(text.length())
, m_storage(0)
{ {
if (m_length >= kBufferSize) if (m_length >= kBufferSize)
{ {
...@@ -210,7 +211,7 @@ struct item_value ...@@ -210,7 +211,7 @@ struct item_value
item_value(item_value &&rhs) item_value(item_value &&rhs)
: m_length(std::exchange(rhs.m_length, 0)) : m_length(std::exchange(rhs.m_length, 0))
, m_data(std::exchange(rhs.m_data, nullptr)) , m_storage(std::exchange(rhs.m_storage, 0))
{ {
} }
...@@ -219,7 +220,7 @@ struct item_value ...@@ -219,7 +220,7 @@ struct item_value
if (this != &rhs) if (this != &rhs)
{ {
m_length = std::exchange(rhs.m_length, m_length); m_length = std::exchange(rhs.m_length, m_length);
m_data = std::exchange(rhs.m_data, m_data); m_storage = std::exchange(rhs.m_storage, m_storage);
} }
return *this; return *this;
} }
...@@ -228,7 +229,7 @@ struct item_value ...@@ -228,7 +229,7 @@ struct item_value
{ {
if (m_length >= kBufferSize) if (m_length >= kBufferSize)
delete[] m_data; delete[] m_data;
m_data = nullptr; m_storage = 0;
m_length = 0; m_length = 0;
} }
...@@ -245,6 +246,7 @@ struct item_value ...@@ -245,6 +246,7 @@ struct item_value
{ {
char m_local_data[8]; char m_local_data[8];
char *m_data; char *m_data;
uint64_t m_storage;
}; };
static constexpr size_t kBufferSize = sizeof(m_local_data); static constexpr size_t kBufferSize = sizeof(m_local_data);
...@@ -257,8 +259,7 @@ struct item_value ...@@ -257,8 +259,7 @@ struct item_value
} }
}; };
// static_assert(sizeof(item_value) == 24, "sizeof(item_value) should be 24 bytes"); static_assert(sizeof(item_value) == sizeof(void*) + 8, "sizeof(item_value) should be correct");
static_assert(sizeof(item_value) == 16, "sizeof(item_value) should be 16 bytes");
// -------------------------------------------------------------------- // --------------------------------------------------------------------
// Transient object to access stored data // Transient object to access stored data
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment