Skip to content

Commit

Permalink
resman: Finally hopefully fix MSVC compile error
Browse files Browse the repository at this point in the history
  • Loading branch information
caseif committed Jul 16, 2024
1 parent e4fde81 commit 77df896
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 <stdbool.h>
#include <stddef.h>

typedef void *argus_resource_loader_t;
typedef const void *argus_resource_loader_const_t;

Expand Down
2 changes: 1 addition & 1 deletion engine/static/resman/src/cabi/resource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<const char *>(cpp_proto.fs_path.c_str()),
reinterpret_cast<const char *>(cpp_proto.fs_path.c_str()), // workaround for MSVC
};
return c_proto;
}
Expand Down
4 changes: 2 additions & 2 deletions engine/static/resman/src/cabi/resource_event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<const char *>(proto.fs_path.c_str()), // workaround for MSVC
};
return wrapped_proto;
}
Expand Down
4 changes: 2 additions & 2 deletions engine/static/resman/src/cabi/resource_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<const char *>(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));
Expand All @@ -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<const char *>(proto.fs_path.c_str()), // workaround for MSVC
};
return _unwrap_voidptr_result(m_copy_fn(this, &manager, wrapped_proto, src, m_user_data));
}
Expand Down

0 comments on commit 77df896

Please sign in to comment.