Fix for bug 84405: Parser for config.ini hardcodes component names (r=tao)

This commit is contained in:
shrutiv%netscape.com 2001-07-19 02:14:39 +00:00
Родитель 2a4432cbd0
Коммит c78f701a21
3 изменённых файлов: 54 добавлений и 75 удалений

Просмотреть файл

@ -18,54 +18,25 @@ extern CString nscpxpiPath;
extern COMPONENT Components[100];
extern int numComponents;
extern CString compString;
extern "C" __declspec(dllexport)
int BuildComponentList(COMPONENT *comps, CString compString, int& compNum, CString iniSrcPath,int invisibleCount)
int BuildComponentList(COMPONENT *comps, int *compNum, CString iniSrcPath,int invisibleCount)
{
CString configcompString[50];
compNum=0;
configcompString[0]="Marker Recommended Start";
configcompString[1]="Marker Full Start";
configcompString[2]="Marker Custom Start";
configcompString[3]="XPCOM";
configcompString[4]="Navigator";
configcompString[5]="Java";
configcompString[6]="MailNews";
configcompString[7]="Instant Messenger";
configcompString[8]="QFA";
configcompString[9]="PSM";
configcompString[10]="Spell Checker";
configcompString[11]="AOL Art";
configcompString[12]="Net2Phone";
configcompString[13]="Flash";
configcompString[14]="Uninstaller";
configcompString[15]="AOD";
configcompString[16]="RealPlayer";
configcompString[17]="Winamp";
configcompString[18]="US English Profile Defaults";
configcompString[19]="HP Printer Plugin";
configcompString[20]="Classic Skin";
configcompString[21]="En US lang pack";
configcompString[22]="US region pack";
configcompString[23]="Marker Recommended End";
configcompString[24]="Marker Full End";
configcompString[25]="Marker Custom End";
configcompString[26]=" ";
int arrayindex=compNum;
compString = configcompString[compNum];
CString invNum = compString;
*compNum = 0;
int invNum = *compNum;
CString componentstr;
// Get all the component info from each component section
CString component;
char component[MAX_SIZE];
char archive[MAX_SIZE];
char name[MAX_SIZE];
char desc[MAX_SIZE];
char attr[MAX_SIZE];
component.Format("Component %s", compString);
char tempcomponentstr[MAX_SIZE];
componentstr.Format("C%d", *compNum);
strcpy(tempcomponentstr, componentstr);
GetPrivateProfileString("Setup Type2", tempcomponentstr, "", component, MAX_SIZE, iniSrcPath);
GetPrivateProfileString(component, "Archive", "", archive, MAX_SIZE, iniSrcPath);
while (*archive)
@ -77,34 +48,37 @@ int BuildComponentList(COMPONENT *comps, CString compString, int& compNum, CStri
GetPrivateProfileString(component, "Attributes", "",
attr, MAX_SIZE, iniSrcPath);
comps[compNum].archive = CString(archive);
comps[compNum].compname = component;
comps[compNum].name = CString(name);
comps[compNum].desc = CString(desc);
comps[compNum].selected = (strstr(attr, "SELECTED") != NULL);
comps[compNum].invisible = (strstr(attr, "INVISIBLE") != NULL);
comps[compNum].launchapp = (strstr(attr, "LAUNCHAPP") != NULL);
comps[compNum].additional = (strstr(attr, "ADDITIONAL") != NULL);
comps[compNum].disabled = (strstr(attr, "DISABLED") != NULL);
comps[compNum].forceupgrade = (strstr(attr, "FORCE_UPGRADE") != NULL);
if (!(comps[compNum].selected && comps[compNum].invisible && invisibleCount))
{
compNum++;
compString = configcompString[compNum];
arrayindex++;
invNum = configcompString[arrayindex];
component.Format("Component %s", invNum);
}
else
{
arrayindex++;
invNum=configcompString[arrayindex];
component.Format("Component %s", invNum);
comps[*compNum].archive = CString(archive);
comps[*compNum].compname = component;
comps[*compNum].name = CString(name);
comps[*compNum].desc = CString(desc);
comps[*compNum].selected = (strstr(attr, "SELECTED") != NULL);
comps[*compNum].invisible = (strstr(attr, "INVISIBLE") != NULL);
comps[*compNum].launchapp = (strstr(attr, "LAUNCHAPP") != NULL);
comps[*compNum].additional = (strstr(attr, "ADDITIONAL") != NULL);
comps[*compNum].disabled = (strstr(attr, "DISABLED") != NULL);
comps[*compNum].forceupgrade = (strstr(attr, "FORCE_UPGRADE") != NULL);
if (!(comps[*compNum].selected && comps[*compNum].invisible && invisibleCount))
{
(*compNum)++;
invNum++;
componentstr.Format("C%d", invNum);
strcpy(tempcomponentstr, componentstr);
GetPrivateProfileString("Setup Type2", tempcomponentstr, "", component, MAX_SIZE, iniSrcPath);
}
else
{
invNum++;
componentstr.Format("C%d", invNum);
strcpy(tempcomponentstr, componentstr);
GetPrivateProfileString("Setup Type2", tempcomponentstr, "", component, MAX_SIZE, iniSrcPath);
}
GetPrivateProfileString(component, "Archive", "", archive, MAX_SIZE, iniSrcPath);
}
return TRUE;
}
@ -122,8 +96,8 @@ int GenerateComponentList(CString parms, WIDGET *curWidget)
nscpxpiPath = rootPath + "NSCPXPI";
iniSrcPath = nscpxpiPath + "\\config.ini";
BuildComponentList(Components, compString, numComponents, iniSrcPath, 1);
BuildComponentList(Components, &numComponents, iniSrcPath, 1);
int i;
CString WidgetValue("");
for (i=0; i<numComponents; i++)

Просмотреть файл

@ -6,11 +6,11 @@ typedef struct s_component {
BOOL selected;
BOOL invisible;
BOOL launchapp;
BOOL additional;
BOOL disabled;
BOOL forceupgrade;
BOOL additional;
BOOL disabled;
BOOL forceupgrade;
} COMPONENT;
extern "C" __declspec(dllexport)
int BuildComponentList(COMPONENT *comps, CString compString, int& compNum, CString iniSrcPath,int invisibleCount);
int BuildComponentList(COMPONENT *comps, int *compNum, CString iniSrcPath,int invisibleCount);

Просмотреть файл

@ -43,7 +43,8 @@ BOOL prefDoesntExist = TRUE;
COMPONENT Components[100];
int numComponents;
int componentOrder;
CString compString=" ";
CString componentstr;
char tempcomponentstr[MAX_SIZE];
int findXPI(CString xpiname, CString filename)
{
@ -609,7 +610,7 @@ void init_components()
{
int i;
WIDGET *w = findWidget("SelectedComponents");
BuildComponentList(Components, compString, numComponents, iniSrcPath,0);
BuildComponentList(Components, &numComponents, iniSrcPath,0);
// Turn off components that aren't selected
for (i=0; i<numComponents; i++)
{
@ -673,7 +674,7 @@ void AddThirdParty()
CString tpComp2 = GetGlobal("CustomComponent23");
CString tpCompSize1 = GetGlobal("ComponentSize");
CString tpCompSize2 = GetGlobal("ModuleSize");
CString componentName;
char *componentName;
CString cName;
CString compSDesc = "Description Short=";
CString compLDesc = "Description Long=";
@ -736,7 +737,9 @@ void AddThirdParty()
if ((firstSix.CompareNoCase("Please") != 0) && !(tpCompPath1.IsEmpty()))
{
componentName.Format("Component %s", (compString));
componentstr.Format("C%d", (numComponents));
strcpy(tempcomponentstr, componentstr);
GetPrivateProfileString("Setup Type2", tempcomponentstr, "", componentName, MAX_SIZE, iniSrcPath);
cName.Format("C%d", componentOrder);
componentOrder++;
@ -752,7 +755,9 @@ void AddThirdParty()
firstSix = tpCompPath2.Left(6);
if ((firstSix.CompareNoCase("Please") != 0) && !(tpCompPath2.IsEmpty()))
{
componentName.Format("Component %s", (compString));
componentstr.Format("C%d", (numComponents));
strcpy(tempcomponentstr, componentstr);
GetPrivateProfileString("Setup Type2", tempcomponentstr, "", componentName, MAX_SIZE, iniSrcPath);
cName.Format("C%d", componentOrder);
WritePrivateProfileString("Setup Type0", cName, componentName, iniDstPath);