From 1274fb2bbb2ebcb2a72731ee436e273dce9ef6c8 Mon Sep 17 00:00:00 2001 From: "bmlk%gmx.de" Date: Tue, 11 Mar 2003 13:33:19 +0000 Subject: [PATCH] compiler warning fix, bug 167659, orig. patch by caillon, r=jkeiser, sr=dbaron git-svn-id: svn://10.0.0.236/trunk@139277 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/html/table/src/nsCellMap.cpp | 97 ++++++++++++++++----- mozilla/layout/tables/nsCellMap.cpp | 97 ++++++++++++++++----- 2 files changed, 146 insertions(+), 48 deletions(-) diff --git a/mozilla/layout/html/table/src/nsCellMap.cpp b/mozilla/layout/html/table/src/nsCellMap.cpp index 4b0d9e99b0b..ec69975fe07 100644 --- a/mozilla/layout/html/table/src/nsCellMap.cpp +++ b/mozilla/layout/html/table/src/nsCellMap.cpp @@ -106,8 +106,6 @@ nsTableCellMap::~nsTableCellMap() { MOZ_COUNT_DTOR(nsTableCellMap); - PRInt32 rowCount = GetRowCount(); - nsCellMap* cellMap = mFirstMap; while (cellMap) { nsCellMap* next = cellMap->GetNextSibling(); @@ -134,18 +132,20 @@ nsTableCellMap::GetRightMostBorder(PRInt32 aRowIndex) { if (!mBCInfo) ABORT1(nsnull); - BCData* bcData; - PRInt32 numRows = mBCInfo->mRightBorders.Count(); if (aRowIndex < numRows) { - bcData = (BCData*)mBCInfo->mRightBorders.ElementAt(aRowIndex); - } - else { - for (PRInt32 rowX = numRows; rowX <= aRowIndex; rowX++) { - bcData = new BCData(); if (!bcData) ABORT1(nsnull); - mBCInfo->mRightBorders.AppendElement(bcData); - } + return (BCData*)mBCInfo->mRightBorders.ElementAt(aRowIndex); } + + BCData* bcData; + PRInt32 rowX = numRows; + + do { + bcData = new BCData(); + if (!bcData) ABORT1(nsnull); + mBCInfo->mRightBorders.AppendElement(bcData); + } while (++rowX <= aRowIndex); + return bcData; } @@ -155,18 +155,20 @@ nsTableCellMap::GetBottomMostBorder(PRInt32 aColIndex) { if (!mBCInfo) ABORT1(nsnull); - BCData* bcData; - PRInt32 numCols = mBCInfo->mBottomBorders.Count(); if (aColIndex < numCols) { - bcData = (BCData*)mBCInfo->mBottomBorders.ElementAt(aColIndex); - } - else { - for (PRInt32 colX = numCols; colX <= aColIndex; colX++) { - bcData = new BCData(); if (!bcData) ABORT1(nsnull); - mBCInfo->mBottomBorders.AppendElement(bcData); - } + return (BCData*)mBCInfo->mBottomBorders.ElementAt(aColIndex); } + + BCData* bcData; + PRInt32 colX = numCols; + + do { + bcData = new BCData(); + if (!bcData) ABORT1(nsnull); + mBCInfo->mBottomBorders.AppendElement(bcData); + } while (++colX <= aColIndex); + return bcData; } @@ -661,6 +663,53 @@ nsTableCellMap::Dump(char* aString) const cellMap->Dump(nsnull != mBCInfo); cellMap = cellMap->GetNextSibling(); } + if (nsnull != mBCInfo) { + printf("***** bottom borders *****\n"); + nscoord size; + BCBorderOwner owner; + PRUint8 side; + PRBool segStart; + PRPackedBool bevel; + PRInt32 colIndex; + PRInt32 numCols = mBCInfo->mBottomBorders.Count(); + for (PRInt32 i = 0; i <= 2; i++) { + + printf("\n "); + for (colIndex = 0; colIndex < numCols; colIndex++) { + BCData* cd = (BCData*)mBCInfo->mBottomBorders.ElementAt(colIndex);; + if (cd) { + if (0 == i) { + size = cd->GetTopEdge(owner, segStart); + printf("t=%d%X%d ", size, owner, segStart); + } + else if (1 == i) { + size = cd->GetLeftEdge(owner, segStart); + printf("l=%d%X%d ", size, owner, segStart); + } + else { + size = cd->GetCorner(side, bevel); + printf("c=%d%X%d ", size, side, bevel); + } + } + } + BCData* cd = &mBCInfo->mLowerRightCorner; + if (cd) { + if (0 == i) { + size = cd->GetTopEdge(owner, segStart); + printf("t=%d%X%d ", size, owner, segStart); + } + else if (1 == i) { + size = cd->GetLeftEdge(owner, segStart); + printf("l=%d%X%d ", size, owner, segStart); + } + else { + size = cd->GetCorner(side, bevel); + printf("c=%d%X%d ", size, side, bevel); + } + } + } + printf("\n"); + } printf("***** END TABLE CELL MAP DUMP *****\n"); } #endif @@ -760,12 +809,12 @@ nsTableCellMap::GetBCData(PRUint8 aSide, // try the next row group nsCellMap* cellMap = aCellMap.GetNextSibling(); if (cellMap) { - cellData = (BCCellData*)cellMap->GetDataAt(*this, aRowIndex, aColIndex, PR_FALSE); + cellData = (BCCellData*)cellMap->GetDataAt(*this, 0, aColIndex, PR_FALSE); if (cellData) { bcData = &cellData->mData; } else { - BCData* bcData = GetBottomMostBorder(aColIndex); + bcData = GetBottomMostBorder(aColIndex); } } } @@ -779,7 +828,7 @@ nsTableCellMap::GetBCData(PRUint8 aSide, } else { NS_ASSERTION(aSide == NS_SIDE_RIGHT, "program error"); - BCData* bcData = GetRightMostBorder(aRowIndex); + bcData = GetRightMostBorder(aRowIndex); } break; } @@ -1457,7 +1506,7 @@ void nsCellMap::ExpandWithCells(nsTableCellMap& aMap, { PRInt32 endRowIndex = aRowIndex + aRowSpan - 1; PRInt32 startColIndex = aColIndex; - PRInt32 endColIndex; + PRInt32 endColIndex = aColIndex; PRInt32 numCells = aCellFrames.Count(); PRInt32 totalColSpan = 0; diff --git a/mozilla/layout/tables/nsCellMap.cpp b/mozilla/layout/tables/nsCellMap.cpp index 4b0d9e99b0b..ec69975fe07 100644 --- a/mozilla/layout/tables/nsCellMap.cpp +++ b/mozilla/layout/tables/nsCellMap.cpp @@ -106,8 +106,6 @@ nsTableCellMap::~nsTableCellMap() { MOZ_COUNT_DTOR(nsTableCellMap); - PRInt32 rowCount = GetRowCount(); - nsCellMap* cellMap = mFirstMap; while (cellMap) { nsCellMap* next = cellMap->GetNextSibling(); @@ -134,18 +132,20 @@ nsTableCellMap::GetRightMostBorder(PRInt32 aRowIndex) { if (!mBCInfo) ABORT1(nsnull); - BCData* bcData; - PRInt32 numRows = mBCInfo->mRightBorders.Count(); if (aRowIndex < numRows) { - bcData = (BCData*)mBCInfo->mRightBorders.ElementAt(aRowIndex); - } - else { - for (PRInt32 rowX = numRows; rowX <= aRowIndex; rowX++) { - bcData = new BCData(); if (!bcData) ABORT1(nsnull); - mBCInfo->mRightBorders.AppendElement(bcData); - } + return (BCData*)mBCInfo->mRightBorders.ElementAt(aRowIndex); } + + BCData* bcData; + PRInt32 rowX = numRows; + + do { + bcData = new BCData(); + if (!bcData) ABORT1(nsnull); + mBCInfo->mRightBorders.AppendElement(bcData); + } while (++rowX <= aRowIndex); + return bcData; } @@ -155,18 +155,20 @@ nsTableCellMap::GetBottomMostBorder(PRInt32 aColIndex) { if (!mBCInfo) ABORT1(nsnull); - BCData* bcData; - PRInt32 numCols = mBCInfo->mBottomBorders.Count(); if (aColIndex < numCols) { - bcData = (BCData*)mBCInfo->mBottomBorders.ElementAt(aColIndex); - } - else { - for (PRInt32 colX = numCols; colX <= aColIndex; colX++) { - bcData = new BCData(); if (!bcData) ABORT1(nsnull); - mBCInfo->mBottomBorders.AppendElement(bcData); - } + return (BCData*)mBCInfo->mBottomBorders.ElementAt(aColIndex); } + + BCData* bcData; + PRInt32 colX = numCols; + + do { + bcData = new BCData(); + if (!bcData) ABORT1(nsnull); + mBCInfo->mBottomBorders.AppendElement(bcData); + } while (++colX <= aColIndex); + return bcData; } @@ -661,6 +663,53 @@ nsTableCellMap::Dump(char* aString) const cellMap->Dump(nsnull != mBCInfo); cellMap = cellMap->GetNextSibling(); } + if (nsnull != mBCInfo) { + printf("***** bottom borders *****\n"); + nscoord size; + BCBorderOwner owner; + PRUint8 side; + PRBool segStart; + PRPackedBool bevel; + PRInt32 colIndex; + PRInt32 numCols = mBCInfo->mBottomBorders.Count(); + for (PRInt32 i = 0; i <= 2; i++) { + + printf("\n "); + for (colIndex = 0; colIndex < numCols; colIndex++) { + BCData* cd = (BCData*)mBCInfo->mBottomBorders.ElementAt(colIndex);; + if (cd) { + if (0 == i) { + size = cd->GetTopEdge(owner, segStart); + printf("t=%d%X%d ", size, owner, segStart); + } + else if (1 == i) { + size = cd->GetLeftEdge(owner, segStart); + printf("l=%d%X%d ", size, owner, segStart); + } + else { + size = cd->GetCorner(side, bevel); + printf("c=%d%X%d ", size, side, bevel); + } + } + } + BCData* cd = &mBCInfo->mLowerRightCorner; + if (cd) { + if (0 == i) { + size = cd->GetTopEdge(owner, segStart); + printf("t=%d%X%d ", size, owner, segStart); + } + else if (1 == i) { + size = cd->GetLeftEdge(owner, segStart); + printf("l=%d%X%d ", size, owner, segStart); + } + else { + size = cd->GetCorner(side, bevel); + printf("c=%d%X%d ", size, side, bevel); + } + } + } + printf("\n"); + } printf("***** END TABLE CELL MAP DUMP *****\n"); } #endif @@ -760,12 +809,12 @@ nsTableCellMap::GetBCData(PRUint8 aSide, // try the next row group nsCellMap* cellMap = aCellMap.GetNextSibling(); if (cellMap) { - cellData = (BCCellData*)cellMap->GetDataAt(*this, aRowIndex, aColIndex, PR_FALSE); + cellData = (BCCellData*)cellMap->GetDataAt(*this, 0, aColIndex, PR_FALSE); if (cellData) { bcData = &cellData->mData; } else { - BCData* bcData = GetBottomMostBorder(aColIndex); + bcData = GetBottomMostBorder(aColIndex); } } } @@ -779,7 +828,7 @@ nsTableCellMap::GetBCData(PRUint8 aSide, } else { NS_ASSERTION(aSide == NS_SIDE_RIGHT, "program error"); - BCData* bcData = GetRightMostBorder(aRowIndex); + bcData = GetRightMostBorder(aRowIndex); } break; } @@ -1457,7 +1506,7 @@ void nsCellMap::ExpandWithCells(nsTableCellMap& aMap, { PRInt32 endRowIndex = aRowIndex + aRowSpan - 1; PRInt32 startColIndex = aColIndex; - PRInt32 endColIndex; + PRInt32 endColIndex = aColIndex; PRInt32 numCells = aCellFrames.Count(); PRInt32 totalColSpan = 0;