From 77df8969cc6ff86555f702e623b0009561df7711 Mon Sep 17 00:00:00 2001 From: Max Roncace Date: Mon, 15 Jul 2024 23:50:43 -0400 Subject: [PATCH] resman: Finally hopefully fix MSVC compile error --- .../resman/include/argus/resman/cabi/resource_event.h | 4 ++-- .../resman/include/argus/resman/cabi/resource_loader.h | 7 +++++-- engine/static/resman/src/cabi/resource.cpp | 2 +- engine/static/resman/src/cabi/resource_event.cpp | 4 ++-- engine/static/resman/src/cabi/resource_loader.cpp | 4 ++-- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/engine/static/resman/include/argus/resman/cabi/resource_event.h b/engine/static/resman/include/argus/resman/cabi/resource_event.h index f1f4b8f3..8fb12e8b 100644 --- a/engine/static/resman/include/argus/resman/cabi/resource_event.h +++ b/engine/static/resman/include/argus/resman/cabi/resource_event.h @@ -24,7 +24,7 @@ extern "C" { #endif -const char *k_event_type_resource = "resource"; +static const char *const k_event_type_resource = "resource"; typedef enum ResourceEventType { RESOURCE_EVENT_TYPE_LOAD, @@ -36,7 +36,7 @@ typedef const void *argus_resource_event_const_t; ResourceEventType argus_resource_event_get_subtype(argus_resource_event_const_t event); -const argus_resource_prototype_t argus_resource_event_get_prototype(argus_resource_event_const_t event); +argus_resource_prototype_t argus_resource_event_get_prototype(argus_resource_event_const_t event); argus_resource_t argus_resource_event_get_resource(argus_resource_event_t event); diff --git a/engine/static/resman/include/argus/resman/cabi/resource_loader.h b/engine/static/resman/include/argus/resman/cabi/resource_loader.h index 17508bb8..0e495c18 100644 --- a/engine/static/resman/include/argus/resman/cabi/resource_loader.h +++ b/engine/static/resman/include/argus/resman/cabi/resource_loader.h @@ -18,12 +18,15 @@ #pragma once -#include "argus/resman/cabi/resource_manager.h" - #ifdef __cplusplus extern "C" { #endif +#include "argus/resman/cabi/resource_manager.h" + +#include +#include + typedef void *argus_resource_loader_t; typedef const void *argus_resource_loader_const_t; diff --git a/engine/static/resman/src/cabi/resource.cpp b/engine/static/resman/src/cabi/resource.cpp index 11029f46..010af0c9 100644 --- a/engine/static/resman/src/cabi/resource.cpp +++ b/engine/static/resman/src/cabi/resource.cpp @@ -41,7 +41,7 @@ argus_resource_prototype_t argus_resource_get_prototype(argus_resource_const_t r argus_resource_prototype_t c_proto { cpp_proto.uid.c_str(), cpp_proto.media_type.c_str(), - reinterpret_cast(cpp_proto.fs_path.c_str()), + reinterpret_cast(cpp_proto.fs_path.c_str()), // workaround for MSVC }; return c_proto; } diff --git a/engine/static/resman/src/cabi/resource_event.cpp b/engine/static/resman/src/cabi/resource_event.cpp index 34bd5fee..bd92b263 100644 --- a/engine/static/resman/src/cabi/resource_event.cpp +++ b/engine/static/resman/src/cabi/resource_event.cpp @@ -38,12 +38,12 @@ ResourceEventType argus_resource_event_get_subtype(argus_resource_event_const_t return ResourceEventType(_as_ref_const(event).subtype); } -const argus_resource_prototype_t argus_resource_event_get_prototype(argus_resource_event_const_t event) { +argus_resource_prototype_t argus_resource_event_get_prototype(argus_resource_event_const_t event) { const auto &proto = _as_ref_const(event).prototype; argus_resource_prototype_t wrapped_proto { proto.uid.c_str(), proto.media_type.c_str(), - proto.fs_path.c_str(), + reinterpret_cast(proto.fs_path.c_str()), // workaround for MSVC }; return wrapped_proto; } diff --git a/engine/static/resman/src/cabi/resource_loader.cpp b/engine/static/resman/src/cabi/resource_loader.cpp index e8231ce0..ecd188e6 100644 --- a/engine/static/resman/src/cabi/resource_loader.cpp +++ b/engine/static/resman/src/cabi/resource_loader.cpp @@ -97,7 +97,7 @@ class ProxiedResourceLoader : public ResourceLoader { auto wrapped_proto = argus_resource_prototype_t { proto.uid.c_str(), proto.media_type.c_str(), - proto.fs_path.c_str(), + reinterpret_cast(proto.fs_path.c_str()), // workaround for MSVC }; return _unwrap_voidptr_result(m_load_fn(this, &manager, wrapped_proto, _read_callback, size, m_user_data, &stream)); @@ -109,7 +109,7 @@ class ProxiedResourceLoader : public ResourceLoader { auto wrapped_proto = argus_resource_prototype_t { proto.uid.c_str(), proto.media_type.c_str(), - proto.fs_path.c_str(), + reinterpret_cast(proto.fs_path.c_str()), // workaround for MSVC }; return _unwrap_voidptr_result(m_copy_fn(this, &manager, wrapped_proto, src, m_user_data)); }