You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Endian-aware native pointer readers instantiate the wrong pointer type #188
The endian-aware pointer readers in include/cpp/marshal/Marshal.hpp call readPointer<T*> even though readPointer already returns cpp::Pointer. Instantiating the reader therefore produces Pointer<T*> where the declared return type is Pointer.
A compile-only probe against checkout 8d3b460 reproduces this on Linux x86_64 with g++ and HXCPP_API_LEVEL=500:
#include<hxcpp.h>voidprobe(const cpp::marshal::View<uint8_t>& bytes) {
auto p = cpp::marshal::Marshal::readLittleEndianPointer<int>(bytes);
(void)p;
}
The diagnostic is:
could not convert ... from Pointer<int*> to Pointer<int>
Both readLittleEndianPointer and readBigEndianPointer use the extra pointer level, including their byte-swapping branches. Header inclusion alone does not instantiate these templates, so ordinary builds can miss the problem.
Call readPointer for a pointer-to-T result. Also verify that byte swapping acts on the native pointer representation rather than assuming cpp::Pointer's wrapper representation is the serialized data format. The write methods already operate on value.ptr.
Add compile and round-trip tests that instantiate both endian readers with concrete pointee types. Cover the host-endian and opposite-endian branches. A big-endian hardware run has not been performed here.
Activity
Read a pointer, not a pointer to one, in the endian pointer readers