add -Wcast-qual switch and fix all related warnings
This commit is contained in:
parent
a9edbcf47b
commit
17f343f682
|
@ -392,7 +392,7 @@ if(WITH_PROF)
|
|||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pg")
|
||||
endif()
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wuninitialized -Wno-deprecated-declarations -Wno-unused-result")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wuninitialized -Wcast-qual -Wno-deprecated-declarations -Wno-unused-result")
|
||||
if(OPTION_OMP)
|
||||
find_package(OpenMP)
|
||||
if(OPENMP_FOUND)
|
||||
|
|
|
@ -240,7 +240,7 @@ int CLASS fcol (int row, int col)
|
|||
|
||||
#ifndef __GLIBC__
|
||||
char *my_memmem (char *haystack, size_t haystacklen,
|
||||
char *needle, size_t needlelen)
|
||||
const char *needle, size_t needlelen)
|
||||
{
|
||||
char *c;
|
||||
for (c = haystack; c <= haystack + haystacklen - needlelen; c++)
|
||||
|
@ -9233,8 +9233,8 @@ void CLASS identify()
|
|||
fseek (ifp, 0, SEEK_SET);
|
||||
fread (head, 1, 32, ifp);
|
||||
/* RT: changed string constant */
|
||||
if ((cp = (char *) memmem (head, 32, (char*)"MMMM", 4)) ||
|
||||
(cp = (char *) memmem (head, 32, (char*)"IIII", 4))) {
|
||||
if ((cp = (char *) memmem (head, 32, "MMMM", 4)) ||
|
||||
(cp = (char *) memmem (head, 32, "IIII", 4))) {
|
||||
parse_phase_one (cp-head);
|
||||
if (cp-head && parse_tiff(0)) apply_tiff();
|
||||
} else if (order == 0x4949 || order == 0x4d4d) {
|
||||
|
|
|
@ -74,7 +74,7 @@ void Image16::getScanline(int row, unsigned char* buffer, int bps, bool isFloat)
|
|||
}
|
||||
}
|
||||
|
||||
void Image16::setScanline(int row, unsigned char* buffer, int bps, unsigned int numSamples)
|
||||
void Image16::setScanline(int row, const unsigned char* buffer, int bps, unsigned int numSamples)
|
||||
{
|
||||
|
||||
if (data == nullptr) {
|
||||
|
@ -101,7 +101,7 @@ void Image16::setScanline(int row, unsigned char* buffer, int bps, unsigned int
|
|||
}
|
||||
|
||||
case (IIOSF_UNSIGNED_SHORT): {
|
||||
unsigned short* sbuffer = (unsigned short*) buffer;
|
||||
const unsigned short* sbuffer = (const unsigned short*) buffer;
|
||||
int ix = 0;
|
||||
|
||||
for (int i = 0; i < width; ++i) {
|
||||
|
|
|
@ -56,7 +56,7 @@ public:
|
|||
}
|
||||
|
||||
void getScanline(int row, unsigned char* buffer, int bps, bool isFloat = false) const override;
|
||||
void setScanline(int row, unsigned char* buffer, int bps, unsigned int numSamples) override;
|
||||
void setScanline(int row, const unsigned char* buffer, int bps, unsigned int numSamples) override;
|
||||
|
||||
// functions inherited from IImage16:
|
||||
MyMutex& getMutex() override
|
||||
|
|
|
@ -55,7 +55,7 @@ void Image8::getScanline (int row, unsigned char* buffer, int bps, bool isFloat)
|
|||
}
|
||||
}
|
||||
|
||||
void Image8::setScanline (int row, unsigned char* buffer, int bps, unsigned int numSamples)
|
||||
void Image8::setScanline (int row, const unsigned char* buffer, int bps, unsigned int numSamples)
|
||||
{
|
||||
|
||||
if (data == nullptr) {
|
||||
|
@ -74,7 +74,7 @@ void Image8::setScanline (int row, unsigned char* buffer, int bps, unsigned int
|
|||
break;
|
||||
|
||||
case (IIOSF_UNSIGNED_SHORT): {
|
||||
unsigned short* sbuffer = (unsigned short*) buffer;
|
||||
const unsigned short* sbuffer = (const unsigned short*) buffer;
|
||||
|
||||
for (int i = 0, ix = row * width * 3; i < width * 3; ++i, ++ix) {
|
||||
data[ix] = uint16ToUint8Rounded(sbuffer[i]);
|
||||
|
|
|
@ -53,7 +53,7 @@ public:
|
|||
}
|
||||
|
||||
void getScanline (int row, unsigned char* buffer, int bps, bool isFloat = false) const override;
|
||||
void setScanline (int row, unsigned char* buffer, int bps, unsigned int numSamples) override;
|
||||
void setScanline (int row, const unsigned char* buffer, int bps, unsigned int numSamples) override;
|
||||
|
||||
// functions inherited from IImage*:
|
||||
MyMutex& getMutex () override
|
||||
|
|
|
@ -45,7 +45,7 @@ Imagefloat::~Imagefloat ()
|
|||
}
|
||||
|
||||
// Call this method to handle floating points input values of different size
|
||||
void Imagefloat::setScanline (int row, unsigned char* buffer, int bps, unsigned int numSamples)
|
||||
void Imagefloat::setScanline (int row, const unsigned char* buffer, int bps, unsigned int numSamples)
|
||||
{
|
||||
|
||||
if (data == nullptr) {
|
||||
|
@ -58,7 +58,7 @@ void Imagefloat::setScanline (int row, unsigned char* buffer, int bps, unsigned
|
|||
switch (sampleFormat) {
|
||||
case (IIOSF_FLOAT16): {
|
||||
int ix = 0;
|
||||
uint16_t* sbuffer = (uint16_t*) buffer;
|
||||
const uint16_t* sbuffer = (const uint16_t*) buffer;
|
||||
|
||||
for (int i = 0; i < width; i++) {
|
||||
r(row, i) = 65535.f * DNG_HalfToFloat(sbuffer[ix++]);
|
||||
|
@ -71,7 +71,7 @@ void Imagefloat::setScanline (int row, unsigned char* buffer, int bps, unsigned
|
|||
//case (IIOSF_FLOAT24):
|
||||
case (IIOSF_FLOAT32): {
|
||||
int ix = 0;
|
||||
float* sbuffer = (float*) buffer;
|
||||
const float* sbuffer = (const float*) buffer;
|
||||
|
||||
for (int i = 0; i < width; i++) {
|
||||
r(row, i) = 65535.f * sbuffer[ix++];
|
||||
|
@ -85,7 +85,7 @@ void Imagefloat::setScanline (int row, unsigned char* buffer, int bps, unsigned
|
|||
case (IIOSF_LOGLUV24):
|
||||
case (IIOSF_LOGLUV32): {
|
||||
int ix = 0;
|
||||
float* sbuffer = (float*) buffer;
|
||||
const float* sbuffer = (const float*) buffer;
|
||||
float xyzvalues[3], rgbvalues[3];
|
||||
|
||||
for (int i = 0; i < width; i++) {
|
||||
|
|
|
@ -62,7 +62,7 @@ public:
|
|||
}
|
||||
|
||||
void getScanline (int row, unsigned char* buffer, int bps, bool isFloat = false) const override;
|
||||
void setScanline (int row, unsigned char* buffer, int bps, unsigned int numSamples) override;
|
||||
void setScanline (int row, const unsigned char* buffer, int bps, unsigned int numSamples) override;
|
||||
|
||||
// functions inherited from IImagefloat:
|
||||
MyMutex& getMutex () override
|
||||
|
|
|
@ -89,7 +89,7 @@ void ImageIO::setMetadata (const rtexif::TagDirectory* eroot)
|
|||
}
|
||||
|
||||
if (eroot) {
|
||||
rtexif::TagDirectory* td = ((rtexif::TagDirectory*)eroot)->clone (nullptr);
|
||||
rtexif::TagDirectory* td = eroot->clone (nullptr);
|
||||
|
||||
// make IPTC and XMP pass through
|
||||
td->keepTag(0x83bb); // IPTC
|
||||
|
@ -113,7 +113,7 @@ void ImageIO::setMetadata (const rtexif::TagDirectory* eroot, const rtengine::pr
|
|||
}
|
||||
|
||||
if (eroot) {
|
||||
exifRoot = ((rtexif::TagDirectory*)eroot)->clone (nullptr);
|
||||
exifRoot = eroot->clone (nullptr);
|
||||
}
|
||||
|
||||
if (iptc != nullptr) {
|
||||
|
@ -140,7 +140,7 @@ void ImageIO::setMetadata (const rtexif::TagDirectory* eroot, const rtengine::pr
|
|||
for (unsigned int j = 0; j < i->second.size(); j++) {
|
||||
IptcDataSet * ds = iptc_dataset_new ();
|
||||
iptc_dataset_set_tag (ds, IPTC_RECORD_APP_2, IPTC_TAG_KEYWORDS);
|
||||
iptc_dataset_set_data (ds, (unsigned char*)i->second.at(j).c_str(), min(static_cast<size_t>(64), i->second.at(j).bytes()), IPTC_DONT_VALIDATE);
|
||||
iptc_dataset_set_data (ds, (const unsigned char*)i->second.at(j).c_str(), min(static_cast<size_t>(64), i->second.at(j).bytes()), IPTC_DONT_VALIDATE);
|
||||
iptc_data_add_dataset (iptc, ds);
|
||||
iptc_dataset_unref (ds);
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ void ImageIO::setMetadata (const rtexif::TagDirectory* eroot, const rtengine::pr
|
|||
for (unsigned int j = 0; j < i->second.size(); j++) {
|
||||
IptcDataSet * ds = iptc_dataset_new ();
|
||||
iptc_dataset_set_tag (ds, IPTC_RECORD_APP_2, IPTC_TAG_SUPPL_CATEGORY);
|
||||
iptc_dataset_set_data (ds, (unsigned char*)i->second.at(j).c_str(), min(static_cast<size_t>(32), i->second.at(j).bytes()), IPTC_DONT_VALIDATE);
|
||||
iptc_dataset_set_data (ds, (const unsigned char*)i->second.at(j).c_str(), min(static_cast<size_t>(32), i->second.at(j).bytes()), IPTC_DONT_VALIDATE);
|
||||
iptc_data_add_dataset (iptc, ds);
|
||||
iptc_dataset_unref (ds);
|
||||
}
|
||||
|
@ -162,7 +162,7 @@ void ImageIO::setMetadata (const rtexif::TagDirectory* eroot, const rtengine::pr
|
|||
if (i->first == strTags[j].field && !(i->second.empty())) {
|
||||
IptcDataSet * ds = iptc_dataset_new ();
|
||||
iptc_dataset_set_tag (ds, IPTC_RECORD_APP_2, strTags[j].tag);
|
||||
iptc_dataset_set_data (ds, (unsigned char*)i->second.at(0).c_str(), min(strTags[j].size, i->second.at(0).bytes()), IPTC_DONT_VALIDATE);
|
||||
iptc_dataset_set_data (ds, (const unsigned char*)i->second.at(0).c_str(), min(strTags[j].size, i->second.at(0).bytes()), IPTC_DONT_VALIDATE);
|
||||
iptc_data_add_dataset (iptc, ds);
|
||||
iptc_dataset_unref (ds);
|
||||
}
|
||||
|
@ -910,12 +910,12 @@ int ImageIO::loadPPMFromMemory(const char* buffer, int width, int height, bool s
|
|||
char swapped[line_length];
|
||||
|
||||
for ( int row = 0; row < height; ++row ) {
|
||||
::rtengine::swab(((char*)buffer) + (row * line_length), swapped, line_length);
|
||||
::rtengine::swab(((const char*)buffer) + (row * line_length), swapped, line_length);
|
||||
setScanline(row, (unsigned char*)&swapped[0], bps);
|
||||
}
|
||||
} else {
|
||||
for ( int row = 0; row < height; ++row ) {
|
||||
setScanline(row, ((unsigned char*)buffer) + (row * line_length), bps);
|
||||
setScanline(row, ((const unsigned char*)buffer) + (row * line_length), bps);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ public:
|
|||
virtual void getStdImage (const ColorTemp &ctemp, int tran, Imagefloat* image, PreviewProps pp) const = 0;
|
||||
virtual int getBPS () const = 0;
|
||||
virtual void getScanline (int row, unsigned char* buffer, int bps, bool isFloat = false) const = 0;
|
||||
virtual void setScanline (int row, unsigned char* buffer, int bps, unsigned int numSamples = 3) = 0;
|
||||
virtual void setScanline (int row, const unsigned char* buffer, int bps, unsigned int numSamples = 3) = 0;
|
||||
virtual const char* getType () const = 0;
|
||||
|
||||
int load (const Glib::ustring &fname);
|
||||
|
|
|
@ -673,7 +673,7 @@ int TagDirectory::calculateSize ()
|
|||
return size;
|
||||
}
|
||||
|
||||
TagDirectory* TagDirectory::clone (TagDirectory* parent)
|
||||
TagDirectory* TagDirectory::clone (TagDirectory* parent) const
|
||||
{
|
||||
|
||||
TagDirectory* td = new TagDirectory (parent, attribs, order);
|
||||
|
@ -857,7 +857,7 @@ TagDirectoryTable::TagDirectoryTable (TagDirectory* p, FILE* f, int memsize, int
|
|||
}
|
||||
}
|
||||
}
|
||||
TagDirectory* TagDirectoryTable::clone (TagDirectory* parent)
|
||||
TagDirectory* TagDirectoryTable::clone (TagDirectory* parent) const
|
||||
{
|
||||
|
||||
TagDirectory* td = new TagDirectoryTable (parent, values, valuesSize, zeroOffset, defaultType, attribs, order);
|
||||
|
@ -1382,7 +1382,7 @@ bool Tag::parseMakerNote (FILE* f, int base, ByteOrder bom )
|
|||
return true;
|
||||
}
|
||||
|
||||
Tag* Tag::clone (TagDirectory* parent)
|
||||
Tag* Tag::clone (TagDirectory* parent) const
|
||||
{
|
||||
|
||||
Tag* t = new Tag (parent, attrib);
|
||||
|
@ -1397,7 +1397,7 @@ Tag* Tag::clone (TagDirectory* parent)
|
|||
t->value = new unsigned char [valuesize];
|
||||
memcpy (t->value, value, valuesize);
|
||||
} else {
|
||||
value = nullptr;
|
||||
t->value = nullptr;
|
||||
}
|
||||
|
||||
t->makerNoteKind = makerNoteKind;
|
||||
|
|
|
@ -180,7 +180,7 @@ public:
|
|||
|
||||
virtual int calculateSize ();
|
||||
virtual int write (int start, unsigned char* buffer);
|
||||
virtual TagDirectory* clone (TagDirectory* parent);
|
||||
virtual TagDirectory* clone (TagDirectory* parent) const;
|
||||
void applyChange (const std::string &field, const Glib::ustring &value);
|
||||
|
||||
virtual void printAll (unsigned int level = 0) const; // reentrant debug function, keep level=0 on first call !
|
||||
|
@ -204,7 +204,7 @@ public:
|
|||
~TagDirectoryTable() override;
|
||||
int calculateSize () override;
|
||||
int write (int start, unsigned char* buffer) override;
|
||||
TagDirectory* clone (TagDirectory* parent) override;
|
||||
TagDirectory* clone (TagDirectory* parent) const override;
|
||||
};
|
||||
|
||||
// a class representing a single tag
|
||||
|
@ -310,7 +310,7 @@ public:
|
|||
// functions for writing
|
||||
int calculateSize ();
|
||||
int write (int offs, int dataOffs, unsigned char* buffer);
|
||||
Tag* clone (TagDirectory* parent);
|
||||
Tag* clone (TagDirectory* parent) const;
|
||||
|
||||
// to control if the tag shall be written
|
||||
bool getKeep ()
|
||||
|
|
Loading…
Reference in New Issue