OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include <stddef.h> // For offsetof(). | 7 #include <stddef.h> // For offsetof(). |
8 | 8 |
9 #include "../../include/fxcrt/fx_basic.h" | 9 #include "../../include/fxcrt/fx_basic.h" |
10 #include "../../../third_party/base/numerics/safe_math.h" | 10 #include "third_party/base/numerics/safe_math.h" |
11 | 11 |
12 static int _Buffer_itoa(char* buf, int i, FX_DWORD flags) { | 12 static int _Buffer_itoa(char* buf, int i, FX_DWORD flags) { |
13 if (i == 0) { | 13 if (i == 0) { |
14 buf[0] = '0'; | 14 buf[0] = '0'; |
15 return 1; | 15 return 1; |
16 } | 16 } |
17 char buf1[32]; | 17 char buf1[32]; |
18 int buf_pos = 31; | 18 int buf_pos = 31; |
19 FX_DWORD u = i; | 19 FX_DWORD u = i; |
20 if ((flags & FXFORMAT_SIGNED) && i < 0) { | 20 if ((flags & FXFORMAT_SIGNED) && i < 0) { |
(...skipping 1065 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1086 fraction %= scale; | 1086 fraction %= scale; |
1087 scale /= 10; | 1087 scale /= 10; |
1088 } | 1088 } |
1089 return buf_size; | 1089 return buf_size; |
1090 } | 1090 } |
1091 CFX_ByteString CFX_ByteString::FormatFloat(FX_FLOAT d, int precision) { | 1091 CFX_ByteString CFX_ByteString::FormatFloat(FX_FLOAT d, int precision) { |
1092 FX_CHAR buf[32]; | 1092 FX_CHAR buf[32]; |
1093 FX_STRSIZE len = FX_ftoa(d, buf); | 1093 FX_STRSIZE len = FX_ftoa(d, buf); |
1094 return CFX_ByteString(buf, len); | 1094 return CFX_ByteString(buf, len); |
1095 } | 1095 } |
OLD | NEW |