nsISupportsArray* value = (nsISupportsArray *)aState; nsresult res = NS_ERROR_NULL_POINTER; if (value) { res = Deselect(); if (NS_SUCCEEDED(res)) { PRUint32 count = 0; res = value->Count(&count); if (NS_SUCCEEDED(res)) { nsISupportsPRInt32* thisVal = nsnull; PRInt32 j=0; for (PRUint32 k=0; k<count; k++) { thisVal = (nsISupportsPRInt32*) value->ElementAt(k); if (thisVal) { res = thisVal->GetData(&j); if (NS_SUCCEEDED(res)) { res = SetOptionSelected(j, PR_TRUE); } } else { res = NS_ERROR_UNEXPECTED; } if (!NS_SUCCEEDED(res)) break; } } } } return res;
return NS_OK;
nsNativeSelectControlFrame::RestoreState(nsIPresContext* aPresContext, nsISupports* aState){  nsISupportsArray* value = (nsISupportsArray *)aState;  nsresult res = NS_ERROR_NULL_POINTER;  if (value) {    res = Deselect();    if (NS_SUCCEEDED(res)) {      PRUint32 count = 0;      res = value->Count(&count);      if (NS_SUCCEEDED(res)) {        nsISupportsPRInt32* thisVal = nsnull;        PRInt32 j=0;        for (PRUint32 k=0; k<count; k++) {          thisVal = (nsISupportsPRInt32*) value->ElementAt(k);          if (thisVal) {            res = thisVal->GetData(&j);	    if (NS_SUCCEEDED(res)) {              res = SetOptionSelected(j, PR_TRUE);	    }	  } else {	    res = NS_ERROR_UNEXPECTED;	  }	  if (!NS_SUCCEEDED(res)) break;	}      }    }  }  return res;}