diff options
Diffstat (limited to 'fxjs')
-rw-r--r-- | fxjs/cfxjse_class.cpp | 3 | ||||
-rw-r--r-- | fxjs/cjs_field.cpp | 4 | ||||
-rw-r--r-- | fxjs/cjs_global.cpp | 18 | ||||
-rw-r--r-- | fxjs/cjs_publicmethods.cpp | 8 | ||||
-rw-r--r-- | fxjs/cjs_runtime.cpp | 2 |
5 files changed, 16 insertions, 19 deletions
diff --git a/fxjs/cfxjse_class.cpp b/fxjs/cfxjse_class.cpp index e7e54c8867..9207fd5094 100644 --- a/fxjs/cfxjse_class.cpp +++ b/fxjs/cfxjse_class.cpp @@ -112,8 +112,7 @@ void DynPropGetterAdapter_MethodCallback( WideString err = JSFormatErrorString(pClassDescriptor->name, *szPropName, result.Error()); v8::MaybeLocal<v8::String> str = v8::String::NewFromUtf8( - info.GetIsolate(), ByteString::FromUnicode(err).c_str(), - v8::NewStringType::kNormal); + info.GetIsolate(), err.ToDefANSI().c_str(), v8::NewStringType::kNormal); info.GetIsolate()->ThrowException(str.ToLocalChecked()); return; } diff --git a/fxjs/cjs_field.cpp b/fxjs/cjs_field.cpp index 19e6712f2a..cd97372ad0 100644 --- a/fxjs/cjs_field.cpp +++ b/fxjs/cjs_field.cpp @@ -731,7 +731,7 @@ CJS_Return CJS_Field::set_border_style(CJS_Runtime* pRuntime, if (!m_bCanSet) return CJS_Return(JSMessage::kReadOnlyError); - ByteString byte_str = ByteString::FromUnicode(pRuntime->ToWideString(vp)); + ByteString byte_str = pRuntime->ToWideString(vp).ToDefANSI(); if (m_bDelay) { AddDelay_String(FP_BORDERSTYLE, byte_str); } else { @@ -2002,7 +2002,7 @@ CJS_Return CJS_Field::set_text_font(CJS_Runtime* pRuntime, if (!m_bCanSet) return CJS_Return(JSMessage::kReadOnlyError); - if (ByteString::FromUnicode(pRuntime->ToWideString(vp)).IsEmpty()) + if (pRuntime->ToWideString(vp).ToDefANSI().IsEmpty()) return CJS_Return(JSMessage::kValueError); return CJS_Return(); } diff --git a/fxjs/cjs_global.cpp b/fxjs/cjs_global.cpp index 567d54853c..1865f57ddb 100644 --- a/fxjs/cjs_global.cpp +++ b/fxjs/cjs_global.cpp @@ -232,7 +232,7 @@ CJS_Return CJS_Global::QueryProperty(const wchar_t* propname) { CJS_Return CJS_Global::DelProperty(CJS_Runtime* pRuntime, const wchar_t* propname) { - auto it = m_MapGlobal.find(ByteString::FromUnicode(propname)); + auto it = m_MapGlobal.find(WideString(propname).ToDefANSI()); if (it == m_MapGlobal.end()) return CJS_Return(JSMessage::kUnknownProperty); @@ -242,7 +242,7 @@ CJS_Return CJS_Global::DelProperty(CJS_Runtime* pRuntime, CJS_Return CJS_Global::GetProperty(CJS_Runtime* pRuntime, const wchar_t* propname) { - auto it = m_MapGlobal.find(ByteString::FromUnicode(propname)); + auto it = m_MapGlobal.find(WideString(propname).ToDefANSI()); if (it == m_MapGlobal.end()) return CJS_Return(); @@ -272,7 +272,7 @@ CJS_Return CJS_Global::GetProperty(CJS_Runtime* pRuntime, CJS_Return CJS_Global::SetProperty(CJS_Runtime* pRuntime, const wchar_t* propname, v8::Local<v8::Value> vp) { - ByteString sPropName = ByteString::FromUnicode(propname); + ByteString sPropName = WideString(propname).ToDefANSI(); if (vp->IsNumber()) { return SetGlobalVariables(sPropName, JS_GlobalDataType::NUMBER, pRuntime->ToDouble(vp), false, "", @@ -284,10 +284,9 @@ CJS_Return CJS_Global::SetProperty(CJS_Runtime* pRuntime, v8::Local<v8::Object>(), false); } if (vp->IsString()) { - return SetGlobalVariables( - sPropName, JS_GlobalDataType::STRING, 0, false, - ByteString::FromUnicode(pRuntime->ToWideString(vp)), - v8::Local<v8::Object>(), false); + return SetGlobalVariables(sPropName, JS_GlobalDataType::STRING, 0, false, + pRuntime->ToWideString(vp).ToDefANSI(), + v8::Local<v8::Object>(), false); } if (vp->IsObject()) { return SetGlobalVariables(sPropName, JS_GlobalDataType::OBJECT, 0, false, @@ -310,8 +309,7 @@ CJS_Return CJS_Global::setPersistent( if (params.size() != 2) return CJS_Return(JSMessage::kParamError); - auto it = m_MapGlobal.find( - ByteString::FromUnicode(pRuntime->ToWideString(params[0]))); + auto it = m_MapGlobal.find(pRuntime->ToWideString(params[0]).ToDefANSI()); if (it == m_MapGlobal.end() || it->second->bDeleted) return CJS_Return(JSMessage::kGlobalNotFoundError); @@ -432,7 +430,7 @@ void CJS_Global::ObjectToArray(CJS_Runtime* pRuntime, continue; } if (v->IsString()) { - ByteString sValue = ByteString::FromUnicode(pRuntime->ToWideString(v)); + ByteString sValue = pRuntime->ToWideString(v).ToDefANSI(); CJS_KeyValue* pObjElement = new CJS_KeyValue; pObjElement->nType = JS_GlobalDataType::STRING; pObjElement->sKey = sKey; diff --git a/fxjs/cjs_publicmethods.cpp b/fxjs/cjs_publicmethods.cpp index a86ece3461..f2cd3ff7c1 100644 --- a/fxjs/cjs_publicmethods.cpp +++ b/fxjs/cjs_publicmethods.cpp @@ -327,7 +327,7 @@ v8::Local<v8::Array> CJS_PublicMethods::AF_MakeArrayFromList( return pRuntime->ToArray(val); WideString wsStr = pRuntime->ToWideString(val); - ByteString t = ByteString::FromUnicode(wsStr); + ByteString t = wsStr.ToDefANSI(); const char* p = t.c_str(); int nIndex = 0; @@ -882,7 +882,7 @@ CJS_Return CJS_PublicMethods::AFNumber_Format( return CJS_Return(L"No event handler"); WideString& Value = pEvent->Value(); - ByteString strValue = StrTrim(ByteString::FromUnicode(Value)); + ByteString strValue = StrTrim(Value.ToDefANSI()); if (strValue.IsEmpty()) return CJS_Return(); @@ -1078,7 +1078,7 @@ CJS_Return CJS_PublicMethods::AFPercent_Format( return CJS_Return(JSMessage::kBadObjectError); WideString& Value = pEvent->Value(); - ByteString strValue = StrTrim(ByteString::FromUnicode(Value)); + ByteString strValue = StrTrim(Value.ToDefANSI()); if (strValue.IsEmpty()) return CJS_Return(); @@ -1683,7 +1683,7 @@ CJS_Return CJS_PublicMethods::AFRange_Validate( if (pEvent->Value().IsEmpty()) return CJS_Return(); - double dEentValue = atof(ByteString::FromUnicode(pEvent->Value()).c_str()); + double dEentValue = atof(pEvent->Value().ToDefANSI().c_str()); bool bGreaterThan = pRuntime->ToBoolean(params[0]); double dGreaterThan = pRuntime->ToDouble(params[1]); bool bLessThan = pRuntime->ToBoolean(params[2]); diff --git a/fxjs/cjs_runtime.cpp b/fxjs/cjs_runtime.cpp index 9329a483f4..6042538e30 100644 --- a/fxjs/cjs_runtime.cpp +++ b/fxjs/cjs_runtime.cpp @@ -234,7 +234,7 @@ v8::Local<v8::Value> CJS_Runtime::MaybeCoerceToNumber( v8::Local<v8::Value> value) { bool bAllowNaN = false; if (value->IsString()) { - ByteString bstr = ByteString::FromUnicode(ToWideString(value)); + ByteString bstr = ToWideString(value).ToDefANSI(); if (bstr.GetLength() == 0) return value; if (bstr == "NaN") |