From 670c4fdea0acb9663145b96bec1fbf76279781df Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Thu, 31 Aug 2017 15:11:52 -0400 Subject: 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 Reviewed-by: Tom Sepez --- core/fxcrt/fx_basic_util.cpp | 40 ++++++++++++++++------------------------ 1 file changed, 16 insertions(+), 24 deletions(-) (limited to 'core/fxcrt/fx_basic_util.cpp') 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(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]; -- cgit v1.2.3