From d602e0b75c9c7f701f834626eee24c2487d277ad Mon Sep 17 00:00:00 2001 From: rlar Date: Tue, 23 Nov 2010 19:36:21 +0000 Subject: [PATCH] attract gcc's attention to some printf format strings (for type checking) --- ChangeLog | 7 +++++++ src/ciderlib/oned/oneprint.c | 6 +++--- src/ciderlib/support/globals.c | 4 ++-- src/ciderlib/support/mater.c | 4 ++-- src/ciderlib/twod/twoprint.c | 6 +++--- 5 files changed, 17 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2ea6f4cbc..cc2cf52a1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2010-11-23 Robert Larice + * src/ciderlib/oned/oneprint.c , + * src/ciderlib/support/globals.c , + * src/ciderlib/support/mater.c , + * src/ciderlib/twod/twoprint.c : + attract gcc's attention to some printf format strings (for type checking) + 2010-11-23 Robert Larice * src/frontend/inpcom.c , * src/frontend/plotting/grid.c : diff --git a/src/ciderlib/oned/oneprint.c b/src/ciderlib/oned/oneprint.c index e3978134f..7b08c7680 100644 --- a/src/ciderlib/oned/oneprint.c +++ b/src/ciderlib/oned/oneprint.c @@ -326,8 +326,8 @@ struct MatrixElement { void ONEmemStats(FILE *file, ONEdevice *pDevice) { - static char *memFormat = "%-20s%10d%10d\n"; -/* static char *sumFormat = "%20s %-10d\n";*/ + static const char memFormat[] = "%-20s%10d%10d\n"; +/* static const char sumFormat[] = "%20s %-10d\n";*/ unsigned int size; unsigned int memory; ONEmaterial *pMaterial; @@ -405,7 +405,7 @@ ONEmemStats(FILE *file, ONEdevice *pDevice) void ONEcpuStats(FILE *file, ONEdevice *pDevice) { - static char *cpuFormat = "%-20s%10g%10g%10g%10g%10g\n"; + static const char cpuFormat[] = "%-20s%10g%10g%10g%10g%10g\n"; ONEstats *pStats = pDevice->pStats; double total; int iTotal; diff --git a/src/ciderlib/support/globals.c b/src/ciderlib/support/globals.c index 8f298eb28..e8b3d63a5 100644 --- a/src/ciderlib/support/globals.c +++ b/src/ciderlib/support/globals.c @@ -132,8 +132,8 @@ void GLOBgetGlobals(GLOBvalues *values) void GLOBprnGlobals(FILE *file, GLOBvalues *values) { - static char *tabformat = "%12s: % .4e %-12s\t"; - static char *newformat = "%12s: % .4e %-12s\n"; + static const char tabformat[] = "%12s: % .4e %-12s\t"; + static const char newformat[] = "%12s: % .4e %-12s\n"; if ( values == NIL( GLOBvalues ) ) { fprintf( stderr, "Error: tried to print NIL GLOBvalues\n"); diff --git a/src/ciderlib/support/mater.c b/src/ciderlib/support/mater.c index 335b13c8a..b77067b6d 100644 --- a/src/ciderlib/support/mater.c +++ b/src/ciderlib/support/mater.c @@ -277,8 +277,8 @@ MATLtempDep(MaterialInfo *info, double tnom) void printMaterialInfo(MaterialInfo *info) { - static char *tabformat = "%12s: % .4e %-12s\t"; - static char *newformat = "%12s: % .4e %-12s\n"; + static const char tabformat[] = "%12s: % .4e %-12s\t"; + static const char newformat[] = "%12s: % .4e %-12s\n"; char *name; diff --git a/src/ciderlib/twod/twoprint.c b/src/ciderlib/twod/twoprint.c index ea5d2179c..a61fdcac2 100644 --- a/src/ciderlib/twod/twoprint.c +++ b/src/ciderlib/twod/twoprint.c @@ -344,8 +344,8 @@ struct MatrixElement void TWOmemStats(FILE *file, TWOdevice *pDevice) { - static char *memFormat = "%-20s%10d%10d\n"; -/* static char *sumFormat = "%20s %-10d\n"; */ + static const char memFormat[] = "%-20s%10d%10d\n"; +/* static const char sumFormat[] = "%20s %-10d\n"; */ unsigned int size; unsigned int memory; TWOmaterial *pMaterial; @@ -432,7 +432,7 @@ TWOmemStats(FILE *file, TWOdevice *pDevice) void TWOcpuStats(FILE *file, TWOdevice *pDevice) { - static char *cpuFormat = "%-20s%10g%10g%10g%10g%10g\n"; + static const char cpuFormat[] = "%-20s%10g%10g%10g%10g%10g\n"; TWOstats *pStats = pDevice->pStats; double total; int iTotal;