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

Side by Side Diff: fpdfsdk/src/javascript/JS_Value.cpp

Issue 1252613002: FX_BOOL considered harmful. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Manual edits. Created 5 years, 5 months 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
« no previous file with comments | « fpdfsdk/src/javascript/JS_Runtime.cpp ('k') | fpdfsdk/src/javascript/PublicMethods.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/javascript/JavaScript.h" 7 #include "../../include/javascript/JavaScript.h"
8 #include "../../include/javascript/JS_Define.h" 8 #include "../../include/javascript/JS_Define.h"
9 #include "../../include/javascript/JS_Object.h" 9 #include "../../include/javascript/JS_Object.h"
10 #include "../../include/javascript/JS_Value.h" 10 #include "../../include/javascript/JS_Value.h"
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 if(m_pValue->IsString()) return VT_string; 249 if(m_pValue->IsString()) return VT_string;
250 if(m_pValue->IsNumber()) return VT_number; 250 if(m_pValue->IsNumber()) return VT_number;
251 if(m_pValue->IsBoolean()) return VT_boolean; 251 if(m_pValue->IsBoolean()) return VT_boolean;
252 if(m_pValue->IsDate()) return VT_date; 252 if(m_pValue->IsDate()) return VT_date;
253 if(m_pValue->IsObject()) return VT_object; 253 if(m_pValue->IsObject()) return VT_object;
254 if(m_pValue->IsNull()) return VT_null; 254 if(m_pValue->IsNull()) return VT_null;
255 if(m_pValue->IsUndefined()) return VT_undefined; 255 if(m_pValue->IsUndefined()) return VT_undefined;
256 return VT_unknown; 256 return VT_unknown;
257 } 257 }
258 258
259 FX_BOOL CJS_Value::IsArrayObject() const 259 bool CJS_Value::IsArrayObject() const
260 { 260 {
261 » if(m_pValue.IsEmpty()) return FALSE; 261 » if(m_pValue.IsEmpty()) return false;
262 return m_pValue->IsArray(); 262 return m_pValue->IsArray();
263 } 263 }
264 264
265 FX_BOOL CJS_Value::IsDateObject() const 265 bool CJS_Value::IsDateObject() const
266 { 266 {
267 » if(m_pValue.IsEmpty()) return FALSE; 267 » if(m_pValue.IsEmpty()) return false;
268 return m_pValue->IsDate(); 268 return m_pValue->IsDate();
269 } 269 }
270 270
271 //CJS_Value::operator CJS_Array() 271 //CJS_Value::operator CJS_Array()
272 FX_BOOL CJS_Value::ConvertToArray(CJS_Array &array) const 272 bool CJS_Value::ConvertToArray(CJS_Array &array) const
273 { 273 {
274 if (IsArrayObject()) 274 if (IsArrayObject())
275 { 275 {
276 array.Attach(JS_ToArray(m_isolate, m_pValue)); 276 array.Attach(JS_ToArray(m_isolate, m_pValue));
277 » » return TRUE; 277 » » return true;
278 } 278 }
279 279
280 » return FALSE; 280 » return false;
281 } 281 }
282 282
283 FX_BOOL CJS_Value::ConvertToDate(CJS_Date &date) const 283 bool CJS_Value::ConvertToDate(CJS_Date &date) const
284 { 284 {
285 // if (GetType() == VT_date) 285 // if (GetType() == VT_date)
286 // { 286 // {
287 // date = (double)(*this); 287 // date = (double)(*this);
288 // » » return TRUE; 288 // » » return true;
289 // } 289 // }
290 290
291 if (IsDateObject()) 291 if (IsDateObject())
292 { 292 {
293 date.Attach(m_pValue); 293 date.Attach(m_pValue);
294 » » return TRUE; 294 » » return true;
295 } 295 }
296 296
297 » return FALSE; 297 » return false;
298 } 298 }
299 299
300 /* ---------------------------- CJS_PropValue ---------------------------- */ 300 /* ---------------------------- CJS_PropValue ---------------------------- */
301 301
302 CJS_PropValue::CJS_PropValue(const CJS_Value &value) : 302 CJS_PropValue::CJS_PropValue(const CJS_Value &value) :
303 CJS_Value(value), 303 CJS_Value(value),
304 m_bIsSetting(0) 304 m_bIsSetting(0)
305 { 305 {
306 } 306 }
307 307
308 CJS_PropValue::CJS_PropValue(v8::Isolate* isolate) : CJS_Value(isolate), 308 CJS_PropValue::CJS_PropValue(v8::Isolate* isolate) : CJS_Value(isolate),
309 m_bIsSetting(0) 309 m_bIsSetting(0)
310 { 310 {
311 } 311 }
312 312
313 CJS_PropValue::~CJS_PropValue() 313 CJS_PropValue::~CJS_PropValue()
314 { 314 {
315 } 315 }
316 316
317 FX_BOOL CJS_PropValue::IsSetting() 317 bool CJS_PropValue::IsSetting()
318 { 318 {
319 return m_bIsSetting; 319 return m_bIsSetting;
320 } 320 }
321 321
322 FX_BOOL CJS_PropValue::IsGetting() 322 bool CJS_PropValue::IsGetting()
323 { 323 {
324 return !m_bIsSetting; 324 return !m_bIsSetting;
325 } 325 }
326 326
327 void CJS_PropValue::operator <<(int iValue) 327 void CJS_PropValue::operator <<(int iValue)
328 { 328 {
329 ASSERT(!m_bIsSetting); 329 ASSERT(!m_bIsSetting);
330 CJS_Value::operator =(iValue); 330 CJS_Value::operator =(iValue);
331 } 331 }
332 332
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 473
474 CJS_Array::~CJS_Array() 474 CJS_Array::~CJS_Array()
475 { 475 {
476 } 476 }
477 477
478 void CJS_Array::Attach(v8::Local<v8::Array> pArray) 478 void CJS_Array::Attach(v8::Local<v8::Array> pArray)
479 { 479 {
480 m_pArray = pArray; 480 m_pArray = pArray;
481 } 481 }
482 482
483 FX_BOOL CJS_Array::IsAttached() 483 bool CJS_Array::IsAttached()
484 { 484 {
485 » return FALSE; 485 » return false;
486 } 486 }
487 487
488 void CJS_Array::GetElement(unsigned index,CJS_Value &value) 488 void CJS_Array::GetElement(unsigned index,CJS_Value &value)
489 { 489 {
490 if (m_pArray.IsEmpty()) 490 if (m_pArray.IsEmpty())
491 return; 491 return;
492 v8::Local<v8::Value> p = JS_GetArrayElement(m_isolate, m_pArray,index); 492 v8::Local<v8::Value> p = JS_GetArrayElement(m_isolate, m_pArray,index);
493 value.Attach(p,VT_object); 493 value.Attach(p,VT_object);
494 } 494 }
495 495
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 536
537 double CJS_Date::MakeDate(int year, int mon, int day,int hour, int min, int sec, int ms) 537 double CJS_Date::MakeDate(int year, int mon, int day,int hour, int min, int sec, int ms)
538 { 538 {
539 return JS_MakeDate(JS_MakeDay(year,mon,day), JS_MakeTime(hour,min,sec,ms )); 539 return JS_MakeDate(JS_MakeDay(year,mon,day), JS_MakeTime(hour,min,sec,ms ));
540 } 540 }
541 541
542 CJS_Date::~CJS_Date() 542 CJS_Date::~CJS_Date()
543 { 543 {
544 } 544 }
545 545
546 FX_BOOL»CJS_Date::IsValidDate() 546 bool» CJS_Date::IsValidDate()
547 { 547 {
548 » if(m_pDate.IsEmpty()) return FALSE; 548 » if(m_pDate.IsEmpty()) return false;
549 return !JS_PortIsNan(JS_ToNumber(m_isolate, m_pDate)); 549 return !JS_PortIsNan(JS_ToNumber(m_isolate, m_pDate));
550 } 550 }
551 551
552 void CJS_Date::Attach(v8::Local<v8::Value> pDate) 552 void CJS_Date::Attach(v8::Local<v8::Value> pDate)
553 { 553 {
554 m_pDate = pDate; 554 m_pDate = pDate;
555 } 555 }
556 556
557 int CJS_Date::GetYear() 557 int CJS_Date::GetYear()
558 { 558 {
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 return 0.0; 653 return 0.0;
654 return JS_ToNumber(m_isolate, m_pDate); 654 return JS_ToNumber(m_isolate, m_pDate);
655 } 655 }
656 656
657 CFX_WideString CJS_Date::ToString() const 657 CFX_WideString CJS_Date::ToString() const
658 { 658 {
659 if(m_pDate.IsEmpty()) 659 if(m_pDate.IsEmpty())
660 return L""; 660 return L"";
661 return JS_ToString(m_isolate, m_pDate); 661 return JS_ToString(m_isolate, m_pDate);
662 } 662 }
OLDNEW
« no previous file with comments | « fpdfsdk/src/javascript/JS_Runtime.cpp ('k') | fpdfsdk/src/javascript/PublicMethods.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698