THRIFT-2639 c_glib: Expose as properties members of generated structs
Client: C-glib
Patch: Simon South

Fixes error: 'to_string' is not a member of 'std' for non-C++11 conformant compilers
diff --git a/compiler/cpp/src/generate/t_c_glib_generator.cc b/compiler/cpp/src/generate/t_c_glib_generator.cc
index 807b628..feef575 100644
--- a/compiler/cpp/src/generate/t_c_glib_generator.cc
+++ b/compiler/cpp/src/generate/t_c_glib_generator.cc
@@ -2448,10 +2448,7 @@
           string param_spec_function_name = "g_param_spec_int";
           string min_value;
           string max_value;
-          string default_value =
-            std::to_string((member_value != NULL) ?
-                           member_value->get_integer() :
-                           0);
+          ostringstream default_value;
 
           switch (base_type) {
           case t_base_type::TYPE_BYTE:
@@ -2479,9 +2476,6 @@
             param_spec_function_name = "g_param_spec_double";
             min_value = "-INFINITY";
             max_value = "INFINITY";
-            if (member_value != NULL) {
-              default_value = std::to_string(member_value->get_double());
-            }
             break;
 
           default:
@@ -2491,6 +2485,15 @@
             break;
           }
 
+          if (member_value != NULL) {
+            default_value <<
+              (base_type == t_base_type::TYPE_DOUBLE ?
+               member_value->get_double() :
+               member_value->get_integer());
+          } else {
+            default_value << "0";
+          }
+
           args_indent += string(param_spec_function_name.length() + 2, ' ');
           f_types_impl_ <<
             param_spec_function_name << " (\"" << member_name << "\"," << endl <<
@@ -2498,7 +2501,7 @@
             args_indent << "NULL," << endl <<
             args_indent << min_value << "," << endl <<
             args_indent << max_value << "," << endl <<
-            args_indent << default_value << "," << endl <<
+            args_indent << default_value.str() << "," << endl <<
             args_indent << "G_PARAM_READWRITE));" << endl;
         }