* More memory issues ironed out.

This commit is contained in:
sgehani%netscape.com 1999-09-01 23:59:16 +00:00
Родитель 8270b2496a
Коммит 2cdd4bd92c
10 изменённых файлов: 199 добавлений и 93 удалений

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

@ -55,7 +55,10 @@ ShowComponentsWin(void)
if (reserr == noErr && listBoxRect != NULL)
{
HLock((Handle)listBoxRect);
gControls->cw->compListBox = (Rect) **((Rect **)listBoxRect);
SetRect(&gControls->cw->compListBox, ((Rect*)*listBoxRect)->left,
((Rect*)*listBoxRect)->top,
((Rect*)*listBoxRect)->right,
((Rect*)*listBoxRect)->bottom);
HUnlock((Handle)listBoxRect);
}
else
@ -63,7 +66,13 @@ ShowComponentsWin(void)
ErrorHandler();
return;
}
gControls->cw->compDescBox = NULL;
gControls->cw->compDescBox = GetNewControl(rCompDescBox, gWPtr);
if (!gControls->cw->compDescBox)
{
ErrorHandler();
return;
}
gControls->cw->compListBox.right -= kScrollBarWidth;
SetRect(&dataBounds, 0, 0, 1, gControls->cfg->numComps);
@ -79,7 +88,7 @@ ShowComponentsWin(void)
SetControlTitle(gControls->cw->compDescBox, compDescTitle);
MoveTo( gControls->cw->compListBox.left, gControls->cw->compListBox.top - kInterWidgetPad);
HLockHi(gControls->cfg->selCompMsg);
HLock(gControls->cfg->selCompMsg);
selCompMsg = CToPascal(*gControls->cfg->selCompMsg);
if (selCompMsg)
DrawString( selCompMsg );
@ -95,6 +104,9 @@ ShowComponentsWin(void)
else
DrawDiskSpaceMsgs( gControls->opt->vRefNum );
//if (selCompMsg)
// DisposePtr((Ptr) selCompMsg);
SetPort(oldPort);
}
@ -108,11 +120,11 @@ PopulateCompInfo(void)
for (i=0; i<gControls->cfg->numComps; i++)
{
HLockHi(gControls->cfg->comp[i].shortDesc);
HLock(gControls->cfg->comp[i].shortDesc);
currDesc = *gControls->cfg->comp[i].shortDesc;
HUnlock(gControls->cfg->comp[i].shortDesc);
SetPt(&currCell, 0, i);
LSetCell( currDesc, strlen(currDesc), currCell, gControls->cw->compList);
HUnlock(gControls->cfg->comp[i].shortDesc);
if (gControls->opt->compSelected[i] == kSelected)
{
LSetSelect(true, currCell, gControls->cw->compList);
@ -134,7 +146,7 @@ UpdateCompWin(void)
SetPort(gWPtr);
MoveTo( gControls->cw->compListBox.left, gControls->cw->compListBox.top - kInterWidgetPad + 1);
HLockHi(gControls->cfg->selCompMsg);
HLock(gControls->cfg->selCompMsg);
DrawString( CToPascal(*gControls->cfg->selCompMsg));
HUnlock(gControls->cfg->selCompMsg);
LUpdate( (*gControls->cw->compList)->port->visRgn,
@ -144,8 +156,11 @@ UpdateCompWin(void)
SetPt(&c, 0, 0);
if (LGetSelect(true, &c, gControls->cw->compList))
{
HLockHi((Handle)gControls->cw->compDescTxt);
r = (*gControls->cw->compDescTxt)->viewRect;
HLock((Handle)gControls->cw->compDescTxt);
SetRect(&r, (*gControls->cw->compDescTxt)->viewRect.left,
(*gControls->cw->compDescTxt)->viewRect.top,
(*gControls->cw->compDescTxt)->viewRect.right,
(*gControls->cw->compDescTxt)->viewRect.bottom);
HUnlock((Handle)gControls->cw->compDescTxt);
TEUpdate(&r, gControls->cw->compDescTxt);
}
@ -174,7 +189,7 @@ InComponentsContent(EventRecord* evt, WindowPtr wCurrPtr)
SetOptInfo();
}
HLockHi((Handle)gControls->backB);
HLock((Handle)gControls->backB);
r = (**(gControls->backB)).contrlRect;
HUnlock((Handle)gControls->backB);
if (PtInRect( localPt, &r))
@ -195,7 +210,7 @@ InComponentsContent(EventRecord* evt, WindowPtr wCurrPtr)
}
}
HLockHi((Handle)gControls->nextB);
HLock((Handle)gControls->nextB);
r = (**(gControls->nextB)).contrlRect;
HUnlock((Handle)gControls->nextB);
if (PtInRect( localPt, &r))
@ -223,8 +238,11 @@ SetOptInfo(void)
int i;
Rect viewRect;
HLockHi((Handle)gControls->cw->compDescBox);
viewRect = (*gControls->cw->compDescBox)->contrlRect;
HLock((Handle)gControls->cw->compDescBox);
SetRect(&viewRect, (*gControls->cw->compDescBox)->contrlRect.left,
(*gControls->cw->compDescBox)->contrlRect.top,
(*gControls->cw->compDescBox)->contrlRect.right,
(*gControls->cw->compDescBox)->contrlRect.bottom);
HUnlock((Handle)gControls->cw->compDescBox);
viewRect.top += kInterWidgetPad;
SetRect(&viewRect, viewRect.left + kTxtRectPad,
@ -253,7 +271,7 @@ SetOptInfo(void)
TextFont(applFont);
TextSize(10);
gControls->cw->compDescTxt = TENew(&viewRect, &viewRect);
HLockHi(gControls->cfg->comp[i].longDesc);
HLock(gControls->cfg->comp[i].longDesc);
TESetText( *gControls->cfg->comp[i].longDesc,
strlen(*gControls->cfg->comp[i].longDesc), gControls->cw->compDescTxt);
TEUpdate( &viewRect, gControls->cw->compDescTxt);

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

@ -47,6 +47,7 @@ ExtractCoreFile(void)
PRInt32 rv;
Boolean bFoundAll = false, isDir;
char filename[255] = "\0", dir[255] = "\0", *lastslash;
Ptr fullPathStr;
FSSpec coreDirFSp, extractedFSp, outFSp, extractedDir;
long coreDirID, tgtDirID, extractedDirID;
@ -55,14 +56,14 @@ ExtractCoreFile(void)
tgtVRefNum = gControls->opt->vRefNum;
/* if there's a core file... */
HLockHi(gControls->cfg->coreFile);
HLock(gControls->cfg->coreFile);
if (*gControls->cfg->coreFile != NULL)
{
/* make local copy and unlock handle */
coreFile = CToPascal(*gControls->cfg->coreFile);
if (!coreFile)
{
err= memFullErr;
err = memFullErr;
goto cleanup;
}
}
@ -104,9 +105,13 @@ ExtractCoreFile(void)
}
HLock(fullPathH);
*(*fullPathH+fullPathLen) = '\0';
rv = ZIP_OpenArchive( *fullPathH, &hZip );
fullPathStr = NewPtrClear(fullPathLen+1);
strncat(fullPathStr, *fullPathH, fullPathLen);
*(fullPathStr+fullPathLen) = '\0';
rv = ZIP_OpenArchive( fullPathStr, &hZip );
HUnlock(fullPathH);
DisposeHandle(fullPathH);
DisposePtr(fullPathStr);
if (rv!=ZIP_OK) return rv;
hFind = ZIP_FindInit( hZip, NULL ); /* NULL to match all files in archive */
@ -120,7 +125,7 @@ ExtractCoreFile(void)
}
else if (rv!=ZIP_OK)
return rv;
lastslash = strrchr(filename, '/');
if (lastslash == (&filename[0] + strlen(filename) - 1)) /* dir entry encountered */
continue;
@ -130,11 +135,14 @@ ExtractCoreFile(void)
if (err!=noErr)
return err;
HLock(fullPathH);
strcat(*fullPathH, filename); /* tack on filename to dirpath */
fullPathLen += strlen(filename);
*(*fullPathH+fullPathLen) = '\0';
rv = ZIP_ExtractFile( hZip, filename, *fullPathH );
fullPathStr = NewPtrClear(fullPathLen + strlen(filename) + 1);
strcat(fullPathStr, *fullPathH);
strcat(fullPathStr, filename); /* tack on filename to dirpath */
*(fullPathStr+fullPathLen+strlen(filename)) = '\0';
rv = ZIP_ExtractFile( hZip, filename, fullPathStr );
HUnlock(fullPathH);
DisposeHandle(fullPathH);
DisposePtr(fullPathStr);
if (rv!=ZIP_OK)
return rv;
@ -206,7 +214,9 @@ ExtractCoreFile(void)
}
cleanup:
// dispose of coreFile, coreDirPath
// dispose of coreFile, coreDirPath, hFind opaque handle
if (hFind)
rv = ZIP_FindFree( hFind );
if (coreFile)
DisposePtr((Ptr) coreFile);
if (coreDirPath)
@ -230,7 +240,10 @@ AppleSingleDecode(FSSpecPtr fd, FSSpecPtr outfd)
ERR_CHECK_RET(decoder->Decode(), err);
}
if (decoder)
delete decoder;
return err;
}
@ -251,7 +264,7 @@ ResolveDirs(char *fname, char *dir)
if (delimFound)
{
strncpy(dir, fname, dirpath-fname);
*(dir+ (dirpath-fname)+1) = 0; // NULL terminate
*(dir + (dirpath-fname)+1) = 0; // NULL terminate
}
}
@ -265,7 +278,7 @@ ForceMoveFile(short vRefNum, long parID, ConstStr255Param name, long newDirID)
if (err == dupFNErr)
{
// handle for stomping over old file
err = FSMakeFSSpec(vRefNum, parID, name, &tmpFSp);
err = FSMakeFSSpec(vRefNum, newDirID, name, &tmpFSp);
err = FSpDelete(&tmpFSp);
err = CatMove(vRefNum, parID, name, newDirID, nil);
}

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

