From bb17868d736f698d5217c30d52c5bbfed62c5936 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Tue, 9 Jun 2015 11:30:25 -0700 Subject: Use stdint.h types throughout PDFium. It's redundant nowadays to provide our own equivalents, now that this is done for us by the system header. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1177483002 --- fpdfsdk/src/javascript/Document.cpp | 2 +- fpdfsdk/src/javascript/Field.cpp | 56 ++++++++++++++++---------------- fpdfsdk/src/javascript/JS_GlobalData.cpp | 12 +++---- fpdfsdk/src/javascript/util.cpp | 4 +-- 4 files changed, 37 insertions(+), 37 deletions(-) (limited to 'fpdfsdk/src/javascript') diff --git a/fpdfsdk/src/javascript/Document.cpp b/fpdfsdk/src/javascript/Document.cpp index 6a3d6e1e33..230a4ce49c 100644 --- a/fpdfsdk/src/javascript/Document.cpp +++ b/fpdfsdk/src/javascript/Document.cpp @@ -1223,7 +1223,7 @@ FX_BOOL Document::documentFileName(IFXJS_Context* cc, CJS_PropValue& vp, CFX_Wid return FALSE; } CFX_WideString wsFilePath = m_pDocument->GetPath(); - FX_INT32 i = wsFilePath.GetLength() - 1; + int32_t i = wsFilePath.GetLength() - 1; for ( ; i >= 0; i-- ) { if ( wsFilePath.GetAt( i ) == L'\\' || wsFilePath.GetAt( i ) == L'/' ) diff --git a/fpdfsdk/src/javascript/Field.cpp b/fpdfsdk/src/javascript/Field.cpp index 7476fa5728..c4936e3799 100644 --- a/fpdfsdk/src/javascript/Field.cpp +++ b/fpdfsdk/src/javascript/Field.cpp @@ -597,7 +597,7 @@ FX_BOOL Field::buttonAlignX(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString FX_FLOAT fLeft,fBottom; IconFit.GetIconPosition(fLeft,fBottom); - vp << (FX_INT32)fLeft; + vp << (int32_t)fLeft; } return TRUE; @@ -648,7 +648,7 @@ FX_BOOL Field::buttonAlignY(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString FX_FLOAT fLeft,fBottom; IconFit.GetIconPosition(fLeft,fBottom); - vp << (FX_INT32)fBottom; + vp << (int32_t)fBottom; } return TRUE; @@ -788,9 +788,9 @@ FX_BOOL Field::buttonScaleHow(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideStri CPDF_IconFit IconFit = pFormControl->GetIconFit(); if (IconFit.IsProportionalScale()) - vp << (FX_INT32)0; + vp << (int32_t)0; else - vp << (FX_INT32)1; + vp << (int32_t)1; } return TRUE; @@ -841,16 +841,16 @@ FX_BOOL Field::buttonScaleWhen(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideStr switch (ScaleM) { case CPDF_IconFit::Always : - vp << (FX_INT32) CPDF_IconFit::Always; + vp << (int32_t) CPDF_IconFit::Always; break; case CPDF_IconFit::Bigger : - vp << (FX_INT32) CPDF_IconFit::Bigger; + vp << (int32_t) CPDF_IconFit::Bigger; break; case CPDF_IconFit::Never : - vp << (FX_INT32) CPDF_IconFit::Never; + vp << (int32_t) CPDF_IconFit::Never; break; case CPDF_IconFit::Smaller : - vp << (FX_INT32) CPDF_IconFit::Smaller; + vp << (int32_t) CPDF_IconFit::Smaller; break; } } @@ -901,7 +901,7 @@ FX_BOOL Field::calcOrderIndex(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideStri CPDF_InterForm* pInterForm = pRDInterForm->GetInterForm(); ASSERT(pInterForm != NULL); - vp << (FX_INT32)pInterForm->FindFieldInCalculationOrder(pFormField); + vp << (int32_t)pInterForm->FindFieldInCalculationOrder(pFormField); } return TRUE; @@ -944,7 +944,7 @@ FX_BOOL Field::charLimit(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& s if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD) return FALSE; - vp << (FX_INT32)pFormField->GetMaxLen(); + vp << (int32_t)pFormField->GetMaxLen(); } return TRUE; } @@ -1141,7 +1141,7 @@ void Field::SetCurrentValueIndices(CPDFSDK_Document* pDocument, const CFX_WideSt break; } - int iSelecting = (FX_INT32)array.GetAt(i); + int iSelecting = (int32_t)array.GetAt(i); if (iSelecting < pFormField->CountOptions() && !pFormField->IsItemSelected(iSelecting)) pFormField->SetItemSelection(iSelecting, TRUE); @@ -1365,7 +1365,7 @@ FX_BOOL Field::display(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sEr if (ANNOTFLAG_INVISIBLE & dwFlag || ANNOTFLAG_HIDDEN & dwFlag) { - vp << (FX_INT32)1; + vp << (int32_t)1; } else { @@ -1373,16 +1373,16 @@ FX_BOOL Field::display(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sEr { if (ANNOTFLAG_NOVIEW & dwFlag) { - vp << (FX_INT32)3; + vp << (int32_t)3; } else { - vp << (FX_INT32)0; + vp << (int32_t)0; } } else { - vp << (FX_INT32)2; + vp << (int32_t)2; } } } @@ -1932,7 +1932,7 @@ FX_BOOL Field::lineWidth(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& s CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormField->GetControl(0)); if (!pWidget) return FALSE; - vp << (FX_INT32)pWidget->GetBorderWidth(); + vp << (int32_t)pWidget->GetBorderWidth(); } return TRUE; @@ -2110,7 +2110,7 @@ FX_BOOL Field::numItems(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sE if (!vp.IsGetting()) return FALSE; - vp << (FX_INT32)pFormField->CountOptions(); + vp << (int32_t)pFormField->CountOptions(); return TRUE; } @@ -2147,14 +2147,14 @@ FX_BOOL Field::page(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError if(!pPageView) return FALSE; - PageArray.SetElement(i, CJS_Value(m_isolate,(FX_INT32)pPageView->GetPageIndex())); + PageArray.SetElement(i, CJS_Value(m_isolate,(int32_t)pPageView->GetPageIndex())); } vp << PageArray; } else { - vp << (FX_INT32) -1; + vp << (int32_t) -1; } return TRUE; @@ -2407,10 +2407,10 @@ FX_BOOL Field::rect(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError CFX_FloatRect crRect = pWidget->GetRect(); CJS_Value Upper_Leftx(m_isolate),Upper_Lefty(m_isolate),Lower_Rightx(m_isolate),Lower_Righty(m_isolate); - Upper_Leftx = (FX_INT32)crRect.left; - Upper_Lefty = (FX_INT32)crRect.top; - Lower_Rightx = (FX_INT32)crRect.right; - Lower_Righty = (FX_INT32)crRect.bottom; + Upper_Leftx = (int32_t)crRect.left; + Upper_Lefty = (int32_t)crRect.top; + Lower_Rightx = (int32_t)crRect.right; + Lower_Righty = (int32_t)crRect.bottom; CJS_Array rcArray(m_isolate); rcArray.SetElement(0,Upper_Leftx); @@ -2643,7 +2643,7 @@ FX_BOOL Field::rotation(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sE CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField); if (!pFormControl)return FALSE; - vp << (FX_INT32)pFormControl->GetRotation(); + vp << (int32_t)pFormControl->GetRotation(); } return TRUE; @@ -2850,7 +2850,7 @@ FX_BOOL Field::textColor(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& s FX_ARGB color; CPDF_DefaultAppearance FieldAppearance = pFormControl->GetDefaultAppearance(); FieldAppearance.GetColor(color, iColorType); - FX_INT32 a,r,g,b; + int32_t a,r,g,b; ArgbDecode(color, a, r, g, b); CPWL_Color crRet = CPWL_Color(COLORTYPE_RGB, r / 255.0f, @@ -3791,7 +3791,7 @@ FX_BOOL Field::setFocus(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Val CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); ASSERT(pFormField != NULL); - FX_INT32 nCount = pFormField->CountControls(); + int32_t nCount = pFormField->CountControls(); if (nCount < 1) return FALSE; @@ -3812,7 +3812,7 @@ FX_BOOL Field::setFocus(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Val return FALSE; if (CPDFSDK_PageView* pCurPageView = m_pDocument->GetPageView(pPage)) { - for (FX_INT32 i=0; iGetWidget(pFormField->GetControl(i))) { @@ -3886,7 +3886,7 @@ FX_BOOL Field::source(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErr /////////////////////////////////////////// delay ///////////////////////////////////////////// -void Field::AddDelay_Int(enum FIELD_PROP prop, FX_INT32 n) +void Field::AddDelay_Int(enum FIELD_PROP prop, int32_t n) { ASSERT(m_pJSDoc != NULL); diff --git a/fpdfsdk/src/javascript/JS_GlobalData.cpp b/fpdfsdk/src/javascript/JS_GlobalData.cpp index b4e4a5b108..450c7a1338 100644 --- a/fpdfsdk/src/javascript/JS_GlobalData.cpp +++ b/fpdfsdk/src/javascript/JS_GlobalData.cpp @@ -105,7 +105,7 @@ void CJS_GlobalVariableArray::Empty() #define PHANTOM_JS_GLOBALDATA_FILENAME L"Phantom_JsGlobal.Data" #define SDK_JS_GLOBALDATA_FILENAME L"SDK_JsGlobal.Data" -static const FX_BYTE JS_RC4KEY[] = {0x19,0xa8,0xe8,0x01,0xf6,0xa8,0xb6,0x4d,0x82,0x04, +static const uint8_t JS_RC4KEY[] = {0x19,0xa8,0xe8,0x01,0xf6,0xa8,0xb6,0x4d,0x82,0x04, 0x45,0x6d,0xb4,0xcf,0xd7,0x77,0x67,0xf9,0x75,0x9f, 0xf0,0xe0,0x1e,0x51,0xee,0x46,0xfd,0x0b,0xc9,0x93, 0x25,0x55,0x4a,0xee,0xe0,0x16,0xd0,0xdf,0x8c,0xfa, @@ -338,7 +338,7 @@ FX_BOOL CJS_GlobalData::DeleteGlobalVariable(FX_LPCSTR propname) return FALSE; } -FX_INT32 CJS_GlobalData::GetSize() const +int32_t CJS_GlobalData::GetSize() const { return m_arrayGlobalData.GetSize(); } @@ -351,7 +351,7 @@ CJS_GlobalData_Element* CJS_GlobalData::GetAt(int index) const void CJS_GlobalData::LoadGlobalPersistentVariables() { FX_LPBYTE pBuffer = NULL; - FX_INT32 nLength = 0; + int32_t nLength = 0; LoadFileBuffer(m_sFilePath.c_str(), pBuffer, nLength); CRYPT_ArcFourCryptBlock(pBuffer, nLength, JS_RC4KEY, sizeof(JS_RC4KEY)); @@ -379,7 +379,7 @@ void CJS_GlobalData::LoadGlobalPersistentVariables() if (dwSize == nLength - sizeof(FX_WORD) * 2 - sizeof(FX_DWORD)* 2) { - for (FX_INT32 i=0,sz=dwCount; i pBuffer + nLength) break; @@ -511,12 +511,12 @@ void CJS_GlobalData::SaveGlobalPersisitentVariables() WriteFileBuffer(m_sFilePath.c_str(), (FX_LPCSTR)sFile.GetBuffer(), sFile.GetSize()); } -void CJS_GlobalData::LoadFileBuffer(FX_LPCWSTR sFilePath, FX_LPBYTE& pBuffer, FX_INT32& nLength) +void CJS_GlobalData::LoadFileBuffer(FX_LPCWSTR sFilePath, FX_LPBYTE& pBuffer, int32_t& nLength) { //UnSupport. } -void CJS_GlobalData::WriteFileBuffer(FX_LPCWSTR sFilePath, FX_LPCSTR pBuffer, FX_INT32 nLength) +void CJS_GlobalData::WriteFileBuffer(FX_LPCWSTR sFilePath, FX_LPCSTR pBuffer, int32_t nLength) { //UnSupport. } diff --git a/fpdfsdk/src/javascript/util.cpp b/fpdfsdk/src/javascript/util.cpp index 26c59a32ad..e051cda66e 100644 --- a/fpdfsdk/src/javascript/util.cpp +++ b/fpdfsdk/src/javascript/util.cpp @@ -603,10 +603,10 @@ FX_BOOL util::scand(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& return TRUE; } -FX_INT64 FX_atoi64(const char *nptr) +int64_t FX_atoi64(const char *nptr) { int c; /* current char */ - FX_INT64 total; /* current total */ + int64_t total; /* current total */ int sign; /* if '-', then negative, otherwise positive */ /* skip whitespace */ -- cgit v1.2.3