Avoid c_str() in StringTo{Double,Float}(WideStringView)
The current code goes from WideString -> c_str -> WideStringView, which
is needless since we can just convert WideString -> WideStringView.
Change-Id: Id591e704ca6e1a7efa2c080bd2814a1f792373ef
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/86851
Auto-Submit: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/core/fxcrt/fx_string.cpp b/core/fxcrt/fx_string.cpp
index 2e22b70..172b196 100644
--- a/core/fxcrt/fx_string.cpp
+++ b/core/fxcrt/fx_string.cpp
@@ -141,7 +141,7 @@
}
float StringToFloat(WideStringView wsStr) {
- return StringToFloat(FX_UTF8Encode(wsStr).c_str());
+ return StringToFloat(FX_UTF8Encode(wsStr).AsStringView());
}
size_t FloatToString(float f, char* buf) {
@@ -154,7 +154,7 @@
}
double StringToDouble(WideStringView wsStr) {
- return StringToDouble(FX_UTF8Encode(wsStr).c_str());
+ return StringToDouble(FX_UTF8Encode(wsStr).AsStringView());
}
size_t DoubleToString(double d, char* buf) {