Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: src/Utils.cpp

Issue 6584950149087232: Issue 1280 - Update v8 (Closed)
Patch Set: get rid of auto and fix friends of JsValue Created Oct. 31, 2014, 5:11 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« src/JsValue.cpp ('K') | « src/Utils.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/Utils.cpp
===================================================================
--- a/src/Utils.cpp
+++ b/src/Utils.cpp
@@ -43,9 +43,10 @@
return std::string();
}
-v8::Local<v8::String> Utils::ToV8String(const std::string& str)
+v8::Local<v8::String> Utils::ToV8String(v8::Isolate* isolate, const std::string& str)
{
- return v8::String::New(str.c_str(), str.length());
+ return v8::String::NewFromUtf8(isolate, str.c_str(),
+ v8::String::NewStringType::kInternalizedString, str.length());
Wladimir Palant 2014/11/01 22:30:25 I doubt that using internalized strings makes sens
Felix Dahlke 2014/11/02 03:55:20 Somehow thought kInternalizedString was the defaul
sergei 2014/11/03 12:58:19 Thanks, I see what it means, anyway it's not impor
}
@@ -84,22 +85,20 @@
{
HRESULT hr;
- std::wstring canonizedUrl;
DWORD canonizedUrlLength = 2049; // de-facto limit of url length
-
- canonizedUrl.resize(canonizedUrlLength);
- hr = UrlCanonicalize(url.c_str(), &canonizedUrl[0], &canonizedUrlLength, 0);
+ std::wstring canonizedUrl(canonizedUrlLength, L'\0');
+ DWORD flags = 0; // nothing special
+ hr = UrlCanonicalizeW(url.c_str(), &canonizedUrl[0], &canonizedUrlLength, flags);
canonizedUrl.resize(canonizedUrlLength);
if (FAILED(hr))
{
- hr = UrlCanonicalize(url.c_str(), &canonizedUrl[0], &canonizedUrlLength, 0);
+ hr = UrlCanonicalizeW(url.c_str(), &canonizedUrl[0], &canonizedUrlLength, flags);
if (FAILED(hr))
{
throw std::runtime_error("CanonizeUrl failed\n");
}
}
return canonizedUrl;
-
}
Wladimir Palant 2014/11/01 22:30:25 The changes to this function are again completely
Felix Dahlke 2014/11/02 03:55:20 I actually presumed switching to UrlCanonicalizeW
#endif
« src/JsValue.cpp ('K') | « src/Utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld