diff options
author | Tom Sepez <tsepez@chromium.org> | 2015-04-27 11:47:29 -0700 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2015-04-27 11:47:29 -0700 |
commit | e6f11a7b95e26affba59a7057776a787056af8df (patch) | |
tree | ac7e527683debb15df04102b9fe333e552965909 /fpdfsdk/src/javascript/global.cpp | |
parent | f7a7d7e07396c3a0fae617ed8f15f29fd491bc3a (diff) | |
download | pdfium-e6f11a7b95e26affba59a7057776a787056af8df.tar.xz |
Reduce usage of operator LPCWSTR from CFX_WideString().
This involves adding some explicit c_str() calls. Doing so flagged
PDF_EncodeText() and FindOptionValue() as having suboptimal signatures, in
that we are often throwing away a perfectly fine length and recomputing it.
There are still some platform-specific code that needs the operator.
R=brucedawson@chromium.org
Review URL: https://codereview.chromium.org/1101933003
Diffstat (limited to 'fpdfsdk/src/javascript/global.cpp')
-rw-r--r-- | fpdfsdk/src/javascript/global.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/fpdfsdk/src/javascript/global.cpp b/fpdfsdk/src/javascript/global.cpp index c3d11b0a84..418508f89e 100644 --- a/fpdfsdk/src/javascript/global.cpp +++ b/fpdfsdk/src/javascript/global.cpp @@ -297,18 +297,18 @@ void global_alternate::UpdateGlobalPersistentVariables() case JS_GLOBALDATA_TYPE_NUMBER: this->SetGlobalVariables(pData->data.sKey, JS_GLOBALDATA_TYPE_NUMBER, pData->data.dData, false, "", v8::Handle<v8::Object>(), pData->bPersistent == 1); JS_PutObjectNumber(NULL,(JSFXObject)(*m_pJSObject), - pData->data.sKey.UTF8Decode(), pData->data.dData); + pData->data.sKey.UTF8Decode().c_str(), pData->data.dData); break; case JS_GLOBALDATA_TYPE_BOOLEAN: this->SetGlobalVariables(pData->data.sKey, JS_GLOBALDATA_TYPE_BOOLEAN, 0, (bool)(pData->data.bData == 1), "", v8::Handle<v8::Object>(), pData->bPersistent == 1); JS_PutObjectBoolean(NULL,(JSFXObject)(*m_pJSObject), - pData->data.sKey.UTF8Decode(), (bool)(pData->data.bData == 1)); + pData->data.sKey.UTF8Decode().c_str(), (bool)(pData->data.bData == 1)); break; case JS_GLOBALDATA_TYPE_STRING: this->SetGlobalVariables(pData->data.sKey, JS_GLOBALDATA_TYPE_STRING, 0, false, pData->data.sData, v8::Handle<v8::Object>(), pData->bPersistent == 1); - JS_PutObjectString(NULL,(JSFXObject)(*m_pJSObject), - pData->data.sKey.UTF8Decode(), - pData->data.sData.UTF8Decode()); + JS_PutObjectString(NULL, (JSFXObject)(*m_pJSObject), + pData->data.sKey.UTF8Decode().c_str(), + pData->data.sData.UTF8Decode().c_str()); break; case JS_GLOBALDATA_TYPE_OBJECT: { @@ -320,13 +320,13 @@ void global_alternate::UpdateGlobalPersistentVariables() this->SetGlobalVariables(pData->data.sKey, JS_GLOBALDATA_TYPE_OBJECT, 0, false, "", (JSObject)pObj, pData->bPersistent == 1); JS_PutObjectObject(NULL,(JSFXObject)(*m_pJSObject), - pData->data.sKey.UTF8Decode(), (JSObject)pObj); + pData->data.sKey.UTF8Decode().c_str(), (JSObject)pObj); } break; case JS_GLOBALDATA_TYPE_NULL: this->SetGlobalVariables(pData->data.sKey, JS_GLOBALDATA_TYPE_NULL, 0, false, "", v8::Handle<v8::Object>(), pData->bPersistent == 1); JS_PutObjectNull(NULL,(JSFXObject)(*m_pJSObject), - pData->data.sKey.UTF8Decode()); + pData->data.sKey.UTF8Decode().c_str()); break; } } @@ -466,24 +466,24 @@ void global_alternate::PutObjectProperty(v8::Handle<v8::Object> pObj, CJS_KeyVal switch (pObjData->nType) { case JS_GLOBALDATA_TYPE_NUMBER: - JS_PutObjectNumber(NULL,(JSObject)pObj, pObjData->sKey.UTF8Decode(), pObjData->dData); + JS_PutObjectNumber(NULL,(JSObject)pObj, pObjData->sKey.UTF8Decode().c_str(), pObjData->dData); break; case JS_GLOBALDATA_TYPE_BOOLEAN: - JS_PutObjectBoolean(NULL,(JSObject)pObj, pObjData->sKey.UTF8Decode(), (bool)(pObjData->bData == 1)); + JS_PutObjectBoolean(NULL,(JSObject)pObj, pObjData->sKey.UTF8Decode().c_str(), (bool)(pObjData->bData == 1)); break; case JS_GLOBALDATA_TYPE_STRING: - JS_PutObjectString(NULL,(JSObject)pObj, pObjData->sKey.UTF8Decode(), pObjData->sData.UTF8Decode()); + JS_PutObjectString(NULL,(JSObject)pObj, pObjData->sKey.UTF8Decode().c_str(), pObjData->sData.UTF8Decode().c_str()); break; case JS_GLOBALDATA_TYPE_OBJECT: { IJS_Runtime* pRuntime = JS_GetRuntime((JSFXObject)(*m_pJSObject)); v8::Handle<v8::Object> pNewObj = JS_NewFxDynamicObj(pRuntime, NULL, -1); PutObjectProperty(pNewObj, pObjData); - JS_PutObjectObject(NULL, (JSObject)pObj, pObjData->sKey.UTF8Decode(), (JSObject)pNewObj); + JS_PutObjectObject(NULL, (JSObject)pObj, pObjData->sKey.UTF8Decode().c_str(), (JSObject)pNewObj); } break; case JS_GLOBALDATA_TYPE_NULL: - JS_PutObjectNull(NULL,(JSObject)pObj, pObjData->sKey.UTF8Decode()); + JS_PutObjectNull(NULL,(JSObject)pObj, pObjData->sKey.UTF8Decode().c_str()); break; } } |