@ -173,7 +173,7 @@ void HandleUpdateEvt(EventRecord* evt)
if (gControls->nextB)
{
HLockHi( (Handle) gControls->nextB);
HLock( (Handle) gControls->nextB);
bounds = (*(gControls->nextB))->contrlRect;
PenMode(patCopy);

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

@ -67,7 +67,6 @@ pascal void* Install(void* unused)
/* call SDI_NetInstall */
gSDDlg = true;
// YieldToAnyThread(); /* force gSDDlg to be picked up by Main Thread */
ourHZ = GetZone();
#if SDINST_IS_DLL == 1
gInstFunc(&sdistruct);
@ -82,8 +81,13 @@ pascal void* Install(void* unused)
/* check if coreFile was downloaded */
HLock(gControls->cfg->coreFile);
if (*gControls->cfg->coreFile != NULL)
{
coreFile = CToPascal(*gControls->cfg->coreFile);
if (!coreFile)
return (void*) memFullErr;
}
HUnlock(gControls->cfg->coreFile);
if (coreFile != NULL && *coreFile > 0) /* core file was specified */
{
err = FSMakeFSSpec(vRefNum, dirID, coreFile, &coreFileSpec);
@ -97,12 +101,11 @@ pascal void* Install(void* unused)
return (void*) nil;
}
sleep(1);
/* run all .xpi's through XPInstall */
err = RunAllXPIs(vRefNum, dirID);
if (err!=noErr)
ErrorHandler();
}
CleanupExtractedFiles();
@ -141,7 +144,13 @@ GenerateIDIFromOpt(Str255 idiName, long dirID, short vRefNum, FSSpec *idiSpec)
ERR_CHECK_RET(FSpOpenDF(idiSpec, fsRdWrPerm, &refNum), false);
// setup buffer to at least 8K
buf = NULL;
buf = NewPtrClear(kGenIDIFileSize);
if (!buf)
{
ErrorHandler();
return false;
}
compsDone = 0;
instChoice = gControls->opt->instChoice-1;
@ -174,7 +183,8 @@ GenerateIDIFromOpt(Str255 idiName, long dirID, short vRefNum, FSSpec *idiSpec)
keybuf = NewPtrClear(2);
keybuf = "]\r";
strncat(buf, keybuf, strlen(keybuf));
DisposePtr(keybuf);
if (keybuf)
DisposePtr(keybuf);
// write out \tdesc=
GetIndString(pkeybuf, rIDIKeys, sDesc);
@ -184,10 +194,11 @@ GenerateIDIFromOpt(Str255 idiName, long dirID, short vRefNum, FSSpec *idiSpec)
strncat(buf, keybuf, strlen(keybuf)); // \tdesc
ch = '='; // \tdesc=
strncat(buf, &ch, 1);
DisposePtr(keybuf);
if (keybuf)
DisposePtr(keybuf);
// write out gControls->cfg->comp[i].shortDesc\r
HLockHi(gControls->cfg->comp[i].shortDesc);
HLock(gControls->cfg->comp[i].shortDesc);
strncat(buf, *gControls->cfg->comp[i].shortDesc, strlen(*gControls->cfg->comp[i].shortDesc));
HUnlock(gControls->cfg->comp[i].shortDesc);
ch = '\r';
@ -204,19 +215,21 @@ GenerateIDIFromOpt(Str255 idiName, long dirID, short vRefNum, FSSpec *idiSpec)
strncat(buf, keybuf, strlen(keybuf)); // \t<n>
ch = '=';
strncat(buf, &ch, 1); // \t<n>=
DisposePtr(keybuf);
if (keybuf)
DisposePtr(keybuf);
// write out gControls->cfg->comp[i].url[j]+archive\r
HLockHi(gControls->cfg->comp[i].url[j]);
HLock(gControls->cfg->comp[i].url[j]);
strncat(buf, *gControls->cfg->comp[i].url[j], strlen(*gControls->cfg->comp[i].url[j]));
HUnlock(gControls->cfg->comp[i].url[j]);
HLockHi(gControls->cfg->comp[i].archive);
HLock(gControls->cfg->comp[i].archive);
strncat(buf, *gControls->cfg->comp[i].archive, strlen(*gControls->cfg->comp[i].archive));
HUnlock(gControls->cfg->comp[i].archive);
ch = '\r';
strncat(buf, &ch, 1);
}
DisposePtr(fnum);
if (fnum)
DisposePtr(fnum);
compsDone++;
}
}
@ -230,12 +243,14 @@ GenerateIDIFromOpt(Str255 idiName, long dirID, short vRefNum, FSSpec *idiSpec)
ch = '[';
strncat(buf, &ch, 1); // [
strncat(buf, keybuf, strlen(keybuf)); // [Netscape Install
DisposePtr(keybuf);
if (keybuf)
DisposePtr(keybuf);
keybuf = NewPtrClear(2);
keybuf = "]\r";
strncat(buf, keybuf, strlen(keybuf)); // [Netscape Install]\r
DisposePtr(keybuf);
if (keybuf)
DisposePtr(keybuf);
// write out \tcore_file=<filename>\r
AddKeyToIDI( sCoreFile, gControls->cfg->coreFile, buf );
@ -262,7 +277,8 @@ GenerateIDIFromOpt(Str255 idiName, long dirID, short vRefNum, FSSpec *idiSpec)
// close file
ERR_CHECK_RET(FSClose(refNum), false)
DisposePtr(buf);
if (buf)
DisposePtr(buf);
return bSuccess;
}
@ -272,7 +288,7 @@ AddKeyToIDI(short key, Handle val, char *ostream)
Str255 pkeybuf;
char *keybuf, *cval, ch;
HLockHi(val);
HLock(val);
cval = *val;
GetIndString(pkeybuf, rIDIKeys, key);
@ -288,7 +304,8 @@ AddKeyToIDI(short key, Handle val, char *ostream)
HUnlock(val);
DisposePtr(keybuf);
if (keybuf)
DisposePtr(keybuf);
}
Boolean

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

