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 "core/fxcrt/fx_basic.h" | 7 #include "core/fxcrt/fx_basic.h" |
8 #include "core/fxcrt/fx_ext.h" | 8 #include "core/fxcrt/fx_ext.h" |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 FX_FLOAT FX_atof(const CFX_ByteStringC& strc) { | 90 FX_FLOAT FX_atof(const CFX_ByteStringC& strc) { |
91 if (strc.IsEmpty()) | 91 if (strc.IsEmpty()) |
92 return 0.0; | 92 return 0.0; |
93 | 93 |
94 int cc = 0; | 94 int cc = 0; |
95 bool bNegative = false; | 95 bool bNegative = false; |
96 int len = strc.GetLength(); | 96 int len = strc.GetLength(); |
97 if (strc[0] == '+') { | 97 if (strc[0] == '+') { |
98 cc++; | 98 cc++; |
99 } else if (strc[0] == '-') { | 99 } else if (strc[0] == '-') { |
100 bNegative = TRUE; | 100 bNegative = true; |
101 cc++; | 101 cc++; |
102 } | 102 } |
103 while (cc < len) { | 103 while (cc < len) { |
104 if (strc[cc] != '+' && strc[cc] != '-') | 104 if (strc[cc] != '+' && strc[cc] != '-') |
105 break; | 105 break; |
106 cc++; | 106 cc++; |
107 } | 107 } |
108 FX_FLOAT value = 0; | 108 FX_FLOAT value = 0; |
109 while (cc < len) { | 109 while (cc < len) { |
110 if (strc[cc] == '.') | 110 if (strc[cc] == '.') |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 dstShift -= 8; | 260 dstShift -= 8; |
261 result |= *dataPtr++ << dstShift; | 261 result |= *dataPtr++ << dstShift; |
262 } | 262 } |
263 if (dstShift > 0) { | 263 if (dstShift > 0) { |
264 bitShift = 8 - dstShift; | 264 bitShift = 8 - dstShift; |
265 bitMask = (1 << dstShift) - 1; | 265 bitMask = (1 << dstShift) - 1; |
266 result |= *dataPtr++ >> bitShift & bitMask; | 266 result |= *dataPtr++ >> bitShift & bitMask; |
267 } | 267 } |
268 return result; | 268 return result; |
269 } | 269 } |
OLD | NEW |