Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
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
protobuf
Commits
e68caa3e
Commit
e68caa3e
authored
Dec 20, 2017
by
Ubuntu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
formatting issues
parent
ffa18ad2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
8 deletions
+11
-8
json_util.cc
src/google/protobuf/util/json_util.cc
+2
-1
json_util_test.cc
src/google/protobuf/util/json_util_test.cc
+9
-7
No files found.
src/google/protobuf/util/json_util.cc
View file @
e68caa3e
...
...
@@ -50,8 +50,9 @@ namespace util {
namespace
internal
{
ZeroCopyStreamByteSink
::~
ZeroCopyStreamByteSink
()
{
if
(
buffer_size_
>
0
)
if
(
buffer_size_
>
0
)
{
stream_
->
BackUp
(
buffer_size_
);
}
}
void
ZeroCopyStreamByteSink
::
Append
(
const
char
*
bytes
,
size_t
len
)
{
...
...
src/google/protobuf/util/json_util_test.cc
View file @
e68caa3e
...
...
@@ -458,18 +458,20 @@ TEST(ZeroCopyStreamByteSinkTest, TestAllInputOutputPatterns) {
}
}
TEST_F
(
JsonUtilTest
,
TestWronJsonInput
)
{
TEST_F
(
JsonUtilTest
,
TestWron
g
JsonInput
)
{
const
char
json
[]
=
"{
\"
unknown_field
\"
:
\"
some_value
\"
}"
;
google
::
protobuf
::
io
::
ArrayInputStream
input_stream
(
json
,
strlen
(
json
));
char
proto
B
uffer
[
10000
];
google
::
protobuf
::
io
::
ArrayOutputStream
output_stream
(
proto
Buffer
,
sizeof
(
protoB
uffer
));
const
char
*
messageT
ype
=
"type.googleapis.com/proto3.TestMessage"
;
char
proto
_b
uffer
[
10000
];
google
::
protobuf
::
io
::
ArrayOutputStream
output_stream
(
proto
_buffer
,
sizeof
(
proto_b
uffer
));
std
::
string
message_t
ype
=
"type.googleapis.com/proto3.TestMessage"
;
TypeResolver
*
resolver
=
NewTypeResolverForDescriptorPool
(
"type.googleapis.com"
,
DescriptorPool
::
generated_pool
());
util
::
Status
resultStatus
=
util
::
JsonToBinaryStream
(
resolver
,
messageType
,
&
input_stream
,
&
output_stream
);
util
::
Status
result_status
=
util
::
JsonToBinaryStream
(
resolver
,
message_type
,
&
input_stream
,
&
output_stream
);
delete
resolver
;
EXPECT_FALSE
(
result
S
tatus
.
ok
());
EXPECT_EQ
(
result
S
tatus
.
error_code
(),
google
::
protobuf
::
util
::
error
::
INVALID_ARGUMENT
);
EXPECT_FALSE
(
result
_s
tatus
.
ok
());
EXPECT_EQ
(
result
_s
tatus
.
error_code
(),
google
::
protobuf
::
util
::
error
::
INVALID_ARGUMENT
);
}
}
// namespace
...
...
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