When you allocate memory with nsMemory::Alloc(), the parameter you pass, does it represent the size of the memory in bytes or the size of the memory in 16-bits chunks (2 bytes)?
I have a standard char string (8 bits per character) that I need to convert to a PRUnichar string (16 bits per character). I use the mbstowcs() function of the stdlib to do it. How must I allocate my memory? Option A: PRUnichar *unicharString = reinterpret_cast<PRUnichar*>(nsMemory::Alloc(strlen(charString)) ; Option B: PRUnichar *unicharString = reinterpret_cast<PRUnichar*>(nsMemory::Alloc(strlen(charString) * 2) ; // strlen * 2 because of 16 bits per character Option C: <none of the above> Thanks Antoine. _______________________________________________ Mozilla-xpcom mailing list [EMAIL PROTECTED] http://mail.mozilla.org/listinfo/mozilla-xpcom
