diff --git a/color_flow.cpp b/color_flow.cpp index 67c75249ed2250ac228f2bafa7bce2c774eaea2d..9bae6fbf9f9b573951e5b74aba9d3030dbfe5d67 100644 --- a/color_flow.cpp +++ b/color_flow.cpp @@ -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; } diff --git a/imageLib/Image.cpp b/imageLib/Image.cpp index ec868a41b1c95c63c1f65c52109a38980df3ce09..2b6c4baf42aeee3ed9d9eb518729439a3ac20d83 100644 --- a/imageLib/Image.cpp +++ b/imageLib/Image.cpp @@ -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(); } diff --git a/imageLib/Image.h b/imageLib/Image.h index 89746c96904ece185cfad9e125f30e1f5d336616..6ed2db0fe421a76a7f09cc0168d79c1122a6c693 100644 --- a/imageLib/Image.h +++ b/imageLib/Image.h @@ -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, diff --git a/imageLib/ImageIO.cpp b/imageLib/ImageIO.cpp index 51aec0df2437b2c1de3c2fcdfd56df09486974d3..10299fe5d22983ce984d55b62621bcab10756bc1 100644 --- a/imageLib/ImageIO.cpp +++ b/imageLib/ImageIO.cpp @@ -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;