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
fcfc47d4
Unverified
Commit
fcfc47d4
authored
May 20, 2019
by
Hao Nguyen
Committed by
GitHub
May 20, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6151 from haon4/201905171200
Down Integrate to GitHub
parents
1bc8cbe1
66540237
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
55 additions
and
54 deletions
+55
-54
py_benchmark.py
benchmarks/python/py_benchmark.py
+2
-2
multiple_files_test.proto
.../test/proto/com/google/protobuf/multiple_files_test.proto
+0
-0
test_bad_identifiers.proto
...test/proto/com/google/protobuf/test_bad_identifiers.proto
+0
-0
protobuf.pc.in
protobuf.pc.in
+1
-0
descriptor_pool.py
python/google/protobuf/descriptor_pool.py
+7
-5
descriptor_database_test.py
python/google/protobuf/internal/descriptor_database_test.py
+2
-3
descriptor_pool_test.py
python/google/protobuf/internal/descriptor_pool_test.py
+1
-14
python_message.py
python/google/protobuf/internal/python_message.py
+4
-0
js_generator.cc
src/google/protobuf/compiler/js/js_generator.cc
+9
-5
descriptor.cc
src/google/protobuf/descriptor.cc
+1
-0
descriptor_database.cc
src/google/protobuf/descriptor_database.cc
+11
-7
descriptor_database.h
src/google/protobuf/descriptor_database.h
+4
-2
generated_message_reflection.cc
src/google/protobuf/generated_message_reflection.cc
+11
-14
time_util.h
src/google/protobuf/util/time_util.h
+2
-2
No files found.
benchmarks/python/py_benchmark.py
View file @
fcfc47d4
...
@@ -41,7 +41,7 @@ import benchmarks_pb2 as benchmarks_pb2
...
@@ -41,7 +41,7 @@ import benchmarks_pb2 as benchmarks_pb2
def
run_one_test
(
filename
):
def
run_one_test
(
filename
):
data
=
open
(
filename
)
.
read
()
data
=
open
(
filename
,
"rb"
)
.
read
()
benchmark_dataset
=
benchmarks_pb2
.
BenchmarkDataset
()
benchmark_dataset
=
benchmarks_pb2
.
BenchmarkDataset
()
benchmark_dataset
.
ParseFromString
(
data
)
benchmark_dataset
.
ParseFromString
(
data
)
total_bytes
=
0
total_bytes
=
0
...
@@ -69,7 +69,7 @@ def init(filename):
...
@@ -69,7 +69,7 @@ def init(filename):
message_list
=
[]
message_list
=
[]
counter
=
0
counter
=
0
total_bytes
=
0
total_bytes
=
0
data
=
open
(
filename
)
.
read
()
data
=
open
(
filename
,
"rb"
)
.
read
()
benchmark_dataset
=
benchmarks_pb2
.
BenchmarkDataset
()
benchmark_dataset
=
benchmarks_pb2
.
BenchmarkDataset
()
benchmark_dataset
.
ParseFromString
(
data
)
benchmark_dataset
.
ParseFromString
(
data
)
...
...
java/core/src/test/proto/com/google/protobuf/multiple_files_test.proto
View file @
fcfc47d4
java/core/src/test/proto/com/google/protobuf/test_bad_identifiers.proto
View file @
fcfc47d4
protobuf.pc.in
View file @
fcfc47d4
...
@@ -8,5 +8,6 @@ Description: Google's Data Interchange Format
...
@@ -8,5 +8,6 @@ Description: Google's Data Interchange Format
Version: @VERSION@
Version: @VERSION@
Libs: -L${libdir} -lprotobuf @PTHREAD_LIBS@
Libs: -L${libdir} -lprotobuf @PTHREAD_LIBS@
Libs.private: @LIBS@
Libs.private: @LIBS@
Cflags: -I${includedir} @PTHREAD_CFLAGS@
Cflags: -I${includedir} @PTHREAD_CFLAGS@
Conflicts: protobuf-lite
Conflicts: protobuf-lite
python/google/protobuf/descriptor_pool.py
View file @
fcfc47d4
...
@@ -99,6 +99,8 @@ def _IsMessageSetExtension(field):
...
@@ -99,6 +99,8 @@ def _IsMessageSetExtension(field):
field
.
label
==
descriptor
.
FieldDescriptor
.
LABEL_OPTIONAL
)
field
.
label
==
descriptor
.
FieldDescriptor
.
LABEL_OPTIONAL
)
class
DescriptorPool
(
object
):
class
DescriptorPool
(
object
):
"""A collection of protobufs dynamically constructed by descriptor protos."""
"""A collection of protobufs dynamically constructed by descriptor protos."""
...
@@ -161,18 +163,18 @@ class DescriptorPool(object):
...
@@ -161,18 +163,18 @@ class DescriptorPool(object):
if
not
isinstance
(
desc
,
descriptor_type
)
or
(
if
not
isinstance
(
desc
,
descriptor_type
)
or
(
old_file
!=
file_name
):
old_file
!=
file_name
):
warn
_msg
=
(
'Conflict register for file "'
+
file_name
+
error
_msg
=
(
'Conflict register for file "'
+
file_name
+
'": '
+
desc_name
+
'": '
+
desc_name
+
' is already defined in file "'
+
' is already defined in file "'
+
old_file
+
'". Please fix the conflict by adding '
old_file
+
'". Please fix the conflict by adding '
'package name on the proto file, or use different '
'package name on the proto file, or use different '
'name for the duplication. This warning will '
'name for the duplication.'
)
'turn into error soon.'
)
if
isinstance
(
desc
,
descriptor
.
EnumValueDescriptor
):
if
isinstance
(
desc
,
descriptor
.
EnumValueDescriptor
):
warn
_msg
+=
(
'
\n
Note: enum values appear as '
error
_msg
+=
(
'
\n
Note: enum values appear as '
'siblings of the enum type instead of '
'siblings of the enum type instead of '
'children of it.'
)
'children of it.'
)
warnings
.
warn
(
warn_msg
,
RuntimeWarning
)
raise
TypeError
(
error_msg
)
return
return
...
...
python/google/protobuf/internal/descriptor_database_test.py
View file @
fcfc47d4
...
@@ -115,19 +115,18 @@ class DescriptorDatabaseTest(unittest.TestCase):
...
@@ -115,19 +115,18 @@ class DescriptorDatabaseTest(unittest.TestCase):
db
.
Add
(
unittest_fd
)
db
.
Add
(
unittest_fd
)
conflict_fd
=
descriptor_pb2
.
FileDescriptorProto
.
FromString
(
conflict_fd
=
descriptor_pb2
.
FileDescriptorProto
.
FromString
(
unittest_pb2
.
DESCRIPTOR
.
serialized_pb
)
unittest_pb2
.
DESCRIPTOR
.
serialized_pb
)
conflict_fd
.
name
=
'other_file'
conflict_fd
.
name
=
'other_file
2
'
with
warnings
.
catch_warnings
(
record
=
True
)
as
w
:
with
warnings
.
catch_warnings
(
record
=
True
)
as
w
:
# Cause all warnings to always be triggered.
# Cause all warnings to always be triggered.
warnings
.
simplefilter
(
'always'
)
warnings
.
simplefilter
(
'always'
)
db
.
Add
(
conflict_fd
)
db
.
Add
(
conflict_fd
)
self
.
assertTrue
(
len
(
w
))
self
.
assertTrue
(
len
(
w
))
self
.
assertIs
(
w
[
0
]
.
category
,
RuntimeWarning
)
self
.
assertIs
(
w
[
0
]
.
category
,
RuntimeWarning
)
self
.
assertIn
(
'Conflict register for file "other_file": '
,
self
.
assertIn
(
'Conflict register for file "other_file
2
": '
,
str
(
w
[
0
]
.
message
))
str
(
w
[
0
]
.
message
))
self
.
assertIn
(
'already defined in file '
self
.
assertIn
(
'already defined in file '
'"google/protobuf/unittest.proto"'
,
'"google/protobuf/unittest.proto"'
,
str
(
w
[
0
]
.
message
))
str
(
w
[
0
]
.
message
))
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
unittest
.
main
()
unittest
.
main
()
python/google/protobuf/internal/descriptor_pool_test.py
View file @
fcfc47d4
...
@@ -36,7 +36,6 @@ __author__ = 'matthewtoia@google.com (Matt Toia)'
...
@@ -36,7 +36,6 @@ __author__ = 'matthewtoia@google.com (Matt Toia)'
import
copy
import
copy
import
os
import
os
import
warnings
try
:
try
:
import
unittest2
as
unittest
#PY26
import
unittest2
as
unittest
#PY26
...
@@ -532,11 +531,7 @@ class DescriptorPoolTestBase(object):
...
@@ -532,11 +531,7 @@ class DescriptorPoolTestBase(object):
if
api_implementation
.
Type
()
==
'cpp'
:
if
api_implementation
.
Type
()
==
'cpp'
:
pass
pass
else
:
else
:
with
warnings
.
catch_warnings
(
record
=
True
)
as
w
:
# Cause all warnings to always be triggered.
warnings
.
simplefilter
(
'always'
)
pool
=
copy
.
deepcopy
(
self
.
pool
)
pool
=
copy
.
deepcopy
(
self
.
pool
)
# No warnings to add the same descriptors.
file_descriptor
=
unittest_pb2
.
DESCRIPTOR
file_descriptor
=
unittest_pb2
.
DESCRIPTOR
pool
.
AddDescriptor
(
pool
.
AddDescriptor
(
file_descriptor
.
message_types_by_name
[
'TestAllTypes'
])
file_descriptor
.
message_types_by_name
[
'TestAllTypes'
])
...
@@ -546,19 +541,11 @@ class DescriptorPoolTestBase(object):
...
@@ -546,19 +541,11 @@ class DescriptorPoolTestBase(object):
file_descriptor
.
services_by_name
[
'TestService'
])
file_descriptor
.
services_by_name
[
'TestService'
])
pool
.
AddExtensionDescriptor
(
pool
.
AddExtensionDescriptor
(
file_descriptor
.
extensions_by_name
[
'optional_int32_extension'
])
file_descriptor
.
extensions_by_name
[
'optional_int32_extension'
])
self
.
assertEqual
(
len
(
w
),
0
)
# Check warnings for conflict descriptors with the same name.
pool
.
Add
(
unittest_fd
)
pool
.
Add
(
unittest_fd
)
pool
.
Add
(
conflict_fd
)
pool
.
Add
(
conflict_fd
)
pool
.
FindFileByName
(
unittest_fd
.
name
)
pool
.
FindFileByName
(
unittest_fd
.
name
)
with
self
.
assertRaises
(
TypeError
):
pool
.
FindFileByName
(
conflict_fd
.
name
)
pool
.
FindFileByName
(
conflict_fd
.
name
)
self
.
assertTrue
(
len
(
w
))
self
.
assertIs
(
w
[
0
]
.
category
,
RuntimeWarning
)
self
.
assertIn
(
'Conflict register for file "other_file": '
,
str
(
w
[
0
]
.
message
))
self
.
assertIn
(
'already defined in file '
'"google/protobuf/unittest.proto"'
,
str
(
w
[
0
]
.
message
))
@testing_refleaks.TestCase
@testing_refleaks.TestCase
...
...
python/google/protobuf/internal/python_message.py
View file @
fcfc47d4
...
@@ -692,7 +692,11 @@ def _AddPropertiesForNonRepeatedScalarField(field, cls):
...
@@ -692,7 +692,11 @@ def _AddPropertiesForNonRepeatedScalarField(field, cls):
# pylint: disable=protected-access
# pylint: disable=protected-access
# Testing the value for truthiness captures all of the proto3 defaults
# Testing the value for truthiness captures all of the proto3 defaults
# (0, 0.0, enum 0, and False).
# (0, 0.0, enum 0, and False).
try
:
new_value
=
type_checker
.
CheckValue
(
new_value
)
new_value
=
type_checker
.
CheckValue
(
new_value
)
except
TypeError
as
e
:
raise
TypeError
(
'Cannot set
%
s to
%.1024
r:
%
s'
%
(
field
.
full_name
,
new_value
,
e
))
if
clear_when_set_to_default
and
not
new_value
:
if
clear_when_set_to_default
and
not
new_value
:
self
.
_fields
.
pop
(
field
,
None
)
self
.
_fields
.
pop
(
field
,
None
)
else
:
else
:
...
...
src/google/protobuf/compiler/js/js_generator.cc
View file @
fcfc47d4
...
@@ -2426,18 +2426,22 @@ void Generator::GenerateObjectTypedef(const GeneratorOptions& options,
...
@@ -2426,18 +2426,22 @@ void Generator::GenerateObjectTypedef(const GeneratorOptions& options,
"method.
\n
"
"method.
\n
"
" * @record
\n
"
" * @record
\n
"
" */
\n
"
" */
\n
"
"$typeName$ = function() {
};
\n
\n
"
,
"$typeName$ = function() {
\n
"
,
"messageName"
,
desc
->
name
(),
"typeName"
,
type_name
);
"messageName"
,
desc
->
name
(),
"typeName"
,
type_name
);
for
(
int
i
=
0
;
i
<
desc
->
field_count
();
i
++
)
{
for
(
int
i
=
0
;
i
<
desc
->
field_count
();
i
++
)
{
if
(
i
>
0
)
{
printer
->
Print
(
"
\n
"
);
}
printer
->
Print
(
printer
->
Print
(
"/** @type {$fieldType$|undefined} */
\n
"
" /** @type {$fieldType$|undefined} */
\n
"
"$typeName$.prototype.$fieldName$;
\n\n
"
,
" this.$fieldName$;
\n
"
,
"typeName"
,
type_name
,
"fieldName"
,
"fieldName"
,
JSObjectFieldName
(
options
,
desc
->
field
(
i
)),
JSObjectFieldName
(
options
,
desc
->
field
(
i
)),
// TODO(b/121097361): Add type checking for field values.
// TODO(b/121097361): Add type checking for field values.
"fieldType"
,
"?"
);
"fieldType"
,
"?"
);
}
}
printer
->
Print
(
"};
\n\n
"
);
}
}
void
Generator
::
GenerateClassFromObject
(
const
GeneratorOptions
&
options
,
void
Generator
::
GenerateClassFromObject
(
const
GeneratorOptions
&
options
,
...
...
src/google/protobuf/descriptor.cc
View file @
fcfc47d4
...
@@ -1487,6 +1487,7 @@ const MethodDescriptor* DescriptorPool::FindMethodByName(
...
@@ -1487,6 +1487,7 @@ const MethodDescriptor* DescriptorPool::FindMethodByName(
const
FieldDescriptor
*
DescriptorPool
::
FindExtensionByNumber
(
const
FieldDescriptor
*
DescriptorPool
::
FindExtensionByNumber
(
const
Descriptor
*
extendee
,
int
number
)
const
{
const
Descriptor
*
extendee
,
int
number
)
const
{
if
(
extendee
->
extension_range_count
()
==
0
)
return
nullptr
;
// A faster path to reduce lock contention in finding extensions, assuming
// A faster path to reduce lock contention in finding extensions, assuming
// most extensions will be cache hit.
// most extensions will be cache hit.
if
(
mutex_
!=
nullptr
)
{
if
(
mutex_
!=
nullptr
)
{
...
...
src/google/protobuf/descriptor_database.cc
View file @
fcfc47d4
...
@@ -127,14 +127,15 @@ bool SimpleDescriptorDatabase::DescriptorIndex<Value>::AddFile(
...
@@ -127,14 +127,15 @@ bool SimpleDescriptorDatabase::DescriptorIndex<Value>::AddFile(
for
(
int
i
=
0
;
i
<
file
.
message_type_size
();
i
++
)
{
for
(
int
i
=
0
;
i
<
file
.
message_type_size
();
i
++
)
{
if
(
!
AddSymbol
(
path
+
file
.
message_type
(
i
).
name
(),
value
))
return
false
;
if
(
!
AddSymbol
(
path
+
file
.
message_type
(
i
).
name
(),
value
))
return
false
;
if
(
!
AddNestedExtensions
(
file
.
message_type
(
i
),
value
))
return
false
;
if
(
!
AddNestedExtensions
(
file
.
name
(),
file
.
message_type
(
i
),
value
))
return
false
;
}
}
for
(
int
i
=
0
;
i
<
file
.
enum_type_size
();
i
++
)
{
for
(
int
i
=
0
;
i
<
file
.
enum_type_size
();
i
++
)
{
if
(
!
AddSymbol
(
path
+
file
.
enum_type
(
i
).
name
(),
value
))
return
false
;
if
(
!
AddSymbol
(
path
+
file
.
enum_type
(
i
).
name
(),
value
))
return
false
;
}
}
for
(
int
i
=
0
;
i
<
file
.
extension_size
();
i
++
)
{
for
(
int
i
=
0
;
i
<
file
.
extension_size
();
i
++
)
{
if
(
!
AddSymbol
(
path
+
file
.
extension
(
i
).
name
(),
value
))
return
false
;
if
(
!
AddSymbol
(
path
+
file
.
extension
(
i
).
name
(),
value
))
return
false
;
if
(
!
AddExtension
(
file
.
extension
(
i
),
value
))
return
false
;
if
(
!
AddExtension
(
file
.
name
(),
file
.
extension
(
i
),
value
))
return
false
;
}
}
for
(
int
i
=
0
;
i
<
file
.
service_size
();
i
++
)
{
for
(
int
i
=
0
;
i
<
file
.
service_size
();
i
++
)
{
if
(
!
AddSymbol
(
path
+
file
.
service
(
i
).
name
(),
value
))
return
false
;
if
(
!
AddSymbol
(
path
+
file
.
service
(
i
).
name
(),
value
))
return
false
;
...
@@ -203,19 +204,22 @@ bool SimpleDescriptorDatabase::DescriptorIndex<Value>::AddSymbol(
...
@@ -203,19 +204,22 @@ bool SimpleDescriptorDatabase::DescriptorIndex<Value>::AddSymbol(
template
<
typename
Value
>
template
<
typename
Value
>
bool
SimpleDescriptorDatabase
::
DescriptorIndex
<
Value
>::
AddNestedExtensions
(
bool
SimpleDescriptorDatabase
::
DescriptorIndex
<
Value
>::
AddNestedExtensions
(
const
DescriptorProto
&
message_type
,
Value
value
)
{
const
std
::
string
&
filename
,
const
DescriptorProto
&
message_type
,
Value
value
)
{
for
(
int
i
=
0
;
i
<
message_type
.
nested_type_size
();
i
++
)
{
for
(
int
i
=
0
;
i
<
message_type
.
nested_type_size
();
i
++
)
{
if
(
!
AddNestedExtensions
(
message_type
.
nested_type
(
i
),
value
))
return
false
;
if
(
!
AddNestedExtensions
(
filename
,
message_type
.
nested_type
(
i
),
value
))
return
false
;
}
}
for
(
int
i
=
0
;
i
<
message_type
.
extension_size
();
i
++
)
{
for
(
int
i
=
0
;
i
<
message_type
.
extension_size
();
i
++
)
{
if
(
!
AddExtension
(
message_type
.
extension
(
i
),
value
))
return
false
;
if
(
!
AddExtension
(
filename
,
message_type
.
extension
(
i
),
value
))
return
false
;
}
}
return
true
;
return
true
;
}
}
template
<
typename
Value
>
template
<
typename
Value
>
bool
SimpleDescriptorDatabase
::
DescriptorIndex
<
Value
>::
AddExtension
(
bool
SimpleDescriptorDatabase
::
DescriptorIndex
<
Value
>::
AddExtension
(
const
FieldDescriptorProto
&
field
,
Value
value
)
{
const
std
::
string
&
filename
,
const
FieldDescriptorProto
&
field
,
Value
value
)
{
if
(
!
field
.
extendee
().
empty
()
&&
field
.
extendee
()[
0
]
==
'.'
)
{
if
(
!
field
.
extendee
().
empty
()
&&
field
.
extendee
()[
0
]
==
'.'
)
{
// The extension is fully-qualified. We can use it as a lookup key in
// The extension is fully-qualified. We can use it as a lookup key in
// the by_symbol_ table.
// the by_symbol_ table.
...
@@ -226,7 +230,7 @@ bool SimpleDescriptorDatabase::DescriptorIndex<Value>::AddExtension(
...
@@ -226,7 +230,7 @@ bool SimpleDescriptorDatabase::DescriptorIndex<Value>::AddExtension(
GOOGLE_LOG
(
ERROR
)
<<
"Extension conflicts with extension already in database: "
GOOGLE_LOG
(
ERROR
)
<<
"Extension conflicts with extension already in database: "
"extend "
"extend "
<<
field
.
extendee
()
<<
" { "
<<
field
.
name
()
<<
" = "
<<
field
.
extendee
()
<<
" { "
<<
field
.
name
()
<<
" = "
<<
field
.
number
()
<<
" }
"
;
<<
field
.
number
()
<<
" }
from:"
<<
filename
;
return
false
;
return
false
;
}
}
}
else
{
}
else
{
...
...
src/google/protobuf/descriptor_database.h
View file @
fcfc47d4
...
@@ -199,8 +199,10 @@ class PROTOBUF_EXPORT SimpleDescriptorDatabase : public DescriptorDatabase {
...
@@ -199,8 +199,10 @@ class PROTOBUF_EXPORT SimpleDescriptorDatabase : public DescriptorDatabase {
// to the index.
// to the index.
bool
AddFile
(
const
FileDescriptorProto
&
file
,
Value
value
);
bool
AddFile
(
const
FileDescriptorProto
&
file
,
Value
value
);
bool
AddSymbol
(
const
std
::
string
&
name
,
Value
value
);
bool
AddSymbol
(
const
std
::
string
&
name
,
Value
value
);
bool
AddNestedExtensions
(
const
DescriptorProto
&
message_type
,
Value
value
);
bool
AddNestedExtensions
(
const
std
::
string
&
filename
,
bool
AddExtension
(
const
FieldDescriptorProto
&
field
,
Value
value
);
const
DescriptorProto
&
message_type
,
Value
value
);
bool
AddExtension
(
const
std
::
string
&
filename
,
const
FieldDescriptorProto
&
field
,
Value
value
);
Value
FindFile
(
const
std
::
string
&
filename
);
Value
FindFile
(
const
std
::
string
&
filename
);
Value
FindSymbol
(
const
std
::
string
&
name
);
Value
FindSymbol
(
const
std
::
string
&
name
);
...
...
src/google/protobuf/generated_message_reflection.cc
View file @
fcfc47d4
...
@@ -1015,8 +1015,7 @@ struct FieldNumberSorter {
...
@@ -1015,8 +1015,7 @@ struct FieldNumberSorter {
}
}
};
};
bool
IsIndexInHasBitSet
(
const
uint32
*
has_bit_set
,
bool
IsIndexInHasBitSet
(
const
uint32
*
has_bit_set
,
uint32
has_bit_index
)
{
uint32
has_bit_index
)
{
GOOGLE_DCHECK_NE
(
has_bit_index
,
~
0u
);
GOOGLE_DCHECK_NE
(
has_bit_index
,
~
0u
);
return
((
has_bit_set
[
has_bit_index
/
32
]
>>
(
has_bit_index
%
32
))
&
return
((
has_bit_set
[
has_bit_index
/
32
]
>>
(
has_bit_index
%
32
))
&
static_cast
<
uint32
>
(
1
))
!=
0
;
static_cast
<
uint32
>
(
1
))
!=
0
;
...
@@ -1874,8 +1873,8 @@ uint32* Reflection::MutableHasBits(Message* message) const {
...
@@ -1874,8 +1873,8 @@ uint32* Reflection::MutableHasBits(Message* message) const {
return
GetPointerAtOffset
<
uint32
>
(
message
,
schema_
.
HasBitsOffset
());
return
GetPointerAtOffset
<
uint32
>
(
message
,
schema_
.
HasBitsOffset
());
}
}
uint32
Reflection
::
GetOneofCase
(
uint32
Reflection
::
GetOneofCase
(
const
Message
&
message
,
const
Message
&
message
,
const
OneofDescriptor
*
oneof_descriptor
)
const
{
const
OneofDescriptor
*
oneof_descriptor
)
const
{
return
GetConstRefAtOffset
<
uint32
>
(
return
GetConstRefAtOffset
<
uint32
>
(
message
,
schema_
.
GetOneofCaseOffset
(
oneof_descriptor
));
message
,
schema_
.
GetOneofCaseOffset
(
oneof_descriptor
));
}
}
...
@@ -1886,8 +1885,7 @@ uint32* Reflection::MutableOneofCase(
...
@@ -1886,8 +1885,7 @@ uint32* Reflection::MutableOneofCase(
message
,
schema_
.
GetOneofCaseOffset
(
oneof_descriptor
));
message
,
schema_
.
GetOneofCaseOffset
(
oneof_descriptor
));
}
}
const
ExtensionSet
&
Reflection
::
GetExtensionSet
(
const
ExtensionSet
&
Reflection
::
GetExtensionSet
(
const
Message
&
message
)
const
{
const
Message
&
message
)
const
{
return
GetConstRefAtOffset
<
ExtensionSet
>
(
message
,
return
GetConstRefAtOffset
<
ExtensionSet
>
(
message
,
schema_
.
GetExtensionSetOffset
());
schema_
.
GetExtensionSetOffset
());
}
}
...
@@ -1901,8 +1899,8 @@ Arena* Reflection::GetArena(Message* message) const {
...
@@ -1901,8 +1899,8 @@ Arena* Reflection::GetArena(Message* message) const {
return
GetInternalMetadataWithArena
(
*
message
).
arena
();
return
GetInternalMetadataWithArena
(
*
message
).
arena
();
}
}
const
InternalMetadataWithArena
&
const
InternalMetadataWithArena
&
Reflection
::
GetInternalMetadataWithArena
(
Reflection
::
GetInternalMetadataWithArena
(
const
Message
&
message
)
const
{
const
Message
&
message
)
const
{
return
GetConstRefAtOffset
<
InternalMetadataWithArena
>
(
return
GetConstRefAtOffset
<
InternalMetadataWithArena
>
(
message
,
schema_
.
GetMetadataOffset
());
message
,
schema_
.
GetMetadataOffset
());
}
}
...
@@ -1980,8 +1978,7 @@ bool Reflection::HasBit(const Message& message,
...
@@ -1980,8 +1978,7 @@ bool Reflection::HasBit(const Message& message,
}
}
}
}
void
Reflection
::
SetBit
(
Message
*
message
,
void
Reflection
::
SetBit
(
Message
*
message
,
const
FieldDescriptor
*
field
)
const
{
const
FieldDescriptor
*
field
)
const
{
GOOGLE_DCHECK
(
!
field
->
options
().
weak
());
GOOGLE_DCHECK
(
!
field
->
options
().
weak
());
if
(
!
schema_
.
HasHasbits
())
{
if
(
!
schema_
.
HasHasbits
())
{
return
;
return
;
...
@@ -2043,8 +2040,8 @@ void Reflection::ClearOneofField(Message* message,
...
@@ -2043,8 +2040,8 @@ void Reflection::ClearOneofField(Message* message,
}
}
}
}
void
Reflection
::
ClearOneof
(
void
Reflection
::
ClearOneof
(
Message
*
message
,
Message
*
message
,
const
OneofDescriptor
*
oneof_descriptor
)
const
{
const
OneofDescriptor
*
oneof_descriptor
)
const
{
// TODO(jieluo): Consider to cache the unused object instead of deleting
// TODO(jieluo): Consider to cache the unused object instead of deleting
// it. It will be much faster if an application switches a lot from
// it. It will be much faster if an application switches a lot from
// a few oneof fields. Time/space tradeoff
// a few oneof fields. Time/space tradeoff
...
@@ -2157,8 +2154,8 @@ const Type& Reflection::GetRepeatedPtrField(const Message& message,
...
@@ -2157,8 +2154,8 @@ const Type& Reflection::GetRepeatedPtrField(const Message& message,
template
<
typename
Type
>
template
<
typename
Type
>
void
Reflection
::
SetRepeatedField
(
Message
*
message
,
void
Reflection
::
SetRepeatedField
(
Message
*
message
,
const
FieldDescriptor
*
field
,
const
FieldDescriptor
*
field
,
int
index
,
int
index
,
Type
value
)
const
{
Type
value
)
const
{
MutableRaw
<
RepeatedField
<
Type
>
>
(
message
,
field
)
->
Set
(
index
,
value
);
MutableRaw
<
RepeatedField
<
Type
>
>
(
message
,
field
)
->
Set
(
index
,
value
);
}
}
...
...
src/google/protobuf/util/time_util.h
View file @
fcfc47d4
...
@@ -39,8 +39,8 @@
...
@@ -39,8 +39,8 @@
#ifdef _MSC_VER
#ifdef _MSC_VER
#ifdef _XBOX_ONE
#ifdef _XBOX_ONE
struct
timeval
{
struct
timeval
{
long
tv_sec
;
/* seconds */
int64
tv_sec
;
/* seconds */
long
tv_usec
;
/* and microseconds */
int64
tv_usec
;
/* and microseconds */
};
};
#else
#else
#include <winsock2.h>
#include <winsock2.h>
...
...
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