URLEnumerator* result = new URLEnumerator(kToken_URLColumn, col, kToken_HiddenColumn, value, len);
URLEnumerator* result = new URLEnumerator(kToken_URLColumn, col, value, len);
nsGlobalHistory::GetSources(nsIRDFResource* aProperty,                            nsIRDFNode* aTarget,                            PRBool aTruthValue,                            nsISimpleEnumerator** aSources){  // XXX TODO: make sure each URL in history is connected back to  // NC:HistoryRoot.  NS_PRECONDITION(aProperty != nsnull, "null ptr");  if (! aProperty)    return NS_ERROR_NULL_POINTER;  NS_PRECONDITION(aTarget != nsnull, "null ptr");  if (! aTarget)    return NS_ERROR_NULL_POINTER;  nsresult rv;  if (aProperty == kNC_URL) {    // Call GetSource() and return a singleton enumerator for the URL.    nsCOMPtr<nsIRDFResource> source;    rv = GetSource(aProperty, aTarget, aTruthValue, getter_AddRefs(source));    if (NS_FAILED(rv)) return rv;    return NS_NewSingletonEnumerator(aSources, source);  }  else {    // See if aProperty is something we understand, and create an    // URLEnumerator to select URLs with the appropriate value.    mdb_column col = 0; // == "not a property that I grok"    void* value = nsnull;    PRInt32 len = 0;    // PRInt64/date properties    if (aProperty == kNC_Date ||        aProperty == kNC_FirstVisitDate) {      nsCOMPtr<nsIRDFDate> date = do_QueryInterface(aTarget);      if (date) {        PRInt64 n;        rv = date->GetValue(&n);        if (NS_FAILED(rv)) return rv;        nsCAutoString valueStr;        rv = PRInt64ToChars(n, valueStr);        if (NS_FAILED(rv)) return rv;                value = (void *)ToNewCString(valueStr);        if (aProperty == kNC_Date)          col = kToken_LastVisitDateColumn;        else          col = kToken_FirstVisitDateColumn;      }    }    // PRInt32 properties    else if (aProperty == kNC_VisitCount) {      nsCOMPtr<nsIRDFInt> countLiteral = do_QueryInterface(aTarget);      if (countLiteral) {        PRInt32 intValue;        rv = countLiteral->GetValue(&intValue);        if (NS_FAILED(rv)) return rv;        nsAutoString valueStr; valueStr.AppendInt(intValue);        value = ToNewUnicode(valueStr);        len = valueStr.Length() * sizeof(PRUnichar);        col = kToken_VisitCountColumn;      }          }    // PRUnichar* properties    else if (aProperty == kNC_Name) {      nsCOMPtr<nsIRDFLiteral> name = do_QueryInterface(aTarget);      if (name) {        PRUnichar* p;        rv = name->GetValue(&p);        if (NS_FAILED(rv)) return rv;        len = nsCRT::strlen(p) * sizeof(PRUnichar);        value = p;        col = kToken_NameColumn;      }    }    // char* properties    else if (aProperty == kNC_Hostname ||             aProperty == kNC_Referrer) {      col = kToken_ReferrerColumn;      nsCOMPtr<nsIRDFResource> referrer = do_QueryInterface(aTarget);      if (referrer) {        char* p;        rv = referrer->GetValue(&p);        if (NS_FAILED(rv)) return rv;        len = PL_strlen(p);        value = p;        if (aProperty == kNC_Hostname)          col = kToken_HostnameColumn;        else if (aProperty == kNC_Referrer)          col = kToken_ReferrerColumn;      }    }    if (col) {      // The URLEnumerator takes ownership of the bytes allocated in |value|.      URLEnumerator* result = new URLEnumerator(kToken_URLColumn, col,                                                kToken_HiddenColumn,                                                value, len);      if (! result)        return NS_ERROR_OUT_OF_MEMORY;      rv = result->Init(mEnv, mTable);      if (NS_FAILED(rv)) return rv;      *aSources = result;      NS_ADDREF(*aSources);      return NS_OK;    }  }  return NS_NewEmptyEnumerator(aSources);}