-
Notifications
You must be signed in to change notification settings - Fork 9
Added the two new types any_pointer and any_array #164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
As requested in the issue wc-duck#145
void* instance, size_t instance_size, | ||
const unsigned char* packed_instance, size_t packed_instance_size, | ||
size_t* consumed ) | ||
void* instance, size_t instance_size, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR contains some "space to tab" conversions to minimize the "strange indent here" feedback.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll try to get to fixing a clang-format file :)
@@ -177,11 +177,11 @@ static void dl_internal_store_string( const uint8_t* instance, CDLBinStoreContex | |||
dl_binary_writer_write( &store_ctx->writer, &offset, sizeof(uintptr_t) ); | |||
} | |||
|
|||
static dl_error_t dl_internal_instance_store( dl_ctx_t dl_ctx, const dl_type_desc* type, uint8_t* instance, CDLBinStoreContext* store_ctx ); | |||
static dl_error_t dl_internal_instance_store( dl_ctx_t dl_ctx, const dl_type_desc* type, const uint8_t* instance, CDLBinStoreContext* store_ctx ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "store" functions now treat the data as const
src/dl.cpp
Outdated
return err; | ||
dl_binary_writer_seek_set( &store_ctx->writer, sub_pos ); | ||
|
||
// use when fast_loading is merged |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code was written to work with fast pointer patching, but since that PR hasn't been merged I've re-written this PR to work without it.
src/dl_typelib_write_c_header.cpp
Outdated
" // ... DL_DECLARE_ANY ...\n" | ||
" typedef uint32_t dl_typeid_t;\n" | ||
"\n" | ||
" struct dl_anyptr {\n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the C/C++ type for anyptr
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to wait with more input until fast-patching is merged and the DL_STORAGE_TYPE_ANY is at least investigated or explained to me why it is a bad idea if it is :)
{ | ||
dl_type_atom_t atom_type = member->AtomType(); | ||
dl_type_storage_t storage_type = member->StorageType(); | ||
|
||
if (storage_type == DL_TYPE_STORAGE_ANYARRAY) | ||
atom_type = DL_TYPE_ATOM_ARRAY; // To avoid code duplification and simplify implementation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
☝️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you prefer the code duplification here?
The new style is "MyAnyPointer" : { "type": "the_type", "data": "ptr_88" }, "MyAnyArray" : { "type": "the_type", "data": [ { "member": "value" } ] }
# Conflicts: # src/dl.cpp # src/dl_txt_pack.cpp # src/dl_typelib_write_c_header.cpp # tests/dl_tests_error.cpp
As requested in the issue #145