diff options
author | deep@alchemy-d.com <deep@alchemy-d.com> | 2015-10-14 12:27:05 +0300 |
---|---|---|
committer | deep@alchemy-d.com <deep@alchemy-d.com> | 2015-10-14 12:27:05 +0300 |
commit | 1b6fc71a0b2d49d4fdb63055859b3eb66221e195 (patch) | |
tree | 031d7b3c68cf35598104f9fa0020d9ad08c1106d /windirstat | |
parent | 0b0d2e7fee428ed84fbc61dba8f56e75de552d41 (diff) |
changed all ASSERT to WEAK_ASSERT
Diffstat (limited to 'windirstat')
-rw-r--r-- | windirstat/Controls/treemap.cpp | 142 |
1 files changed, 71 insertions, 71 deletions
diff --git a/windirstat/Controls/treemap.cpp b/windirstat/Controls/treemap.cpp index 4df6958..5d1950e 100644 --- a/windirstat/Controls/treemap.cpp +++ b/windirstat/Controls/treemap.cpp @@ -47,8 +47,8 @@ double CColorSpace::GetColorBrightness(COLORREF color) COLORREF CColorSpace::MakeBrightColor(COLORREF color, double brightness) { - ASSERT(brightness >= 0.0); - ASSERT(brightness <= 1.0); + WEAK_ASSERT(brightness >= 0.0); + WEAK_ASSERT(brightness <= 1.0); double dred = (RGB_GET_RVALUE(color) & 0xFF) / 255.0; double dgreen = (RGB_GET_GVALUE(color) & 0xFF) / 255.0; @@ -80,7 +80,7 @@ bool CColorSpace::Is256Colors() void CColorSpace::NormalizeColor(int& red, int& green, int& blue) { - ASSERT(red + green + blue <= 3 * 255); + WEAK_ASSERT(red + green + blue <= 3 * 255); if(red > 255) { @@ -108,14 +108,14 @@ void CColorSpace::DistributeFirst(int& first, int& second, int& third) int h = second - 255; second = 255; third += h; - ASSERT(third <= 255); + WEAK_ASSERT(third <= 255); } else if(third > 255) { int h = third - 255; third = 255; second += h; - ASSERT(second <= 255); + WEAK_ASSERT(second <= 255); } } @@ -222,7 +222,7 @@ CTreemap::CTreemap(Callback *callback) void CTreemap::SetOptions(const Options *options) { - ASSERT(options != NULL); + WEAK_ASSERT(options != NULL); m_options = *options; // Derive normalized vector here for performance @@ -256,7 +256,7 @@ void CTreemap::RecurseCheckTree(Item *item) { if(item->TmiIsLeaf()) { - ASSERT(item->TmiGetChildrenCount() == 0); + WEAK_ASSERT(item->TmiGetChildrenCount() == 0); } else { @@ -268,7 +268,7 @@ void CTreemap::RecurseCheckTree(Item *item) sum += child->TmiGetSize(); RecurseCheckTree(child); } - ASSERT(sum == item->TmiGetSize()); + WEAK_ASSERT(sum == item->TmiGetSize()); } } #endif @@ -330,7 +330,7 @@ void CTreemap::DrawTreemap(CDC *pdc, CRect rc, Item *root, const Options *option { for(int y = rc.top; y < rc.bottom - m_options.grid; y++) { - ASSERT(FindItemByPoint(root, CPoint(x, y)) != NULL); + WEAK_ASSERT(FindItemByPoint(root, CPoint(x, y)) != NULL); } } #endif @@ -371,7 +371,7 @@ void CTreemap::DrawTreemapDoubleBuffered(CDC *pdc, const CRect& rc, Item *root, CTreemap::Item *CTreemap::FindItemByPoint(Item *item, CPoint point) { - ASSERT(item != NULL); + WEAK_ASSERT(item != NULL); const CRect& rc = item->TmiGetRectangle(); if(!rc.PtInRect(point)) @@ -388,7 +388,7 @@ CTreemap::Item *CTreemap::FindItemByPoint(Item *item, CPoint point) return NULL; } - ASSERT(rc.PtInRect(point)); + WEAK_ASSERT(rc.PtInRect(point)); Item *ret = NULL; @@ -404,14 +404,14 @@ CTreemap::Item *CTreemap::FindItemByPoint(Item *item, CPoint point) } else { - ASSERT(item->TmiGetSize() > 0); - ASSERT(item->TmiGetChildrenCount() > 0); + WEAK_ASSERT(item->TmiGetSize() > 0); + WEAK_ASSERT(item->TmiGetChildrenCount() > 0); for(int i = 0; i < item->TmiGetChildrenCount(); i++) { Item *child = item->TmiGetChild(i); - ASSERT(child->TmiGetSize() > 0); + WEAK_ASSERT(child->TmiGetSize() > 0); #ifdef _DEBUG CRect rcChild(child->TmiGetRectangle()); @@ -425,7 +425,7 @@ CTreemap::Item *CTreemap::FindItemByPoint(Item *item, CPoint point) if(child->TmiGetRectangle().PtInRect(point)) { ret = FindItemByPoint(child, point); - ASSERT(ret != NULL); + WEAK_ASSERT(ret != NULL); #ifdef STRONGDEBUG #ifdef _DEBUG for(i++; i < item->TmiGetChildrenCount(); i++) @@ -440,18 +440,18 @@ CTreemap::Item *CTreemap::FindItemByPoint(Item *item, CPoint point) rcChild = child->TmiGetRectangle(); if(rcChild.left == -1) { - ASSERT(rcChild.top == -1); - ASSERT(rcChild.right == -1); - ASSERT(rcChild.bottom == -1); + WEAK_ASSERT(rcChild.top == -1); + WEAK_ASSERT(rcChild.right == -1); + WEAK_ASSERT(rcChild.bottom == -1); break; } - ASSERT(rcChild.right >= rcChild.left); - ASSERT(rcChild.bottom >= rcChild.top); - ASSERT(rcChild.left >= rc.left); - ASSERT(rcChild.right <= rc.right); - ASSERT(rcChild.top >= rc.top); - ASSERT(rcChild.bottom <= rc.bottom); + WEAK_ASSERT(rcChild.right >= rcChild.left); + WEAK_ASSERT(rcChild.bottom >= rcChild.top); + WEAK_ASSERT(rcChild.left >= rc.left); + WEAK_ASSERT(rcChild.right <= rc.right); + WEAK_ASSERT(rcChild.top >= rc.top); + WEAK_ASSERT(rcChild.bottom <= rc.bottom); } #endif #endif @@ -461,7 +461,7 @@ CTreemap::Item *CTreemap::FindItemByPoint(Item *item, CPoint point) } } - ASSERT(ret != NULL); + WEAK_ASSERT(ret != NULL); if(ret == NULL) { @@ -506,8 +506,8 @@ void CTreemap::RecurseDrawGraph( DWORD flags ) { - ASSERT(rc.Width() >= 0); - ASSERT(rc.Height() >= 0); + WEAK_ASSERT(rc.Width() >= 0); + WEAK_ASSERT(rc.Height() >= 0); WEAK_ASSERT(item->TmiGetSize() > 0); @@ -546,8 +546,8 @@ void CTreemap::RecurseDrawGraph( } else { - ASSERT(item->TmiGetChildrenCount() > 0); - ASSERT(item->TmiGetSize() > 0); + WEAK_ASSERT(item->TmiGetChildrenCount() > 0); + WEAK_ASSERT(item->TmiGetSize() > 0); DrawChildren(pdc, item, surface, h, flags); } @@ -594,7 +594,7 @@ void CTreemap::DrawChildren( // void CTreemap::KDirStat_DrawChildren(CDC *pdc, Item *parent, const double *surface, double h, DWORD /*flags*/) { - ASSERT(parent->TmiGetChildrenCount() > 0); + WEAK_ASSERT(parent->TmiGetChildrenCount() > 0); const CRect& rc = parent->TmiGetRectangle(); @@ -608,8 +608,8 @@ void CTreemap::KDirStat_DrawChildren(CDC *pdc, Item *parent, const double *surfa const int width = horizontalRows ? rc.Width() : rc.Height(); const int height = horizontalRows ? rc.Height() : rc.Width(); - ASSERT(width >= 0); - ASSERT(height >= 0); + WEAK_ASSERT(width >= 0); + WEAK_ASSERT(height >= 0); int c = 0; double top = horizontalRows ? rc.top : rc.left; @@ -657,7 +657,7 @@ void CTreemap::KDirStat_DrawChildren(CDC *pdc, Item *parent, const double *surfa { CRect test; test.IntersectRect(parent->TmiGetRectangle(), rcChild); - ASSERT(test == rcChild); + WEAK_ASSERT(test == rcChild); } #endif @@ -678,10 +678,10 @@ void CTreemap::KDirStat_DrawChildren(CDC *pdc, Item *parent, const double *surfa left = fRight; } - // This asserts due to rounding error: ASSERT(left == (horizontalRows ? rc.right : rc.bottom)); + // This asserts due to rounding error: WEAK_ASSERT(left == (horizontalRows ? rc.right : rc.bottom)); top = fBottom; } - // This asserts due to rounding error: ASSERT(top == (horizontalRows ? rc.bottom : rc.right)); + // This asserts due to rounding error: WEAK_ASSERT(top == (horizontalRows ? rc.bottom : rc.right)); } @@ -694,8 +694,8 @@ bool CTreemap::KDirStat_ArrangeChildren( CArray<int, int>& childrenPerRow ) { - ASSERT(!parent->TmiIsLeaf()); - ASSERT(parent->TmiGetChildrenCount() > 0); + WEAK_ASSERT(!parent->TmiIsLeaf()); + WEAK_ASSERT(parent->TmiGetChildrenCount() > 0); if(parent->TmiGetSize() == 0) { @@ -742,13 +742,13 @@ double CTreemap::KDirStat_CalcutateNextRow(Item *parent, const int nextChild, do { int i = 0; static const double _minProportion = 0.4; - ASSERT(_minProportion < 1); + WEAK_ASSERT(_minProportion < 1); - ASSERT(nextChild < parent->TmiGetChildrenCount()); - ASSERT(width >= 1.0); + WEAK_ASSERT(nextChild < parent->TmiGetChildrenCount()); + WEAK_ASSERT(width >= 1.0); const double mySize = (double)parent->TmiGetSize(); - ASSERT(mySize > 0); + WEAK_ASSERT(mySize > 0); ULONGLONG sizeUsed = 0; double rowHeight = 0; @@ -763,8 +763,8 @@ double CTreemap::KDirStat_CalcutateNextRow(Item *parent, const int nextChild, do sizeUsed += childSize; double virtualRowHeight = sizeUsed / mySize; - ASSERT(virtualRowHeight > 0); - ASSERT(virtualRowHeight <= 1); + WEAK_ASSERT(virtualRowHeight > 0); + WEAK_ASSERT(virtualRowHeight <= 1); // Rectangle(mySize) = width * 1.0 // Rectangle(childSize) = childWidth * virtualRowHeight @@ -774,7 +774,7 @@ double CTreemap::KDirStat_CalcutateNextRow(Item *parent, const int nextChild, do if(childWidth / virtualRowHeight < _minProportion) { - ASSERT(i > nextChild); // because width >= 1 and _minProportion < 1. + WEAK_ASSERT(i > nextChild); // because width >= 1 and _minProportion < 1. // For the first child we have: // childWidth / rowHeight // = childSize / mySize * width / rowHeight / rowHeight @@ -821,12 +821,12 @@ void CTreemap::SequoiaView_DrawChildren(CDC *pdc, Item *parent, const double *su // Rest rectangle to fill CRect remaining(parent->TmiGetRectangle()); - ASSERT(remaining.Width() > 0); - ASSERT(remaining.Height() > 0); + WEAK_ASSERT(remaining.Width() > 0); + WEAK_ASSERT(remaining.Height() > 0); // Size of rest rectangle ULONGLONG remainingSize = parent->TmiGetSize(); - ASSERT(remainingSize > 0); + WEAK_ASSERT(remainingSize > 0); // Scale factor const double sizePerSquarePixel = (double)parent->TmiGetSize() / remaining.Width() / remaining.Height(); @@ -837,8 +837,8 @@ void CTreemap::SequoiaView_DrawChildren(CDC *pdc, Item *parent, const double *su // At least one child left while(head < parent->TmiGetChildrenCount()) { - ASSERT(remaining.Width() > 0); - ASSERT(remaining.Height() > 0); + WEAK_ASSERT(remaining.Width() > 0); + WEAK_ASSERT(remaining.Height() > 0); // How we divide the remaining rectangle bool horizontal = (remaining.Width() >= remaining.Height()); @@ -848,7 +848,7 @@ void CTreemap::SequoiaView_DrawChildren(CDC *pdc, Item *parent, const double *su // Square of height in size scale for ratio formula const double hh = (height * height) * sizePerSquarePixel; - ASSERT(hh > 0); + WEAK_ASSERT(hh > 0); // Row will be made up of child(rowBegin)...child(rowEnd - 1) int rowBegin = head; @@ -909,11 +909,11 @@ void CTreemap::SequoiaView_DrawChildren(CDC *pdc, Item *parent, const double *su // As the size of parent is greater than zero, the size of // the first child must have been greater than zero, too. - ASSERT(sum > 0); + WEAK_ASSERT(sum > 0); // Width of row int width = (horizontal ? remaining.Width() : remaining.Height()); - ASSERT(width > 0); + WEAK_ASSERT(width > 0); if(sum < remainingSize) width = (int)((double)sum / remainingSize * width); @@ -963,13 +963,13 @@ void CTreemap::SequoiaView_DrawChildren(CDC *pdc, Item *parent, const double *su rc.right = end; } - ASSERT(rc.left <= rc.right); - ASSERT(rc.top <= rc.bottom); + WEAK_ASSERT(rc.left <= rc.right); + WEAK_ASSERT(rc.top <= rc.bottom); - ASSERT(rc.left >= remaining.left); - ASSERT(rc.right <= remaining.right); - ASSERT(rc.top >= remaining.top); - ASSERT(rc.bottom <= remaining.bottom); + WEAK_ASSERT(rc.left >= remaining.left); + WEAK_ASSERT(rc.right <= remaining.right); + WEAK_ASSERT(rc.top >= remaining.top); + WEAK_ASSERT(rc.bottom <= remaining.bottom); RecurseDrawGraph(pdc, parent->TmiGetChild(i), rc, false, surface, h * m_options.scaleFactor, 0); @@ -991,10 +991,10 @@ void CTreemap::SequoiaView_DrawChildren(CDC *pdc, Item *parent, const double *su remainingSize -= sum; - ASSERT(remaining.left <= remaining.right); - ASSERT(remaining.top <= remaining.bottom); + WEAK_ASSERT(remaining.left <= remaining.right); + WEAK_ASSERT(remaining.top <= remaining.bottom); - ASSERT(remainingSize >= 0); + WEAK_ASSERT(remainingSize >= 0); head += (rowEnd - rowBegin); @@ -1008,8 +1008,8 @@ void CTreemap::SequoiaView_DrawChildren(CDC *pdc, Item *parent, const double *su break; } } - ASSERT(remainingSize == 0); - ASSERT(remaining.left == remaining.right || remaining.top == remaining.bottom); + WEAK_ASSERT(remainingSize == 0); + WEAK_ASSERT(remaining.left == remaining.right || remaining.top == remaining.bottom); } @@ -1018,20 +1018,20 @@ void CTreemap::SequoiaView_DrawChildren(CDC *pdc, Item *parent, const double *su void CTreemap::Simple_DrawChildren(CDC *pdc, Item *parent, const double *surface, double h, DWORD flags) { #if 1 - ASSERT(0); // Not used in WinDirStat. + WEAK_ASSERT(0); // Not used in WinDirStat. pdc; parent; surface; h; flags; #else - ASSERT(parent->TmiGetChildrenCount() > 0); - ASSERT(parent->TmiGetSize() > 0); + WEAK_ASSERT(parent->TmiGetChildrenCount() > 0); + WEAK_ASSERT(parent->TmiGetSize() > 0); const CRect& rc = parent->TmiGetRectangle(); bool horizontal = (flags == 0); int width = horizontal ? rc.Width() : rc.Height(); - ASSERT(width >= 0); + WEAK_ASSERT(width >= 0); double fBegin = horizontal ? rc.left : rc.top; int veryEnd = horizontal ? rc.right : rc.bottom; @@ -1052,8 +1052,8 @@ void CTreemap::Simple_DrawChildren(CDC *pdc, Item *parent, const double *surface int begin = (int)fBegin; int end = (int)fEnd; - ASSERT(begin <= end); - ASSERT(end <= veryEnd); + WEAK_ASSERT(begin <= end); + WEAK_ASSERT(end <= veryEnd); CRect rcChild; if(horizontal) @@ -1200,7 +1200,7 @@ void CTreemap::DrawCushion(CDC *pdc, const CRect& rc, const double *surface, COL } pixel += Ia; - ASSERT(pixel <= 1.0); + WEAK_ASSERT(pixel <= 1.0); // Now, pixel is the brightness of the pixel, 0...1.0. @@ -1248,7 +1248,7 @@ void CTreemap::AddRidge(const CRect& rc, double *surface, double h) int width = rc.Width(); int height = rc.Height(); - ASSERT(width > 0 && height > 0); + WEAK_ASSERT(width > 0 && height > 0); double h4 = 4 * h; |