Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(829)

Side by Side Diff: core/src/fxcrt/fx_basic_util.cpp

Issue 1405253007: Revert "Revert "Cleanup some numeric code."" (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Fix mac build Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "../../include/fxcrt/fx_basic.h" 7 #include "../../include/fxcrt/fx_basic.h"
8 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ 8 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
9 #include <sys/types.h> 9 #include <sys/types.h>
10 #include <dirent.h> 10 #include <dirent.h>
11 #else 11 #else
12 #include <direct.h> 12 #include <direct.h>
13 #endif 13 #endif
14
15 #include <cctype>
16
14 CFX_PrivateData::~CFX_PrivateData() { 17 CFX_PrivateData::~CFX_PrivateData() {
15 ClearAll(); 18 ClearAll();
16 } 19 }
17 void FX_PRIVATEDATA::FreeData() { 20 void FX_PRIVATEDATA::FreeData() {
18 if (m_pData == NULL) { 21 if (m_pData == NULL) {
19 return; 22 return;
20 } 23 }
21 if (m_bSelfDestruct) { 24 if (m_bSelfDestruct) {
22 delete (CFX_DestructObject*)m_pData; 25 delete (CFX_DestructObject*)m_pData;
23 } else if (m_pCallback) { 26 } else if (m_pCallback) {
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 const FX_CHAR* str = strc.GetCStr(); 97 const FX_CHAR* str = strc.GetCStr();
95 int len = strc.GetLength(); 98 int len = strc.GetLength();
96 FX_BOOL bNegative = FALSE; 99 FX_BOOL bNegative = FALSE;
97 if (str[0] == '+') { 100 if (str[0] == '+') {
98 cc++; 101 cc++;
99 } else if (str[0] == '-') { 102 } else if (str[0] == '-') {
100 bNegative = TRUE; 103 bNegative = TRUE;
101 cc++; 104 cc++;
102 } 105 }
103 while (cc < len) { 106 while (cc < len) {
104 if (str[cc] < '0' || str[cc] > '9') { 107 if (!std::isdigit(str[cc]))
105 break; 108 break;
106 } 109
107 integer = integer * 10 + str[cc] - '0'; 110 integer = integer * 10 + str[cc] - '0';
108 if (integer < 0) { 111 if (integer < 0)
109 break; 112 break;
110 } 113
111 cc++; 114 cc++;
112 } 115 }
113 if (bNegative) { 116 if (bNegative) {
114 integer = -integer; 117 integer = -integer;
115 } 118 }
116 *(int*)pData = integer; 119 *(int*)pData = integer;
117 } else { 120 } else {
118 bInteger = FALSE; 121 bInteger = FALSE;
119 *(FX_FLOAT*)pData = FX_atof(strc); 122 *(FX_FLOAT*)pData = FX_atof(strc);
120 } 123 }
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 d * m.b + e * m.e + f * m.h, d * m.c + e * m.f + f * m.i, 367 d * m.b + e * m.e + f * m.h, d * m.c + e * m.f + f * m.i,
365 g * m.a + h * m.d + i * m.g, g * m.b + h * m.e + i * m.h, 368 g * m.a + h * m.d + i * m.g, g * m.b + h * m.e + i * m.h,
366 g * m.c + h * m.f + i * m.i); 369 g * m.c + h * m.f + i * m.i);
367 } 370 }
368 371
369 CFX_Vector_3by1 CFX_Matrix_3by3::TransformVector(const CFX_Vector_3by1& v) { 372 CFX_Vector_3by1 CFX_Matrix_3by3::TransformVector(const CFX_Vector_3by1& v) {
370 return CFX_Vector_3by1(a * v.a + b * v.b + c * v.c, 373 return CFX_Vector_3by1(a * v.a + b * v.b + c * v.c,
371 d * v.a + e * v.b + f * v.c, 374 d * v.a + e * v.b + f * v.c,
372 g * v.a + h * v.b + i * v.c); 375 g * v.a + h * v.b + i * v.c);
373 } 376 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698