Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace MS { namespace Internal { namespace Text { namespace TextInterface

public:

FontCollectionLoader() { Debug::Assert(false); }
FontCollectionLoader() { Debug::Assert(false, "Assertion failed"); }

FontCollectionLoader(
IFontSourceCollectionFactory^ fontSourceCollectionFactory,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace MS { namespace Internal { namespace Text { namespace TextInterface

public:

FontFileEnumerator() { Debug::Assert(false); }
FontFileEnumerator() { Debug::Assert(false, "Assertion failed"); }

FontFileEnumerator(
IEnumerable<IFontSource^>^ fontSourceCollection,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace MS { namespace Internal { namespace Text { namespace TextInterface

public:

FontFileLoader() { Debug::Assert(false); }
FontFileLoader() { Debug::Assert(false, "Assertion failed"); }

FontFileLoader(IFontSourceFactory^ fontSourceFactory);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace MS { namespace Internal { namespace Text { namespace TextInterface
/// Asserts false because COM convention requires us to have a default constructor
/// but we are the only entity that can construct these objects, and we use the
/// other constructor.
FontFileStream() { Debug::Assert(false); }
FontFileStream() { Debug::Assert(false, "Assertion failed"); }

/// <summary>
/// ctor.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ ref class CGDIRenderTarget : public CGDIDevice, public ILegacyDevice
public:
FontSimulatedStyleKey(String^ faceName, LONG lfWeight, BYTE lfItalic)
{
Debug::Assert(faceName != nullptr);
Debug::Assert(faceName != nullptr, "faceName is not null.");

m_faceName = faceName;
m_lfWeight = lfWeight;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
// FontStreamContext
FontStreamContext::FontStreamContext(GlyphTypeface^ source)
{
Debug::Assert(source != nullptr);
Debug::Assert(source != nullptr, "source should not be null");

_sourceTypeface = source;
}

FontStreamContext::FontStreamContext(Uri^ source, int streamLength)
{
Debug::Assert(source != nullptr);
Debug::Assert(source != nullptr, "Source should not be null.");

_sourceUri = source;
_streamLength = streamLength;
Expand Down Expand Up @@ -129,7 +129,7 @@ bool FontStreamContext::Equals(FontStreamContext% otherContext)

if (otherStream != nullptr)
{
Debug::Assert(thisStream->Length == otherStream->Length);
Debug::Assert(thisStream->Length == otherStream->Length, "Length of both streams should be same.");

//
// Compare both streams CompareLength bytes at a time.
Expand Down Expand Up @@ -187,7 +187,7 @@ bool FontStreamContext::Equals(FontStreamContext% otherContext)
}
}

Debug::Assert(eof == 2);
Debug::Assert(eof == 2, "Number of streams reaching eof should be 2.");
}
}

Expand All @@ -197,14 +197,14 @@ bool FontStreamContext::Equals(FontStreamContext% otherContext)
// FontInstallInfo
FontInstallInfo::FontInstallInfo(Uri^ uri)
{
Debug::Assert(uri != nullptr);
Debug::Assert(uri != nullptr, "Uri should not be null.");

_uri = uri;
}

bool FontInstallInfo::Equals(FontStreamContext% context, FontInstallInfo^ otherFont)
{
Debug::Assert(otherFont != nullptr);
Debug::Assert(otherFont != nullptr, "OtherFont should not be null.");

if (_uri->Equals(otherFont->_uri))
{
Expand Down Expand Up @@ -798,7 +798,7 @@ Object^ FontInstallInfo::Install(FontStreamContext% context, String^ % newFamily

void FontInstallInfo::Uninstall(Object^ installHandle)
{
Debug::Assert(installHandle != nullptr);
Debug::Assert(installHandle != nullptr, "Install handle should not be null.");

String^ filename = dynamic_cast<String^>(installHandle);

Expand Down Expand Up @@ -851,7 +851,7 @@ bool FontInfo::UsePrivate(GlyphTypeface^ typeface)
// installed as private or system font, in which case we simply use one of those.
// Otherwise install the GlyphTypeface font into GDI.
//
Debug::Assert(typeface != nullptr);
Debug::Assert(typeface != nullptr, "GlyphTypeface should not be null");

FontStreamContext installContext(typeface);

Expand Down Expand Up @@ -904,7 +904,7 @@ void FontInfo::UninstallPrivate()
{
if (_privateInstall != nullptr)
{
Debug::Assert(_privateInstallHandle != nullptr);
Debug::Assert(_privateInstallHandle != nullptr, "Private font should not be installed at this point");

_privateInstall->Uninstall(_privateInstallHandle);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ int PaletteSorter::Search(int start, int end, COLORREF color)
{
for (;;)
{
Debug::Assert((start >= 0) && (end < IndexUsed));
Debug::Assert((start >= 0) && (end < IndexUsed), "Invalid index range. Start: " + start + ", End: " + end + ", IndexUsed: " + IndexUsed);

// Break condition
if (start > end)
Expand Down Expand Up @@ -251,8 +251,8 @@ void CGDIBitmap::SetBits(interior_ptr<BITMAPINFO> bmi)
// Convert to indexed bitmap
HRESULT CGDIBitmap::ColorReduction()
{
Debug::Assert(m_pSorter != nullptr);
Debug::Assert(m_pSorter->IndexUsed <= 256);
Debug::Assert(m_pSorter != nullptr, "m_pSorter should not be null.");
Debug::Assert(m_pSorter->IndexUsed <= 256, "IndexUsed is out of bounds. IndexUsed: " + m_pSorter->IndexUsed);

int bpp = 8;

Expand Down Expand Up @@ -284,7 +284,7 @@ HRESULT CGDIBitmap::ColorReduction()
{
int index = m_pSorter->Find(RGB(src[2], src[1], src[0]));

Debug::Assert(index < 2);
Debug::Assert(index < 2, "index should be less than 2.");

dst[0] |= mask * index;

Expand All @@ -305,7 +305,7 @@ HRESULT CGDIBitmap::ColorReduction()
{
int index = m_pSorter->Find(RGB(src[2], src[1], src[0]));

Debug::Assert(index < 16);
Debug::Assert(index < 16, "index should be less than 16.");

if (w & 1)
{
Expand All @@ -322,13 +322,13 @@ HRESULT CGDIBitmap::ColorReduction()
}
else
{
Debug::Assert(bpp == 8);
Debug::Assert(bpp == 8, "bpp should be equal to 8.");

for (int w = 0; w < m_Width; w ++)
{
int index = m_pSorter->Find(RGB(src[2], src[1], src[0]));

Debug::Assert(index < 256);
Debug::Assert(index < 256, "index should be less than 256.");

dst[0] = (BYTE) index;

Expand Down Expand Up @@ -510,15 +510,15 @@ value class BandIterator
// Gets the current band's rectangle.
Int32Rect GetCurrent()
{
Debug::Assert(_index < _count && _index >= 0);
Debug::Assert(_index < _count && _index >= 0, "Index out of bounds. Index: " + _index + ", Count: " + _count);

return _band;
}

// Moves to the next band.
bool MoveNext()
{
Debug::Assert(_index < _count && _index >= -1);
Debug::Assert(_index < _count && _index >= -1, "Index out of bounds. Index: " + _index + ", Count: " + _count);

_index++;

Expand Down Expand Up @@ -565,8 +565,8 @@ value class BandIterator
HRESULT
CGDIBitmap::StretchBlt(CGDIDevice ^ pDevice, const Int32Rect & dst, bool flipHoriz, bool flipVert)
{
Debug::Assert(pDevice != nullptr);
Debug::Assert(IsValid());
Debug::Assert(pDevice != nullptr, "pDevice should not be null.");
Debug::Assert(IsValid(), "Not in a valid state.");

if ((m_Height > 0) && (m_Width > 0))
{
Expand Down Expand Up @@ -682,7 +682,7 @@ CGDIBitmap::StretchBlt(CGDIDevice ^ pDevice, const Int32Rect & dst, bool flipHor

HRESULT CGDIBitmap::Load(BitmapSource ^ pBitmap, array<Byte>^ buffer, PixelFormat LoadFormat)
{
Debug::Assert(pBitmap != nullptr);
Debug::Assert(pBitmap != nullptr, "pBitmap should not be null.");

m_pBitmap = pBitmap;

Expand Down Expand Up @@ -831,8 +831,8 @@ BitmapSource ^ CreateBitmapAndFillWithBrush(
PixelFormat pixelFormat
)
{
Debug::Assert(brush != nullptr);
Debug::Assert((nWidth > 0) && (nHeight > 0));
Debug::Assert(brush != nullptr, "brush should not be null.");
Debug::Assert((nWidth > 0) && (nHeight > 0), "Width and height must be positive. Width: " + nWidth + ", Height: " + nHeight);

RenderTargetBitmap ^pBitmap = gcnew RenderTargetBitmap(nWidth, nHeight, 96, 96, pixelFormat);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ HRESULT CGDIDevice::SetupForIncreasedResolution(int resolutionMultiplier, XFORM&
{
if (resolutionMultiplier > 1)
{
Debug::Assert((GetCaps() & CAP_WorldTransform) != 0);
Debug::Assert((GetCaps() & CAP_WorldTransform) != 0, "CAP_WorldTransform flag is not set. GetCaps() returned: " + GetCaps());

// The points are greater than we want them so we need
// to set a scaling transform to get them to the right size.
Expand Down Expand Up @@ -337,7 +337,7 @@ CGDIDevice::CleanupForIncreasedResolution(int resolutionMultiplier, const XFORM&
{
if (resolutionMultiplier > 1)
{
Debug::Assert((GetCaps() & CAP_WorldTransform) != 0);
Debug::Assert((GetCaps() & CAP_WorldTransform) != 0, "CAP_WorldTransform flag is not set. GetCaps() returned: " + GetCaps());

return ErrorCode(CNativeMethods::SetWorldTransform(m_hDC, &oldTransform));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ ref class GdiGeometryConverter : public CapacityStreamGeometryContext
}

_figureStartIndex = AddPoint(point, PT_MOVETO);
Debug::Assert(_figureStartIndex != -1);
Debug::Assert(_figureStartIndex != -1, "figure start index cannot be -1.");

_figureStartPoint = point;
_figureHasGaps = false;
Expand Down Expand Up @@ -403,7 +403,9 @@ ref class GdiGeometryConverter : public CapacityStreamGeometryContext
if (_bezierIndex == 2 && _pointCount >= 3)
{
Debug::Assert((_types[_pointCount - 1] & PT_TYPEMASK) == PT_BEZIERTO &&
(_types[_pointCount - 2] & PT_TYPEMASK) == PT_BEZIERTO);
(_types[_pointCount - 2] & PT_TYPEMASK) == PT_BEZIERTO,
"Last two points must be of type PT_BEZIERTO. "
"Types: " + (_types[_pointCount - 1] & PT_TYPEMASK) + ", " + (_types[_pointCount - 2] & PT_TYPEMASK));

if (Colinear(dx, dy, _pointCount - 2, _pointCount - 1) &&
Colinear(dx, dy, _pointCount - 3, _pointCount - 1))
Expand Down Expand Up @@ -436,7 +438,7 @@ ref class GdiGeometryConverter : public CapacityStreamGeometryContext
// MUST be followed by adding a new point, or end geometry.
void RemoveLastPoint()
{
Debug::Assert(_pointCount > 0);
Debug::Assert(_pointCount > 0, "-pointCount should be greater than 0.");

if ((_types[_pointCount - 1] & PT_TYPEMASK) == PT_MOVETO)
{
Expand All @@ -451,7 +453,8 @@ ref class GdiGeometryConverter : public CapacityStreamGeometryContext

Point GetLastPoint()
{
Debug::Assert(!Double::IsNaN(_lastPoint.X) && !Double::IsNaN(_lastPoint.Y));
Debug::Assert(!Double::IsNaN(_lastPoint.X) && !Double::IsNaN(_lastPoint.Y),
"Invalid point coordinates. X: " + _lastPoint.X + ", Y: " + _lastPoint.Y);

return _lastPoint;
}
Expand Down Expand Up @@ -630,7 +633,8 @@ CGDIPath::CGDIPath(
bool ForFill,
Pen ^ pPen)
{
Debug::Assert(ForFill || pPen != nullptr);
Debug::Assert(ForFill || pPen != nullptr,
"ForFill is false and pPen is null. ForFill: " + ForFill + ", pPen: " + (pPen == nullptr ? "null" : "not null"));

// get path GDI fill mode
m_PathFillMode = (geometry.GetFillRule() == FillRule::EvenOdd) ? ALTERNATE : WINDING;
Expand Down Expand Up @@ -757,7 +761,8 @@ void CGDIPath::ProcessPolygon(int count, bool ForFill, int figureCount)
}

// add polygon count for previous polygon
Debug::Assert((iPoint - iStartPoint) >= 2);
Debug::Assert((iPoint - iStartPoint) >= 2, "Insufficient points for polygon. Points: " + (iPoint - iStartPoint));

m_PolyCounts[iPolygon] = iPoint - iStartPoint;
}

Expand All @@ -770,7 +775,7 @@ void CGDIPath::ProcessPolygon(int count, bool ForFill, int figureCount)

default:
// invalid type
Debug::Assert(0);
Debug::Assert(0, "Unexpected assertion reached. This is a placeholder for an invalid type check.");
// FALLTHRU

case PT_LINETO:
Expand Down Expand Up @@ -838,7 +843,7 @@ void CGDIPath::ProcessCurve(int count, bool ForFill)
// Get the actual device bounds of the transformed points
void CGDIPath::GetDeviceBounds(array<PointI>^ p, int count)
{
Debug::Assert(count >= 1);
Debug::Assert(count >= 1, "Count should be greater than or equal to 1.");

int minX, minY, maxX, maxY;

Expand Down Expand Up @@ -875,8 +880,8 @@ void CGDIPath::GetDeviceBounds(array<PointI>^ p, int count)
// !!! This is a problem if there is already a path opened or defined
HRESULT CGDIPath::Fill(CGDIDevice ^ dc, GdiSafeHandle^ brush)
{
Debug::Assert(IsValid());
Debug::Assert(brush != nullptr);
Debug::Assert(IsValid(), "Not in a valid state.");
Debug::Assert(brush != nullptr, "brush should not be null.");

HRESULT hr = S_OK;

Expand Down Expand Up @@ -964,8 +969,8 @@ HRESULT CGDIPath::Fill(CGDIDevice ^ dc, GdiSafeHandle^ brush)

HRESULT CGDIPath::Draw(CGDIDevice ^ dc, GdiSafeHandle ^ pen)
{
Debug::Assert(IsValid());
Debug::Assert(pen != nullptr);
Debug::Assert(IsValid(), "Not in a valid state.");
Debug::Assert(pen != nullptr, "pen should not be null.");

HRESULT hr = S_OK;

Expand Down Expand Up @@ -1005,7 +1010,7 @@ HRESULT CGDIPath::Draw(CGDIDevice ^ dc, GdiSafeHandle ^ pen)

// The polygons are generated through our API and
// should have been verified above.
Debug::Assert(count > 0);
Debug::Assert(count > 0, "Count should be greater than 0.");

if ((m_Points[offset].x == m_Points[offset + count - 1].x) &&
(m_Points[offset].y == m_Points[offset + count - 1].y))
Expand Down Expand Up @@ -1068,7 +1073,7 @@ HRESULT CGDIPath::Draw(CGDIDevice ^ dc, GdiSafeHandle ^ pen)

HRESULT CGDIPath::SelectClip(CGDIDevice ^ dc, int mode)
{
Debug::Assert(IsValid());
Debug::Assert(IsValid(), "Not in a valid state.");

HRESULT hr = S_OK;

Expand Down Expand Up @@ -1154,7 +1159,7 @@ double CGDIPath::MaxCos(void)
{
// close of figure.
// figure is from this point and last PT_MOVETO inclusive.
Debug::Assert(lastMoveTo != -1);
Debug::Assert(lastMoveTo != -1, "last PT_MOVETO is not initialized.");

figureStartClose->Add(lastMoveTo);
figureStartClose->Add(i);
Expand Down Expand Up @@ -1343,7 +1348,7 @@ void CPolyPolygon::GetBounds(void)
nTotal += m_rgcPoly[m_offsetC + i];
}

Debug::Assert(nTotal >= 1);
Debug::Assert(nTotal >= 1, "nTotal should be greater than or equal to 1.");

for (int i = 1; i < nTotal; i++)
{
Expand Down Expand Up @@ -1371,7 +1376,7 @@ void CPolyPolygon::Divide(
IN INT cGroup // number of CPolyPolygon to divide into
)
{
Debug::Assert(m_cPolygons >= cGroup);
Debug::Assert(m_cPolygons >= cGroup, "The number of polygons (m_cPolygons) should be greater than or equal to the group count (cGroup).");

int part = m_cPolygons / cGroup; // number of polygons per group

Expand Down
Loading