Skip to content

Commit d64e923

Browse files
author
Nicholas Reed
committed
Fix printf format errors. Informed by SCL git c075554, 0366706, af7d90d, ec41f80, d33d4c5, and e52c290.
1 parent afad910 commit d64e923

8 files changed

Lines changed: 14 additions & 27 deletions

File tree

src/clstepcore/STEPaggregate.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1737,7 +1737,7 @@ const char *
17371737
IntNode::STEPwrite( std::string & s, const char * ) {
17381738
char tmp[BUFSIZ];
17391739
if( value != S_INT_NULL ) {
1740-
sprintf( tmp, "%d", ( int )value );
1740+
sprintf( tmp, "%ld", value );
17411741
s = tmp;
17421742
} else {
17431743
s.clear();

src/exppp/exppp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1921,8 +1921,8 @@ EXPRstring( char * buffer, Expression e ) {
19211921
strcat( buffer, ")" );
19221922
break;
19231923
default:
1924-
sprintf( buffer, "EXPRstring: unknown expression, type %d", TYPEis( e->type ), buffer );
1925-
fprintf( stderr, buffer );
1924+
sprintf( buffer, "EXPRstring: unknown expression, type %d", TYPEis( e->type ));
1925+
fprintf( stderr, "%s", buffer );
19261926
}
19271927
}
19281928

src/express/dict.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ DICTprint( Dictionary dict ) {
5151
HASHlistinit( dict, &de );
5252

5353
while( 0 != ( e = ( HASHlist( &de ) ) ) ) {
54-
printf( "key <%s> data <%x> line <%d> <\"%c\" %s> <%s>\n",
54+
printf( "key <%s> data <%s> line <%d> <\"%c\" %s> <%s>\n",
5555
e->key, e->data, e->symbol->line, e->type,
5656
OBJget_type( e->type ), e->symbol->filename );
5757
}

src/express/error.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ va_dcl {
280280
fputc( '\n', error_file );
281281
ERRORoccurred = true;
282282
} else if( what->severity >= SEVERITY_WARNING ) {
283-
fprintf( error_file, "WARNING: ", what->severity );
283+
fprintf( error_file, "WARNING: ");
284284
vfprintf( error_file, what->message, args );
285285
fputc( '\n', error_file );
286286
}
@@ -520,7 +520,7 @@ ERROR_flush_message_buffer( void ) {
520520
int parent, child;
521521

522522
/* pop off the top of the heap */
523-
fprintf( stderr, heap[1].msg );
523+
fprintf( stderr, "%s", heap[1].msg );
524524

525525
replace = &heap[ERROR_with_lines--];
526526

src/express/express.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ PARSERrun( char * filename, FILE * fp ) {
615615
parseData.scanner = scanner;
616616

617617
if( print_objects_while_running & OBJ_PASS_BITS ) {
618-
fprintf( stdout, "parse (pass 0)\n", EXPRESSpass );
618+
fprintf( stdout, "parse (pass %d)\n", EXPRESSpass );
619619
}
620620

621621
if( print_objects_while_running & OBJ_SCHEMA_BITS ) {

src/express/memory.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,6 @@ Now you can say things like:
4444
#define ALLOC
4545
#endif /*ALLOC*/
4646

47-
void print_freelist( struct freelist_head * flh )
48-
{
49-
Freelist * current;
50-
51-
current = flh->freelist;
52-
while( current ) {
53-
printf( "-> %x", current );
54-
current = current->next;
55-
}
56-
putchar( '\n' );
57-
}
58-
5947
/* chop up big block into linked list of small blocks */
6048
Freelist * /* return 0 for failure */
6149
create_freelist( flh, bytes )

src/fedex_plus/classes.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1131,8 +1131,7 @@ DataMemberPrint( Entity entity, FILE * file, Schema schema ) {
11311131
generate_attribute_name( a, attrnm );
11321132
if( !strcmp( ctype, "SCLundefined" ) ) {
11331133
printf( "WARNING: in entity %s:\n", ENTITYget_name( entity ) );
1134-
printf( "\tthe type for attribute %s is not fully ",
1135-
"implemented\n", attrnm );
1134+
printf( "\tthe type for attribute %s is not fully implemented\n", attrnm );
11361135
}
11371136
if( TYPEis_entity( VARget_type( a ) ) ) {
11381137
fprintf( file, "\tSCLP23(Application_instance_ptr) _%s ;", attrnm );
@@ -1509,7 +1508,7 @@ get_attribute_number( Entity entity ) {
15091508
return i;
15101509
} else printf( "Internal error: %s:%d\n"
15111510
"Attribute %s not found. \n"
1512-
, __FILE__, __LINE__, VARget_name( a ) );
1511+
, __FILE__, __LINE__, EXPget_name( VARget_name( a ) ) );
15131512
}
15141513

15151514
LISTod;
@@ -2494,7 +2493,7 @@ ENTITYprint_new( Entity entity, FILES * files, Schema schema, int externMap ) {
24942493
fprintf( files->create, ", " );
24952494
}
24962495
uniqRule = EXPRto_string( v->name );
2497-
fprintf( files->create, uniqRule );
2496+
fprintf( files->create, "%s", uniqRule );
24982497
}
24992498
LISTod
25002499
fprintf( files->create, ";\\n\");\n" );

src/fedex_plus/selects.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ TYPEselect_inc_print_vars( const Type type, FILE * f, Linked_List dups ) {
591591
fprintf( f, "\t// types in SELECT \n" );
592592
LISTdo( SEL_TYPEget_items( type ), t, Type )
593593
fprintf( f, "\t// %s\t-- %s\n",
594-
SEL_ITEMget_enumtype( t ), FundamentalType( t ) );
594+
SEL_ITEMget_enumtype( t ), FundamentalType( t, 0 ) );
595595
LISTod;
596596

597597
LISTdo( data_members, t, Type )
@@ -667,7 +667,7 @@ class.
667667
*******************/
668668
void
669669
TYPEselect_inc_print( const Type type, FILE * f ) {
670-
char n[BUFSIZ]; /* class name */
670+
char n[BUFSIZ];
671671
char tdnm [BUFSIZ]; /* TypeDescriptor name */
672672
String attrnm;
673673
Linked_List dups;
@@ -748,7 +748,7 @@ TYPEselect_inc_print( const Type type, FILE * f ) {
748748
/** if there are duplicate underlying types **/
749749
fprintf( f, "\n\t// part 7\n" );
750750
fprintf( f, "\tconst TypeDescriptor *"
751-
"SetUnderlyingType ( const TypeDescriptor * td );\n", n );
751+
"SetUnderlyingType ( const TypeDescriptor * td );\n");
752752
} else {
753753
fprintf( f, "\n\t// part 7 ... NONE\tonly for complex selects...\n" );
754754
}
@@ -1900,7 +1900,7 @@ TYPEselect_lib_print( const Type type, FILE * f, Schema schema ) {
19001900
LISTdo( SEL_TYPEget_items( type ), t, Type )
19011901
z = FirstToUpper( TYPEget_name( t ) );
19021902
fprintf( f, "Logical %s::Is%s() const\n{\n", n, z );
1903-
fprintf( f, " if( !exists() )\n", n );
1903+
fprintf( f, " if( !exists() )\n");
19041904
fprintf( f, " return LUnknown;\n" );
19051905
fprintf( f, " if( CurrentUnderlyingType () == %s )\n", TYPEtd_name( t ) );
19061906
fprintf( f, " return LTrue;\n" );

0 commit comments

Comments
 (0)