diff options
author | tsepez <tsepez@chromium.org> | 2016-04-06 10:51:14 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-04-06 10:51:14 -0700 |
commit | 6fe7d2174a47107578da912299c93b4dfb9f2add (patch) | |
tree | 4f2d343c477c9a4ec18d25801800eb08d8938dad /fpdfsdk | |
parent | 89bdd0876e6b92c959839908204eb82337a27ba2 (diff) | |
download | pdfium-6fe7d2174a47107578da912299c93b4dfb9f2add.tar.xz |
Make CFX_WideString::FromUTF8() take a CFX_ByteStringC argument.
Methods that take string arguments and do not persist them should
take *StringC types as argument rather than discrete ptr/len args.
Avoids a number of implicit casts from CFX_ByteString to char*.
BUG=
Review URL: https://codereview.chromium.org/1861183002
Diffstat (limited to 'fpdfsdk')
-rw-r--r-- | fpdfsdk/javascript/Document.cpp | 3 | ||||
-rw-r--r-- | fpdfsdk/javascript/JS_Define.h | 16 | ||||
-rw-r--r-- | fpdfsdk/jsapi/fxjs_v8.cpp | 2 |
3 files changed, 10 insertions, 11 deletions
diff --git a/fpdfsdk/javascript/Document.cpp b/fpdfsdk/javascript/Document.cpp index 762ba71cf2..75cd2ec251 100644 --- a/fpdfsdk/javascript/Document.cpp +++ b/fpdfsdk/javascript/Document.cpp @@ -784,8 +784,7 @@ FX_BOOL Document::info(IJS_Context* cc, for (const auto& it : *pDictionary) { const CFX_ByteString& bsKey = it.first; CPDF_Object* pValueObj = it.second; - CFX_WideString wsKey = CFX_WideString::FromUTF8(bsKey, bsKey.GetLength()); - + CFX_WideString wsKey = CFX_WideString::FromUTF8(bsKey.AsByteStringC()); if (pValueObj->IsString() || pValueObj->IsName()) { FXJS_PutObjectString(isolate, pObj, wsKey.c_str(), pValueObj->GetUnicodeText().c_str()); diff --git a/fpdfsdk/javascript/JS_Define.h b/fpdfsdk/javascript/JS_Define.h index 4e158fda29..c7872599bf 100644 --- a/fpdfsdk/javascript/JS_Define.h +++ b/fpdfsdk/javascript/JS_Define.h @@ -354,8 +354,8 @@ void JSSpecialPropQuery(const char*, const v8::PropertyCallbackInfo<v8::Integer>& info) { v8::Isolate* isolate = info.GetIsolate(); v8::String::Utf8Value utf8_value(property); - CFX_WideString propname = - CFX_WideString::FromUTF8(*utf8_value, utf8_value.length()); + CFX_WideString propname = CFX_WideString::FromUTF8( + CFX_ByteStringC(*utf8_value, utf8_value.length())); CJS_Object* pJSObj = reinterpret_cast<CJS_Object*>(FXJS_GetPrivate(isolate, info.Holder())); Alt* pObj = reinterpret_cast<Alt*>(pJSObj->GetEmbedObject()); @@ -377,8 +377,8 @@ void JSSpecialPropGet(const char* class_name, reinterpret_cast<CJS_Object*>(FXJS_GetPrivate(isolate, info.Holder())); Alt* pObj = reinterpret_cast<Alt*>(pJSObj->GetEmbedObject()); v8::String::Utf8Value utf8_value(property); - CFX_WideString propname = - CFX_WideString::FromUTF8(*utf8_value, utf8_value.length()); + CFX_WideString propname = CFX_WideString::FromUTF8( + CFX_ByteStringC(*utf8_value, utf8_value.length())); CFX_WideString sError; CJS_PropValue value(pRuntime); value.StartGetting(); @@ -404,8 +404,8 @@ void JSSpecialPropPut(const char* class_name, reinterpret_cast<CJS_Object*>(FXJS_GetPrivate(isolate, info.Holder())); Alt* pObj = reinterpret_cast<Alt*>(pJSObj->GetEmbedObject()); v8::String::Utf8Value utf8_value(property); - CFX_WideString propname = - CFX_WideString::FromUTF8(*utf8_value, utf8_value.length()); + CFX_WideString propname = CFX_WideString::FromUTF8( + CFX_ByteStringC(*utf8_value, utf8_value.length())); CFX_WideString sError; CJS_PropValue PropValue(CJS_Value(pRuntime, value, CJS_Value::VT_unknown)); PropValue.StartSetting(); @@ -427,8 +427,8 @@ void JSSpecialPropDel(const char* class_name, reinterpret_cast<CJS_Object*>(FXJS_GetPrivate(isolate, info.Holder())); Alt* pObj = reinterpret_cast<Alt*>(pJSObj->GetEmbedObject()); v8::String::Utf8Value utf8_value(property); - CFX_WideString propname = - CFX_WideString::FromUTF8(*utf8_value, utf8_value.length()); + CFX_WideString propname = CFX_WideString::FromUTF8( + CFX_ByteStringC(*utf8_value, utf8_value.length())); CFX_WideString sError; if (!pObj->DelProperty(pContext, propname.c_str(), sError)) { CFX_ByteString cbName; diff --git a/fpdfsdk/jsapi/fxjs_v8.cpp b/fpdfsdk/jsapi/fxjs_v8.cpp index db64eee974..c66cf91b56 100644 --- a/fpdfsdk/jsapi/fxjs_v8.cpp +++ b/fpdfsdk/jsapi/fxjs_v8.cpp @@ -807,7 +807,7 @@ CFX_WideString FXJS_ToString(v8::Isolate* pIsolate, return L""; v8::Local<v8::Context> context = pIsolate->GetCurrentContext(); v8::String::Utf8Value s(pValue->ToString(context).ToLocalChecked()); - return CFX_WideString::FromUTF8(*s, s.length()); + return CFX_WideString::FromUTF8(CFX_ByteStringC(*s, s.length())); } v8::Local<v8::Array> FXJS_ToArray(v8::Isolate* pIsolate, |