Various fixes for Installer stability, bugs 39749, 41002. r=sgehani

This commit is contained in:
sfraser%netscape.com 2000-06-01 00:38:17 +00:00
Родитель d5dde04bd9
Коммит a741dd03f7
4 изменённых файлов: 74 добавлений и 54 удалений

Двоичные данные
xpinstall/wizard/mac/rsrc/MIWCommon.rsrc

Двоичный файл не отображается.

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

@ -125,7 +125,7 @@ ReadConfigFile(char **text)
bSuccess = false;
if (dataSize > 0)
{
*text = (char*) NewPtrClear(dataSize);
*text = (char*) NewPtrClear(dataSize + 1); // ensure null termination
if (!(*text))
{
ErrorHandler(eMem);
@ -499,9 +499,9 @@ PopulateCompWinKeys(char *cfgText)
{
// currKey = "Dependee<j>"
currDepNum = ltoa(j);
currKey = NewPtrClear(strlen(currKeyBuf) + strlen(currDepNum));
strncpy(currKey, currKeyBuf, strlen(currKeyBuf));
strncat(currKey, currDepNum, strlen(currDepNum));
currKey = NewPtrClear(strlen(currKeyBuf) + strlen(currDepNum) + 1);
strcpy(currKey, currKeyBuf);
strcat(currKey, currDepNum);
gControls->cfg->comp[i].depName[j] = NewHandleClear(kValueMaxLen);
if (!FillKeyValueUsingName(currSName, currKey, gControls->cfg->comp[i].depName[j], cfgText))
@ -1030,7 +1030,6 @@ FillKeyValueUsingName(char *sectionName, char *keyName, Handle dest, char *cfgTe
/* Fill key-value pair using the pascal string section name and key name */
char *value;
long len;
Boolean bFound = false;
value = (char*) NewPtrClear(kValueMaxLen);
@ -1042,9 +1041,19 @@ FillKeyValueUsingName(char *sectionName, char *keyName, Handle dest, char *cfgTe
if (FindKeyValue(cfgText, sectionName, keyName, value))
{
long len = strlen(value);
OSErr err;
SetHandleSize(dest, len + 1);
err = MemError();
if (err != noErr)
{
ErrorHandler(err);
return false;
}
HLock(dest);
len = strlen(value);
strncpy(*dest, value, len);
strcpy(*dest, value);
HUnlock(dest);
bFound = true;
}
@ -1188,12 +1197,10 @@ GetNextKeyVal(char **inSection, char *outKey, char *outVal)
/* clear out extra carriage returns above next key */
while( (*sbuf == MAC_EOL) || (*sbuf == WIN_EOL) || (*sbuf == ' ') || (*sbuf == '\t'))
{
if (*sbuf == MY_EOF) /* no more keys */
return false;
else
sbuf++;
}
if (*sbuf == MY_EOF) /* no more keys */
return false;
if (*sbuf == ';') /* comment encountered */
{
@ -1221,6 +1228,7 @@ GetNextKeyVal(char **inSection, char *outKey, char *outVal)
else
sbuf++;
}
*key = MY_EOF; /* close string */
sbuf++;

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

@ -161,8 +161,11 @@ OurNavEventFunction(NavEventCallbackMessage callBackSelector, NavCBRecPtr callBa
NavCallBackUserData callBackUD)
{
WindowPtr windowPtr;
windowPtr = (WindowPtr) callBackParms->eventData.eventDataParms.event->message;
if (!callBackParms || !callBackParms->eventData.eventDataParms.event)
return;
windowPtr = (WindowPtr)callBackParms->eventData.eventDataParms.event->message;
if (!windowPtr)
return;
@ -670,44 +673,45 @@ ClearDiskSpaceMsgs(void)
** a string of the appropriate size and the caller
** should assume ownership of the returned pointer.
*/
#define kMaxLongLen 12
char *
ltoa(long n)
{
char *s;
int i, j, sign, tmp;
char s[kMaxLongLen] = "";
char *returnBuf;
int i, j, sign;
/* check sign and convert to positive to stringify numbers */
if ( (sign = n) < 0)
n = -n;
i = 0;
s = (char*) malloc(sizeof(char));
/* grow string as needed to add numbers from powers of 10 down till none left */
do
{
s = (char*) realloc(s, (i+1)*sizeof(char));
s[i++] = n % 10 + '0'; /* '0' or 30 is where ASCII numbers start from */
s[i] = '\0';
}
while( (n /= 10) > 0);
/* tack on minus sign if we found earlier that this was negative */
if (sign < 0)
{
s = (char*) realloc(s, (i+1)*sizeof(char));
s[i++] = '-';
}
s[i] = '\0';
/* pop numbers (and sign) off of string to push back into right direction */
for (i = 0, j = strlen(s) - 1; i < j; i++, j--)
{
tmp = s[i];
char tmp = s[i];
s[i] = s[j];
s[j] = tmp;
}
return s;
returnBuf = (char *)malloc(strlen(s) + 1);
strcpy(returnBuf, s);
return returnBuf;
}
short

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

@ -70,20 +70,22 @@ ShowTerminalWin(void)
return;
}
gControls->tw->siteSelector = NULL;
gControls->tw->saveBitsCheckbox = NULL;
gControls->tw->startMsgBox = viewRect;
gControls->tw->startMsg = TENew(&viewRect, &viewRect);
if (gControls->tw->startMsg == NULL)
{
ErrorHandler(eMem);
return;
}
if (gControls->tw->startMsg == NULL)
{
ErrorHandler(eMem);
return;
}
#if MOZILLA == 0
// site selector
if (gControls->cfg->numSites > 0)
{
gControls->tw->siteSelector = NULL;
gControls->tw->siteSelector = GetNewControl( rSiteSelector, gWPtr );
if (!gControls->tw->siteSelector)
{
@ -215,32 +217,38 @@ InTerminalContent(EventRecord* evt, WindowPtr wCurrPtr)
localPt = evt->where;
GlobalToLocal( &localPt);
#if MOZILLA == 0
HLock((Handle)gControls->tw->siteSelector);
r = (**(gControls->tw->siteSelector)).contrlRect;
HUnlock((Handle)gControls->tw->siteSelector);
if (PtInRect(localPt, &r))
#if MOZILLA == 0
if (gControls->tw->siteSelector)
{
part = FindControl(localPt, gWPtr, &currCntl);
part = TrackControl(currCntl, localPt, (ControlActionUPP) -1);
gControls->opt->siteChoice = GetControlValue(currCntl);
return;
}
HLock((Handle)gControls->tw->saveBitsCheckbox);
r = (**(gControls->tw->saveBitsCheckbox)).contrlRect;
HUnlock((Handle)gControls->tw->saveBitsCheckbox);
if (PtInRect(localPt, &r))
HLock((Handle)gControls->tw->siteSelector);
r = (**(gControls->tw->siteSelector)).contrlRect;
HUnlock((Handle)gControls->tw->siteSelector);
if (PtInRect(localPt, &r))
{
part = FindControl(localPt, gWPtr, &currCntl);
part = TrackControl(currCntl, localPt, (ControlActionUPP) -1);
gControls->opt->siteChoice = GetControlValue(currCntl);
return;
}
}
if (gControls->tw->saveBitsCheckbox)
{
part = FindControl(localPt, gWPtr, &currCntl);
part = TrackControl(currCntl, localPt, (ControlActionUPP) -1);
checkboxVal = GetControlValue(currCntl);
SetControlValue(currCntl, 1 - checkboxVal);
if (checkboxVal) // was selected so now toggling off
gControls->opt->saveBits = false;
else // was not selected so now toggling on
gControls->opt->saveBits = true;
return;
HLock((Handle)gControls->tw->saveBitsCheckbox);
r = (**(gControls->tw->saveBitsCheckbox)).contrlRect;
HUnlock((Handle)gControls->tw->saveBitsCheckbox);
if (PtInRect(localPt, &r))
{
part = FindControl(localPt, gWPtr, &currCntl);
part = TrackControl(currCntl, localPt, (ControlActionUPP) -1);
checkboxVal = GetControlValue(currCntl);
SetControlValue(currCntl, 1 - checkboxVal);
if (checkboxVal) // was selected so now toggling off
gControls->opt->saveBits = false;
else // was not selected so now toggling on
gControls->opt->saveBits = true;
return;
}
}
#endif /* MOZILLA == 0 */