MCPcopy Create free account
hub / github.com/aseprite/laf / base_assert

Function base_assert

base/debug.cpp:30–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28#ifdef _DEBUG
29
30int base_assert(const char* condition, const char* file, int lineNum)
31{
32 #if LAF_WINDOWS
33
34 std::vector<wchar_t> buf(MAX_PATH);
35 GetModuleFileNameW(nullptr, &buf[0], MAX_PATH);
36
37 int ret = _CrtDbgReportW(_CRT_ASSERT,
38 base::from_utf8(file).c_str(),
39 lineNum,
40 &buf[0],
41 base::from_utf8(condition).c_str());
42
43 return (ret == 1 ? 1 : 0);
44
45 #else
46
47 std::string text = file;
48 text += ":";
49 text += base::convert_to<std::string>(lineNum);
50 text += ": Assertion failed: ";
51 text += condition;
52 std::cerr << text << std::endl;
53 std::abort();
54 return 1;
55
56 #endif
57}
58
59#endif // _DEBUG
60

Callers

nothing calls this directly

Calls 1

from_utf8Function · 0.85

Tested by

no test coverage detected