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: Created Oct. 24, 2014, 12:42 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
« no previous file with comments | « 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());
}
@@ -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;
-
}
#endif
« no previous file with comments | « src/Utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld