false alarm (short->int)

David Hyatt hyatt at apple.com
Fri Feb 27 02:42:13 CET 2004


Here's the remainder of the patch...

-------------- next part --------------
Index: ChangeLog
===================================================================
RCS file: /local/home/cvs/Labyrinth/WebCore/ChangeLog,v
retrieving revision 1.2544
diff -u -p -r1.2544 ChangeLog
--- ChangeLog	2004/02/27 00:44:41	1.2544
+++ ChangeLog	2004/02/27 01:22:47
@@ -1,3 +1,16 @@
+2004-02-26  David Hyatt  <hyatt at apple.com>
+
+	The bug for overflowing because of shorts is 3528839, and I missed a few overflow guards on tables
+	that can now be removed.
+	
+        * khtml/rendering/render_table.cpp:
+        (RenderTableSection::layoutRows):
+        * khtml/rendering/table_layout.cpp:
+        (FixedTableLayout::calcWidthArray):
+        (FixedTableLayout::calcMinMaxWidth):
+        (AutoTableLayout::recalcColumn):
+        (AutoTableLayout::calcMinMaxWidth):
+
 2004-02-26  Chris Blumenberg  <cblu at apple.com>
 
 	Fixed a few problems I found with reconstructed source while on my way to implementing "Mail Page".
Index: khtml/rendering/render_table.cpp
===================================================================
RCS file: /local/home/cvs/Labyrinth/WebCore/khtml/rendering/render_table.cpp,v
retrieving revision 1.97
diff -u -p -r1.97 khtml/rendering/render_table.cpp
--- khtml/rendering/render_table.cpp	2004/02/26 23:10:44	1.97
+++ khtml/rendering/render_table.cpp	2004/02/27 01:22:47
@@ -1227,7 +1227,7 @@ int RenderTableSection::layoutRows( int 
 	    int rh = rowPos[1]-rowPos[0];
 	    for ( int r = 0; r < totalRows; r++ ) {
 		if ( totalPercent > 0 && grid[r].height.type == Percent ) {
-		    int toAdd = QMIN(dh, (totalHeight * grid[r].height.value / 100)-rh);
+		    int toAdd = kMin(dh, (totalHeight * grid[r].height.value / 100)-rh);
                     // If toAdd is negative, then we don't want to shrink the row (this bug
                     // affected Outlook Web Access).
                     toAdd = QMAX(0, toAdd);
@@ -1672,7 +1672,6 @@ void RenderTableCell::calcWidth()
 
 void RenderTableCell::setWidth( int width )
 {
-    assert(width <= SHRT_MAX);
     if ( width != m_width ) {
 	m_width = width;
 	m_widthChanged = true;
Index: khtml/rendering/table_layout.cpp
===================================================================
RCS file: /local/home/cvs/Labyrinth/WebCore/khtml/rendering/table_layout.cpp,v
retrieving revision 1.18
diff -u -p -r1.18 khtml/rendering/table_layout.cpp
--- khtml/rendering/table_layout.cpp	2004/02/26 23:10:44	1.18
+++ khtml/rendering/table_layout.cpp	2004/02/27 01:22:48
@@ -119,7 +119,6 @@ int FixedTableLayout::calcWidthArray( in
 		int effWidth = 0;
 		if ( w.type == Fixed && w.value > 0 ) {
                     effWidth = w.value;
-		    effWidth = QMIN( effWidth, 32760 );
 		}
 #ifdef DEBUG_LAYOUT
 		qDebug("    col element: effCol=%d, span=%d: %d w=%d type=%d",
@@ -186,7 +185,6 @@ int FixedTableLayout::calcWidthArray( in
 		int effWidth = 0;
 		if ( (w.type == Fixed || w.type == Percent) && w.value > 0 ) {
                     effWidth = w.value;
-		    effWidth = QMIN( effWidth, 32760 );
 		}
 #ifdef DEBUG_LAYOUT
 		qDebug("    table cell: effCol=%d, span=%d: %d",  cCol, span, effWidth);
@@ -242,7 +240,7 @@ void FixedTableLayout::calcMinMaxWidth()
     int tableWidth = table->style()->width().type == Fixed ? table->style()->width().value - bs : 0;
     int mw = calcWidthArray( tableWidth ) + bs;
 
-    table->m_minWidth = kMin(kMax( mw, tableWidth ), 0x7fff);
+    table->m_minWidth = kMax(mw, tableWidth);
     table->m_maxWidth = table->m_minWidth;
     
     if ( !tableWidth ) {
@@ -253,8 +251,8 @@ void FixedTableLayout::calcMinMaxWidth()
 		break;
 	    }
 	}
-	if ( haveNonFixed )
-	    table->m_maxWidth = 0x7fff;
+	if (haveNonFixed)
+	    table->m_maxWidth = INT_MAX;
     }
 #ifdef DEBUG_LAYOUT
     qDebug("FixedTableLayout::calcMinMaxWidth: minWidth=%d, maxWidth=%d", table->m_minWidth, table->m_maxWidth );
@@ -411,8 +409,6 @@ void AutoTableLayout::recalcColumn( int 
 		    }
 
 		    Length w = cell->style()->width();
-		    if ( w.value > 32760 )
-			w.value = 32760;
 		    if ( w.value < 0 )
 			w.value = 0;
 		    switch( w.type ) {
@@ -615,8 +611,8 @@ void AutoTableLayout::calcMinMaxWidth()
 	maxWidth = minWidth;
     }
 
-    table->m_maxWidth = kMin(maxWidth, 0x7fff);
-    table->m_minWidth = kMin(minWidth, 0x7fff);
+    table->m_maxWidth = maxWidth;
+    table->m_minWidth = minWidth;
 #ifdef DEBUG_LAYOUT
     qDebug("    minWidth=%d, maxWidth=%d", table->m_minWidth, table->m_maxWidth );
 #endif
-------------- next part --------------


dave


More information about the Khtml-devel mailing list