From 70c82569668048642c26cdefb7b908e9ed5c590e Mon Sep 17 00:00:00 2001 From: Holden <68555040+HTRamsey@users.noreply.github.com> Date: Mon, 19 Aug 2024 04:31:38 -0400 Subject: [PATCH] fix Windows Build (#10) - Fix portability of vector iterator - Fix casting to HANDLE --- ulog_cpp/messages.cpp | 2 +- ulog_cpp/simple_writer.cpp | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/ulog_cpp/messages.cpp b/ulog_cpp/messages.cpp index 776b5f0..c5c82fd 100644 --- a/ulog_cpp/messages.cpp +++ b/ulog_cpp/messages.cpp @@ -278,7 +278,7 @@ Value::NativeTypeVariant Value::asNativeTypeVariant() const if (_backing_ref_end - string_start_iterator < _field_ref.arrayLength()) { throw AccessException("Decoding fault, memory too short"); } - int string_length = strnlen(string_start_iterator.base(), _field_ref.arrayLength()); + const int string_length = strnlen(&(*string_start_iterator), _field_ref.arrayLength()); return std::string(string_start_iterator, string_start_iterator + string_length); } diff --git a/ulog_cpp/simple_writer.cpp b/ulog_cpp/simple_writer.cpp index 0651859..5331147 100644 --- a/ulog_cpp/simple_writer.cpp +++ b/ulog_cpp/simple_writer.cpp @@ -5,7 +5,8 @@ #include "simple_writer.hpp" -#ifdef WINDOWS +#ifdef _WIN32 +#include // NOLINT #include #else #include @@ -112,8 +113,8 @@ void SimpleWriter::fsync() { if (_file) { fflush(_file); -#ifdef WINDOWS - FlushFileBuffers(static_cast(_fileno(_file))); +#ifdef _WIN32 + FlushFileBuffers(reinterpret_cast(static_cast(_fileno(_file)))); #else ::fsync(fileno(_file)); #endif