Made native tests compile again

This commit is contained in:
Martin Bauer
2023-08-28 15:06:29 +02:00
parent 900d3c8262
commit 2efa985a05
12 changed files with 172 additions and 28 deletions

View File

@@ -12,7 +12,7 @@ class VectorAdaptor {
public:
VectorAdaptor(std::vector<uint8_t> * v) : v_(v) {}
void write(const char *data, uint32_t size) {
void write(const uint8_t *data, uint32_t size) {
v_->insert(v_->end(), data, data + size );
}
@@ -38,7 +38,7 @@ public:
FilePtrAdaptor(const FilePtrAdaptor &) = delete;
void operator=(const FilePtrAdaptor &) = delete;
void write(const char *data, uint32_t size) {
void write(const uint8_t *data, uint32_t size) {
fwrite(data, size, 1, fptr);
}

View File

@@ -1,7 +1,9 @@
#include "Dtypes.h"
#include "SessionChunk.h"
#include "FilesystemAbstraction.h"
#include "AllocAbstraction.h"
#include "Logger.h"
#include "SwimTrackerConfig.h"
template <typename Measurement_T, uint32_t MAX_SIZE>
@@ -85,7 +87,8 @@ private:
deleteUntilBytesFree(CONFIG_SESSION_MAX_SIZE);
LOG_INFO(" %ld after deleteUntilBytesFree()", millis());
String filename = String(CONFIG_DATA_PATH) + "/" + String(chunk->getStartTime());
using fs_string = portablefs::string;
fs_string filename = fs_string(CONFIG_DATA_PATH) + "/" + portablefs::to_string(chunk->getStartTime());
if (portablefs::exists(filename.c_str()))
{
auto file = portablefs::open(filename.c_str(), "r+");
@@ -111,6 +114,7 @@ private:
void deleteUntilBytesFree(size_t requiredSpace)
{
#ifdef PLATFORM_ESP32
auto freeBytes = portablefs::totalBytes() - portablefs::usedBytes();
while (freeBytes < requiredSpace)
{
@@ -140,6 +144,7 @@ private:
assert(newFreeBytes > freeBytes);
freeBytes = newFreeBytes;
}
#endif // PLATFORM_ESP32
}
ChunkT *chunk;

View File

@@ -1,4 +1,5 @@
#pragma once
#include "Logger.h"
template<typename T> struct TypeToMsgPackCode{};
template<> struct TypeToMsgPackCode<uint8_t> { static const char CODE; };
@@ -52,7 +53,7 @@ public:
else
{
size |= 0b10000000;
writer->write((byte*)(&size), 1);
writer->write((uint8_t*)(&size), 1);
}
}