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
9c0b35cf
Commit
9c0b35cf
authored
Jun 22, 2017
by
Bo Yang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enusre public header and generated code have no implicit converion.
parent
f752d816
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
73 additions
and
58 deletions
+73
-58
Makefile.am
src/Makefile.am
+1
-1
any.pb.cc
src/google/protobuf/any.pb.cc
+3
-3
api.pb.cc
src/google/protobuf/api.pb.cc
+0
-0
cpp_enum_field.cc
src/google/protobuf/compiler/cpp/cpp_enum_field.cc
+2
-1
cpp_map_field.cc
src/google/protobuf/compiler/cpp/cpp_map_field.cc
+16
-11
cpp_primitive_field.cc
src/google/protobuf/compiler/cpp/cpp_primitive_field.cc
+2
-1
cpp_string_field.cc
src/google/protobuf/compiler/cpp/cpp_string_field.cc
+13
-7
plugin.pb.cc
src/google/protobuf/compiler/plugin.pb.cc
+0
-0
profile.pb.cc
src/google/protobuf/compiler/profile.pb.cc
+6
-6
descriptor.pb.cc
src/google/protobuf/descriptor.pb.cc
+0
-0
field_mask.pb.cc
src/google/protobuf/field_mask.pb.cc
+3
-3
generated_message_reflection.h
src/google/protobuf/generated_message_reflection.h
+2
-1
map_entry_lite.h
src/google/protobuf/map_entry_lite.h
+3
-3
map_field_inl.h
src/google/protobuf/map_field_inl.h
+1
-1
map_field_lite.h
src/google/protobuf/map_field_lite.h
+1
-1
map_type_handler.h
src/google/protobuf/map_type_handler.h
+4
-3
source_context.pb.cc
src/google/protobuf/source_context.pb.cc
+3
-3
struct.pb.cc
src/google/protobuf/struct.pb.cc
+6
-6
type.pb.cc
src/google/protobuf/type.pb.cc
+0
-0
wire_format_lite_inl.h
src/google/protobuf/wire_format_lite_inl.h
+4
-4
wrappers.pb.cc
src/google/protobuf/wrappers.pb.cc
+3
-3
No files found.
src/Makefile.am
View file @
9c0b35cf
...
...
@@ -924,7 +924,7 @@ no_warning_test_LDADD = $(PTHREAD_LIBS) libprotobuf.la \
../gmock/gtest/lib/libgtest_main.la
no_warning_test_CPPFLAGS
=
-I
$(srcdir)
/../gmock/gtest/include
no_warning_test_CXXFLAGS
=
$(PTHREAD_CFLAGS)
$(PTHREAD_DEF)
$(ZLIB_DEF)
\
-Wall
-Werror
-Wall
-W
conversion
-W
error
nodist_no_warning_test_SOURCES
=
no_warning_test.cc
$(protoc_outputs)
TESTS
=
protobuf-test protobuf-lazy-descriptor-test protobuf-lite-test
\
...
...
src/google/protobuf/any.pb.cc
View file @
9c0b35cf
...
...
@@ -240,7 +240,7 @@ bool Any::MergePartialFromCodedStream(
DO_
(
::
google
::
protobuf
::
internal
::
WireFormatLite
::
ReadString
(
input
,
this
->
mutable_type_url
()));
DO_
(
::
google
::
protobuf
::
internal
::
WireFormatLite
::
VerifyUtf8String
(
this
->
type_url
().
data
(),
this
->
type_url
().
length
(
),
this
->
type_url
().
data
(),
static_cast
<
int
>
(
this
->
type_url
().
length
()
),
::
google
::
protobuf
::
internal
::
WireFormatLite
::
PARSE
,
"google.protobuf.Any.type_url"
));
}
else
{
...
...
@@ -291,7 +291,7 @@ void Any::SerializeWithCachedSizes(
// string type_url = 1;
if
(
this
->
type_url
().
size
()
>
0
)
{
::
google
::
protobuf
::
internal
::
WireFormatLite
::
VerifyUtf8String
(
this
->
type_url
().
data
(),
this
->
type_url
().
length
(
),
this
->
type_url
().
data
(),
static_cast
<
int
>
(
this
->
type_url
().
length
()
),
::
google
::
protobuf
::
internal
::
WireFormatLite
::
SERIALIZE
,
"google.protobuf.Any.type_url"
);
::
google
::
protobuf
::
internal
::
WireFormatLite
::
WriteStringMaybeAliased
(
...
...
@@ -316,7 +316,7 @@ void Any::SerializeWithCachedSizes(
// string type_url = 1;
if
(
this
->
type_url
().
size
()
>
0
)
{
::
google
::
protobuf
::
internal
::
WireFormatLite
::
VerifyUtf8String
(
this
->
type_url
().
data
(),
this
->
type_url
().
length
(
),
this
->
type_url
().
data
(),
static_cast
<
int
>
(
this
->
type_url
().
length
()
),
::
google
::
protobuf
::
internal
::
WireFormatLite
::
SERIALIZE
,
"google.protobuf.Any.type_url"
);
target
=
...
...
src/google/protobuf/api.pb.cc
View file @
9c0b35cf
This diff is collapsed.
Click to expand it.
src/google/protobuf/compiler/cpp/cpp_enum_field.cc
View file @
9c0b35cf
...
...
@@ -488,7 +488,8 @@ GenerateByteSize(io::Printer* printer) const {
printer
->
Print
(
variables_
,
"if (data_size > 0) {
\n
"
" total_size += $tag_size$ +
\n
"
" ::google::protobuf::internal::WireFormatLite::Int32Size(data_size);
\n
"
" ::google::protobuf::internal::WireFormatLite::Int32Size(
\n
"
" static_cast<google::protobuf::int32>(data_size));
\n
"
"}
\n
"
"int cached_size = ::google::protobuf::internal::ToCachedSize(data_size);
\n
"
"GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
\n
"
...
...
src/google/protobuf/compiler/cpp/cpp_map_field.cc
View file @
9c0b35cf
...
...
@@ -256,7 +256,8 @@ GenerateMergeFromCodedStream(io::Printer* printer) const {
}
else
{
printer
->
Print
(
variables_
,
" unknown_fields_stream.WriteVarint32($tag$u);
\n
"
" unknown_fields_stream.WriteVarint32(data.size());
\n
"
" unknown_fields_stream.WriteVarint32(
\n
"
" static_cast<google::protobuf::uint32>(data.size()));
\n
"
" unknown_fields_stream.WriteString(data);
\n
"
);
}
...
...
@@ -267,12 +268,16 @@ GenerateMergeFromCodedStream(io::Printer* printer) const {
if
(
key_field
->
type
()
==
FieldDescriptor
::
TYPE_STRING
)
{
GenerateUtf8CheckCodeForString
(
key_field
,
options_
,
true
,
variables_
,
StrCat
(
key
,
".data(), "
,
key
,
".length(),
\n
"
).
data
(),
printer
);
key_field
,
options_
,
true
,
variables_
,
StrCat
(
key
,
".data(), static_cast<int>("
,
key
,
".length()),
\n
"
).
data
(),
printer
);
}
if
(
value_field
->
type
()
==
FieldDescriptor
::
TYPE_STRING
)
{
GenerateUtf8CheckCodeForString
(
value_field
,
options_
,
true
,
variables_
,
StrCat
(
value
,
".data(), "
,
value
,
".length(),
\n
"
).
data
(),
printer
);
GenerateUtf8CheckCodeForString
(
value_field
,
options_
,
true
,
variables_
,
StrCat
(
value
,
".data(), static_cast<int>("
,
value
,
".length()),
\n
"
)
.
data
(),
printer
);
}
// If entry is allocated by arena, its desctructor should be avoided.
...
...
@@ -376,14 +381,14 @@ void MapFieldGenerator::GenerateSerializeWithCachedSizes(
printer
->
Indent
();
printer
->
Indent
();
if
(
string_key
)
{
GenerateUtf8CheckCodeForString
(
key_field
,
options_
,
false
,
variables
,
"p->first.data(), p->first.length(),
\n
"
,
printer
);
GenerateUtf8CheckCodeForString
(
key_field
,
options_
,
false
,
variables
,
"p->first.data(), static_cast<int>(p->first.length()),
\n
"
,
printer
);
}
if
(
string_value
)
{
GenerateUtf8CheckCodeForString
(
value_field
,
options_
,
false
,
variables
,
"p->second.data(), p->second.length(),
\n
"
,
printer
);
GenerateUtf8CheckCodeForString
(
value_field
,
options_
,
false
,
variables
,
"p->second.data(), static_cast<int>(p->second.length()),
\n
"
,
printer
);
}
printer
->
Outdent
();
printer
->
Outdent
();
...
...
src/google/protobuf/compiler/cpp/cpp_primitive_field.cc
View file @
9c0b35cf
...
...
@@ -452,7 +452,8 @@ GenerateByteSize(io::Printer* printer) const {
printer
->
Print
(
variables_
,
"if (data_size > 0) {
\n
"
" total_size += $tag_size$ +
\n
"
" ::google::protobuf::internal::WireFormatLite::Int32Size(data_size);
\n
"
" ::google::protobuf::internal::WireFormatLite::Int32Size(
\n
"
" static_cast<google::protobuf::int32>(data_size));
\n
"
"}
\n
"
"int cached_size = ::google::protobuf::internal::ToCachedSize(data_size);
\n
"
"GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
\n
"
...
...
src/google/protobuf/compiler/cpp/cpp_string_field.cc
View file @
9c0b35cf
...
...
@@ -477,7 +477,8 @@ GenerateMergeFromCodedStream(io::Printer* printer) const {
if
(
descriptor_
->
type
()
==
FieldDescriptor
::
TYPE_STRING
)
{
GenerateUtf8CheckCodeForString
(
descriptor_
,
options_
,
true
,
variables_
,
"this->$name$().data(), this->$name$().length(),
\n
"
,
printer
);
"this->$name$().data(), static_cast<int>(this->$name$().length()),
\n
"
,
printer
);
}
}
...
...
@@ -486,7 +487,8 @@ GenerateSerializeWithCachedSizes(io::Printer* printer) const {
if
(
descriptor_
->
type
()
==
FieldDescriptor
::
TYPE_STRING
)
{
GenerateUtf8CheckCodeForString
(
descriptor_
,
options_
,
false
,
variables_
,
"this->$name$().data(), this->$name$().length(),
\n
"
,
printer
);
"this->$name$().data(), static_cast<int>(this->$name$().length()),
\n
"
,
printer
);
}
printer
->
Print
(
variables_
,
"::google::protobuf::internal::WireFormatLite::Write$declared_type$MaybeAliased(
\n
"
...
...
@@ -498,7 +500,8 @@ GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const {
if
(
descriptor_
->
type
()
==
FieldDescriptor
::
TYPE_STRING
)
{
GenerateUtf8CheckCodeForString
(
descriptor_
,
options_
,
false
,
variables_
,
"this->$name$().data(), this->$name$().length(),
\n
"
,
printer
);
"this->$name$().data(), static_cast<int>(this->$name$().length()),
\n
"
,
printer
);
}
printer
->
Print
(
variables_
,
"target =
\n
"
...
...
@@ -797,7 +800,8 @@ GenerateMergeFromCodedStream(io::Printer* printer) const {
if
(
descriptor_
->
type
()
==
FieldDescriptor
::
TYPE_STRING
)
{
GenerateUtf8CheckCodeForString
(
descriptor_
,
options_
,
true
,
variables_
,
"this->$name$().data(), this->$name$().length(),
\n
"
,
printer
);
"this->$name$().data(), static_cast<int>(this->$name$().length()),
\n
"
,
printer
);
}
}
...
...
@@ -969,7 +973,7 @@ GenerateMergeFromCodedStream(io::Printer* printer) const {
GenerateUtf8CheckCodeForString
(
descriptor_
,
options_
,
true
,
variables_
,
"this->$name$(this->$name$_size() - 1).data(),
\n
"
"
this->$name$(this->$name$_size() - 1).length(
),
\n
"
,
"
static_cast<int>(this->$name$(this->$name$_size() - 1).length()
),
\n
"
,
printer
);
}
}
...
...
@@ -982,7 +986,8 @@ GenerateSerializeWithCachedSizes(io::Printer* printer) const {
if
(
descriptor_
->
type
()
==
FieldDescriptor
::
TYPE_STRING
)
{
GenerateUtf8CheckCodeForString
(
descriptor_
,
options_
,
false
,
variables_
,
"this->$name$(i).data(), this->$name$(i).length(),
\n
"
,
printer
);
"this->$name$(i).data(), static_cast<int>(this->$name$(i).length()),
\n
"
,
printer
);
}
printer
->
Outdent
();
printer
->
Print
(
variables_
,
...
...
@@ -999,7 +1004,8 @@ GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const {
if
(
descriptor_
->
type
()
==
FieldDescriptor
::
TYPE_STRING
)
{
GenerateUtf8CheckCodeForString
(
descriptor_
,
options_
,
false
,
variables_
,
"this->$name$(i).data(), this->$name$(i).length(),
\n
"
,
printer
);
"this->$name$(i).data(), static_cast<int>(this->$name$(i).length()),
\n
"
,
printer
);
}
printer
->
Outdent
();
printer
->
Print
(
variables_
,
...
...
src/google/protobuf/compiler/plugin.pb.cc
View file @
9c0b35cf
This diff is collapsed.
Click to expand it.
src/google/protobuf/compiler/profile.pb.cc
View file @
9c0b35cf
...
...
@@ -280,7 +280,7 @@ bool FieldAccessInfo::MergePartialFromCodedStream(
DO_
(
::
google
::
protobuf
::
internal
::
WireFormatLite
::
ReadString
(
input
,
this
->
mutable_name
()));
::
google
::
protobuf
::
internal
::
WireFormat
::
VerifyUTF8StringNamedField
(
this
->
name
().
data
(),
this
->
name
().
length
(
),
this
->
name
().
data
(),
static_cast
<
int
>
(
this
->
name
().
length
()
),
::
google
::
protobuf
::
internal
::
WireFormat
::
PARSE
,
"google.protobuf.compiler.FieldAccessInfo.name"
);
}
else
{
...
...
@@ -363,7 +363,7 @@ void FieldAccessInfo::SerializeWithCachedSizes(
// optional string name = 1;
if
(
cached_has_bits
&
0x00000001u
)
{
::
google
::
protobuf
::
internal
::
WireFormat
::
VerifyUTF8StringNamedField
(
this
->
name
().
data
(),
this
->
name
().
length
(
),
this
->
name
().
data
(),
static_cast
<
int
>
(
this
->
name
().
length
()
),
::
google
::
protobuf
::
internal
::
WireFormat
::
SERIALIZE
,
"google.protobuf.compiler.FieldAccessInfo.name"
);
::
google
::
protobuf
::
internal
::
WireFormatLite
::
WriteStringMaybeAliased
(
...
...
@@ -402,7 +402,7 @@ void FieldAccessInfo::SerializeWithCachedSizes(
// optional string name = 1;
if
(
cached_has_bits
&
0x00000001u
)
{
::
google
::
protobuf
::
internal
::
WireFormat
::
VerifyUTF8StringNamedField
(
this
->
name
().
data
(),
this
->
name
().
length
(
),
this
->
name
().
data
(),
static_cast
<
int
>
(
this
->
name
().
length
()
),
::
google
::
protobuf
::
internal
::
WireFormat
::
SERIALIZE
,
"google.protobuf.compiler.FieldAccessInfo.name"
);
target
=
...
...
@@ -795,7 +795,7 @@ bool MessageAccessInfo::MergePartialFromCodedStream(
DO_
(
::
google
::
protobuf
::
internal
::
WireFormatLite
::
ReadString
(
input
,
this
->
mutable_name
()));
::
google
::
protobuf
::
internal
::
WireFormat
::
VerifyUTF8StringNamedField
(
this
->
name
().
data
(),
this
->
name
().
length
(
),
this
->
name
().
data
(),
static_cast
<
int
>
(
this
->
name
().
length
()
),
::
google
::
protobuf
::
internal
::
WireFormat
::
PARSE
,
"google.protobuf.compiler.MessageAccessInfo.name"
);
}
else
{
...
...
@@ -862,7 +862,7 @@ void MessageAccessInfo::SerializeWithCachedSizes(
// optional string name = 1;
if
(
cached_has_bits
&
0x00000001u
)
{
::
google
::
protobuf
::
internal
::
WireFormat
::
VerifyUTF8StringNamedField
(
this
->
name
().
data
(),
this
->
name
().
length
(
),
this
->
name
().
data
(),
static_cast
<
int
>
(
this
->
name
().
length
()
),
::
google
::
protobuf
::
internal
::
WireFormat
::
SERIALIZE
,
"google.protobuf.compiler.MessageAccessInfo.name"
);
::
google
::
protobuf
::
internal
::
WireFormatLite
::
WriteStringMaybeAliased
(
...
...
@@ -897,7 +897,7 @@ void MessageAccessInfo::SerializeWithCachedSizes(
// optional string name = 1;
if
(
cached_has_bits
&
0x00000001u
)
{
::
google
::
protobuf
::
internal
::
WireFormat
::
VerifyUTF8StringNamedField
(
this
->
name
().
data
(),
this
->
name
().
length
(
),
this
->
name
().
data
(),
static_cast
<
int
>
(
this
->
name
().
length
()
),
::
google
::
protobuf
::
internal
::
WireFormat
::
SERIALIZE
,
"google.protobuf.compiler.MessageAccessInfo.name"
);
target
=
...
...
src/google/protobuf/descriptor.pb.cc
View file @
9c0b35cf
This diff is collapsed.
Click to expand it.
src/google/protobuf/field_mask.pb.cc
View file @
9c0b35cf
...
...
@@ -213,7 +213,7 @@ bool FieldMask::MergePartialFromCodedStream(
input
,
this
->
add_paths
()));
DO_
(
::
google
::
protobuf
::
internal
::
WireFormatLite
::
VerifyUtf8String
(
this
->
paths
(
this
->
paths_size
()
-
1
).
data
(),
this
->
paths
(
this
->
paths_size
()
-
1
).
length
(
),
static_cast
<
int
>
(
this
->
paths
(
this
->
paths_size
()
-
1
).
length
()
),
::
google
::
protobuf
::
internal
::
WireFormatLite
::
PARSE
,
"google.protobuf.FieldMask.paths"
));
}
else
{
...
...
@@ -252,7 +252,7 @@ void FieldMask::SerializeWithCachedSizes(
// repeated string paths = 1;
for
(
int
i
=
0
,
n
=
this
->
paths_size
();
i
<
n
;
i
++
)
{
::
google
::
protobuf
::
internal
::
WireFormatLite
::
VerifyUtf8String
(
this
->
paths
(
i
).
data
(),
this
->
paths
(
i
).
length
(
),
this
->
paths
(
i
).
data
(),
static_cast
<
int
>
(
this
->
paths
(
i
).
length
()
),
::
google
::
protobuf
::
internal
::
WireFormatLite
::
SERIALIZE
,
"google.protobuf.FieldMask.paths"
);
::
google
::
protobuf
::
internal
::
WireFormatLite
::
WriteString
(
...
...
@@ -271,7 +271,7 @@ void FieldMask::SerializeWithCachedSizes(
// repeated string paths = 1;
for
(
int
i
=
0
,
n
=
this
->
paths_size
();
i
<
n
;
i
++
)
{
::
google
::
protobuf
::
internal
::
WireFormatLite
::
VerifyUtf8String
(
this
->
paths
(
i
).
data
(),
this
->
paths
(
i
).
length
(
),
this
->
paths
(
i
).
data
(),
static_cast
<
int
>
(
this
->
paths
(
i
).
length
()
),
::
google
::
protobuf
::
internal
::
WireFormatLite
::
SERIALIZE
,
"google.protobuf.FieldMask.paths"
);
target
=
::
google
::
protobuf
::
internal
::
WireFormatLite
::
...
...
src/google/protobuf/generated_message_reflection.h
View file @
9c0b35cf
...
...
@@ -150,7 +150,8 @@ struct ReflectionSchema {
}
uint32
GetOneofCaseOffset
(
const
OneofDescriptor
*
oneof_descriptor
)
const
{
return
oneof_case_offset_
+
(
oneof_descriptor
->
index
()
*
sizeof
(
uint32
));
return
oneof_case_offset_
+
static_cast
<
uint32
>
(
oneof_descriptor
->
index
()
*
sizeof
(
uint32
));
}
bool
HasHasbits
()
const
{
return
has_bits_offset_
!=
-
1
;
}
...
...
src/google/protobuf/map_entry_lite.h
View file @
9c0b35cf
...
...
@@ -250,11 +250,11 @@ class MapEntryImpl : public Base {
int
GetCachedSize
()
const
{
int
size
=
0
;
size
+=
has_key
()
?
kTagSize
+
KeyTypeHandler
::
GetCachedSize
(
key
(
))
?
static_cast
<
int
>
(
kTagSize
+
KeyTypeHandler
::
GetCachedSize
(
key
()
))
:
0
;
size
+=
has_value
()
?
kTagSize
+
ValueTypeHandler
::
GetCachedSize
(
value
())
?
static_cast
<
int
>
(
kTagSize
+
ValueTypeHandler
::
GetCachedSize
(
value
())
)
:
0
;
return
size
;
}
...
...
src/google/protobuf/map_field_inl.h
View file @
9c0b35cf
...
...
@@ -168,7 +168,7 @@ template <typename Derived, typename Key, typename T,
int
MapField
<
Derived
,
Key
,
T
,
kKeyFieldType
,
kValueFieldType
,
default_enum_value
>::
size
()
const
{
MapFieldBase
::
SyncMapWithRepeatedField
();
return
impl_
.
GetMap
().
size
(
);
return
static_cast
<
int
>
(
impl_
.
GetMap
().
size
()
);
}
template
<
typename
Derived
,
typename
Key
,
typename
T
,
...
...
src/google/protobuf/map_field_lite.h
View file @
9c0b35cf
...
...
@@ -60,7 +60,7 @@ class MapFieldLite {
Map
<
Key
,
T
>*
MutableMap
()
{
return
&
map_
;
}
// Convenient methods for generated message implementation.
int
size
()
const
{
return
map_
.
size
(
);
}
int
size
()
const
{
return
static_cast
<
int
>
(
map_
.
size
()
);
}
void
Clear
()
{
return
map_
.
clear
();
}
void
MergeFrom
(
const
MapFieldLite
&
other
)
{
for
(
typename
Map
<
Key
,
T
>::
const_iterator
it
=
other
.
map_
.
begin
();
...
...
src/google/protobuf/map_type_handler.h
View file @
9c0b35cf
...
...
@@ -284,7 +284,7 @@ MapTypeHandler<WireFormatLite::TYPE_MESSAGE, Type>::ByteSize(
template <typename Type> \
inline int MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>::ByteSize( \
const MapEntryAccessorType& value) { \
return
WireFormatLite::DeclaredType##Size(value);
\
return
static_cast<int>(WireFormatLite::DeclaredType##Size(value));
\
}
GOOGLE_PROTOBUF_BYTE_SIZE
(
STRING
,
String
)
...
...
@@ -320,7 +320,8 @@ template <typename Type>
inline
int
MapTypeHandler
<
WireFormatLite
::
TYPE_MESSAGE
,
Type
>::
GetCachedSize
(
const
MapEntryAccessorType
&
value
)
{
return
WireFormatLite
::
LengthDelimitedSize
(
value
.
GetCachedSize
());
return
static_cast
<
int
>
(
WireFormatLite
::
LengthDelimitedSize
(
value
.
GetCachedSize
()));
}
#define GET_CACHED_SIZE(FieldType, DeclaredType) \
...
...
@@ -328,7 +329,7 @@ MapTypeHandler<WireFormatLite::TYPE_MESSAGE, Type>::GetCachedSize(
inline int \
MapTypeHandler<WireFormatLite::TYPE_##FieldType, Type>::GetCachedSize( \
const MapEntryAccessorType& value) { \
return
WireFormatLite::DeclaredType##Size(value);
\
return
static_cast<int>(WireFormatLite::DeclaredType##Size(value));
\
}
GET_CACHED_SIZE
(
STRING
,
String
)
...
...
src/google/protobuf/source_context.pb.cc
View file @
9c0b35cf
...
...
@@ -218,7 +218,7 @@ bool SourceContext::MergePartialFromCodedStream(
DO_
(
::
google
::
protobuf
::
internal
::
WireFormatLite
::
ReadString
(
input
,
this
->
mutable_file_name
()));
DO_
(
::
google
::
protobuf
::
internal
::
WireFormatLite
::
VerifyUtf8String
(
this
->
file_name
().
data
(),
this
->
file_name
().
length
(
),
this
->
file_name
().
data
(),
static_cast
<
int
>
(
this
->
file_name
().
length
()
),
::
google
::
protobuf
::
internal
::
WireFormatLite
::
PARSE
,
"google.protobuf.SourceContext.file_name"
));
}
else
{
...
...
@@ -257,7 +257,7 @@ void SourceContext::SerializeWithCachedSizes(
// string file_name = 1;
if
(
this
->
file_name
().
size
()
>
0
)
{
::
google
::
protobuf
::
internal
::
WireFormatLite
::
VerifyUtf8String
(
this
->
file_name
().
data
(),
this
->
file_name
().
length
(
),
this
->
file_name
().
data
(),
static_cast
<
int
>
(
this
->
file_name
().
length
()
),
::
google
::
protobuf
::
internal
::
WireFormatLite
::
SERIALIZE
,
"google.protobuf.SourceContext.file_name"
);
::
google
::
protobuf
::
internal
::
WireFormatLite
::
WriteStringMaybeAliased
(
...
...
@@ -276,7 +276,7 @@ void SourceContext::SerializeWithCachedSizes(
// string file_name = 1;
if
(
this
->
file_name
().
size
()
>
0
)
{
::
google
::
protobuf
::
internal
::
WireFormatLite
::
VerifyUtf8String
(
this
->
file_name
().
data
(),
this
->
file_name
().
length
(
),
this
->
file_name
().
data
(),
static_cast
<
int
>
(
this
->
file_name
().
length
()
),
::
google
::
protobuf
::
internal
::
WireFormatLite
::
SERIALIZE
,
"google.protobuf.SourceContext.file_name"
);
target
=
...
...
src/google/protobuf/struct.pb.cc
View file @
9c0b35cf
...
...
@@ -340,7 +340,7 @@ bool Struct::MergePartialFromCodedStream(
DO_
(
::
google
::
protobuf
::
internal
::
WireFormatLite
::
ReadMessageNoVirtual
(
input
,
&
parser
));
DO_
(
::
google
::
protobuf
::
internal
::
WireFormatLite
::
VerifyUtf8String
(
parser
.
key
().
data
(),
parser
.
key
().
length
(
),
parser
.
key
().
data
(),
static_cast
<
int
>
(
parser
.
key
().
length
()
),
::
google
::
protobuf
::
internal
::
WireFormatLite
::
PARSE
,
"google.protobuf.Struct.FieldsEntry.key"
));
}
else
{
...
...
@@ -385,7 +385,7 @@ void Struct::SerializeWithCachedSizes(
struct
Utf8Check
{
static
void
Check
(
ConstPtr
p
)
{
::
google
::
protobuf
::
internal
::
WireFormatLite
::
VerifyUtf8String
(
p
->
first
.
data
(),
p
->
first
.
length
(
),
p
->
first
.
data
(),
static_cast
<
int
>
(
p
->
first
.
length
()
),
::
google
::
protobuf
::
internal
::
WireFormatLite
::
SERIALIZE
,
"google.protobuf.Struct.FieldsEntry.key"
);
}
...
...
@@ -449,7 +449,7 @@ void Struct::SerializeWithCachedSizes(
struct
Utf8Check
{
static
void
Check
(
ConstPtr
p
)
{
::
google
::
protobuf
::
internal
::
WireFormatLite
::
VerifyUtf8String
(
p
->
first
.
data
(),
p
->
first
.
length
(
),
p
->
first
.
data
(),
static_cast
<
int
>
(
p
->
first
.
length
()
),
::
google
::
protobuf
::
internal
::
WireFormatLite
::
SERIALIZE
,
"google.protobuf.Struct.FieldsEntry.key"
);
}
...
...
@@ -834,7 +834,7 @@ bool Value::MergePartialFromCodedStream(
DO_
(
::
google
::
protobuf
::
internal
::
WireFormatLite
::
ReadString
(
input
,
this
->
mutable_string_value
()));
DO_
(
::
google
::
protobuf
::
internal
::
WireFormatLite
::
VerifyUtf8String
(
this
->
string_value
().
data
(),
this
->
string_value
().
length
(
),
this
->
string_value
().
data
(),
static_cast
<
int
>
(
this
->
string_value
().
length
()
),
::
google
::
protobuf
::
internal
::
WireFormatLite
::
PARSE
,
"google.protobuf.Value.string_value"
));
}
else
{
...
...
@@ -923,7 +923,7 @@ void Value::SerializeWithCachedSizes(
// string string_value = 3;
if
(
has_string_value
())
{
::
google
::
protobuf
::
internal
::
WireFormatLite
::
VerifyUtf8String
(
this
->
string_value
().
data
(),
this
->
string_value
().
length
(
),
this
->
string_value
().
data
(),
static_cast
<
int
>
(
this
->
string_value
().
length
()
),
::
google
::
protobuf
::
internal
::
WireFormatLite
::
SERIALIZE
,
"google.protobuf.Value.string_value"
);
::
google
::
protobuf
::
internal
::
WireFormatLite
::
WriteStringMaybeAliased
(
...
...
@@ -970,7 +970,7 @@ void Value::SerializeWithCachedSizes(
// string string_value = 3;
if
(
has_string_value
())
{
::
google
::
protobuf
::
internal
::
WireFormatLite
::
VerifyUtf8String
(
this
->
string_value
().
data
(),
this
->
string_value
().
length
(
),
this
->
string_value
().
data
(),
static_cast
<
int
>
(
this
->
string_value
().
length
()
),
::
google
::
protobuf
::
internal
::
WireFormatLite
::
SERIALIZE
,
"google.protobuf.Value.string_value"
);
target
=
...
...
src/google/protobuf/type.pb.cc
View file @
9c0b35cf
This diff is collapsed.
Click to expand it.
src/google/protobuf/wire_format_lite_inl.h
View file @
9c0b35cf
...
...
@@ -268,7 +268,7 @@ inline bool WireFormatLite::ReadRepeatedFixedSizePrimitive(
if
(
size
>
0
)
{
const
uint8
*
buffer
=
reinterpret_cast
<
const
uint8
*>
(
void_pointer
);
// The number of bytes each type occupies on the wire.
const
int
per_value_size
=
tag_size
+
s
izeof
(
value
);
const
int
per_value_size
=
tag_size
+
s
tatic_cast
<
int
>
(
sizeof
(
value
)
);
// parentheses around (std::min) prevents macro expansion of min(...)
int
elements_available
=
...
...
@@ -344,8 +344,8 @@ inline bool WireFormatLite::ReadPackedFixedSizePrimitive(
int
length
;
if
(
!
input
->
ReadVarintSizeAsInt
(
&
length
))
return
false
;
const
int
old_entries
=
values
->
size
();
const
int
new_entries
=
length
/
s
izeof
(
CType
);
const
int
new_bytes
=
new_entries
*
s
izeof
(
CType
);
const
int
new_entries
=
length
/
s
tatic_cast
<
int
>
(
sizeof
(
CType
)
);
const
int
new_bytes
=
new_entries
*
s
tatic_cast
<
int
>
(
sizeof
(
CType
)
);
if
(
new_bytes
!=
length
)
return
false
;
// We would *like* to pre-allocate the buffer to write into (for
// speed), but *must* avoid performing a very large allocation due
...
...
@@ -695,7 +695,7 @@ inline uint8* WireFormatLite::WriteFixedNoTagToArray(
GOOGLE_DCHECK_GT
(
n
,
0
);
const
T
*
ii
=
value
.
unsafe_data
();
const
int
bytes
=
n
*
s
izeof
(
ii
[
0
]
);
const
int
bytes
=
n
*
s
tatic_cast
<
int
>
(
sizeof
(
ii
[
0
])
);
memcpy
(
target
,
ii
,
bytes
);
return
target
+
bytes
;
#else
...
...
src/google/protobuf/wrappers.pb.cc
View file @
9c0b35cf
...
...
@@ -2209,7 +2209,7 @@ bool StringValue::MergePartialFromCodedStream(
DO_
(
::
google
::
protobuf
::
internal
::
WireFormatLite
::
ReadString
(
input
,
this
->
mutable_value
()));
DO_
(
::
google
::
protobuf
::
internal
::
WireFormatLite
::
VerifyUtf8String
(
this
->
value
().
data
(),
this
->
value
().
length
(
),
this
->
value
().
data
(),
static_cast
<
int
>
(
this
->
value
().
length
()
),
::
google
::
protobuf
::
internal
::
WireFormatLite
::
PARSE
,
"google.protobuf.StringValue.value"
));
}
else
{
...
...
@@ -2248,7 +2248,7 @@ void StringValue::SerializeWithCachedSizes(
// string value = 1;
if
(
this
->
value
().
size
()
>
0
)
{
::
google
::
protobuf
::
internal
::
WireFormatLite
::
VerifyUtf8String
(
this
->
value
().
data
(),
this
->
value
().
length
(
),
this
->
value
().
data
(),
static_cast
<
int
>
(
this
->
value
().
length
()
),
::
google
::
protobuf
::
internal
::
WireFormatLite
::
SERIALIZE
,
"google.protobuf.StringValue.value"
);
::
google
::
protobuf
::
internal
::
WireFormatLite
::
WriteStringMaybeAliased
(
...
...
@@ -2267,7 +2267,7 @@ void StringValue::SerializeWithCachedSizes(
// string value = 1;
if
(
this
->
value
().
size
()
>
0
)
{
::
google
::
protobuf
::
internal
::
WireFormatLite
::
VerifyUtf8String
(
this
->
value
().
data
(),
this
->
value
().
length
(
),
this
->
value
().
data
(),
static_cast
<
int
>
(
this
->
value
().
length
()
),
::
google
::
protobuf
::
internal
::
WireFormatLite
::
SERIALIZE
,
"google.protobuf.StringValue.value"
);
target
=
...
...
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