diff --git a/rtengine/array2D.h b/rtengine/array2D.h index e79482543..b80f1d1e8 100644 --- a/rtengine/array2D.h +++ b/rtengine/array2D.h @@ -262,7 +262,7 @@ public: array2D & operator[](int index) { if (static_cast(index) >= num) { - printf("index %0u is out of range[0..%0u]", index, num - 1); + printf("index %0u is out of range[0..%0lu]", index, num - 1); raise( SIGSEGV); } return list[index]; diff --git a/rtengine/klt/error.cc b/rtengine/klt/error.cc index b984d3aeb..c23640d50 100644 --- a/rtengine/klt/error.cc +++ b/rtengine/klt/error.cc @@ -20,7 +20,7 @@ * exactly like printf */ -void KLTError(char *fmt, ...) +void KLTError(const char *fmt, ...) { va_list args; @@ -42,7 +42,7 @@ void KLTError(char *fmt, ...) * exactly like printf */ -void KLTWarning(char *fmt, ...) +void KLTWarning(const char *fmt, ...) { va_list args; diff --git a/rtengine/klt/error.h b/rtengine/klt/error.h index 95c2af736..3905f99ac 100644 --- a/rtengine/klt/error.h +++ b/rtengine/klt/error.h @@ -8,8 +8,8 @@ #include #include -void KLTError(char *fmt, ...); -void KLTWarning(char *fmt, ...); +void KLTError(const char *fmt, ...); +void KLTWarning(const char *fmt, ...); #endif diff --git a/rtengine/klt/klt.h b/rtengine/klt/klt.h index 10f318593..7b174b69b 100644 --- a/rtengine/klt/klt.h +++ b/rtengine/klt/klt.h @@ -209,28 +209,28 @@ void KLTWriteFeatureListToPPM( KLT_PixelType *greyimg, int ncols, int nrows, - char *filename); + const char *filename); void KLTWriteFeatureList( KLT_FeatureList fl, - char *filename, - char *fmt); + const char *filename, + const char *fmt); void KLTWriteFeatureHistory( KLT_FeatureHistory fh, - char *filename, - char *fmt); + const char *filename, + const char *fmt); void KLTWriteFeatureTable( KLT_FeatureTable ft, - char *filename, - char *fmt); + const char *filename, + const char *fmt); KLT_FeatureList KLTReadFeatureList( KLT_FeatureList fl, - char *filename); + const char *filename); KLT_FeatureHistory KLTReadFeatureHistory( KLT_FeatureHistory fh, - char *filename); + const char *filename); KLT_FeatureTable KLTReadFeatureTable( KLT_FeatureTable ft, - char *filename); + const char *filename); #ifdef __cplusplus } #endif diff --git a/rtengine/klt/klt_util.cc b/rtengine/klt/klt_util.cc index 0e3563daf..ebf203ae2 100644 --- a/rtengine/klt/klt_util.cc +++ b/rtengine/klt/klt_util.cc @@ -96,7 +96,7 @@ void _KLTPrintSubFloatImage( void _KLTWriteFloatImageToPGM( _KLT_FloatImage img, - char *filename) + const char *filename) { int npixs = img->ncols * img->nrows; float mmax = -999999.9f, mmin = 999999.9f; @@ -137,7 +137,7 @@ void _KLTWriteFloatImageToPGM( void _KLTWriteAbsFloatImageToPGM( _KLT_FloatImage img, - char *filename,float scale) + const char *filename,float scale) { int npixs = img->ncols * img->nrows; float fact; diff --git a/rtengine/klt/klt_util.h b/rtengine/klt/klt_util.h index 4759d7ace..4ddd2e74b 100644 --- a/rtengine/klt/klt_util.h +++ b/rtengine/klt/klt_util.h @@ -25,12 +25,12 @@ void _KLTPrintSubFloatImage( void _KLTWriteFloatImageToPGM( _KLT_FloatImage img, - char *filename); + const char *filename); /* for affine mapping */ void _KLTWriteAbsFloatImageToPGM( _KLT_FloatImage img, - char *filename,float scale); + const char *filename,float scale); #endif diff --git a/rtengine/klt/pnmio.cc b/rtengine/klt/pnmio.cc index 82ae5c467..de8a1b0d9 100644 --- a/rtengine/klt/pnmio.cc +++ b/rtengine/klt/pnmio.cc @@ -122,7 +122,7 @@ void ppmReadHeader( */ void pgmReadHeaderFile( - char *fname, + const char *fname, int *magic, int *ncols, int *nrows, int *maxval) @@ -148,7 +148,7 @@ void pgmReadHeaderFile( */ void ppmReadHeaderFile( - char *fname, + const char *fname, int *magic, int *ncols, int *nrows, int *maxval) @@ -218,7 +218,7 @@ unsigned char* pgmRead( */ unsigned char* pgmReadFile( - char *fname, + const char *fname, unsigned char *img, int *ncols, int *nrows) { @@ -247,7 +247,7 @@ unsigned char* pgmReadFile( void pgmWrite( FILE *fp, - unsigned char *img, + const unsigned char *img, int ncols, int nrows) { @@ -271,8 +271,8 @@ void pgmWrite( */ void pgmWriteFile( - char *fname, - unsigned char *img, + const char *fname, + const unsigned char *img, int ncols, int nrows) { @@ -298,9 +298,9 @@ void pgmWriteFile( void ppmWrite( FILE *fp, - unsigned char *redimg, - unsigned char *greenimg, - unsigned char *blueimg, + const unsigned char *redimg, + const unsigned char *greenimg, + const unsigned char *blueimg, int ncols, int nrows) { @@ -328,10 +328,10 @@ void ppmWrite( */ void ppmWriteFileRGB( - char *fname, - unsigned char *redimg, - unsigned char *greenimg, - unsigned char *blueimg, + const char *fname, + const unsigned char *redimg, + const unsigned char *greenimg, + const unsigned char *blueimg, int ncols, int nrows) { diff --git a/rtengine/klt/pnmio.h b/rtengine/klt/pnmio.h index 611439e57..9cf8ded95 100644 --- a/rtengine/klt/pnmio.h +++ b/rtengine/klt/pnmio.h @@ -16,20 +16,20 @@ * used for reading from/writing to files */ unsigned char* pgmReadFile( - char *fname, + const char *fname, unsigned char *img, int *ncols, int *nrows); void pgmWriteFile( - char *fname, - unsigned char *img, + const char *fname, + const unsigned char *img, int ncols, int nrows); void ppmWriteFileRGB( - char *fname, - unsigned char *redimg, - unsigned char *greenimg, - unsigned char *blueimg, + const char *fname, + const unsigned char *redimg, + const unsigned char *greenimg, + const unsigned char *blueimg, int ncols, int nrows); @@ -42,14 +42,14 @@ unsigned char* pgmRead( int *ncols, int *nrows); void pgmWrite( FILE *fp, - unsigned char *img, + const unsigned char *img, int ncols, int nrows); void ppmWrite( FILE *fp, - unsigned char *redimg, - unsigned char *greenimg, - unsigned char *blueimg, + const unsigned char *redimg, + const unsigned char *greenimg, + const unsigned char *blueimg, int ncols, int nrows); diff --git a/rtengine/klt/writeFeatures.cc b/rtengine/klt/writeFeatures.cc index e0be198fc..d902778de 100644 --- a/rtengine/klt/writeFeatures.cc +++ b/rtengine/klt/writeFeatures.cc @@ -40,7 +40,7 @@ void KLTWriteFeatureListToPPM( KLT_PixelType *greyimg, int ncols, int nrows, - char *filename) + const char *filename) { int nbytes = ncols * nrows * sizeof(char); uchar *redimg, *grnimg, *bluimg; @@ -94,8 +94,8 @@ void KLTWriteFeatureListToPPM( static FILE* _printSetupTxt( - char *fname, /* Input: filename, or NULL for stderr */ - char *fmt, /* Input: format (e.g., %5.1f or %3d) */ + const char *fname, /* Input: filename, or NULL for stderr */ + const char *fmt, /* Input: format (e.g., %5.1f or %3d) */ char *format, /* Output: format (e.g., (%5.1f,%5.1f)=%3d) */ char *type) /* Output: either 'f' or 'd', based on input format */ { @@ -131,7 +131,7 @@ static FILE* _printSetupTxt( static FILE* _printSetupBin( - char *fname) /* Input: filename */ + const char *fname) /* Input: filename */ { FILE *fp; if (fname == NULL) { @@ -169,8 +169,8 @@ static void _printInteger( static KLT_BOOL _isCharInString( - char c, - char *str) + const char c, + const char *str) { int width = strlen(str); int i; @@ -191,7 +191,7 @@ static KLT_BOOL _isCharInString( */ static int _findStringWidth( - char *str) + const char *str) { int width = 0; int add; @@ -234,7 +234,7 @@ static int _findStringWidth( static void _printHeader( FILE *fp, - char *format, + const char *format, structureType id, int nFrames, int nFeatures) @@ -290,8 +290,8 @@ static void _printHeader( static void _printFeatureTxt( FILE *fp, KLT_Feature feat, - char *format, - char type) + const char *format, + const char type) { assert(type == 'f' || type == 'd'); @@ -343,8 +343,8 @@ static void _printShutdown( void KLTWriteFeatureList( KLT_FeatureList fl, - char *fname, - char *fmt) + const char *fname, + const char *fmt) { FILE *fp; char format[100]; @@ -381,8 +381,8 @@ void KLTWriteFeatureList( void KLTWriteFeatureHistory( KLT_FeatureHistory fh, - char *fname, - char *fmt) + const char *fname, + const char *fmt) { FILE *fp; char format[100]; @@ -420,8 +420,8 @@ void KLTWriteFeatureHistory( void KLTWriteFeatureTable( KLT_FeatureTable ft, - char *fname, - char *fmt) + const char *fname, + const char *fmt) { FILE *fp; char format[100]; @@ -616,7 +616,7 @@ static void _readFeatureBin( KLT_FeatureList KLTReadFeatureList( KLT_FeatureList fl_in, - char *fname) + const char *fname) { FILE *fp; KLT_FeatureList fl; @@ -679,7 +679,7 @@ KLT_FeatureList KLTReadFeatureList( KLT_FeatureHistory KLTReadFeatureHistory( KLT_FeatureHistory fh_in, - char *fname) + const char *fname) { FILE *fp; KLT_FeatureHistory fh; @@ -741,7 +741,7 @@ KLT_FeatureHistory KLTReadFeatureHistory( KLT_FeatureTable KLTReadFeatureTable( KLT_FeatureTable ft_in, - char *fname) + const char *fname) { FILE *fp; KLT_FeatureTable ft;