if ((*next == *ptr->value) || ((ptr->count>0) && (*next == ""))) { if (((*next == *ptr->value) || (*next == "")) && ptr->inputElement) { ptr->inputElement->SetValue(*next);
if ((next == *ptr->value) || ((ptr->count>0) && (next == ""))) { if (((next == *ptr->value) || (next == "")) && ptr->inputElement) { ptr->inputElement->SetValue(next);
WLLT_PrefillReturn(nsAutoString results) {  char* listAsAscii;  char* fillins;  char* urlName;  char* skip;  nsAutoString * next;  /* get values that are in environment variables */  fillins = SI_FindValueInArgs(results, "|fillins|");  listAsAscii = SI_FindValueInArgs(results, "|list|");  skip = SI_FindValueInArgs(results, "|skip|");  urlName = SI_FindValueInArgs(results, "|url|");  /* add url to url list if user doesn't want to preview this page in the future */  if (!PL_strcmp(skip, "true")) {    nsAutoString url = nsAutoString(urlName);    nsVoidArray* dummy;    nsAutoString value = nsAutoString("nn");    wallet_ReadFromList(url, value, dummy, wallet_URL_list);    value.SetCharAt('y', NO_PREVIEW);    wallet_WriteToList(url, value, dummy, wallet_URL_list, DUP_OVERWRITE);    wallet_WriteToFile("URL.tbl", wallet_URL_list, PR_FALSE);  }  /* process the list, doing the fillins */  nsVoidArray * list;  sscanf(listAsAscii, "%p", &list);  if (fillins[0] == '\0') { /* user pressed CANCEL */    wallet_ReleasePrefillElementList(list);    return;  }  /*   * note: there are two lists involved here and we are stepping through both of them.   * One is the pre-fill list that was generated when we walked through the html content.   * For each pre-fillable item, it contains n entries, one for each possible value that   * can be prefilled for that field.  The first entry for each field can be identified   * because it has a non-zero count field (in fact, the count is the number of entries   * for that field), all subsequent entries for the same field have a zero count field.   * The other is the fillin list which was generated by the html dialog that just   * finished.  It contains one entry for each pre-fillable item specificying that   * particular value that should be prefilled for that item.   */  wallet_PrefillElement * ptr;  char * ptr2;  ptr2 = fillins;  /* step through pre-fill list */  PRBool first = PR_TRUE;  PRInt32 count = LIST_COUNT(list);  for (PRInt32 i=0; i<count; i++) {    ptr = NS_STATIC_CAST(wallet_PrefillElement*, list->ElementAt(i));    /* advance in fillins list each time a new schema name in pre-fill list is encountered */    if (ptr->count != 0) {      /* count != 0 indicates a new schema name */      if (!first) {        delete next;      } else {        first = PR_FALSE;      }      next = wallet_GetNextInString(ptr2);      if (nsnull == next) {        break;      }      if (*next != *ptr->schema) {        break; /* something's wrong so stop prefilling */      }      delete next;      next = wallet_GetNextInString(ptr2);    }    if (*next == *ptr->value) {      /*       * 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.       */      /*       * Test for ptr->count being zero is an optimization that avoids us from doing a       * reordering if the current entry already was first       */      if (ptr->count == 0) {        nsAutoString oldValue;        PRInt32 index = 0;        PRInt32 lastIndex = index;        nsVoidArray* dummy;        while(wallet_ReadFromList(*ptr->schema, oldValue, dummy, wallet_SchemaToValue_list, index)) {          if (oldValue == *ptr->value) {            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);            delete mapElement;            break;          }          lastIndex = index;        }      }    }    /* Change the value */     if ((*next == *ptr->value) || ((ptr->count>0) && (*next == ""))) {       if (((*next == *ptr->value) || (*next == "")) && ptr->inputElement) {         ptr->inputElement->SetValue(*next);       } else {         nsresult result;         result = wallet_GetSelectIndex(ptr->selectElement, *next, ptr->selectIndex);         if (NS_SUCCEEDED(result)) {           ptr->selectElement->SetSelectedIndex(ptr->selectIndex);         } else {           ptr->selectElement->SetSelectedIndex(0);        }      }    }  }  if (next != nsnull ) {    delete next;  }  /* Release the prefill list that was generated when we walked thru the html content */  wallet_ReleasePrefillElementList(list);}