mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-07 22:03:40 +00:00
Implemented the file identifier functionality for Java.
Also fixed flatc not outputting these identifiers for files compiled on the command-line. Bug: 16983987 Change-Id: I8b714cfea3a8e144fa52133f62b2f7eda6eb044a Tested: on Linux
This commit is contained in:
@@ -665,8 +665,8 @@ template<typename T> const T *GetRoot(const void *buf) {
|
||||
|
||||
// Helper to see if the identifier in a buffer has the expected value.
|
||||
inline bool BufferHasIdentifier(const void *buf, const char *identifier) {
|
||||
return strncmp(reinterpret_cast<const char *>(buf) + 4, identifier,
|
||||
FlatBufferBuilder::kFileIdentifierLength) == 0;
|
||||
return strncmp(reinterpret_cast<const char *>(buf) + sizeof(uoffset_t),
|
||||
identifier, FlatBufferBuilder::kFileIdentifierLength) == 0;
|
||||
}
|
||||
|
||||
// Helper class to verify the integrity of a FlatBuffer
|
||||
|
||||
Reference in New Issue
Block a user