Code cleanups

on behalf of Lebedev, see issue 1279
This commit is contained in:
Oliver Duis 2012-03-16 15:22:27 +01:00
parent d520543462
commit 2a507c8615
9 changed files with 62 additions and 62 deletions

View File

@ -262,7 +262,7 @@ public:
array2D<T> & operator[](int index) {
if (static_cast<size_t>(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];

View File

@ -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;

View File

@ -8,8 +8,8 @@
#include <cstdio>
#include <cstdarg>
void KLTError(char *fmt, ...);
void KLTWarning(char *fmt, ...);
void KLTError(const char *fmt, ...);
void KLTWarning(const char *fmt, ...);
#endif

View File

@ -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

View File

@ -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;

View File

@ -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

View File

@ -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)
{

View File

@ -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);

View File

@ -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;