Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .github/workflows/bump-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
test-packio:
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/dev-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
name: Bump Packio version
on:
pull_request:
branches:
- master

jobs:
test-packio:
name: Build and Test on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-13, macos-14]

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Build C++ project and run C++ tests
run: |
mkdir build && cd build
cmake -DPACKIO_BUILD_TESTS=ON .. && cmake --build .
ctest .
cd ..
8 changes: 8 additions & 0 deletions modules/core/include/packio/core/serializable.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@ namespace packio
struct DeserializeHelper<U, MAJOR, MINOR, PATCH, T> {
static U deserialize(std::istream& stream, const std::array<char, 16>& signature)
{
if(stream.bad()){
throw std::runtime_error("Attempt to deserialize with a bad stream");
}

// 1) Check signature
std::array<char, 16> expectedSig = serializeSignature<T>();
if (!std::equal(signature.begin(), signature.end(), expectedSig.begin())) {
Expand Down Expand Up @@ -295,6 +299,10 @@ namespace packio
template<typename T, bool EnableCompression = true>
inline void serialize(const T &serializable, std::ostream &stream)
{
if(stream.bad()){
throw std::runtime_error("Attempt to serialize with a bad stream");
}

// 1) Write out "signature" (unique ID for type T)
auto signature = serializeSignature<T>();
writeAll(stream, signature.data(), signature.size(),
Expand Down