Skip to content
Snippets Groups Projects
Commit b8660296 authored by Hilb, Stephan's avatar Hilb, Stephan
Browse files

fix warnings

parent ee350f15
No related branches found
No related tags found
No related merge requests found
......@@ -90,7 +90,7 @@ int main(int argc, char *argv[])
throw CError(usage, argv[0]);
}
catch (CError &err) {
fprintf(stderr, err.message);
fprintf(stderr, "%s", err.message);
fprintf(stderr, "\n");
return -1;
}
......
......@@ -83,10 +83,14 @@ void CImage::ReAllocate(CShape s, const type_info& ti, int bandSize,
void CImage::ReAllocate(CShape s, const type_info& ti, int bandSize,
void *memory, bool deleteWhenDone, int rowSize)
{ ReAllocate(s, &ti, bandSize, memory, deleteWhenDone, rowSize); }
void CImage::ReAllocate(CShape s, const type_info* ti, int bandSize,
void *memory, bool deleteWhenDone, int rowSize)
{
// Set up the type_id, shape, and size info
m_shape = s; // image shape (dimensions)
m_pTI = &ti; // pointer to type_info class
m_pTI = ti; // pointer to type_info class
m_bandSize = bandSize; // size of each band in bytes
m_pixSize = m_bandSize * s.nBands; // stride between pixels in bytes
......@@ -107,7 +111,7 @@ void CImage::ReAllocate(CShape s, const type_info& ti, int bandSize,
void CImage::DeAllocate()
{
// Release the memory & set to default values
ReAllocate(CShape(), *(const type_info *) 0, 0, 0, false, 0);
ReAllocate(CShape(), (const type_info *) 0, 0, 0, false, 0);
SetDefaults();
}
......
......@@ -119,6 +119,8 @@ public:
CImage(CShape s, const type_info& ti, int bandSize);
// uses system-supplied copy constructor, assignment operator, and destructor
void ReAllocate(CShape s, const type_info* ti, int bandSize,
void *memory, bool deleteWhenDone, int rowSize);
void ReAllocate(CShape s, const type_info& ti, int bandSize,
void *memory, bool deleteWhenDone, int rowSize);
void ReAllocate(CShape s, const type_info& ti, int bandSize,
......
......@@ -74,11 +74,11 @@ const int TargaRawColormap = 1;
const int TargaRawRGB = 2;
const int TargaRawBW = 3;
const int TargaRunColormap = 9;
const int TargaRunRGB = 10;
[[maybe_unused]] const int TargaRunRGB = 10;
const int TargaRunBW = 11;
// Descriptor fields
const int TargaAttrBits = 15;
[[maybe_unused]] const int TargaAttrBits = 15;
const int TargaScreenOrigin = (1<<5);
const int TargaCMapSize = 256;
const int TargaCMapBands = 3;
......@@ -151,7 +151,7 @@ void ReadFileTGA(CByteImage& img, const char* filename)
{
char* tmp = new char[h.idLength];
int nread = (int)fread(tmp, sizeof(uchar), h.idLength, stream);
delete tmp; // throw away this data
delete[] tmp; // throw away this data
if (nread != h.idLength)
throw CError("ReadFileTGA(%s): file is too short", filename);
}
......@@ -358,7 +358,7 @@ void ReadFilePGM(CByteImage& img, const char* filename)
if (stream == 0)
throw CError("ReadFilePGM: could not open %s", filename);
int width, height, nBands;
int width = 0, height = 0, nBands = 0;
const char *dot = strrchr(filename, '.');
int isGray = 0, isFloat = 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment