Fix off-by one error in decoder and make padding deterministic.
This commit is contained in:
parent
fe0fe1873a
commit
8e02263084
@ -79,7 +79,7 @@ struct ObjectEncoder
|
|||||||
replaceAll(encoded, "-", "+");
|
replaceAll(encoded, "-", "+");
|
||||||
replaceAll(encoded, "_", "/");
|
replaceAll(encoded, "_", "/");
|
||||||
|
|
||||||
std::copy(binary_t(encoded.begin()), binary_t(encoded.begin() + encoded.length() - 1),
|
std::copy(binary_t(encoded.begin()), binary_t(encoded.begin() + encoded.length()),
|
||||||
reinterpret_cast<char *>(&object));
|
reinterpret_cast<char *>(&object));
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
|
@ -88,8 +88,10 @@ struct PhantomNode
|
|||||||
unsigned component_id;
|
unsigned component_id;
|
||||||
FixedPointCoordinate location;
|
FixedPointCoordinate location;
|
||||||
unsigned short fwd_segment_position;
|
unsigned short fwd_segment_position;
|
||||||
TravelMode forward_travel_mode : 4;
|
// note 4 bits would suffice for each,
|
||||||
TravelMode backward_travel_mode : 4;
|
// but the saved byte would be padding anyway
|
||||||
|
TravelMode forward_travel_mode;
|
||||||
|
TravelMode backward_travel_mode;
|
||||||
|
|
||||||
int GetForwardWeightPlusOffset() const;
|
int GetForwardWeightPlusOffset() const;
|
||||||
|
|
||||||
@ -108,6 +110,8 @@ struct PhantomNode
|
|||||||
bool operator==(const PhantomNode &other) const;
|
bool operator==(const PhantomNode &other) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static_assert(sizeof(PhantomNode) == 48, "PhantomNode has more padding then expected");
|
||||||
|
|
||||||
using PhantomNodeArray = std::vector<std::vector<PhantomNode>>;
|
using PhantomNodeArray = std::vector<std::vector<PhantomNode>>;
|
||||||
|
|
||||||
class phantom_node_pair : public std::pair<PhantomNode, PhantomNode>
|
class phantom_node_pair : public std::pair<PhantomNode, PhantomNode>
|
||||||
|
Loading…
Reference in New Issue
Block a user