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
Родитель 16d726e002
Коммит 4c2fe11940
3 изменённых файлов: 54 добавлений и 75 удалений

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

@ -18,54 +18,25 @@ extern CString nscpxpiPath;
extern COMPONENT Components[100]; extern COMPONENT Components[100];
extern int numComponents; extern int numComponents;
extern CString compString;
extern "C" __declspec(dllexport) 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;
compNum=0; int invNum = *compNum;
CString componentstr;
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;
// Get all the component info from each component section // Get all the component info from each component section
CString component; char component[MAX_SIZE];
char archive[MAX_SIZE]; char archive[MAX_SIZE];
char name[MAX_SIZE]; char name[MAX_SIZE];
char desc[MAX_SIZE]; char desc[MAX_SIZE];
char attr[MAX_SIZE]; char attr[MAX_SIZE];
char tempcomponentstr[MAX_SIZE];
component.Format("Component %s", compString);
componentstr.Format("C%d", *compNum);
strcpy(tempcomponentstr, componentstr);
GetPrivateProfileString("Setup Type2", tempcomponentstr, "", component, MAX_SIZE, iniSrcPath);
GetPrivateProfileString(component, "Archive", "", archive, MAX_SIZE, iniSrcPath); GetPrivateProfileString(component, "Archive", "", archive, MAX_SIZE, iniSrcPath);
while (*archive) while (*archive)
@ -77,34 +48,37 @@ int BuildComponentList(COMPONENT *comps, CString compString, int& compNum, CStri
GetPrivateProfileString(component, "Attributes", "", GetPrivateProfileString(component, "Attributes", "",
attr, MAX_SIZE, iniSrcPath); attr, MAX_SIZE, iniSrcPath);
comps[compNum].archive = CString(archive); comps[*compNum].archive = CString(archive);
comps[compNum].compname = component; comps[*compNum].compname = component;
comps[compNum].name = CString(name); comps[*compNum].name = CString(name);
comps[compNum].desc = CString(desc); comps[*compNum].desc = CString(desc);
comps[compNum].selected = (strstr(attr, "SELECTED") != NULL); comps[*compNum].selected = (strstr(attr, "SELECTED") != NULL);
comps[compNum].invisible = (strstr(attr, "INVISIBLE") != NULL); comps[*compNum].invisible = (strstr(attr, "INVISIBLE") != NULL);
comps[compNum].launchapp = (strstr(attr, "LAUNCHAPP") != NULL); comps[*compNum].launchapp = (strstr(attr, "LAUNCHAPP") != NULL);
comps[compNum].additional = (strstr(attr, "ADDITIONAL") != NULL); comps[*compNum].additional = (strstr(attr, "ADDITIONAL") != NULL);
comps[compNum].disabled = (strstr(attr, "DISABLED") != NULL); comps[*compNum].disabled = (strstr(attr, "DISABLED") != NULL);
comps[compNum].forceupgrade = (strstr(attr, "FORCE_UPGRADE") != NULL); comps[*compNum].forceupgrade = (strstr(attr, "FORCE_UPGRADE") != NULL);
if (!(comps[compNum].selected && comps[compNum].invisible && invisibleCount))
{ if (!(comps[*compNum].selected && comps[*compNum].invisible && invisibleCount))
compNum++; {
compString = configcompString[compNum]; (*compNum)++;
arrayindex++; invNum++;
invNum = configcompString[arrayindex]; componentstr.Format("C%d", invNum);
component.Format("Component %s", invNum); strcpy(tempcomponentstr, componentstr);
} GetPrivateProfileString("Setup Type2", tempcomponentstr, "", component, MAX_SIZE, iniSrcPath);
else }
{ else
arrayindex++; {
invNum=configcompString[arrayindex]; invNum++;
component.Format("Component %s", invNum); componentstr.Format("C%d", invNum);
strcpy(tempcomponentstr, componentstr);
GetPrivateProfileString("Setup Type2", tempcomponentstr, "", component, MAX_SIZE, iniSrcPath);
} }
GetPrivateProfileString(component, "Archive", "", archive, MAX_SIZE, iniSrcPath); GetPrivateProfileString(component, "Archive", "", archive, MAX_SIZE, iniSrcPath);
} }
return TRUE; return TRUE;
} }
@ -122,8 +96,8 @@ int GenerateComponentList(CString parms, WIDGET *curWidget)
nscpxpiPath = rootPath + "NSCPXPI"; nscpxpiPath = rootPath + "NSCPXPI";
iniSrcPath = nscpxpiPath + "\\config.ini"; iniSrcPath = nscpxpiPath + "\\config.ini";
BuildComponentList(Components, compString, numComponents, iniSrcPath, 1); BuildComponentList(Components, &numComponents, iniSrcPath, 1);
int i; int i;
CString WidgetValue(""); CString WidgetValue("");
for (i=0; i<numComponents; i++) for (i=0; i<numComponents; i++)

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

@ -6,11 +6,11 @@ typedef struct s_component {
BOOL selected; BOOL selected;
BOOL invisible; BOOL invisible;
BOOL launchapp; BOOL launchapp;
BOOL additional; BOOL additional;
BOOL disabled; BOOL disabled;
BOOL forceupgrade; BOOL forceupgrade;
} COMPONENT; } COMPONENT;
extern "C" __declspec(dllexport) 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]; COMPONENT Components[100];
int numComponents; int numComponents;
int componentOrder; int componentOrder;
CString compString=" "; CString componentstr;
char tempcomponentstr[MAX_SIZE];
int findXPI(CString xpiname, CString filename) int findXPI(CString xpiname, CString filename)
{ {
@ -609,7 +610,7 @@ void init_components()
{ {
int i; int i;
WIDGET *w = findWidget("SelectedComponents"); WIDGET *w = findWidget("SelectedComponents");
BuildComponentList(Components, compString, numComponents, iniSrcPath,0); BuildComponentList(Components, &numComponents, iniSrcPath,0);
// Turn off components that aren't selected // Turn off components that aren't selected
for (i=0; i<numComponents; i++) for (i=0; i<numComponents; i++)
{ {
@ -673,7 +674,7 @@ void AddThirdParty()
CString tpComp2 = GetGlobal("CustomComponent23"); CString tpComp2 = GetGlobal("CustomComponent23");
CString tpCompSize1 = GetGlobal("ComponentSize"); CString tpCompSize1 = GetGlobal("ComponentSize");
CString tpCompSize2 = GetGlobal("ModuleSize"); CString tpCompSize2 = GetGlobal("ModuleSize");
CString componentName; char *componentName;
CString cName; CString cName;
CString compSDesc = "Description Short="; CString compSDesc = "Description Short=";
CString compLDesc = "Description Long="; CString compLDesc = "Description Long=";
@ -736,7 +737,9 @@ void AddThirdParty()
if ((firstSix.CompareNoCase("Please") != 0) && !(tpCompPath1.IsEmpty())) 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); cName.Format("C%d", componentOrder);
componentOrder++; componentOrder++;
@ -752,7 +755,9 @@ void AddThirdParty()
firstSix = tpCompPath2.Left(6); firstSix = tpCompPath2.Left(6);
if ((firstSix.CompareNoCase("Please") != 0) && !(tpCompPath2.IsEmpty())) 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); cName.Format("C%d", componentOrder);
WritePrivateProfileString("Setup Type0", cName, componentName, iniDstPath); WritePrivateProfileString("Setup Type0", cName, componentName, iniDstPath);