replace ASSERT with Expects

This commit is contained in:
Jamiras
2021-10-31 11:48:02 -06:00
parent 4b9ee2a233
commit 18a8d73eb2
4 changed files with 9 additions and 22 deletions
-13
View File
@@ -160,19 +160,6 @@ public:
//};
//using namespace RA;
#ifdef _DEBUG
#ifndef RA_UTEST
#undef ASSERT
#define ASSERT( x ) assert( x )
#else
#undef ASSERT
#define ASSERT( x ) {}
#endif
#else
#undef ASSERT
#define ASSERT( x ) {}
#endif
#ifndef UNUSED
#define UNUSED( x ) ( x );
#endif
+3 -3
View File
@@ -6,7 +6,7 @@
_Use_decl_annotations_
void DrawImage(HDC hDC, HBITMAP hBitmap, int nX, int nY, int nW, int nH)
{
ASSERT(hBitmap != nullptr);
Expects(hBitmap != nullptr);
HDC hdcMem = CreateCompatibleDC(hDC);
if (hdcMem)
{
@@ -29,7 +29,7 @@ void DrawImage(HDC hDC, HBITMAP hBitmap, int nX, int nY, int nW, int nH)
_Use_decl_annotations_
void DrawImageStretched(HDC hDC, HBITMAP hBitmap, const RECT& rcSource, const RECT& rcDest)
{
ASSERT(hBitmap != nullptr);
Expects(hBitmap != nullptr);
HDC hdcMem = CreateCompatibleDC(hDC);
if (hdcMem)
{
@@ -60,7 +60,7 @@ void DrawImageStretched(HDC hDC, HBITMAP hBitmap, const RECT& rcSource, const RE
_Use_decl_annotations_
void DrawImageTiled(HDC hDC, HBITMAP hBitmap, RECT& rcSource, const RECT& rcDest)
{
ASSERT(hBitmap != nullptr);
Expects(hBitmap != nullptr);
HDC hdcMem = CreateCompatibleDC(hDC);
if (hdcMem)
{
+5 -5
View File
@@ -123,7 +123,7 @@ std::wstring ImageRepository::GetFilename(ImageType nType, const std::string& sN
sFilename += ra::Widen(sName);
break;
default:
ASSERT(!"Unsupported image type");
Expects(!"Unsupported image type");
break;
}
@@ -193,7 +193,7 @@ void ImageRepository::FetchImage(ImageType nType, const std::string& sName)
sUrl += "/Images/";
break;
default:
ASSERT(!"Unsupported image type");
Expects(!"Unsupported image type");
return;
}
sUrl += sName;
@@ -262,7 +262,7 @@ HBITMAP ImageRepository::GetDefaultImage(ImageType nType)
return GetImage(ImageType::UserPic, DefaultUserPic);
default:
ASSERT(!"Unsupported image type");
Expects(!"Unsupported image type");
return nullptr;
}
}
@@ -459,7 +459,7 @@ ImageRepository::HBitmapMap* ImageRepository::GetBitmapMap(ImageType nType) noex
return &m_mIcons;
default:
ASSERT(!"Unsupported image type");
Expects(!"Unsupported image type");
return nullptr;
}
}
@@ -542,7 +542,7 @@ void ImageRepository::AddReference(const ImageReference& pImage)
std::lock_guard<std::mutex> lock(m_oMutex);
const HBitmapMap::iterator iter = mMap->find(pImage.Name());
ASSERT(iter != mMap->end()); // AddReference should only be called if an HBITMAP exists, which will be in the map
Expects(iter != mMap->end()); // AddReference should only be called if an HBITMAP exists, which will be in the map
if (iter != mMap->end())
++iter->second.m_nReferences;
}
+1 -1
View File
@@ -60,7 +60,7 @@ private:
HBitmapMap m_mLocal;
HBitmapMap m_mIcons;
HBitmapMap* GetBitmapMap(ImageType nType) noexcept;
GSL_SUPPRESS_F6 HBitmapMap* GetBitmapMap(ImageType nType) noexcept;
mutable std::mutex m_oMutex;
std::set<std::wstring> m_vRequestedImages;