Bug 840706 - Part 1: Add MFBT_API annotations to other methods in StringToDoubleConverter, r=glandium

The annotations added in bug 1770158 only covered `StringToDouble`,
however as noted in the comments in that file, that isn't sufficient for
accurately parsing floating point numbers. This patch extends the
annotations to the single-precision floating point numbers as well and
will be used in the next part to clean up the implementation of
`nsTString::ToDouble`.

Differential Revision: https://phabricator.services.mozilla.com/D148304
This commit is contained in:
Nika Layzell 2022-12-06 20:27:49 +00:00
parent e5ec4ca924
commit 97bb85687e
2 changed files with 17 additions and 3 deletions

View File

@ -190,5 +190,19 @@ diff --git a/mfbt/double-conversion/double-conversion/string-to-double.h b/mfbt/
// Same as StringToDouble but reads a float.
// Note that this is not equivalent to static_cast<float>(StringToDouble(...))
// due to potential double-rounding.
float StringToFloat(const char* buffer,
- float StringToFloat(const char* buffer,
+ MFBT_API float StringToFloat(const char* buffer,
int length,
int* processed_characters_count) const;
// Same as StringToFloat above but for 16 bit characters.
- float StringToFloat(const uc16* buffer,
+ MFBT_API float StringToFloat(const uc16* buffer,
int length,
int* processed_characters_count) const;
// Same as StringToDouble for T = double, and StringToFloat for T = float.
template <typename T>
T StringTo(const char* buffer,
int length,
int* processed_characters_count) const;

View File

@ -196,12 +196,12 @@ class StringToDoubleConverter {
// Same as StringToDouble but reads a float.
// Note that this is not equivalent to static_cast<float>(StringToDouble(...))
// due to potential double-rounding.
float StringToFloat(const char* buffer,
MFBT_API float StringToFloat(const char* buffer,
int length,
int* processed_characters_count) const;
// Same as StringToFloat above but for 16 bit characters.
float StringToFloat(const uc16* buffer,
MFBT_API float StringToFloat(const uc16* buffer,
int length,
int* processed_characters_count) const;