~ubuntu-branches/ubuntu/precise/glbsp/precise

« back to all changes in this revision

Viewing changes to nodeview/asserts.cc

  • Committer: Bazaar Package Importer
  • Author(s): Darren Salt
  • Date: 2008-01-30 13:33:49 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20080130133349-kgojg33vyiu8xbvp
Tags: 2.24-1
* New upstream release.
* Bumped the lib soname and the library package name due to one silly
  little binary incompatibility caused by changes in an exported struct.
  (Safe; nothing else currently in the archive has ever used libglbsp2.)
* Removed my patches since they're all applied upstream.
* Updated the list of documentation files.
* Build-time changes:
  - Switched from dh_movefiles to dh_install.
  - Updated my makefile to cope with upstream changes.
  - Corrected for debian-rules-ignores-make-clean-error.
  - Corrected for substvar-source-version-is-deprecated.
  - Link libglbsp, rather than glbsp, with libm and libz.
* Fixed shlibdeps. (Closes: #460387)
* Bumped standards version to 3.7.3 (no other changes).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//------------------------------------------------------------------------
 
2
//  ASSERTIONS
 
3
//------------------------------------------------------------------------
 
4
//
 
5
//  GL-Node Viewer (C) 2004-2007 Andrew Apted
 
6
//
 
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.
 
11
//
 
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.
 
16
//
 
17
//------------------------------------------------------------------------
 
18
 
 
19
#include "defs.h"
 
20
 
 
21
assert_fail_c::assert_fail_c(const char *_msg)
 
22
{
 
23
  strncpy(message, _msg, sizeof(message));
 
24
 
 
25
  message[sizeof(message) - 1] = 0;
 
26
}
 
27
 
 
28
assert_fail_c::~assert_fail_c()
 
29
{
 
30
  /* nothing needed */
 
31
}
 
32
 
 
33
assert_fail_c::assert_fail_c(const assert_fail_c &other)
 
34
{
 
35
  strcpy(message, other.message);
 
36
}
 
37
 
 
38
assert_fail_c& assert_fail_c::operator=(const assert_fail_c &other)
 
39
{
 
40
  if (this != &other)
 
41
    strcpy(message, other.message);
 
42
  
 
43
  return *this;
 
44
}
 
45
 
 
46
//------------------------------------------------------------------------
 
47
 
 
48
void AssertFail(const char *msg, ...)
 
49
{
 
50
  char buffer[1024];
 
51
 
 
52
  va_list argptr;
 
53
 
 
54
  va_start(argptr, msg);
 
55
  vsprintf(buffer, msg, argptr);
 
56
  va_end(argptr);
 
57
 
 
58
  // assertion messages shouldn't overflow... (famous last words)
 
59
  buffer[sizeof(buffer) - 1] = 0;
 
60
 
 
61
  PrintDebug("%s\n", buffer);
 
62
  
 
63
  throw assert_fail_c(buffer);
 
64
}
 
65