Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
flatbuffers
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
flatbuffers
Commits
ad84b5b8
Commit
ad84b5b8
authored
Aug 04, 2015
by
Wouter van Oortmerssen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed AddFlatBuffer using wrong buffer length.
Also made the Xcode project link. Tested: on OS X.
parent
7101224d
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
3 additions
and
4 deletions
+3
-4
project.pbxproj
build/Xcode/FlatBuffers.xcodeproj/project.pbxproj
+0
-0
reflection.cpp
src/reflection.cpp
+1
-2
test.cpp
tests/test.cpp
+2
-2
No files found.
build/Xcode/FlatBuffers.xcodeproj/project.pbxproj
View file @
ad84b5b8
This diff is collapsed.
Click to expand it.
src/reflection.cpp
View file @
ad84b5b8
...
...
@@ -334,8 +334,7 @@ const uint8_t *AddFlatBuffer(std::vector<uint8_t> &flatbuf,
}
auto
insertion_point
=
static_cast
<
uoffset_t
>
(
flatbuf
.
size
());
// Insert the entire FlatBuffer minus the root pointer.
flatbuf
.
insert
(
flatbuf
.
end
(),
newbuf
+
sizeof
(
uoffset_t
),
newbuf
+
newlen
-
sizeof
(
uoffset_t
));
flatbuf
.
insert
(
flatbuf
.
end
(),
newbuf
+
sizeof
(
uoffset_t
),
newbuf
+
newlen
);
auto
root_offset
=
ReadScalar
<
uoffset_t
>
(
newbuf
)
-
sizeof
(
uoffset_t
);
return
flatbuf
.
data
()
+
insertion_point
+
root_offset
;
}
...
...
tests/test.cpp
View file @
ad84b5b8
...
...
@@ -393,8 +393,8 @@ void ReflectionTest(uint8_t *flatbuf, size_t length) {
// We do this last, so the pointer doesn't get invalidated (since it is
// at the end of the buffer):
auto
string_ptr
=
flatbuffers
::
AddFlatBuffer
(
resizingbuf
,
stringfbb
.
GetBufferPointer
(),
stringfbb
.
GetSize
());
stringfbb
.
GetBufferPointer
(),
stringfbb
.
GetSize
());
// Finally, set the new value in the vector.
rtestarrayofstring
->
MutateOffset
(
2
,
string_ptr
);
TEST_EQ_STR
(
rtestarrayofstring
->
Get
(
0
)
->
c_str
(),
"bob"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment