I guess you can, it works great and much faster J. BTW,
thanks for all the great work in JavaScriptCore.. its fast as crap ;)
From:
webkit-dev-bounces@lists.webkit.org
[mailto:webkit-dev-bounces@lists.webkit.org] On Behalf Of Justin Haygood
Sent: Sunday, November 26, 2006 12:33 AM
To: webkit-dev@lists.webkit.org
Subject: RE: [webkit-dev] (JavaScriptCore impl) UString -> unsigned
short array
Can you do memcpy with a UChar* ?
From: Maciej Stachowiak
[mailto:mjs@apple.com]
Sent: Sunday, November 26, 2006 12:28 AM
To: Justin Haygood
Cc: webkit-dev@lists.webkit.org
Subject: Re: [webkit-dev] (JavaScriptCore impl) UString -> unsigned
short array
On Nov 25, 2006, at 9:20 PM, Justin Haygood wrote:
I’m
currently working on a project to embed JSCore (chosen since I was fairly
familiar with it, it was C++, and its blazing fast on Windows) into an app to
replace Perl as the company I work for’s language of choice for quick and dirty
scripting. Since we have a massive library of Win32 code to use with it, I was
wondering:
You don't need the ZeroMemory, and instead of the copy loop
you could try memcpy.
Cheers,
Maciej
Is
there a quick way to convert a KJS::UString to an array of Unicode shorts (aka
LPCWSTR in Win32 speak).
I
came up with the much hackish solution below that works, but seems to me to be
really inefficient:
//
Convert from UString to LPCWSTR.
//
FIXME: Find a better solution if possible
//
TODO: Convert into global C style function if above FIXME becomes invalidated
const UChar* data = ustring.data();
int
length = ustring.size();
WCHAR* winstringp = new WCHAR[length+1];
ZeroMemory(winstring, (sizeof(WCHAR)*length+1));
for(
int i = 0; i < length; i++) winstrinpg[i] =
data[i].unicode();
winstringp[length] = '\0';
LPCWSTR winstring = winstringp;
If
someone can think of a better way, that would be totally awesome.
Justin
Haygood | Software Engineer | EyeWonder, Inc.
Phone: 678-891-2031 Cell: 404-271-2273 (jhaygood86@tmomail.net)
jhaygood@eyewonder.com
EyeWonder
Richer Media. Richer Results.
www.eyewonder.com
_______________________________________________
webkit-dev mailing list