Bug 242524 Component lists should hold references to real components (not "duplicates")
patch by ajschult@verizon.net r=bsmedberg sr=dveditz git-svn-id: svn://10.0.0.236/trunk@169589 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
d1db18ffb0
commit
f1fdaa5423
@ -48,7 +48,6 @@ nsComponent::nsComponent() :
|
||||
mArchiveSize(0),
|
||||
mNextDependeeIdx(0),
|
||||
mAttributes(NO_ATTR),
|
||||
mNext(NULL),
|
||||
mIndex(-1),
|
||||
mRefCount(0),
|
||||
mDepRefCount(0),
|
||||
@ -82,7 +81,6 @@ nsComponent::Duplicate()
|
||||
nsComponent *zdup = new nsComponent();
|
||||
*zdup = *this;
|
||||
zdup->InitRefCount();
|
||||
zdup->InitNext();
|
||||
|
||||
return zdup;
|
||||
}
|
||||
@ -358,34 +356,6 @@ nsComponent::IsDownloadOnly()
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int
|
||||
nsComponent::SetNext(nsComponent *aComponent)
|
||||
{
|
||||
if (!aComponent)
|
||||
return E_PARAM;
|
||||
|
||||
mNext = aComponent;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
int
|
||||
nsComponent::InitNext()
|
||||
{
|
||||
mNext = NULL;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
nsComponent *
|
||||
nsComponent::GetNext()
|
||||
{
|
||||
if (mNext)
|
||||
return mNext;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int
|
||||
nsComponent::SetIndex(int aIndex)
|
||||
{
|
||||
|
||||
@ -84,9 +84,6 @@ public:
|
||||
int IsLaunchApp();
|
||||
int SetDownloadOnly();
|
||||
int IsDownloadOnly();
|
||||
int SetNext(nsComponent *aComponent);
|
||||
int InitNext();
|
||||
nsComponent *GetNext();
|
||||
int SetIndex(int aIndex);
|
||||
int GetIndex();
|
||||
int AddRef();
|
||||
@ -124,7 +121,6 @@ private:
|
||||
char *mDependees[MAX_COMPONENTS];
|
||||
int mNextDependeeIdx;
|
||||
int mAttributes;
|
||||
nsComponent *mNext;
|
||||
int mIndex;
|
||||
int mRefCount;
|
||||
int mDepRefCount;
|
||||
|
||||
@ -41,38 +41,38 @@
|
||||
#include "nsComponent.h"
|
||||
|
||||
nsComponentList::nsComponentList() :
|
||||
mHead(NULL),
|
||||
mTail(NULL),
|
||||
mNext(NULL),
|
||||
mHeadItem(NULL),
|
||||
mTailItem(NULL),
|
||||
mNextItem(NULL),
|
||||
mLength(0)
|
||||
{
|
||||
}
|
||||
|
||||
nsComponentList::~nsComponentList()
|
||||
{
|
||||
nsComponent *curr = mHead;
|
||||
nsComponent *next = NULL;
|
||||
nsComponentItem *currItem = mHeadItem;
|
||||
nsComponentItem *nextItem = NULL;
|
||||
|
||||
while (curr)
|
||||
while (currItem)
|
||||
{
|
||||
next = NULL;
|
||||
next = curr->GetNext();
|
||||
curr->Release();
|
||||
curr = next;
|
||||
nextItem = currItem->mNext;
|
||||
currItem->mComp->Release();
|
||||
delete currItem;
|
||||
currItem = nextItem;
|
||||
}
|
||||
|
||||
mHead = NULL;
|
||||
mTail = NULL;
|
||||
mHeadItem = NULL;
|
||||
mTailItem = NULL;
|
||||
mLength = 0;
|
||||
}
|
||||
|
||||
nsComponent *
|
||||
nsComponentList::GetHead()
|
||||
{
|
||||
if (mHead)
|
||||
if (mHeadItem)
|
||||
{
|
||||
mNext = mHead->GetNext();
|
||||
return mHead;
|
||||
mNextItem = mHeadItem->mNext;
|
||||
return mHeadItem->mComp;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@ -81,12 +81,12 @@ nsComponentList::GetHead()
|
||||
nsComponent *
|
||||
nsComponentList::GetNext()
|
||||
{
|
||||
nsComponent *curr = mNext;
|
||||
nsComponentItem *currItem = mNextItem;
|
||||
|
||||
if (mNext)
|
||||
if (mNextItem)
|
||||
{
|
||||
mNext = mNext->GetNext();
|
||||
return curr;
|
||||
mNextItem = mNextItem->mNext;
|
||||
return currItem->mComp;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@ -95,8 +95,8 @@ nsComponentList::GetNext()
|
||||
nsComponent *
|
||||
nsComponentList::GetTail()
|
||||
{
|
||||
if (mTail)
|
||||
return mTail;
|
||||
if (mTailItem)
|
||||
return mTailItem->mComp;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@ -111,16 +111,16 @@ int
|
||||
nsComponentList::GetLengthVisible()
|
||||
{
|
||||
int numVisible = 0;
|
||||
nsComponent *curr;
|
||||
nsComponentItem *currItem;
|
||||
|
||||
curr = mHead;
|
||||
if (!curr) return 0;
|
||||
currItem = mHeadItem;
|
||||
if (!currItem) return 0;
|
||||
|
||||
while (curr)
|
||||
while (currItem)
|
||||
{
|
||||
if (!curr->IsInvisible())
|
||||
if (!currItem->mComp->IsInvisible())
|
||||
numVisible++;
|
||||
curr = curr->GetNext();
|
||||
currItem = currItem->mNext;
|
||||
}
|
||||
|
||||
return numVisible;
|
||||
@ -130,23 +130,16 @@ int
|
||||
nsComponentList::GetLengthSelected()
|
||||
{
|
||||
int numSelected = 0;
|
||||
nsComponent *curr;
|
||||
nsComponentItem *currItem;
|
||||
|
||||
/* NOTE:
|
||||
* ----
|
||||
* If copies of components are help by this list rather than pointers
|
||||
* then this method will return an inaccurate number. Due to
|
||||
* architecture be very careful when using this method.
|
||||
*/
|
||||
currItem = mHeadItem;
|
||||
if (!currItem) return 0;
|
||||
|
||||
curr = mHead;
|
||||
if (!curr) return 0;
|
||||
|
||||
while (curr)
|
||||
while (currItem)
|
||||
{
|
||||
if (!curr->IsSelected())
|
||||
if (currItem->mComp->IsSelected())
|
||||
numSelected++;
|
||||
curr = curr->GetNext();
|
||||
currItem = currItem->mNext;
|
||||
}
|
||||
|
||||
return numSelected;
|
||||
@ -158,26 +151,26 @@ nsComponentList::AddComponent(nsComponent *aComponent)
|
||||
if (!aComponent)
|
||||
return E_PARAM;
|
||||
|
||||
// empty list: head and tail are the same -- the new comp
|
||||
if (!mHead)
|
||||
aComponent->AddRef();
|
||||
aComponent->SetIndex(mLength);
|
||||
nsComponentItem *newItem
|
||||
= (nsComponentItem *) malloc(sizeof(nsComponentItem));
|
||||
newItem->mComp = aComponent;
|
||||
newItem->mNext = NULL;
|
||||
mLength++;
|
||||
|
||||
if (mHeadItem)
|
||||
{
|
||||
mHead = aComponent;
|
||||
mHead->InitNext();
|
||||
mTail = mHead;
|
||||
aComponent->AddRef();
|
||||
mLength = 1;
|
||||
mHead->SetIndex(0);
|
||||
|
||||
return OK;
|
||||
// non-empty list: the new comp is tacked on then end
|
||||
mTailItem->mNext = newItem;
|
||||
}
|
||||
else
|
||||
{
|
||||
// empty list: head and tail are the new comp
|
||||
mHeadItem = newItem;
|
||||
}
|
||||
|
||||
// non-empty list: the new comp is tacked on and tail is updated
|
||||
mTail->SetNext(aComponent);
|
||||
mTail = aComponent;
|
||||
mTail->InitNext();
|
||||
aComponent->AddRef();
|
||||
mLength++;
|
||||
mTail->SetIndex(mLength - 1);
|
||||
mTailItem = newItem;
|
||||
|
||||
return OK;
|
||||
}
|
||||
@ -185,61 +178,65 @@ nsComponentList::AddComponent(nsComponent *aComponent)
|
||||
int
|
||||
nsComponentList::RemoveComponent(nsComponent *aComponent)
|
||||
{
|
||||
int err = OK;
|
||||
nsComponent *curr = GetHead();
|
||||
nsComponent *last = NULL;
|
||||
nsComponentItem *currItem = mHeadItem;
|
||||
nsComponentItem *last = NULL;
|
||||
|
||||
if (!aComponent)
|
||||
return E_PARAM;
|
||||
|
||||
while (curr)
|
||||
while (currItem)
|
||||
{
|
||||
if (aComponent == curr)
|
||||
if (aComponent == currItem->mComp)
|
||||
{
|
||||
// remove and link last to next while deleting current
|
||||
if (last)
|
||||
{
|
||||
last->SetNext(curr->GetNext());
|
||||
last->mNext = currItem->mNext;
|
||||
}
|
||||
else
|
||||
{
|
||||
mHead = curr->GetNext();
|
||||
if (mTail == curr)
|
||||
mTail = NULL;
|
||||
mHeadItem = currItem->mNext;
|
||||
}
|
||||
|
||||
if (mTailItem == currItem)
|
||||
mTailItem = NULL;
|
||||
if (mNextItem == currItem)
|
||||
mNextItem = mNextItem->mNext;
|
||||
|
||||
aComponent->Release();
|
||||
mLength--;
|
||||
|
||||
|
||||
return OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
// move on to next
|
||||
last = curr;
|
||||
curr = GetNext();
|
||||
last = currItem;
|
||||
currItem = currItem->mNext;
|
||||
}
|
||||
}
|
||||
|
||||
return err;
|
||||
return E_PARAM;
|
||||
}
|
||||
|
||||
nsComponent *
|
||||
nsComponentList::GetCompByIndex(int aIndex)
|
||||
{
|
||||
nsComponent *comp = GetHead();
|
||||
nsComponentItem *currItem = mHeadItem;
|
||||
int i;
|
||||
|
||||
// param check
|
||||
if (!comp || mLength == 0) return NULL;
|
||||
if (!currItem || mLength == 0) return NULL;
|
||||
|
||||
for (i=0; i<mLength; i++)
|
||||
{
|
||||
if (aIndex == comp->GetIndex())
|
||||
return comp;
|
||||
if (aIndex == currItem->mComp->GetIndex())
|
||||
{
|
||||
return currItem->mComp;
|
||||
}
|
||||
|
||||
comp = GetNext();
|
||||
if (!comp) break;
|
||||
currItem = currItem->mNext;
|
||||
if (!currItem) break;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@ -248,19 +245,21 @@ nsComponentList::GetCompByIndex(int aIndex)
|
||||
nsComponent *
|
||||
nsComponentList::GetCompByArchive(char *aArchive)
|
||||
{
|
||||
nsComponent *comp = GetHead();
|
||||
nsComponentItem *currItem = mHeadItem;
|
||||
int i;
|
||||
|
||||
// param check
|
||||
if (!comp || mLength == 0 || !aArchive) return NULL;
|
||||
if (!currItem || mLength == 0 || !aArchive) return NULL;
|
||||
|
||||
for (i=0; i<mLength; i++)
|
||||
{
|
||||
if (0==strncmp(aArchive, comp->GetArchive(), strlen(aArchive)))
|
||||
return comp;
|
||||
if (0==strncmp(aArchive, currItem->mComp->GetArchive(), strlen(aArchive)))
|
||||
{
|
||||
return currItem->mComp;
|
||||
}
|
||||
|
||||
comp = GetNext();
|
||||
if (!comp) break;
|
||||
currItem = currItem->mNext;
|
||||
if (!currItem) break;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@ -269,20 +268,22 @@ nsComponentList::GetCompByArchive(char *aArchive)
|
||||
nsComponent *
|
||||
nsComponentList::GetCompByShortDesc(char *aShortDesc)
|
||||
{
|
||||
nsComponent *comp = GetHead();
|
||||
nsComponentItem *currItem = mHeadItem;
|
||||
int i;
|
||||
|
||||
// param check
|
||||
if (!comp || mLength == 0 || !aShortDesc) return NULL;
|
||||
if (!currItem || mLength == 0 || !aShortDesc) return NULL;
|
||||
|
||||
for (i=0; i<mLength; i++)
|
||||
{
|
||||
if (0==strncmp(aShortDesc, comp->GetDescShort(),
|
||||
if (0==strncmp(aShortDesc, currItem->mComp->GetDescShort(),
|
||||
strlen(aShortDesc)))
|
||||
return comp;
|
||||
{
|
||||
return currItem->mComp;
|
||||
}
|
||||
|
||||
comp = GetNext();
|
||||
if (!comp) break;
|
||||
currItem = currItem->mNext;
|
||||
if (!currItem) break;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@ -292,18 +293,20 @@ nsComponent *
|
||||
nsComponentList::GetFirstVisible()
|
||||
{
|
||||
int i;
|
||||
nsComponent *comp = GetHead();
|
||||
nsComponentItem *currItem = mHeadItem;
|
||||
|
||||
// param check
|
||||
if (mLength == 0) return NULL;
|
||||
|
||||
for (i=0; i<mLength; i++)
|
||||
{
|
||||
if (!comp->IsInvisible())
|
||||
return comp;
|
||||
if (!currItem->mComp->IsInvisible())
|
||||
{
|
||||
return currItem->mComp;
|
||||
}
|
||||
|
||||
comp = GetNext();
|
||||
if (!comp) break;
|
||||
currItem = currItem->mNext;
|
||||
if (!currItem) break;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
||||
@ -172,9 +172,15 @@ public:
|
||||
nsComponent *GetFirstVisible();
|
||||
|
||||
private:
|
||||
nsComponent *mHead;
|
||||
nsComponent *mTail;
|
||||
nsComponent *mNext;
|
||||
typedef struct _nsComponentItem
|
||||
{
|
||||
nsComponent *mComp;
|
||||
struct _nsComponentItem *mNext;
|
||||
} nsComponentItem;
|
||||
|
||||
nsComponentItem *mHeadItem;
|
||||
nsComponentItem *mTailItem;
|
||||
nsComponentItem *mNextItem;
|
||||
int mLength;
|
||||
};
|
||||
|
||||
|
||||
@ -355,7 +355,7 @@ nsComponentsDlg::Show()
|
||||
currRow++;
|
||||
}
|
||||
|
||||
currComp = currComp->GetNext();
|
||||
currComp = sCustomST->GetComponents()->GetNext();
|
||||
}
|
||||
|
||||
// by default, first row selected upon Show()
|
||||
@ -556,7 +556,7 @@ nsComponentsDlg::ToggleRowSelection(GtkWidget *aWidget, gint aRow,
|
||||
}
|
||||
currRow++;
|
||||
}
|
||||
currComp = currComp->GetNext();
|
||||
currComp = sCustomST->GetComponents()->GetNext();
|
||||
}
|
||||
|
||||
// after resolving dependees redraw all checkboxes in one fell swoop
|
||||
@ -578,6 +578,6 @@ nsComponentsDlg::ToggleRowSelection(GtkWidget *aWidget, gint aRow,
|
||||
}
|
||||
currRow++;
|
||||
}
|
||||
currComp = currComp->GetNext();
|
||||
currComp = sCustomST->GetComponents()->GetNext();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1446,7 +1446,7 @@ nsInstallDlg::TotalDLSize()
|
||||
total += (archiveSize - currentSize);
|
||||
}
|
||||
}
|
||||
currComp = currComp->GetNext();
|
||||
currComp = comps->GetNext();
|
||||
}
|
||||
|
||||
return total;
|
||||
|
||||
@ -168,7 +168,6 @@ nsSetupTypeDlg::Parse(nsINIParser *aParser)
|
||||
char *currFile = NULL, *currMsg = NULL;
|
||||
nsLegacyCheck *currLC = NULL, *nextLC = NULL;
|
||||
nsComponent *currComp = NULL;
|
||||
nsComponent *currCompDup = NULL;
|
||||
int currIndex;
|
||||
int currNumComps = 0;
|
||||
|
||||
@ -340,8 +339,7 @@ nsSetupTypeDlg::Parse(nsINIParser *aParser)
|
||||
if (currComp)
|
||||
{
|
||||
// preserve next ptr
|
||||
currCompDup = currComp->Duplicate();
|
||||
currST->SetComponent(currCompDup);
|
||||
currST->SetComponent(currComp);
|
||||
currNumComps++;
|
||||
}
|
||||
}
|
||||
@ -1177,7 +1175,7 @@ nsSetupTypeDlg::DSRequired(void)
|
||||
dsReqd += currComp->GetArchiveSize();
|
||||
}
|
||||
|
||||
currComp = currComp->GetNext();
|
||||
currComp = comps->GetNext();
|
||||
}
|
||||
|
||||
return dsReqd;
|
||||
|
||||
@ -101,8 +101,7 @@ nsXIEngine::Download(int aCustom, nsComponentList *aComps)
|
||||
return E_PARAM;
|
||||
|
||||
int err = OK;
|
||||
nsComponent *currComp = aComps->GetHead(), *markedComp = NULL;
|
||||
nsComponent *currCompSave;
|
||||
nsComponent *currComp = NULL, *markedComp = NULL;
|
||||
char *currURL = NULL;
|
||||
char *currHost = NULL;
|
||||
char *currPath = NULL;
|
||||
@ -115,18 +114,15 @@ nsXIEngine::Download(int aCustom, nsComponentList *aComps)
|
||||
struct stat stbuf;
|
||||
int resPos = 0;
|
||||
int fileSize = 0;
|
||||
int currCompNum = 1, markedCompNum = 0;
|
||||
int currCompNum = 1;
|
||||
int numToDL = 0; // num xpis to download
|
||||
int passCount;
|
||||
CONN myConn;
|
||||
|
||||
err = GetDLMarkedComp(aComps, aCustom, &markedComp, &markedCompNum);
|
||||
err = GetDLMarkedComp(aComps, &markedComp);
|
||||
if (err == OK && markedComp)
|
||||
{
|
||||
currComp = markedComp;
|
||||
currCompNum = markedCompNum;
|
||||
sprintf(localPath, "%s/%s", XPI_DIR, currComp->GetArchive());
|
||||
currComp->SetResumePos(GetFileSize(localPath));
|
||||
sprintf(localPath, "%s/%s", XPI_DIR, markedComp->GetArchive());
|
||||
markedComp->SetResumePos(GetFileSize(localPath));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -145,14 +141,14 @@ nsXIEngine::Download(int aCustom, nsComponentList *aComps)
|
||||
|
||||
numToDL = TotalToDownload(aCustom, aComps);
|
||||
|
||||
currComp = aComps->GetHead();
|
||||
|
||||
myConn.URL = (char *) NULL;
|
||||
myConn.type = TYPE_UNDEF;
|
||||
|
||||
crcPass = 0;
|
||||
currCompSave = currComp;
|
||||
bDone = 0;
|
||||
while ( bDone == 0 && crcPass < MAXCRC ) {
|
||||
passCount = 0;
|
||||
while (currComp)
|
||||
{
|
||||
if ( (aCustom == TRUE && currComp->IsSelected()) || (aCustom == FALSE) )
|
||||
@ -160,7 +156,7 @@ nsXIEngine::Download(int aCustom, nsComponentList *aComps)
|
||||
// in case we are resuming inter- or intra-installer session
|
||||
if (currComp->IsDownloaded())
|
||||
{
|
||||
currComp = currComp->GetNext();
|
||||
currComp = aComps->GetNext();
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -327,7 +323,6 @@ nsXIEngine::Download(int aCustom, nsComponentList *aComps)
|
||||
else
|
||||
err = conn->Get(srvPath, localPath, nsFTPConn::BINARY,
|
||||
resPos, 1, nsInstallDlg::DownloadCB);
|
||||
passCount++;
|
||||
}
|
||||
|
||||
XI_IF_FREE(currHost);
|
||||
@ -385,28 +380,22 @@ nsXIEngine::Download(int aCustom, nsComponentList *aComps)
|
||||
}
|
||||
}
|
||||
|
||||
currComp = currComp->GetNext();
|
||||
currComp = aComps->GetNext();
|
||||
}
|
||||
|
||||
CheckConn( "", TYPE_UNDEF, &myConn, true );
|
||||
|
||||
bDone = CRCCheckDownloadedArchives(XPI_DIR, strlen(XPI_DIR),
|
||||
currCompSave, passCount, aCustom);
|
||||
aComps, aCustom);
|
||||
crcPass++;
|
||||
if ( bDone == 0 && crcPass < MAXCRC ) {
|
||||
// reset ourselves
|
||||
if (markedComp) {
|
||||
currComp = markedComp;
|
||||
currCompNum = markedCompNum;
|
||||
} else {
|
||||
currComp = aComps->GetHead();
|
||||
currCompNum = 1;
|
||||
}
|
||||
currCompSave = currComp;
|
||||
numToDL = TotalToDownload(aCustom, aComps);
|
||||
currComp = aComps->GetHead();
|
||||
currCompNum = 1;
|
||||
if (gCtx->opt->mMode != nsXIOptions::MODE_SILENT)
|
||||
gCtx->idlg->ReInitUI();
|
||||
gCtx->idlg->ShowCRCDlg();
|
||||
numToDL = TotalToDownload(aCustom, aComps);
|
||||
}
|
||||
}
|
||||
gCtx->idlg->DestroyCRCDlg(); // destroy the CRC dialog if showing
|
||||
@ -564,7 +553,7 @@ nsXIEngine::Install(int aCustom, nsComponentList *aComps, char *aDestination)
|
||||
}
|
||||
}
|
||||
|
||||
currComp = currComp->GetNext();
|
||||
currComp = aComps->GetNext();
|
||||
}
|
||||
UnloadXPIStub(&stub);
|
||||
}
|
||||
@ -787,7 +776,7 @@ nsXIEngine::ExistAllXPIs(int aCustom, nsComponentList *aComps, int *aTotal)
|
||||
(*aTotal)++;
|
||||
}
|
||||
|
||||
currComp = currComp->GetNext();
|
||||
currComp = aComps->GetNext();
|
||||
}
|
||||
|
||||
return bAllExist;
|
||||
@ -819,7 +808,7 @@ nsXIEngine::DeleteXPIs(int aCustom, nsComponentList *aComps)
|
||||
#endif
|
||||
}
|
||||
|
||||
currComp = currComp->GetNext();
|
||||
currComp = aComps->GetNext();
|
||||
}
|
||||
|
||||
// all xpi should be deleted so delete the ./xpi dir
|
||||
@ -886,17 +875,15 @@ nsXIEngine::SetDLMarker(char *aCompName)
|
||||
}
|
||||
|
||||
int
|
||||
nsXIEngine::GetDLMarkedComp(nsComponentList *aComps, int aCustom,
|
||||
nsComponent **aOutComp, int *aOutCompNum)
|
||||
nsXIEngine::GetDLMarkedComp(nsComponentList *aComps, nsComponent **aOutComp)
|
||||
{
|
||||
int rv = OK;
|
||||
FILE *dlMarkerFD = NULL;
|
||||
struct stat stbuf;
|
||||
char *compNameInFile = NULL;
|
||||
int compNum = 1;
|
||||
nsComponent *currComp = NULL;
|
||||
|
||||
if (!aComps || !aOutComp || !aOutCompNum)
|
||||
if (!aComps || !aOutComp)
|
||||
return E_PARAM;
|
||||
|
||||
*aOutComp = NULL;
|
||||
@ -941,24 +928,16 @@ nsXIEngine::GetDLMarkedComp(nsComponentList *aComps, int aCustom,
|
||||
// compare the comp name read in with all those in the components list
|
||||
while (currComp)
|
||||
{
|
||||
if ( (aCustom == TRUE && currComp->IsSelected()) ||
|
||||
(aCustom == FALSE) )
|
||||
if (strcmp(currComp->GetArchive(), compNameInFile) == 0)
|
||||
{
|
||||
if (strcmp(currComp->GetArchive(), compNameInFile) == 0)
|
||||
{
|
||||
*aOutComp = currComp;
|
||||
break;
|
||||
}
|
||||
|
||||
compNum++;
|
||||
*aOutComp = currComp;
|
||||
break;
|
||||
}
|
||||
|
||||
currComp = currComp->GetNext();
|
||||
|
||||
currComp = aComps->GetNext();
|
||||
}
|
||||
}
|
||||
|
||||
*aOutCompNum = compNum;
|
||||
|
||||
BAIL:
|
||||
if (dlMarkerFD)
|
||||
fclose(dlMarkerFD);
|
||||
@ -991,7 +970,7 @@ nsXIEngine::TotalToDownload(int aCustom, nsComponentList *aComps)
|
||||
if (!currComp->IsDownloaded())
|
||||
total++;
|
||||
}
|
||||
currComp = currComp->GetNext();
|
||||
currComp = aComps->GetNext();
|
||||
}
|
||||
|
||||
return total;
|
||||
@ -1018,11 +997,13 @@ nsXIEngine::TotalToDownload(int aCustom, nsComponentList *aComps)
|
||||
|
||||
PRBool
|
||||
nsXIEngine::CRCCheckDownloadedArchives(char *dlPath, short dlPathlen,
|
||||
nsComponent *currComp, int count, int aCustom)
|
||||
nsComponentList *aComps, int aCustom)
|
||||
{
|
||||
int i;
|
||||
PRBool isClean;
|
||||
char buf[ 1024 ];
|
||||
nsComponent *currComp = aComps->GetHead();
|
||||
int numComps = aCustom ? aComps->GetLengthSelected() : aComps->GetLength();
|
||||
|
||||
isClean = PR_TRUE;
|
||||
|
||||
@ -1031,15 +1012,17 @@ nsXIEngine::CRCCheckDownloadedArchives(char *dlPath, short dlPathlen,
|
||||
buf[ dlPathlen ] = '\0';
|
||||
strcat( buf, "/" );
|
||||
strcat( buf, currComp->GetArchive() );
|
||||
if (gCtx->opt->mMode != nsXIOptions::MODE_SILENT)
|
||||
nsInstallDlg::MajorProgressCB(buf, i, count, nsInstallDlg::ACT_INSTALL);
|
||||
if (gCtx->opt->mMode != nsXIOptions::MODE_SILENT) {
|
||||
nsInstallDlg::MajorProgressCB(buf, i, numComps,
|
||||
nsInstallDlg::ACT_INSTALL);
|
||||
}
|
||||
if (((aCustom == TRUE && currComp->IsSelected()) ||
|
||||
(aCustom == FALSE)) && IsArchiveFile(buf) == PR_TRUE &&
|
||||
(aCustom == FALSE)) && IsArchiveFile(buf) == TRUE &&
|
||||
VerifyArchive( buf ) != ZIP_OK) {
|
||||
currComp->SetDownloaded(FALSE); // VerifyArchive has unlinked it
|
||||
isClean = false;
|
||||
isClean = PR_FALSE;
|
||||
}
|
||||
currComp = currComp->GetNext();
|
||||
currComp = aComps->GetNext();
|
||||
}
|
||||
return isClean;
|
||||
}
|
||||
|
||||
@ -128,12 +128,11 @@ private:
|
||||
int UnloadXPIStub(xpistub_t *aStub);
|
||||
int GetFileSize(char *aPath);
|
||||
int SetDLMarker(char *aCompName);
|
||||
int GetDLMarkedComp(nsComponentList *aComps, int aCustom,
|
||||
nsComponent **aOutComp, int *aOutCompNum);
|
||||
int GetDLMarkedComp(nsComponentList *aComps, nsComponent **aOutComp);
|
||||
int DelDLMarker();
|
||||
int TotalToDownload(int aCustom, nsComponentList *aComps);
|
||||
PRBool CRCCheckDownloadedArchives(char *dlPath, short dlPathLen,
|
||||
nsComponent *currComp, int count, int aCustom);
|
||||
nsComponentList *aComps, int aCustom);
|
||||
PRBool IsArchiveFile(char *path);
|
||||
int VerifyArchive(char *szArchive);
|
||||
PRBool CheckConn( char *URL, int type, CONN *myConn, PRBool force );
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user