1
//------------------------------------------------------------------------
3
//------------------------------------------------------------------------
5
// GL-Node Viewer (C) 2004-2007 Andrew Apted
7
// This program is free software; you can redistribute it and/or
8
// modify it under the terms of the GNU General Public License
9
// as published by the Free Software Foundation; either version 2
10
// of the License, or (at your option) any later version.
12
// This program is distributed in the hope that it will be useful,
13
// but WITHOUT ANY WARRANTY; without even the implied warranty of
14
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
// GNU General Public License for more details.
17
//------------------------------------------------------------------------
21
assert_fail_c::assert_fail_c(const char *_msg)
23
strncpy(message, _msg, sizeof(message));
25
message[sizeof(message) - 1] = 0;
28
assert_fail_c::~assert_fail_c()
33
assert_fail_c::assert_fail_c(const assert_fail_c &other)
35
strcpy(message, other.message);
38
assert_fail_c& assert_fail_c::operator=(const assert_fail_c &other)
41
strcpy(message, other.message);
46
//------------------------------------------------------------------------
48
void AssertFail(const char *msg, ...)
54
va_start(argptr, msg);
55
vsprintf(buffer, msg, argptr);
58
// assertion messages shouldn't overflow... (famous last words)
59
buffer[sizeof(buffer) - 1] = 0;
61
PrintDebug("%s\n", buffer);
63
throw assert_fail_c(buffer);