diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-08-31 15:50:25 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-08-31 20:01:56 +0000 |
commit | 0872b04ea41ba6706e42b28f632ab190bc77dede (patch) | |
tree | b6bf5114395046b79cbe4e20dab61fd05edc1239 /core/fxcrt/cfx_bytestring.cpp | |
parent | ce9ad1bee792856c2d9e940ecffff97145e18d32 (diff) | |
download | pdfium-0872b04ea41ba6706e42b28f632ab190bc77dede.tar.xz |
Move methods string methods to fx_string.cpp
This CL creates an fx_string.cpp and moves any methods defined in
fx_string.h into the .cpp file.
Change-Id: I64c310b9be6d8f4c3be633a22884023c0b16fc1b
Reviewed-on: https://pdfium-review.googlesource.com/12671
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fxcrt/cfx_bytestring.cpp')
-rw-r--r-- | core/fxcrt/cfx_bytestring.cpp | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/core/fxcrt/cfx_bytestring.cpp b/core/fxcrt/cfx_bytestring.cpp index 7a738277cf..efe49f8fd6 100644 --- a/core/fxcrt/cfx_bytestring.cpp +++ b/core/fxcrt/cfx_bytestring.cpp @@ -801,53 +801,6 @@ void CFX_ByteString::TrimLeft() { TrimLeft("\x09\x0a\x0b\x0c\x0d\x20"); } -FX_STRSIZE FX_ftoa(float d, char* buf) { - buf[0] = '0'; - buf[1] = '\0'; - if (d == 0.0f) { - return 1; - } - bool bNegative = false; - if (d < 0) { - bNegative = true; - d = -d; - } - int scale = 1; - int scaled = FXSYS_round(d); - while (scaled < 100000) { - if (scale == 1000000) { - break; - } - scale *= 10; - scaled = FXSYS_round(d * scale); - } - if (scaled == 0) { - return 1; - } - char buf2[32]; - FX_STRSIZE buf_size = 0; - if (bNegative) { - buf[buf_size++] = '-'; - } - int i = scaled / scale; - FXSYS_itoa(i, buf2, 10); - FX_STRSIZE len = FXSYS_strlen(buf2); - memcpy(buf + buf_size, buf2, len); - buf_size += len; - int fraction = scaled % scale; - if (fraction == 0) { - return buf_size; - } - buf[buf_size++] = '.'; - scale /= 10; - while (fraction) { - buf[buf_size++] = '0' + fraction / scale; - fraction %= scale; - scale /= 10; - } - return buf_size; -} - CFX_ByteString CFX_ByteString::FormatFloat(float d, int precision) { char buf[32]; FX_STRSIZE len = FX_ftoa(d, buf); |