Wallet_Decrypt(const nsString& cryptUCS2, nsString& textUCS2) { nsCAutoString textUTF8; nsresult rv = wallet_Decrypt(NS_ConvertUCS2toUTF8(cryptUCS2), textUTF8); textUCS2 = NS_ConvertUTF8toUCS2(textUTF8); return rv;
Wallet_Decrypt(const nsString& crypt, nsString& text) {   char * cryptCString = ToNewCString(crypt); char * UTF8textCString = nsnull;  nsresult rv = DecryptString(cryptCString, UTF8textCString); Recycle(cryptCString); if NS_FAILED(rv) { return rv; }   PRUnichar c1, c2, c3; text.Truncate(0); text.SetCapacity(2 * crypt.Length());  PRUint32 UTF8textCString_len = PL_strlen(UTF8textCString); for (PRUint32 i=0; i<UTF8textCString_len; ) { c1 = (PRUnichar)UTF8textCString[i++]; if ((c1 & 0x80) == 0x00) { text += c1; } else if ((c1 & 0xE0) == 0xC0) { c2 = (PRUnichar)UTF8textCString[i++]; text += (PRUnichar)(((c1 & 0x1F)<<6) + (c2 & 0x3F)); } else if ((c1 & 0xF0) == 0xE0) { c2 = (PRUnichar)UTF8textCString[i++]; c3 = (PRUnichar)UTF8textCString[i++]; text += (PRUnichar)(((c1 & 0x0F)<<12) + ((c2 & 0x3F)<<6) + (c3 & 0x3F)); } else { Recycle(UTF8textCString); return NS_ERROR_FAILURE;  } } Recycle(UTF8textCString); return NS_OK;
Wallet_Decrypt(const nsString& cryptUCS2, nsString& textUCS2) {  nsCAutoString textUTF8;  nsresult rv = wallet_Decrypt(NS_ConvertUCS2toUTF8(cryptUCS2), textUTF8);  textUCS2 = NS_ConvertUTF8toUCS2(textUTF8);  return rv;}