Applied patch to escape apostrophes in message definition strings.

This commit is contained in:
Brian Gerkey 2010-05-14 19:56:21 +00:00
parent c01e24a970
commit fedf71d665
1 changed files with 7 additions and 1 deletions

View File

@ -822,7 +822,7 @@ void msg_spec::emit_cpp_class(FILE *f, bool for_srv, const string &srv_name)
for (; it != end; ++it) {
std::string& line = *it;
// Escape bare \ and "
// Escape bare \, ', and "
size_t pos = line.find("\\");
while (pos != std::string::npos) {
line.insert(pos, "\\");
@ -835,6 +835,12 @@ void msg_spec::emit_cpp_class(FILE *f, bool for_srv, const string &srv_name)
pos = line.find("\"", pos + 2);
}
pos = line.find("'");
while (pos != std::string::npos) {
line.insert(pos, "'");
pos = line.find("'", pos + 2);
}
fprintf(f, " '%s\\n' ...\n", line.c_str());
}
fprintf(f, "];\n\n");