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
f0640b5a
Commit
f0640b5a
authored
Aug 28, 2015
by
Feng Xiao
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #770 from pkasting/string_space
Move StringSpaceUsedIncludingSelf to lite library.
parents
69ac02a2
b913cbd3
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
19 deletions
+14
-19
generated_message_reflection.cc
src/google/protobuf/generated_message_reflection.cc
+0
-12
generated_message_util.cc
src/google/protobuf/generated_message_util.cc
+12
-0
generated_message_util.h
src/google/protobuf/generated_message_util.h
+0
-6
repeated_field.h
src/google/protobuf/repeated_field.h
+2
-1
No files found.
src/google/protobuf/generated_message_reflection.cc
View file @
f0640b5a
...
@@ -57,18 +57,6 @@ bool IsMapFieldInApi(const FieldDescriptor* field) {
...
@@ -57,18 +57,6 @@ bool IsMapFieldInApi(const FieldDescriptor* field) {
}
}
}
// anonymous namespace
}
// anonymous namespace
int
StringSpaceUsedExcludingSelf
(
const
string
&
str
)
{
const
void
*
start
=
&
str
;
const
void
*
end
=
&
str
+
1
;
if
(
start
<=
str
.
data
()
&&
str
.
data
()
<
end
)
{
// The string's data is stored inside the string object itself.
return
0
;
}
else
{
return
str
.
capacity
();
}
}
bool
ParseNamedEnum
(
const
EnumDescriptor
*
descriptor
,
bool
ParseNamedEnum
(
const
EnumDescriptor
*
descriptor
,
const
string
&
name
,
const
string
&
name
,
int
*
value
)
{
int
*
value
)
{
...
...
src/google/protobuf/generated_message_util.cc
View file @
f0640b5a
...
@@ -60,6 +60,18 @@ void InitEmptyString() {
...
@@ -60,6 +60,18 @@ void InitEmptyString() {
OnShutdown
(
&
DeleteEmptyString
);
OnShutdown
(
&
DeleteEmptyString
);
}
}
int
StringSpaceUsedExcludingSelf
(
const
string
&
str
)
{
const
void
*
start
=
&
str
;
const
void
*
end
=
&
str
+
1
;
if
(
start
<=
str
.
data
()
&&
str
.
data
()
<
end
)
{
// The string's data is stored inside the string object itself.
return
0
;
}
else
{
return
str
.
capacity
();
}
}
}
// namespace internal
}
// namespace internal
}
// namespace protobuf
}
// namespace protobuf
...
...
src/google/protobuf/generated_message_util.h
View file @
f0640b5a
...
@@ -89,12 +89,6 @@ LIBPROTOBUF_EXPORT inline const ::std::string& GetEmptyString() {
...
@@ -89,12 +89,6 @@ LIBPROTOBUF_EXPORT inline const ::std::string& GetEmptyString() {
return
GetEmptyStringAlreadyInited
();
return
GetEmptyStringAlreadyInited
();
}
}
// Defined in generated_message_reflection.cc -- not actually part of the lite
// library.
//
// TODO(jasonh): The various callers get this declaration from a variety of
// places: probably in most cases repeated_field.h. Clean these up so they all
// get the declaration from this file.
LIBPROTOBUF_EXPORT
int
StringSpaceUsedExcludingSelf
(
const
string
&
str
);
LIBPROTOBUF_EXPORT
int
StringSpaceUsedExcludingSelf
(
const
string
&
str
);
...
...
src/google/protobuf/repeated_field.h
View file @
f0640b5a
...
@@ -647,7 +647,8 @@ inline const Message& GenericTypeHandler<Message>::default_instance() {
...
@@ -647,7 +647,8 @@ inline const Message& GenericTypeHandler<Message>::default_instance() {
// StringTypeHandler is exported. So, we factor out StringTypeHandlerBase,
// StringTypeHandler is exported. So, we factor out StringTypeHandlerBase,
// export that, then make StringTypeHandler be a subclass which is NOT
// export that, then make StringTypeHandler be a subclass which is NOT
// exported.
// exported.
// TODO(kenton): There has to be a better way.
// TODO(kenton): Now that StringSpaceUsedExcludingSelf() is in the lite
// library, this can be cleaned up.
class
LIBPROTOBUF_EXPORT
StringTypeHandlerBase
{
class
LIBPROTOBUF_EXPORT
StringTypeHandlerBase
{
public
:
public
:
typedef
string
Type
;
typedef
string
Type
;
...
...
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