~verterok/ubuntu/lucid/protobuf/2.4.0a-backport

« back to all changes in this revision

Viewing changes to src/google/protobuf/compiler/cpp/cpp_helpers.cc

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2011-05-31 14:41:47 UTC
  • mfrom: (2.2.8 sid)
  • Revision ID: james.westby@ubuntu.com-20110531144147-s41g5fozgvyo462l
Tags: 2.4.0a-2ubuntu1
* Merge with Debian; remaining changes:
  - Fix linking with -lpthread.

Show diffs side-by-side

added added

removed removed

Lines of Context:
292
292
          ClassName(field->enum_type(), true),
293
293
          field->default_value_enum()->number());
294
294
    case FieldDescriptor::CPPTYPE_STRING:
295
 
      return "\"" + CEscape(field->default_value_string()) + "\"";
 
295
      return "\"" + EscapeTrigraphs(CEscape(field->default_value_string())) +
 
296
             "\"";
296
297
    case FieldDescriptor::CPPTYPE_MESSAGE:
297
298
      return FieldMessageTypeName(field) + "::default_instance()";
298
299
  }
335
336
  return "protobuf_ShutdownFile_" + FilenameIdentifier(filename);
336
337
}
337
338
 
 
339
// Escape C++ trigraphs by escaping question marks to \?
 
340
string EscapeTrigraphs(const string& to_escape) {
 
341
  return StringReplace(to_escape, "?", "\\?", true);
 
342
}
 
343
 
338
344
}  // namespace cpp
339
345
}  // namespace compiler
340
346
}  // namespace protobuf