@ -287,10 +287,9 @@ InLicenseContent(EventRecord* evt, WindowPtr wCurrPtr)
}
}
return;
break; /* <--- what is this for? */
}
HLockHi((Handle)gControls->backB);
HLock((Handle)gControls->backB);
r = (**(gControls->backB)).contrlRect;
HUnlock((Handle)gControls->backB);
if (PtInRect( localPt, &r))
@ -300,7 +299,7 @@ InLicenseContent(EventRecord* evt, WindowPtr wCurrPtr)
gDone = true; /* Decline pressed */
}
HLockHi((Handle)gControls->nextB);
HLock((Handle)gControls->nextB);
r = (**(gControls->nextB)).contrlRect;
HUnlock((Handle)gControls->nextB);
if (PtInRect( localPt, &r))

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

@ -32,7 +32,6 @@ Boolean gSDDlg = false;
WindowPtr gWPtr = NULL;
short gCurrWin = 0;
InstWiz *gControls = NULL;
static Boolean bInShutdown = false;
EventProc gSDIEvtHandler; /* SDI */
SDI_NETINSTALL gInstFunc;
@ -158,10 +157,10 @@ InitOptObject(void)
/* ComponentsWin options */
for (i=0; i<kMaxComponents; i++)
{
if (gControls->cfg->st[0].comp[i] == kNotInSetupType)
gControls->opt->compSelected[i] = kNotSelected;
else if (gControls->cfg->st[0].comp[i] == kInSetupType)
if ((i<gControls->cfg->st[0].numComps) && (gControls->cfg->st[0].comp[i] == kInSetupType))
gControls->opt->compSelected[i] = kSelected;
else
gControls->opt->compSelected[i] = kNotSelected;
}
}
@ -255,7 +254,7 @@ void MainEventLoop(void)
if (gSDDlg)
YieldToAnyThread(); /* SmartDownload dialog thread */
if (!gDone && !bInShutdown) /* after cx switch back ensure not done */
if (!gDone) /* after cx switch back ensure not done */
{
if(WaitNextEvent(everyEvent, &evt, 0, NULL))
{
@ -283,7 +282,10 @@ void MainEventLoop(void)
void ErrorHandler(void)
{
//TODO: this needs to be fixed.
// TO DO
// * throw up an error dialog
// * handle a "fatality" parameter for recovery
SysBeep(10);
gDone = true;
}
@ -293,7 +295,6 @@ void Shutdown(void)
WindowPtr frontWin;
long MIWMagic = 0;
bInShutdown = true;
UnloadSDLib(&gConnID);
/* deallocate config object */
@ -305,7 +306,7 @@ void Shutdown(void)
/* deallocate all controls */
#if 0
/* XXX gets dispose by DisposeWindow() ? */
/* XXX gets disposed by DisposeWindow() ? */
if (gControls->nextB)
DisposeControl(gControls->nextB);
if (gControls->backB)

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

@ -274,7 +274,7 @@ PopulateCompWinKeys(char *cfgText)
currKey = PascalToC(pkey);
Handle sizeH = NewHandleClear(4); // long is four bytes
FillKeyValueUsingName(currSName, currKey, sizeH, cfgText);
HLockHi(sizeH);
HLock(sizeH);
gControls->cfg->comp[i].size = atol(*sizeH);
HUnlock(sizeH);
DisposeHandle(sizeH);
@ -410,7 +410,7 @@ PopulateSetupTypeWinKeys(char *cfgText)
currCompName = NewPtrClear(kKeyMaxLen);
strncpy(currCompName, currSNameBuf, strlen(currSNameBuf));
HLockHi(currVal);
HLock(currVal);
cNumIdx = strspn(currCompName, *currVal);
compIdx = *currVal+cNumIdx;
compNum = atoi(compIdx);

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

@ -85,8 +85,11 @@ ShowSetupTypeWin(void)
//Draw1Control(gControls->stw->instType);
// setup type desc TE init and default item desc display
HLockHi((Handle)gControls->stw->instDescBox);
viewRect = (*(gControls->stw->instDescBox))->contrlRect;
HLock((Handle)gControls->stw->instDescBox);
SetRect(&viewRect, (*(gControls->stw->instDescBox))->contrlRect.left,
(*(gControls->stw->instDescBox))->contrlRect.top,
(*(gControls->stw->instDescBox))->contrlRect.right,
(*(gControls->stw->instDescBox))->contrlRect.bottom);
HUnlock((Handle)gControls->stw->instDescBox);
InsetRect(&viewRect, kTxtRectPad, kTxtRectPad);
@ -95,7 +98,7 @@ ShowSetupTypeWin(void)
TextFace(normal);
TextSize(12);
gControls->stw->instDescTxt = TENew( &viewRect, &viewRect);
HLockHi(gControls->cfg->st[gControls->opt->instChoice - 1].longDesc);
HLock(gControls->cfg->st[gControls->opt->instChoice - 1].longDesc);
txtSize = strlen(*gControls->cfg->st[gControls->opt->instChoice - 1].longDesc);
TEInsert( *gControls->cfg->st[gControls->opt->instChoice - 1].longDesc, txtSize, gControls->stw->instDescTxt);
TESetAlignment( teFlushDefault, gControls->stw->instDescTxt);
@ -105,7 +108,7 @@ ShowSetupTypeWin(void)
volName = (unsigned char **)NewPtrClear(sizeof(unsigned char *));
GetAllVInfo(volName, &numVols);
gControls->stw->numVols = numVols;
HLockHi((Handle)gControls->stw->destLoc);
HLock((Handle)gControls->stw->destLoc);
pvtDataHdl = (PopupPrivateData **) (*(gControls->stw->destLoc))->contrlData;
popupMenu = (MenuHandle) (**pvtDataHdl).mHandle;
for (i=0; i<numVols; i++)
@ -202,8 +205,11 @@ InSetupTypeContent(EventRecord* evt, WindowPtr wCurrPtr)
localPt = evt->where;
GlobalToLocal( &localPt);
HLockHi((Handle)gControls->stw->instType);
r = (**(gControls->stw->instType)).contrlRect;
HLock((Handle)gControls->stw->instType);
SetRect(&r, (**(gControls->stw->instType)).contrlRect.left,
(**(gControls->stw->instType)).contrlRect.top,
(**(gControls->stw->instType)).contrlRect.right,
(**(gControls->stw->instType)).contrlRect.bottom);
HUnlock((Handle)gControls->stw->instType);
if (PtInRect(localPt, &r))
{
@ -212,8 +218,12 @@ InSetupTypeContent(EventRecord* evt, WindowPtr wCurrPtr)
gControls->opt->instChoice = GetControlValue(currCntl);
r = (**(gControls->stw->instDescTxt)).viewRect;
HLockHi(gControls->cfg->st[gControls->opt->instChoice-1].longDesc);
SetRect(&r, (**(gControls->stw->instDescTxt)).viewRect.left,
(**(gControls->stw->instDescTxt)).viewRect.top,
(**(gControls->stw->instDescTxt)).viewRect.right,
(**(gControls->stw->instDescTxt)).viewRect.bottom);
HLock(gControls->cfg->st[gControls->opt->instChoice-1].longDesc);
len = strlen(*gControls->cfg->st[gControls->opt->instChoice-1].longDesc);
TESetText( *gControls->cfg->st[gControls->opt->instChoice-1].longDesc, len, gControls->stw->instDescTxt);
HUnlock(gControls->cfg->st[gControls->opt->instChoice-1].longDesc);
@ -223,7 +233,10 @@ InSetupTypeContent(EventRecord* evt, WindowPtr wCurrPtr)
}
HLockHi((Handle)gControls->stw->destLoc);
r = (**(gControls->stw->destLoc)).contrlRect;
SetRect(&r, (**(gControls->stw->destLoc)).contrlRect.left,
(**(gControls->stw->destLoc)).contrlRect.top,
(**(gControls->stw->destLoc)).contrlRect.right,
(**(gControls->stw->destLoc)).contrlRect.bottom);
HUnlock((Handle)gControls->stw->destLoc);
if (PtInRect(localPt, &r))
{
@ -380,9 +393,9 @@ void
DrawDiskSpaceMsgs(short vRefNum)
{
HVolumeParam pb;
OSErr err;
OSErr err, reserr;
long freeSpace;
TEHandle diskSpaceMsgH;
TEHandle dsAvailH, dsNeededH;
Rect instDescBox, viewRect;
Handle instDescRectH;
Str255 msg;
@ -398,8 +411,16 @@ DrawDiskSpaceMsgs(short vRefNum)
freeSpace = pb.ioVFrBlk * pb.ioVAlBlkSiz; // in bytes
freeSpace /= 1024; // translate to kilobytes
instDescRectH = NULL;
instDescRectH = Get1Resource('RECT', rCompListBox);
HLockHi(instDescRectH);
reserr = ResError();
if (reserr!=noErr || !instDescRectH)
{
ErrorHandler();
return;
}
HLock(instDescRectH);
instDescBox = (Rect) **((Rect**)instDescRectH);
SetRect( &viewRect, instDescBox.left, instDescBox.bottom + 2,
instDescBox.right, instDescBox.bottom + 12 );
@ -411,7 +432,13 @@ DrawDiskSpaceMsgs(short vRefNum)
TextSize(9);
TextFont(applFont);
EraseRect(&viewRect);
diskSpaceMsgH = TENew(&viewRect, &viewRect);
dsAvailH = NULL;
dsAvailH = TENew(&viewRect, &viewRect);
if (!dsAvailH)
{
ErrorHandler();
return;
}
/* Get the "Disk Space Available: " string */
GetIndString( msg, rStringList, sDiskSpcAvail );
@ -427,16 +454,21 @@ DrawDiskSpaceMsgs(short vRefNum)
strcat( cmsg, ckb );
/* draw the disk space available string */
TEInsert( cmsg, strlen(cmsg), diskSpaceMsgH );
TEUpdate( &viewRect, diskSpaceMsgH );
TEInsert( cmsg, strlen(cmsg), dsAvailH );
TEUpdate( &viewRect, dsAvailH );
/* recycle msg pointer and handle */
TEDispose(diskSpaceMsgH);
/* recycle msg pointer */
DisposePtr((char*)cmsg);
SetRect( &viewRect, instDescBox.right - 150, instDescBox.bottom + 2,
instDescBox.right, instDescBox.bottom + 12 );
diskSpaceMsgH = TENew( &viewRect, &viewRect );
dsNeededH = NULL;
dsNeededH = TENew( &viewRect, &viewRect );
if (!dsNeededH)
{
ErrorHandler();
return;
}
/* Get the "Disk Space Needed: " string */
GetIndString( msg, rStringList, sDiskSpcNeeded );
@ -452,14 +484,22 @@ DrawDiskSpaceMsgs(short vRefNum)
strcat( cmsg, ckb );
/* draw the disk space available string */
TEInsert( cmsg, strlen(cmsg), diskSpaceMsgH );
TEUpdate( &viewRect, diskSpaceMsgH );
TEInsert( cmsg, strlen(cmsg), dsNeededH );
TEUpdate( &viewRect, dsNeededH );
DisposePtr((char*)ckb);
free(cSpaceNeeded); // malloc'd, not NewPtrClear'd
free(cfreeSpace); // malloc'd, not NewPtrClear'd
DisposePtr((char*)cmsg);
TEDispose(diskSpaceMsgH);
if (dsAvailH)
TEDispose(dsAvailH);
if (dsNeededH)
TEDispose(dsNeededH);
if (ckb)
DisposePtr((Ptr)ckb);
if (cSpaceNeeded)
free(cSpaceNeeded); // malloc'd, not NewPtrClear'd
if (cfreeSpace)
free(cfreeSpace); // malloc'd, not NewPtrClear'd
if (cmsg)
DisposePtr((Ptr)cmsg);
TextFont(systemFont);
TextSize(12);
}
@ -492,9 +532,18 @@ ClearDiskSpaceMsgs(void)
{
Rect instDescBox, viewRect;
Handle instDescRectH;
OSErr reserr;
instDescRectH = NULL;
instDescRectH = Get1Resource('RECT', rCompListBox);
HLockHi(instDescRectH);
reserr = ResError();
if (reserr!=noErr || !instDescRectH)
{
ErrorHandler();
return;
}
HLock(instDescRectH);
instDescBox = (Rect) **((Rect**)instDescRectH);
SetRect( &viewRect, instDescBox.left, instDescBox.bottom + 2,
instDescBox.right, instDescBox.bottom + 12 );

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

@ -96,20 +96,22 @@ UpdateTerminalWin(void)
void
InTerminalContent(EventRecord* evt, WindowPtr wCurrPtr)
{
Point localPt;
Rect r;
Point localPt;
Rect r;
ControlPartCode part;
ThreadID tid;
GrafPtr oldPort;
ThreadID tid;
GrafPtr oldPort;
GetPort(&oldPort);
SetPort(wCurrPtr);
localPt = evt->where;
GlobalToLocal( &localPt);
HLockHi((Handle)gControls->backB);
r = (**(gControls->backB)).contrlRect;
HLock((Handle)gControls->backB);
SetRect(&r, (**(gControls->backB)).contrlRect.left,
(**(gControls->backB)).contrlRect.top,
(**(gControls->backB)).contrlRect.right,
(**(gControls->backB)).contrlRect.bottom);
HUnlock((Handle)gControls->backB);
if (PtInRect( localPt, &r))
{
@ -137,8 +139,11 @@ InTerminalContent(EventRecord* evt, WindowPtr wCurrPtr)
}
}
HLockHi((Handle)gControls->nextB);
r = (**(gControls->nextB)).contrlRect;
HLock((Handle)gControls->nextB);
SetRect(&r, (**(gControls->nextB)).contrlRect.left,
(**(gControls->nextB)).contrlRect.top,
(**(gControls->nextB)).contrlRect.right,
(**(gControls->nextB)).contrlRect.bottom);
HUnlock((Handle)gControls->nextB);
if (PtInRect( localPt, &r))
{
@ -158,7 +163,8 @@ SpawnSDThread(ThreadEntryProcPtr threadProc, ThreadID *tid)
OSErr err;
err = NewThread(kCooperativeThread, (ThreadEntryProcPtr)threadProc, (void*) nil,
20000, kCreateIfNeeded, (void**)nil, tid);
0, kCreateIfNeeded, (void**)nil, tid);
// ^---- 0 means gimme the default stack size from Thread Manager
if (err == noErr)
YieldToThread(*tid); /* force ctx switch */
else

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

@ -59,8 +59,11 @@ if (NS_FAILED(rv)) \
return rv; \
}
/* XXX temporary... */
#ifdef DEBUG
#define XPISTUB_DLL "\pxpistubDebug.shlb"
#else
#define XPISTUB_DLL "\pxpistub.shlb"
#endif
void
@ -99,9 +102,9 @@ RunAllXPIs(short vRefNum, long dirID)
err = FSMakeFSSpec(vRefNum, dirID, "\pmozilla.jar", &xpiSpec);
err = FSMakeFSSpec(vRefNum, dirID, 0, &tgtDirSpec);
if (err==noErr)
err = RunXPI(xpiSpec, tgtDirSpec);
err = RunXPI(xpiSpec, tgtDirSpec);
else
ErrorHandler();
ErrorHandler();
return err;
}