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 ([EMAIL PROTECTED])
[EMAIL PROTECTED]
EyeWonder
Richer Media. Richer Results.
www.eyewonder.com
_______________________________________________
webkit-dev mailing list
[EMAIL PROTECTED]
http://lists.webkit.org/mailman/listinfo/webkit-dev
_______________________________________________
webkit-dev mailing list
[EMAIL PROTECTED]
http://lists.webkit.org/mailman/listinfo/webkit-dev