for (int k = 1; k < sizeof(specialFiles) / sizeof(char*); k++)
for (k = 1; k < sizeof(specialFiles) / sizeof(char*); k++)
extern "C" JSBool pref_InitInitialObjects()// Initialize default preference JavaScript buffers from// appropriate TEXT resources//----------------------------------------------------------------------------------------{    JSBool funcResult;    nsresult rv;    JSBool worked = PR_FALSE;    NS_WITH_SERVICE(nsIFileLocator, locator, kFileLocatorCID, &rv);    if (NS_FAILED(rv))    	return JS_TRUE;    nsIFileSpec* componentsDir;    rv = locator->GetFileLocation(nsSpecialFileSpec::App_ComponentsDirectory, &componentsDir);    if (NS_FAILED(rv))    	return JS_TRUE;	static const char* specialFiles[] = {		"initpref.js"#ifdef XP_MAC	,	"macprefs.js"#elif defined(XP_PC)	,	"winpref.js"#elif defined(XP_UNIX)	,	"unix.js"#endif	};    // Parse all the random files that happen to be in the components directory.    nsIDirectoryIterator* i;    rv = nsComponentManager::CreateInstance(    	"component://netscape/directoryiterator",    	(nsISupports*)nsnull,    	nsIDirectoryIterator::GetIID(),    	(void**)&i);    if (NS_FAILED(i->Init(componentsDir)))    	return JS_FALSE;	// Get any old child of the components directory.	nsIFileSpec* specialChild;	if NS_FAILED(i->GetCurrentSpec(&specialChild))    	return JS_FALSE;		if (NS_FAILED(specialChild->SetLeafName((char*)specialFiles[0])))	{		funcResult = JS_FALSE;		goto done;	}    worked = (JSBool)(pref_OpenFileSpec(    	specialChild,    	PR_FALSE,    	PR_FALSE,    	PR_FALSE,    	PR_FALSE) == PREF_NOERROR);	NS_ASSERTION(worked, "initpref.js not parsed successfully");	// Keep this child	for (; Exists(i); i->next())	{		nsIFileSpec* child;		if NS_FAILED(i->GetCurrentSpec(&child))			continue;		char* leafName;		rv = child->GetLeafName(&leafName);		NS_RELEASE(child);		if NS_FAILED(rv)			continue;		PRBool shouldParse = PR_TRUE;		// Skip non-js files		if (strstr(leafName, ".js") + strlen(".js") != leafName + strlen(leafName))			shouldParse = PR_FALSE;		// Skip files in the special list.		if (shouldParse)		{			for (int j = 0; j < sizeof(specialFiles) / sizeof(char*); j++)				if (strcmp(leafName, specialFiles[j]) == 0)					shouldParse = PR_FALSE;		}		nsCRT::free((char*)leafName);		if (shouldParse)		{		    worked = (JSBool)(pref_OpenFileSpec(		    	child,		    	PR_FALSE,		    	PR_FALSE,		    	PR_FALSE,		    	PR_FALSE) == PREF_NOERROR);			NS_ASSERTION(worked, "Config file not parsed successfully");		}	}	// Finally, parse any other special files (platform-specific ones).	for (int k = 1; k < sizeof(specialFiles) / sizeof(char*); k++)	{	    if (NS_FAILED(specialChild->SetLeafName((char*)specialFiles[k])))	    	continue;	    worked = (JSBool)(pref_OpenFileSpec(    		specialChild,	    	PR_FALSE,	    	PR_FALSE,	    	PR_FALSE,	    	PR_FALSE) == PREF_NOERROR);		NS_ASSERTION(worked, "<platform>.js was not parsed successfully");	}done:	NS_RELEASE(specialChild);    return JS_TRUE;}