Skip to content

Commit

Permalink
fix const string serializer
Browse files Browse the repository at this point in the history
  • Loading branch information
jpeletier committed Oct 16, 2024
1 parent 5bef9cc commit 73c85da
Showing 2 changed files with 18 additions and 2 deletions.
10 changes: 9 additions & 1 deletion distr/flecs.c
Original file line number Diff line number Diff line change
@@ -49213,6 +49213,13 @@ size_t flecs_addon_vec_count(const void *ptr) {
return flecs_ito(size_t, count);
}

static
int flecs_const_str_serialize(const ecs_serializer_t *ser, const void *ptr) {
char **data = ECS_CONST_CAST(char**, ptr);
ser->value(ser, ecs_id(ecs_string_t), data);
return 0;
}

static
const char* flecs_const_get_string(const void *ptr) {
return *((const char *const *) ptr);
@@ -49257,7 +49264,8 @@ void flecs_meta_import_core_definitions(
}),
.type = {
.as_type = ecs_id(ecs_string_t),
.get_string = flecs_const_get_string,
.serialize = flecs_const_str_serialize,
.get_string = flecs_const_get_string,
}
});

10 changes: 9 additions & 1 deletion src/addons/meta/definitions.c
Original file line number Diff line number Diff line change
@@ -30,6 +30,13 @@ size_t flecs_addon_vec_count(const void *ptr) {
return flecs_ito(size_t, count);
}

static
int flecs_const_str_serialize(const ecs_serializer_t *ser, const void *ptr) {
char **data = ECS_CONST_CAST(char**, ptr);
ser->value(ser, ecs_id(ecs_string_t), data);
return 0;
}

static
const char* flecs_const_get_string(const void *ptr) {
return *((const char *const *) ptr);
@@ -74,7 +81,8 @@ void flecs_meta_import_core_definitions(
}),
.type = {
.as_type = ecs_id(ecs_string_t),
.get_string = flecs_const_get_string,
.serialize = flecs_const_str_serialize,
.get_string = flecs_const_get_string,
}
});

0 comments on commit 73c85da

Please sign in to comment.