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
43c3abf0
Unverified
Commit
43c3abf0
authored
Dec 22, 2018
by
Adam Cozzette
Committed by
GitHub
Dec 22, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5489 from aaron-bray/master
Use NoLocalStrtod for international compliance
parents
152c8301
42430821
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
6 deletions
+7
-6
libprotobuf-lite.cmake
cmake/libprotobuf-lite.cmake
+2
-0
libprotobuf.cmake
cmake/libprotobuf.cmake
+0
-2
Makefile.am
src/Makefile.am
+1
-1
strutil.cc
src/google/protobuf/stubs/strutil.cc
+4
-3
No files found.
cmake/libprotobuf-lite.cmake
View file @
43c3abf0
...
...
@@ -7,6 +7,7 @@ set(libprotobuf_lite_files
${
protobuf_source_dir
}
/src/google/protobuf/implicit_weak_message.cc
${
protobuf_source_dir
}
/src/google/protobuf/parse_context.cc
${
protobuf_source_dir
}
/src/google/protobuf/io/coded_stream.cc
${
protobuf_source_dir
}
/src/google/protobuf/io/strtod.cc
${
protobuf_source_dir
}
/src/google/protobuf/io/zero_copy_stream.cc
${
protobuf_source_dir
}
/src/google/protobuf/io/zero_copy_stream_impl_lite.cc
${
protobuf_source_dir
}
/src/google/protobuf/message_lite.cc
...
...
@@ -33,6 +34,7 @@ set(libprotobuf_lite_includes
${
protobuf_source_dir
}
/src/google/protobuf/implicit_weak_message.h
${
protobuf_source_dir
}
/src/google/protobuf/parse_context.h
${
protobuf_source_dir
}
/src/google/protobuf/io/coded_stream.h
${
protobuf_source_dir
}
/src/google/protobuf/io/strtod.h
${
protobuf_source_dir
}
/src/google/protobuf/io/zero_copy_stream.h
${
protobuf_source_dir
}
/src/google/protobuf/io/zero_copy_stream_impl_lite.h
${
protobuf_source_dir
}
/src/google/protobuf/message_lite.h
...
...
cmake/libprotobuf.cmake
View file @
43c3abf0
...
...
@@ -16,7 +16,6 @@ set(libprotobuf_files
${
protobuf_source_dir
}
/src/google/protobuf/generated_message_table_driven.cc
${
protobuf_source_dir
}
/src/google/protobuf/io/gzip_stream.cc
${
protobuf_source_dir
}
/src/google/protobuf/io/printer.cc
${
protobuf_source_dir
}
/src/google/protobuf/io/strtod.cc
${
protobuf_source_dir
}
/src/google/protobuf/io/tokenizer.cc
${
protobuf_source_dir
}
/src/google/protobuf/io/zero_copy_stream_impl.cc
${
protobuf_source_dir
}
/src/google/protobuf/map_field.cc
...
...
@@ -72,7 +71,6 @@ set(libprotobuf_includes
${
protobuf_source_dir
}
/src/google/protobuf/generated_message_reflection.h
${
protobuf_source_dir
}
/src/google/protobuf/io/gzip_stream.h
${
protobuf_source_dir
}
/src/google/protobuf/io/printer.h
${
protobuf_source_dir
}
/src/google/protobuf/io/strtod.h
${
protobuf_source_dir
}
/src/google/protobuf/io/tokenizer.h
${
protobuf_source_dir
}
/src/google/protobuf/io/zero_copy_stream_impl.h
${
protobuf_source_dir
}
/src/google/protobuf/map_field.h
...
...
src/Makefile.am
View file @
43c3abf0
...
...
@@ -213,6 +213,7 @@ libprotobuf_lite_la_SOURCES = \
google/protobuf/wire_format_lite.cc
\
google/protobuf/io/coded_stream.cc
\
google/protobuf/io/coded_stream_inl.h
\
google/protobuf/io/strtod.cc
\
google/protobuf/io/zero_copy_stream.cc
\
google/protobuf/io/zero_copy_stream_impl_lite.cc
...
...
@@ -257,7 +258,6 @@ libprotobuf_la_SOURCES = \
google/protobuf/wrappers.pb.cc
\
google/protobuf/io/gzip_stream.cc
\
google/protobuf/io/printer.cc
\
google/protobuf/io/strtod.cc
\
google/protobuf/io/tokenizer.cc
\
google/protobuf/io/zero_copy_stream_impl.cc
\
google/protobuf/compiler/importer.cc
\
...
...
src/google/protobuf/stubs/strutil.cc
View file @
43c3abf0
...
...
@@ -42,6 +42,7 @@
#include <google/protobuf/stubs/logging.h>
#include <google/protobuf/stubs/stl_util.h>
#include <google/protobuf/io/strtod.h>
#ifdef _WIN32
// MSVC has only _snprintf, not snprintf.
...
...
@@ -1287,7 +1288,7 @@ char* DoubleToBuffer(double value, char* buffer) {
// of a double. This long double may have extra bits that make it compare
// unequal to "value" even though it would be exactly equal if it were
// truncated to a double.
volatile
double
parsed_value
=
s
trtod
(
buffer
,
nullptr
);
volatile
double
parsed_value
=
io
::
NoLocaleS
trtod
(
buffer
,
nullptr
);
if
(
parsed_value
!=
value
)
{
int
snprintf_result
=
snprintf
(
buffer
,
kDoubleToBufferSize
,
"%.*g"
,
DBL_DIG
+
2
,
value
);
...
...
@@ -1339,7 +1340,7 @@ bool safe_strtof(const char* str, float* value) {
char
*
endptr
;
errno
=
0
;
// errno only gets set on errors
#if defined(_WIN32) || defined (__hpux) // has no strtof()
*
value
=
s
trtod
(
str
,
&
endptr
);
*
value
=
io
::
NoLocaleS
trtod
(
str
,
&
endptr
);
#else
*
value
=
strtof
(
str
,
&
endptr
);
#endif
...
...
@@ -1348,7 +1349,7 @@ bool safe_strtof(const char* str, float* value) {
bool
safe_strtod
(
const
char
*
str
,
double
*
value
)
{
char
*
endptr
;
*
value
=
s
trtod
(
str
,
&
endptr
);
*
value
=
io
::
NoLocaleS
trtod
(
str
,
&
endptr
);
if
(
endptr
!=
str
)
{
while
(
ascii_isspace
(
*
endptr
))
++
endptr
;
}
...
...
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