From 0872b04ea41ba6706e42b28f632ab190bc77dede Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Thu, 31 Aug 2017 15:50:25 -0400 Subject: 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 Commit-Queue: dsinclair --- core/fxcrt/cfx_bytestring.cpp | 47 ------------------------------------------- 1 file changed, 47 deletions(-) (limited to 'core/fxcrt/cfx_bytestring.cpp') 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); -- cgit v1.2.3