From ec41f80087bd01e7b4039fa859fe10ebacff33e3 Mon Sep 17 00:00:00 2001 From: Mark Pictor Date: Fri, 5 Aug 2011 17:04:09 -0400 Subject: [PATCH] [warning-fix][Wformat] Fix fprintf format specifier warnings --- src/clstepcore/STEPaggregate.cc | 2 +- src/express/variable.c | 2 +- src/fedex_plus/classes.c | 17 ++++++++++------- src/fedex_plus/selects.c | 16 ++++++++-------- 4 files changed, 20 insertions(+), 17 deletions(-) diff --git a/src/clstepcore/STEPaggregate.cc b/src/clstepcore/STEPaggregate.cc index 9d2d4e1b..6669b3a3 100644 --- a/src/clstepcore/STEPaggregate.cc +++ b/src/clstepcore/STEPaggregate.cc @@ -1942,7 +1942,7 @@ IntNode::STEPwrite(std::string &s, const char *) char tmp[BUFSIZ]; if(value != S_INT_NULL) { - sprintf(tmp, "%d", value); + sprintf(tmp, "%ld", value); s = tmp; } else diff --git a/src/express/variable.c b/src/express/variable.c index c95659c0..c400db87 100644 --- a/src/express/variable.c +++ b/src/express/variable.c @@ -214,7 +214,7 @@ VARget_simple_name(Variable v) e = e->e.op2; break; default: - fprintf(stderr,"unexpected op_code (%d) encountered in variable name expression\n",opcode_print(e->e.op_code)); + fprintf(stderr,"unexpected op_code (%s) encountered in variable name expression\n",opcode_print(e->e.op_code)); abort(); } } diff --git a/src/fedex_plus/classes.c b/src/fedex_plus/classes.c index 678b8110..b4328cd7 100644 --- a/src/fedex_plus/classes.c +++ b/src/fedex_plus/classes.c @@ -2422,7 +2422,7 @@ MemberFunctionSign (Entity entity, FILE* file) /* //////////////// */ if(corba_binding) { - fprintf(file, "\n//\t%d_ptr create_TIE();\n\tIDL_Application_instance_ptr create_TIE();\n", + fprintf(file, "\n//\t%s_ptr create_TIE();\n\tIDL_Application_instance_ptr create_TIE();\n", ENTITYget_CORBAname(entity)); /* fprintf(file, "\n//\t%s_ptr create_TIE();\n\tP26::Application_instance_ptr create_TIE();\n", @@ -2432,7 +2432,7 @@ MemberFunctionSign (Entity entity, FILE* file) fprintf (file, "};\n"); if(corba_binding) { - fprintf (file, "\n// Associate IDL interface generated code with implementation object\nDEF_TIE_%d(%s)\n", ENTITYget_CORBAname(entity), entnm); + fprintf (file, "\n// Associate IDL interface generated code with implementation object\nDEF_TIE_%s(%s)\n", ENTITYget_CORBAname(entity), entnm); } /* print creation function for class */ @@ -2711,7 +2711,10 @@ get_attribute_number (Entity entity) if (found) return i; else printf ( "Internal error: %s:%d\n" "Attribute %s not found. \n" - ,__FILE__,__LINE__, VARget_name (a)); + /* In this case, a is a Variable - so macro VARget_name (a) expands * + * to an Expression. The first element of an Expression is a Symbol. * + * The first element of a Symbol is char * name. */ + ,__FILE__,__LINE__, VARget_name(a)->symbol.name ); } LISTod; @@ -3232,7 +3235,7 @@ print_typechain(FILE *f,const Type t,char *buf,Schema schema) case set_: case list_: /* create a new TypeDescriptor variable, e.g. t1, and new space for it */ - fprintf(f,"\t%d * %s%d = new %d;\n", + fprintf(f,"\t%s * %s%d = new %s;\n", GetTypeDescriptorName(t), TD_PREFIX, count, GetTypeDescriptorName(t) ); @@ -4432,7 +4435,7 @@ TYPEprint_typedefs (Type t, FILE *classes) externln: /* Print the extern statement: */ strncpy (nm, TYPEtd_name(t), BUFSIZ); - fprintf( classes, "extern %d \t*%s;\n", GetTypeDescriptorName(t), nm ); + fprintf( classes, "extern %s \t*%s;\n", GetTypeDescriptorName(t), nm ); } /* return 1 if it is a multidimensional aggregate at the level passed in @@ -4602,7 +4605,7 @@ TYPEprint_descriptions (const Type type, FILES* files, Schema schema) /* in source - declare the real definition of the pointer */ /* i.e. in the .cc file */ - fprintf(files -> lib,"%d \t*%s;\n", GetTypeDescriptorName(type), tdnm); + fprintf(files -> lib,"%s \t*%s;\n", GetTypeDescriptorName(type), tdnm); if(isAggregateType(type)) { const char * ctype = TYPEget_ctype (type); @@ -4941,7 +4944,7 @@ TYPEprint_new (const Type type, FILE *create, Schema schema) case set_: case list_: - fprintf(create,"\n\t%s = new %d (\n", + fprintf(create,"\n\t%s = new %s (\n", TYPEtd_name (type), GetTypeDescriptorName(type)); /* fill in it's values */ diff --git a/src/fedex_plus/selects.c b/src/fedex_plus/selects.c index 9d273589..15b4abbf 100644 --- a/src/fedex_plus/selects.c +++ b/src/fedex_plus/selects.c @@ -570,7 +570,7 @@ TYPEselect_inc_print_vars( const Type type, FILE *f, Linked_List dups) fprintf( f, "/* \tunion { */\n" ); fprintf( f, "\t// types in SELECT \n" ); LISTdo( SEL_TYPEget_items(type), t, Type ) - fprintf( f, "\t// %s\t-- %d\n", + fprintf( f, "\t// %s\t-- %s\n", SEL_ITEMget_enumtype (t), FundamentalType (t,0)); LISTod; @@ -1432,7 +1432,7 @@ TYPEselect_lib_part21 (const Type type, FILE* f, Schema schema) fprintf(f, " return _%s.ValueType();\n else ", dm); break; default: - fprintf(f, " return %d;\n else ", FundamentalType(t,0)); + fprintf(f, " return %s;\n else ", FundamentalType(t,0)); } LISTod; @@ -1506,7 +1506,7 @@ TYPEselect_lib_part21 (const Type type, FILE* f, Schema schema) fprintf(f, " out << \")\";\n }\n else "); break; default: - fprintf(f, " _%s -> STEPwrite (out); \n else "); + fprintf(f, " _%s -> STEPwrite (out); \n else "); //FIXME should this be given 'dm' as an arg? break; } LISTod; @@ -1660,19 +1660,19 @@ TYPEselect_lib_StrToVal (const Type type, FILE* f, Schema schema) case enumeration_: if (!enum_cnt) { /* if there\'s more than one enumeration they are done in Select class */ - fprintf (f, " case %d : \n", FundamentalType (t, 0)); + fprintf (f, " case %s : \n", FundamentalType (t, 0)); fprintf( f, "\treturn _%s.StrToVal (str, &_error);\n", SEL_ITEMget_dmname (t)); } else { - fprintf (f, " // case %d : done in Select class\n", FundamentalType (t, 0)); + fprintf (f, " // case %s : done in Select class\n", FundamentalType (t, 0)); } ++enum_cnt; break; case string_: - fprintf (f, " case %d : \n", FundamentalType (t, 0)); + fprintf (f, " case %s : \n", FundamentalType (t, 0)); fprintf( f, "\treturn _%s.StrToVal (str);\n", SEL_ITEMget_dmname (t)); @@ -1683,7 +1683,7 @@ TYPEselect_lib_StrToVal (const Type type, FILE* f, Schema schema) case bag_: case set_: case list_: - fprintf (f, " case %d : \n", FundamentalType (t, 0)); + fprintf (f, " case %s : \n", FundamentalType (t, 0)); fprintf( f, "\treturn _%s.StrToVal (str, &_error, " "%s -> AggrElemTypeDescriptor ());\n", @@ -1694,7 +1694,7 @@ TYPEselect_lib_StrToVal (const Type type, FILE* f, Schema schema) default: /* otherwise use StrToVal on the contents to check the format */ - fprintf (f, " case %d : \n", FundamentalType (t, 0)); + fprintf (f, " case %s : \n", FundamentalType (t, 0)); fprintf( f, "\treturn _%s -> StrToVal (str, instances);\n", SEL_ITEMget_dmname (t));