*value = password.ToNewUnicode();
*value = ToNewUnicode(password);
si_RestoreSignonData(nsIPrompt* dialog, const char* passwordRealm, const PRUnichar* name, PRUnichar** value, PRUint32 elementNumber) {  si_SignonUserStruct* user;  si_SignonDataStruct* data;  nsAutoString correctedName;  /* do nothing if signon preference is not enabled */  if (!si_GetSignonRememberingPref()){    return;  }  si_lock_signon_list();  if (elementNumber == 0) {    si_UserHasBeenSelected = PR_FALSE;  }  /* Correct the field name to avoid mistaking for fields in browser-generated form   *   *   Note that data saved for browser-generated logins (e.g. http authentication)   *   use artificial field names starting with * \= (see USERNAMEFIELD and PASSWORDFIELD.   *   To avoid mistakes whereby saved logins for http authentication is then prefilled   *   into a field on the html form at the same URL, we will prevent html field names   *   from starting with \=.  We do that by doubling up a backslash if it appears in the   *   first character position   */  if (*name == '\\') {    correctedName = nsAutoString('\\');    correctedName.Append(name);  } else {    correctedName = name;  }  /* determine if name has been saved (avoids unlocking the database if not) */  PRBool nameFound = PR_FALSE;  user = si_GetUser(dialog, passwordRealm, PR_FALSE, correctedName);  if (user) {    PRInt32 dataCount = user->signonData_list.Count();    for (PRInt32 i=0; i<dataCount; i++) {      data = NS_STATIC_CAST(si_SignonDataStruct*, user->signonData_list.ElementAt(i));      if(correctedName.Length() && (data->name == correctedName)) {        nameFound = PR_TRUE;      }    }  }  if (!nameFound) {    si_unlock_signon_list();    return;  }#ifdef xxx  /*   * determine if it is a change-of-password field   *    the heuristic that we will use is that if this is the first   *    item on the form and it is a password, this is probably a   *    change-of-password form   */  /* see if this is first item in form and is a password */  /* get first saved user just so we can see the name of the first item on the form */  user = si_GetUser(passwordRealm, PR_TRUE, NULL); /* this is the first saved user */  if (user) {    data = NS_STATIC_CAST(si_SignonDataStruct *,                    user->signonData_list.ElementAt(0)); /* 1st item on form */    if(data->isPassword && correctedName.Length() && (data->name == correctedName)) {      /* current item is first item on form and is a password */      user = (passwordRealm, MK_SIGNON_PASSWORDS_FETCH);      if (user) {        /* user has confirmed it's a change-of-password form */        PRInt32 dataCount = user->signonData_list.Count();        for (PRInt32 i=1; i<dataCount; i++) {          data = NS_STATIC_CAST(si_SignonDataStruct*, user->signonData_list.ElementAt(i));          if (data->isPassword) {            nsAutoString password;            if (NS_SUCCEEDED(si_Decrypt(data->value, password))) {              *value = password.ToNewUnicode();            }            si_unlock_signon_list();            return;          }        }      }    }  }#endif  /* restore the data from previous time this URL was visited */  user = si_GetUser(dialog, passwordRealm, PR_FALSE, correctedName);  if (user) {    PRInt32 dataCount = user->signonData_list.Count();    for (PRInt32 i=0; i<dataCount; i++) {      data = NS_STATIC_CAST(si_SignonDataStruct*, user->signonData_list.ElementAt(i));      if(correctedName.Length() && (data->name == correctedName)) {        nsAutoString password;        if (NS_SUCCEEDED(si_Decrypt(data->value, password))) {          *value = password.ToNewUnicode();        }        si_unlock_signon_list();        return;      }    }  }  si_unlock_signon_list();}