From 23d9bf4583c90a8255783a411e4d60718790816b Mon Sep 17 00:00:00 2001 From: David Rose Date: Wed, 4 Dec 2002 21:08:44 +0000 Subject: [PATCH] properly enquote spam text --- dtool/src/interrogate/interfaceMaker.cxx | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/dtool/src/interrogate/interfaceMaker.cxx b/dtool/src/interrogate/interfaceMaker.cxx index 56ed92b771..c702c22f12 100644 --- a/dtool/src/interrogate/interfaceMaker.cxx +++ b/dtool/src/interrogate/interfaceMaker.cxx @@ -763,10 +763,31 @@ hash_function_signature(FunctionRemap *remap) { //////////////////////////////////////////////////////////////////// void InterfaceMaker:: write_spam_message(ostream &out, FunctionRemap *remap) const { + ostringstream strm; + remap->write_orig_prototype(strm, 0); + string prototype = strm.str(); + out << " if (interrogatedb_cat.is_spam()) {\n" " interrogatedb_cat.spam() << \""; - remap->write_orig_prototype(out, 0); + + for (string::const_iterator si = prototype.begin(); + si != prototype.end(); + ++si) { + switch (*si) { + case '"': + out << "\\\""; + break; + + case '\\': + out << "\\\\"; + break; + + default: + out << *si; + } + } + out << "\\n\";\n" " }\n"; }