dummy = nsnull; nsAutoString hostFileFieldUCS2; wallet_GetHostFile(wallet_lastUrl, hostFileFieldUCS2); hostFileFieldUCS2.Append(NS_LITERAL_STRING(":")); hostFileFieldUCS2.Append(field);
dummy = 0; nsAutoString hostFileField; wallet_GetHostFile(wallet_lastUrl, hostFileField); hostFileField.Append(NS_LITERAL_STRING(":")); hostFileField.Append(field);
wallet_Capture(nsIDocument* doc, const nsString& field, const nsString& value, nsACString& schema){  /* do nothing if there is no value */  if (!value.Length()) {    return PR_FALSE;  }  /* read in the mappings if they are not already present */  wallet_Initialize();  wallet_InitializeCurrentURL(doc);#ifdef IgnoreFieldNames// use displayable text instead of field names  if (schema.IsEmpty()) {    return PR_FALSE;  }#endif  const char* valueCString = NS_ConvertUCS2toUTF8(value).get();  nsCAutoString oldValue;  /* is there a mapping from this field name to a schema name */  nsCAutoString localSchema; localSchema.Assign(schema);  nsVoidArray* dummy;  nsCAutoString stripField;  if (localSchema.IsEmpty()) {    Strip(field, stripField);  }  if (!localSchema.IsEmpty() ||      (wallet_ReadFromList(stripField, localSchema, dummy,                           wallet_FieldToSchema_list, PR_FALSE))) {    /* field to schema mapping already exists */    /* is this a new value for the schema */    PRInt32 index = 0;    PRInt32 lastIndex = index;    while(wallet_ReadFromList(localSchema, oldValue, dummy, wallet_SchemaToValue_list, PR_TRUE, index)) {      PRBool isNewValue = !oldValue.Equals(valueCString);      if (!isNewValue) {        /*         * Remove entry from wallet_SchemaToValue_list and then reinsert.  This will         * keep multiple values in that list for the same field ordered with         * most-recently-used first.  That's useful since the first such entry         * is the default value used for pre-filling.         */        wallet_MapElement * mapElement =          (wallet_MapElement *) (wallet_SchemaToValue_list->ElementAt(lastIndex));        wallet_SchemaToValue_list->RemoveElementAt(lastIndex);        wallet_WriteToList(          mapElement->item1,          mapElement->item2,          mapElement->itemList,           wallet_SchemaToValue_list,          PR_FALSE); /* note: obscure=false, otherwise we will obscure an obscured value */        delete mapElement;        return PR_TRUE;      }      lastIndex = index;    }    /* this is a new value so store it */    dummy = nsnull;    if (wallet_WriteToList(localSchema.get(), valueCString, dummy, wallet_SchemaToValue_list, PR_TRUE)) {      wallet_WriteToFile(schemaValueFileName, wallet_SchemaToValue_list);    }  } else {    /* no field to schema mapping so assume schema name is same as field name */    /* is this a new value for the schema */    PRInt32 index = 0;    PRInt32 lastIndex = index;    nsAutoString concatParamUCS2;    wallet_GetHostFile(wallet_lastUrl, concatParamUCS2);    concatParamUCS2.Append(NS_LITERAL_STRING(":"));    concatParamUCS2.Append(field);    nsCAutoString concatParamUTF8 = NS_ConvertUCS2toUTF8(concatParamUCS2);    while(wallet_ReadFromList        (concatParamUTF8, oldValue, dummy, wallet_SchemaToValue_list, PR_TRUE, index)) {      PRBool isNewValue = !oldValue.Equals(valueCString);      if (!isNewValue) {        /*         * Remove entry from wallet_SchemaToValue_list and then reinsert.  This will         * keep multiple values in that list for the same field ordered with         * most-recently-used first.  That's useful since the first such entry         * is the default value used for pre-filling.         */        wallet_MapElement * mapElement =          (wallet_MapElement *) (wallet_SchemaToValue_list->ElementAt(lastIndex));        wallet_SchemaToValue_list->RemoveElementAt(lastIndex);        wallet_WriteToList(          mapElement->item1,          mapElement->item2,          mapElement->itemList,           wallet_SchemaToValue_list,          PR_FALSE); /* note: obscure=false, otherwise we will obscure an obscured value */        delete mapElement;        return PR_TRUE;      }      lastIndex = index;      //??? aren't these next four lines redundant?      wallet_GetHostFile(wallet_lastUrl, concatParamUCS2);      concatParamUCS2.Append(NS_LITERAL_STRING(":"));      concatParamUCS2.Append(field);      concatParamUTF8 = NS_ConvertUCS2toUTF8(concatParamUCS2);    }    /* this is a new value so store it */    dummy = nsnull;    nsAutoString hostFileFieldUCS2;    wallet_GetHostFile(wallet_lastUrl, hostFileFieldUCS2);    hostFileFieldUCS2.Append(NS_LITERAL_STRING(":"));    hostFileFieldUCS2.Append(field);    if (wallet_WriteToList        (NS_ConvertUCS2toUTF8(hostFileFieldUCS2).get(), valueCString, dummy,         wallet_SchemaToValue_list, PR_TRUE)) {      wallet_WriteToFile(schemaValueFileName, wallet_SchemaToValue_list);    }  }  return PR_TRUE;}