Debian Codegraph @

debian/patches/constchar

raw
1 Index: atom4-4.1/proglib/c++/exception.cc
2 ===================================================================
3 --- atom4-4.1.orig/proglib/c++/exception.cc
4 +++ atom4-4.1/proglib/c++/exception.cc
5 @@ -19,7 +19,7 @@ void exception::out_of_memory() {
6 abort(); // fatal: cannot create exception
7 }
8
9 -void exception::varinit(char *fmt, va_list args) {
10 +void exception::varinit(const char *fmt, va_list args) {
11 size_t bufsize, msglen;
12
13 // Initial attempt to format message string
14 @@ -42,9 +42,9 @@ void exception::varinit(char *fmt, va_li
15 }
16 }
17
18 -exception::exception(char *error_msg, ...) : is_variable(*error_msg=='@') {
19 +exception::exception(const char *error_msg, ...) : is_variable(*error_msg=='@') {
20 if (!is_variable) { // Static exception
21 - msg = error_msg;
22 + msg = const_cast<char*>(error_msg);
23 } else { // Variable exception
24 va_list args;
25
26 Index: atom4-4.1/proglib/c++/exception.h
27 ===================================================================
28 --- atom4-4.1.orig/proglib/c++/exception.h
29 +++ atom4-4.1/proglib/c++/exception.h
30 @@ -41,22 +41,22 @@ class exception {
31 char *msg;
32
33 void out_of_memory(); // does not return
34 - void varinit(char *msg, va_list args);
35 + void varinit(const char *msg, va_list args);
36 protected:
37 // NOTE: the dummy argument is a dirty, cruel hack necessary because the
38 // stdarg in glibc defines va_list as char*, and the bogonous C++ compiler
39 // (g++) does not know how to find a next-better ctor match when this one
40 // is protected. It's not my fault! Derived exception classes will just
41 // have to cope.
42 - exception(int dummy, char *error_msg, va_list args) :
43 + exception(int dummy, const char *error_msg, va_list args) :
44 is_variable(*error_msg=='@') {
45 if (is_variable)
46 varinit(error_msg+1, args);
47 else
48 - msg=error_msg;
49 + msg=const_cast<char*>(error_msg);
50 }
51 public:
52 - exception(char *error_msg, ...);
53 + exception(const char *error_msg, ...);
54 exception(const exception &e);
55 virtual ~exception();
56