summaryrefslogtreecommitdiff
path: root/core/fxcrt/fx_basic_util.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-08-31 15:11:52 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-08-31 19:30:34 +0000
commit670c4fdea0acb9663145b96bec1fbf76279781df (patch)
tree3a28b6244430514b9702e964c24663c3ec31d7fd /core/fxcrt/fx_basic_util.cpp
parent47a90b894ecca2d3547226169602d7f8729d564f (diff)
downloadpdfium-670c4fdea0acb9663145b96bec1fbf76279781df.tar.xz
Cleanup fx_basic_* files
Remove dead code, move code to namespaces where possible, cleanup some single use items. Change-Id: Ia734477ceb2105a1ed272463bd8220f1205a7ce9 Reviewed-on: https://pdfium-review.googlesource.com/12732 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core/fxcrt/fx_basic_util.cpp')
-rw-r--r--core/fxcrt/fx_basic_util.cpp40
1 files changed, 16 insertions, 24 deletions
diff --git a/core/fxcrt/fx_basic_util.cpp b/core/fxcrt/fx_basic_util.cpp
index 2a9ce05e4b..d8cf087b73 100644
--- a/core/fxcrt/fx_basic_util.cpp
+++ b/core/fxcrt/fx_basic_util.cpp
@@ -11,8 +11,22 @@
#include "core/fxcrt/fx_extension.h"
#include "core/fxcrt/fx_stream.h"
+#include "core/fxcrt/fx_system.h"
#include "third_party/base/ptr_util.h"
+namespace {
+
+const float fraction_scales[] = {0.1f, 0.01f, 0.001f,
+ 0.0001f, 0.00001f, 0.000001f,
+ 0.0000001f, 0.00000001f, 0.000000001f,
+ 0.0000000001f, 0.00000000001f};
+
+float FractionalScale(size_t scale_factor, int value) {
+ return fraction_scales[scale_factor] * value;
+}
+
+} // namespace
+
bool FX_atonum(const CFX_ByteStringC& strc, void* pData) {
if (strc.Contains('.')) {
float* pFloat = static_cast<float*>(pData);
@@ -70,19 +84,6 @@ bool FX_atonum(const CFX_ByteStringC& strc, void* pData) {
return true;
}
-static const float fraction_scales[] = {
- 0.1f, 0.01f, 0.001f, 0.0001f,
- 0.00001f, 0.000001f, 0.0000001f, 0.00000001f,
- 0.000000001f, 0.0000000001f, 0.00000000001f};
-
-int FXSYS_FractionalScaleCount() {
- return FX_ArraySize(fraction_scales);
-}
-
-float FXSYS_FractionalScale(size_t scale_factor, int value) {
- return fraction_scales[scale_factor] * value;
-}
-
float FX_atof(const CFX_ByteStringC& strc) {
if (strc.IsEmpty())
return 0.0;
@@ -112,10 +113,9 @@ float FX_atof(const CFX_ByteStringC& strc) {
if (cc < len && strc[cc] == '.') {
cc++;
while (cc < len) {
- value +=
- FXSYS_FractionalScale(scale, FXSYS_DecimalCharToInt(strc.CharAt(cc)));
+ value += FractionalScale(scale, FXSYS_DecimalCharToInt(strc.CharAt(cc)));
scale++;
- if (scale == FXSYS_FractionalScaleCount())
+ if (scale == FX_ArraySize(fraction_scales))
break;
cc++;
}
@@ -181,14 +181,6 @@ void FX_CloseFolder(FX_FileHandle* handle) {
#endif
}
-wchar_t FX_GetFolderSeparator() {
-#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
- return '\\';
-#else
- return '/';
-#endif
-}
-
uint32_t GetBits32(const uint8_t* pData, int bitpos, int nbits) {
ASSERT(0 < nbits && nbits <= 32);
const uint8_t* dataPtr = &pData[bitpos / 8];