nsCOMPtr<nsIPref> pPref(do_GetService(kPrefCID, &rv));
nsCOMPtr<nsIPref> pPref(do_GetService(NS_PREF_CONTRACTID, &rv));
static void DIR_SetIntPref (const char *prefRoot, const char *prefLeaf, char *scratch, PRInt32 value, PRInt32 defaultValue){    nsresult rv = NS_OK;    nsCOMPtr<nsIPref> pPref(do_GetService(kPrefCID, &rv));     if (NS_FAILED(rv) || !pPref) 		return;	PRInt32 defaultPref;	PRInt32 prefErr = PREF_NOERROR;	PL_strcpy(scratch, prefRoot);	PL_strcat(scratch, ".");	PL_strcat(scratch, prefLeaf);	if (PREF_NOERROR == pPref->GetDefaultIntPref (scratch, &defaultPref))	{		/* solve the problem where reordering user prefs must override default prefs */		pPref->SetIntPref (scratch, value);	}	else	{		PRInt32 userPref;		if (PREF_NOERROR == pPref->GetIntPref (scratch, &userPref))		{			if (value != defaultValue)				prefErr = pPref->SetIntPref(scratch, value);			else				DIR_ClearIntPref (scratch);		}		else		{			if (value != defaultValue)				prefErr = pPref->SetIntPref (scratch, value); 		}	}	PR_ASSERT(prefErr >= 0);}