summaryrefslogtreecommitdiff
path: root/fpdfsdk/src
diff options
context:
space:
mode:
authorBo Xu <bo_xu@foxitsoftware.com>2014-12-30 16:56:12 -0800
committerBo Xu <bo_xu@foxitsoftware.com>2014-12-30 17:07:17 -0800
commitc616483e834b791b92b0c0d4f99d0ea3b66f1a4f (patch)
treee9589ee48c4aeb5e0ab5e9ba0766e6d8c1f768dd /fpdfsdk/src
parentbb1405dda43fd4b605fd9c2808dc0ead87f54ccc (diff)
downloadpdfium-c616483e834b791b92b0c0d4f99d0ea3b66f1a4f.tar.xz
XFA: merge patch from CL 733693003, get rid of FX_LPCSTR cast
Get rid of FX_LPCSTR cast. Follow up on https://codereview.chromium.org/733693003 R=brucedawson@chromium.org, tsepez@chromium.org Review URL: https://codereview.chromium.org/809993004
Diffstat (limited to 'fpdfsdk/src')
-rw-r--r--fpdfsdk/src/formfiller/FFL_ComboBox.cpp2
-rw-r--r--fpdfsdk/src/formfiller/FFL_TextField.cpp2
-rw-r--r--fpdfsdk/src/fpdf_flatten.cpp6
-rw-r--r--fpdfsdk/src/fpdfdoc.cpp4
-rw-r--r--fpdfsdk/src/fsdk_baseannot.cpp2
-rw-r--r--fpdfsdk/src/fsdk_baseform.cpp2
-rw-r--r--fpdfsdk/src/javascript/JS_Value.cpp2
-rw-r--r--fpdfsdk/src/javascript/PublicMethods.cpp8
-rw-r--r--fpdfsdk/src/javascript/util.cpp4
-rw-r--r--fpdfsdk/src/jsapi/fxjs_v8.cpp8
-rw-r--r--fpdfsdk/src/pdfwindow/PWL_Edit.cpp2
11 files changed, 21 insertions, 21 deletions
diff --git a/fpdfsdk/src/formfiller/FFL_ComboBox.cpp b/fpdfsdk/src/formfiller/FFL_ComboBox.cpp
index 1c5b49812e..2607a76b5c 100644
--- a/fpdfsdk/src/formfiller/FFL_ComboBox.cpp
+++ b/fpdfsdk/src/formfiller/FFL_ComboBox.cpp
@@ -377,7 +377,7 @@ void CFFL_ComboBox::OnSetFocus(CPWL_Wnd* pWnd)
CFX_WideString wsText = pEdit->GetText();
int nCharacters = wsText.GetLength();
CFX_ByteString bsUTFText = wsText.UTF16LE_Encode();
- unsigned short* pBuffer = (unsigned short*)(FX_LPCSTR)bsUTFText;
+ unsigned short* pBuffer = (unsigned short*)bsUTFText.c_str();
m_pApp->FFI_OnSetFieldInputFocus(m_pWidget->GetFormField(), pBuffer, nCharacters, TRUE);
pEdit->SetEditNotify(this);
diff --git a/fpdfsdk/src/formfiller/FFL_TextField.cpp b/fpdfsdk/src/formfiller/FFL_TextField.cpp
index f9c93914a5..dce166282e 100644
--- a/fpdfsdk/src/formfiller/FFL_TextField.cpp
+++ b/fpdfsdk/src/formfiller/FFL_TextField.cpp
@@ -374,7 +374,7 @@ void CFFL_TextField::OnSetFocus(CPWL_Wnd* pWnd)
CFX_WideString wsText = pEdit->GetText();
int nCharacters = wsText.GetLength();
CFX_ByteString bsUTFText = wsText.UTF16LE_Encode();
- unsigned short* pBuffer = (unsigned short*)(FX_LPCSTR)bsUTFText;
+ unsigned short* pBuffer = (unsigned short*)bsUTFText.c_str();
m_pApp->FFI_OnSetFieldInputFocus(m_pWidget->GetFormField(), pBuffer, nCharacters, TRUE);
pEdit->SetEditNotify(this);
diff --git a/fpdfsdk/src/fpdf_flatten.cpp b/fpdfsdk/src/fpdf_flatten.cpp
index e07ccc91b7..c7ef4b50d8 100644
--- a/fpdfsdk/src/fpdf_flatten.cpp
+++ b/fpdfsdk/src/fpdf_flatten.cpp
@@ -222,7 +222,7 @@ void SetPageContents(CFX_ByteString key, CPDF_Dictionary* pPage, CPDF_Document*
pPage->SetAtReference("Contents", pDocument, pDocument->AddIndirectObject(pNewContents));
CFX_ByteString sStream;
- sStream.Format("q 1 0 0 1 0 0 cm /%s Do Q", (FX_LPCSTR)key);
+ sStream.Format("q 1 0 0 1 0 0 cm /%s Do Q", key.c_str());
pNewContents->SetData((FX_LPCBYTE)sStream, sStream.GetLength(), FALSE, FALSE);
}
return;
@@ -269,7 +269,7 @@ void SetPageContents(CFX_ByteString key, CPDF_Dictionary* pPage, CPDF_Document*
pContentsArray->AddReference(pDocument, dwObjNum);
CFX_ByteString sStream;
- sStream.Format("q 1 0 0 1 0 0 cm /%s Do Q", (FX_LPCSTR)key);
+ sStream.Format("q 1 0 0 1 0 0 cm /%s Do Q", key.c_str());
pNewContents->SetData((FX_LPCBYTE)sStream, sStream.GetLength(), FALSE, FALSE);
}
}
@@ -552,7 +552,7 @@ DLLEXPORT int STDCALL FPDFPage_Flatten( FPDF_PAGE page, int nFlag)
}
CFX_AffineMatrix m = GetMatrix(rcAnnot, rcStream, matrix);
- sTemp.Format("q %f 0 0 %f %f %f cm /%s Do Q\n", m.a, m.d, m.e, m.f, (FX_LPCSTR)sFormName);
+ sTemp.Format("q %f 0 0 %f %f %f cm /%s Do Q\n", m.a, m.d, m.e, m.f, sFormName.c_str());
sStream += sTemp;
pNewXObject->SetData((FX_LPCBYTE)sStream, sStream.GetLength(), FALSE, FALSE);
diff --git a/fpdfsdk/src/fpdfdoc.cpp b/fpdfsdk/src/fpdfdoc.cpp
index 643e398cfd..79d335da53 100644
--- a/fpdfsdk/src/fpdfdoc.cpp
+++ b/fpdfsdk/src/fpdfdoc.cpp
@@ -109,7 +109,7 @@ DLLEXPORT unsigned long STDCALL FPDFAction_GetURIPath(FPDF_DOCUMENT document, FP
CFX_ByteString path = Action.GetURI(pDoc);
unsigned long len = path.GetLength() + 1;
if (buffer != NULL && buflen >= len)
- FXSYS_memcpy(buffer, (FX_LPCSTR)path, len);
+ FXSYS_memcpy(buffer, path.c_str(), len);
return len;
}
@@ -255,7 +255,7 @@ DLLEXPORT unsigned long STDCALL FPDF_GetMetaText(FPDF_DOCUMENT doc, FPDF_BYTESTR
CFX_ByteString bstr = text.UTF16LE_Encode();
unsigned long len = bstr.GetLength();
if (buffer != NULL && buflen >= len+2) {
- FXSYS_memcpy(buffer, (FX_LPCSTR)bstr, len);
+ FXSYS_memcpy(buffer, bstr.c_str(), len);
// use double zero as trailer
((FX_BYTE*)buffer)[len] = ((FX_BYTE*)buffer)[len+1] = 0;
}
diff --git a/fpdfsdk/src/fsdk_baseannot.cpp b/fpdfsdk/src/fsdk_baseannot.cpp
index 90e22d32b2..9b669e9f4a 100644
--- a/fpdfsdk/src/fsdk_baseannot.cpp
+++ b/fpdfsdk/src/fsdk_baseannot.cpp
@@ -1058,7 +1058,7 @@ void CPDFSDK_BAAnnot::WriteAppearance(const CFX_ByteString& sAPType, const CPDF_
pStreamDict->SetAtRect("BBox", rcBBox);
}
- pStream->SetData((FX_BYTE*)(FX_LPCSTR)sContents, sContents.GetLength(), FALSE, FALSE);
+ pStream->SetData((FX_BYTE*)sContents.c_str(), sContents.GetLength(), FALSE, FALSE);
}
#define BA_ANNOT_MINWIDTH 1
diff --git a/fpdfsdk/src/fsdk_baseform.cpp b/fpdfsdk/src/fsdk_baseform.cpp
index 5dbd4f721b..7cdb32f4bd 100644
--- a/fpdfsdk/src/fsdk_baseform.cpp
+++ b/fpdfsdk/src/fsdk_baseform.cpp
@@ -2685,7 +2685,7 @@ CPDF_Stream* CPDFSDK_InterForm::LoadImageFromFile(const CFX_WideString& sFile)
pRetStream = new CPDF_Stream(NULL, 0, NULL);
CFX_ByteString csStream;
csStream.Format("q\n%d 0 0 %d 0 0 cm\n/Img Do\nQ", nWidth, nHeight);
- pRetStream->InitStream((FX_BYTE*)(FX_LPCSTR)csStream, csStream.GetLength(), pStreamDict);
+ pRetStream->InitStream((FX_BYTE*)csStream.c_str(), csStream.GetLength(), pStreamDict);
pDocument->AddIndirectObject(pRetStream);
}
diff --git a/fpdfsdk/src/javascript/JS_Value.cpp b/fpdfsdk/src/javascript/JS_Value.cpp
index 93da9bea2e..9279ff5db4 100644
--- a/fpdfsdk/src/javascript/JS_Value.cpp
+++ b/fpdfsdk/src/javascript/JS_Value.cpp
@@ -400,7 +400,7 @@ void CJS_PropValue::StartGetting()
void CJS_PropValue::operator <<(CFX_ByteString string)
{
ASSERT(!m_bIsSetting);
- CJS_Value::operator =((FX_LPCSTR)string);
+ CJS_Value::operator = (string.c_str());
}
void CJS_PropValue::operator >>(CFX_ByteString &string) const
diff --git a/fpdfsdk/src/javascript/PublicMethods.cpp b/fpdfsdk/src/javascript/PublicMethods.cpp
index 82bffe67bf..7d652496af 100644
--- a/fpdfsdk/src/javascript/PublicMethods.cpp
+++ b/fpdfsdk/src/javascript/PublicMethods.cpp
@@ -443,7 +443,7 @@ CJS_Array CJS_PublicMethods::AF_MakeArrayFromList(v8::Isolate* isolate, CJS_Valu
const char * pTemp = strchr(p, ch);
if (pTemp == NULL)
{
- StrArray.SetElement(nIndex, CJS_Value(isolate,(FX_LPCSTR)StrTrim(p)));
+ StrArray.SetElement(nIndex, CJS_Value(isolate, StrTrim(p).c_str()));
break;
}
else
@@ -452,7 +452,7 @@ CJS_Array CJS_PublicMethods::AF_MakeArrayFromList(v8::Isolate* isolate, CJS_Valu
strncpy(pSub, p, pTemp - p);
*(pSub + (pTemp - p)) = '\0';
- StrArray.SetElement(nIndex, CJS_Value(isolate,(FX_LPCSTR)StrTrim(pSub)));
+ StrArray.SetElement(nIndex, CJS_Value(isolate, StrTrim(pSub).c_str()));
delete []pSub;
nIndex ++;
@@ -1807,7 +1807,7 @@ FX_BOOL CJS_PublicMethods::AFSpecial_Format(OBJ_METHOD_PARAMS)
if(!pEvent->m_pValue)
return FALSE;
CFX_WideString& Value = pEvent->Value();
- std::string strSrc = (FX_LPCSTR)CFX_ByteString::FromUnicode(Value);
+ std::string strSrc = CFX_ByteString::FromUnicode(Value).c_str();
switch (iIndex)
{
@@ -1962,7 +1962,7 @@ FX_BOOL CJS_PublicMethods::AFSpecial_Keystroke(OBJ_METHOD_PARAMS)
return FALSE;
//CJS_Value val = pEvent->Value();
CFX_WideString& val = pEvent->Value();
- std::string strSrc = (FX_LPCSTR)CFX_ByteString::FromUnicode(val);
+ std::string strSrc = CFX_ByteString::FromUnicode(val).c_str();
std::wstring wstrChange(pEvent->Change());
switch (iIndex)
diff --git a/fpdfsdk/src/javascript/util.cpp b/fpdfsdk/src/javascript/util.cpp
index d2813f5083..83fb32cb82 100644
--- a/fpdfsdk/src/javascript/util.cpp
+++ b/fpdfsdk/src/javascript/util.cpp
@@ -471,8 +471,8 @@ FX_BOOL util::printx(OBJ_METHOD_PARAMS)
return FALSE;
CFX_WideString sFormat = params[0].operator CFX_WideString();
CFX_WideString sSource = params[1].operator CFX_WideString();
- std::string cFormat = (FX_LPCSTR)CFX_ByteString::FromUnicode(sFormat);
- std::string cSource = (FX_LPCSTR)CFX_ByteString::FromUnicode(sSource);
+ std::string cFormat = CFX_ByteString::FromUnicode(sFormat).c_str();
+ std::string cSource = CFX_ByteString::FromUnicode(sSource).c_str();
std::string cDest;
printx(cFormat,cSource,cDest);
vRet = cDest.c_str();
diff --git a/fpdfsdk/src/jsapi/fxjs_v8.cpp b/fpdfsdk/src/jsapi/fxjs_v8.cpp
index dcfe4c6663..d5d0aa1566 100644
--- a/fpdfsdk/src/jsapi/fxjs_v8.cpp
+++ b/fpdfsdk/src/jsapi/fxjs_v8.cpp
@@ -253,7 +253,7 @@ void JS_InitialRuntime(IJS_Runtime* pJSRuntime,IFXJS_Runtime* pFXRuntime, IFXJS_
CJS_ObjDefintion* pObjDef = (CJS_ObjDefintion*)pArray->GetAt(i);
CFX_WideString ws = CFX_WideString(pObjDef->objName);
CFX_ByteString bs = ws.UTF8Encode();
- v8::Handle<v8::String> objName = v8::String::NewFromUtf8(isolate,(FX_LPCSTR)bs, v8::String::kNormalString, bs.GetLength());
+ v8::Handle<v8::String> objName = v8::String::NewFromUtf8(isolate, bs.c_str(), v8::String::kNormalString, bs.GetLength());
if(pObjDef->objType == JS_DYNAMIC)
@@ -327,7 +327,7 @@ int JS_Parse(IJS_Runtime* pJSRuntime, IFXJS_Context* pJSContext, const wchar_t*
CFX_ByteString bsScript = wsScript.UTF8Encode();
- v8::Handle<v8::Script> compiled_script = v8::Script::Compile(v8::String::NewFromUtf8(isolate,(FX_LPCSTR)bsScript,v8::String::kNormalString, bsScript.GetLength()));
+ v8::Handle<v8::Script> compiled_script = v8::Script::Compile(v8::String::NewFromUtf8(isolate, bsScript.c_str(), v8::String::kNormalString, bsScript.GetLength()));
if (compiled_script.IsEmpty()) {
v8::String::Utf8Value error(try_catch.Exception());
return -1;
@@ -344,7 +344,7 @@ int JS_Execute(IJS_Runtime* pJSRuntime, IFXJS_Context* pJSContext, const wchar_t
CFX_WideString wsScript(script);
CFX_ByteString bsScript = wsScript.UTF8Encode();
- v8::Handle<v8::Script> compiled_script = v8::Script::Compile(v8::String::NewFromUtf8(isolate,(FX_LPCSTR)bsScript,v8::String::kNormalString, bsScript.GetLength()));
+ v8::Handle<v8::Script> compiled_script = v8::Script::Compile(v8::String::NewFromUtf8(isolate, bsScript.c_str(), v8::String::kNormalString, bsScript.GetLength()));
if (compiled_script.IsEmpty()) {
v8::String::Utf8Value error(try_catch.Exception());
return -1;
@@ -556,7 +556,7 @@ v8::Handle<v8::String> WSToJSString(IJS_Runtime* pJSRuntime, const wchar_t* Prop
CFX_WideString ws = CFX_WideString(PropertyName,Len);
CFX_ByteString bs = ws.UTF8Encode();
if(!pJSRuntime) pJSRuntime = v8::Isolate::GetCurrent();
- return v8::String::NewFromUtf8(pJSRuntime, (FX_LPCSTR)bs);
+ return v8::String::NewFromUtf8(pJSRuntime, bs.c_str());
}
v8::Handle<v8::Value> JS_GetObjectElement(IJS_Runtime* pJSRuntime, v8::Handle<v8::Object> pObj,const wchar_t* PropertyName)
diff --git a/fpdfsdk/src/pdfwindow/PWL_Edit.cpp b/fpdfsdk/src/pdfwindow/PWL_Edit.cpp
index dfdbf64f0e..bbac382967 100644
--- a/fpdfsdk/src/pdfwindow/PWL_Edit.cpp
+++ b/fpdfsdk/src/pdfwindow/PWL_Edit.cpp
@@ -44,7 +44,7 @@ void CPWL_Edit::SetText(FX_LPCWSTR csText)
{
CFX_ByteString sValue = CFX_ByteString::FromUnicode(swText);
- if (CXML_Element * pXML = CXML_Element::Parse((FX_LPCSTR)sValue,sValue.GetLength()))
+ if (CXML_Element * pXML = CXML_Element::Parse(sValue.c_str(), sValue.GetLength()))
{
FX_INT32 nCount = pXML->CountChildren();
FX_BOOL bFirst = TRUE;