Fix to the catch-all namespace commit
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@992458 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/compiler/cpp/src/parse/t_program.h b/compiler/cpp/src/parse/t_program.h
index daad6b9..320d1f0 100644
--- a/compiler/cpp/src/parse/t_program.h
+++ b/compiler/cpp/src/parse/t_program.h
@@ -160,28 +160,30 @@
// Language neutral namespace / packaging
void set_namespace(std::string language, std::string name_space) {
- size_t sub_index = language.find('.');
- std::string base_language = language.substr(0, sub_index);
- std::string sub_namespace;
+ if (language != "*") {
+ size_t sub_index = language.find('.');
+ std::string base_language = language.substr(0, sub_index);
+ std::string sub_namespace;
- if(base_language == "smalltalk") {
- pwarning(1, "Namespace 'smalltalk' is deprecated. Use 'st' instead");
- base_language = "st";
- }
+ if(base_language == "smalltalk") {
+ pwarning(1, "Namespace 'smalltalk' is deprecated. Use 'st' instead");
+ base_language = "st";
+ }
- t_generator_registry::gen_map_t my_copy = t_generator_registry::get_generator_map();
+ t_generator_registry::gen_map_t my_copy = t_generator_registry::get_generator_map();
- t_generator_registry::gen_map_t::iterator it;
- it=my_copy.find(base_language);
+ t_generator_registry::gen_map_t::iterator it;
+ it=my_copy.find(base_language);
- if (it == my_copy.end()) {
- throw "No generator named '" + base_language + "' could be found!";
- }
+ if (it == my_copy.end()) {
+ throw "No generator named '" + base_language + "' could be found!";
+ }
- if (sub_index != std::string::npos) {
- std::string sub_namespace = language.substr(sub_index+1);
- if(! it->second->is_valid_namespace(sub_namespace)) {
- throw base_language +" generator does not accept '" + sub_namespace + "' as sub-namespace!";
+ if (sub_index != std::string::npos) {
+ std::string sub_namespace = language.substr(sub_index+1);
+ if(! it->second->is_valid_namespace(sub_namespace)) {
+ throw base_language +" generator does not accept '" + sub_namespace + "' as sub-namespace!";
+ }
}
}