Fix some coverity issues
This commit is contained in:
@@ -931,7 +931,12 @@ std::shared_ptr<rtengine::LCPProfile> rtengine::LCPStore::getProfile(const Glib:
|
||||
|
||||
std::shared_ptr<LCPProfile> res;
|
||||
if (!cache.get(filename, res)) {
|
||||
res.reset(new LCPProfile(filename));
|
||||
try {
|
||||
res.reset(new LCPProfile(filename));
|
||||
} catch (...) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
cache.set(filename, res);
|
||||
}
|
||||
|
||||
|
||||
@@ -479,13 +479,13 @@ int RawImage::loadRaw (bool loadData, unsigned int imageNum, bool closeFile, Pro
|
||||
iwidth = width;
|
||||
|
||||
if (filters || colors == 1) {
|
||||
raw_image = (ushort *) calloc ((raw_height + 7) * raw_width, 2);
|
||||
raw_image = (ushort *) calloc ((static_cast<unsigned int>(raw_height) + 7u) * static_cast<unsigned int>(raw_width), 2);
|
||||
merror (raw_image, "main()");
|
||||
}
|
||||
|
||||
// dcraw needs this global variable to hold pixel data
|
||||
image = (dcrawImage_t)calloc (height * width * sizeof * image + meta_length, 1);
|
||||
meta_data = (char *) (image + height * width);
|
||||
image = (dcrawImage_t)calloc (static_cast<unsigned int>(height) * static_cast<unsigned int>(width) * sizeof * image + meta_length, 1);
|
||||
meta_data = (char *) (image + static_cast<unsigned int>(height) * static_cast<unsigned int>(width));
|
||||
|
||||
if(!image) {
|
||||
return 200;
|
||||
@@ -673,7 +673,7 @@ int RawImage::loadRaw (bool loadData, unsigned int imageNum, bool closeFile, Pro
|
||||
return 0;
|
||||
}
|
||||
|
||||
float** RawImage::compress_image(int frameNum, bool freeImage)
|
||||
float** RawImage::compress_image(unsigned int frameNum, bool freeImage)
|
||||
{
|
||||
if( !image ) {
|
||||
return nullptr;
|
||||
@@ -682,7 +682,7 @@ float** RawImage::compress_image(int frameNum, bool freeImage)
|
||||
if (isBayer() || isXtrans()) {
|
||||
if (!allocation) {
|
||||
// shift the beginning of all frames but the first by 32 floats to avoid cache miss conflicts on CPUs which have <= 4-way associative L1-Cache
|
||||
allocation = new float[height * width + frameNum * 32];
|
||||
allocation = new float[static_cast<unsigned int>(height) * static_cast<unsigned int>(width) + frameNum * 32u];
|
||||
data = new float*[height];
|
||||
|
||||
for (int i = 0; i < height; i++) {
|
||||
|
||||
@@ -121,7 +121,7 @@ public:
|
||||
{
|
||||
return image;
|
||||
}
|
||||
float** compress_image(int frameNum, bool freeImage = true); // revert to compressed pixels format and release image data
|
||||
float** compress_image(unsigned int frameNum, bool freeImage = true); // revert to compressed pixels format and release image data
|
||||
float** data; // holds pixel values, data[i][j] corresponds to the ith row and jth column
|
||||
unsigned prefilters; // original filters saved ( used for 4 color processing )
|
||||
unsigned int getFrameCount() const { return is_raw; }
|
||||
|
||||
@@ -976,16 +976,19 @@ Tag::Tag (TagDirectory* p, FILE* f, int base)
|
||||
|
||||
if (tag == 0x002e) { // location of the embedded preview image in raw files of Panasonic cameras
|
||||
ExifManager eManager(f, nullptr, true);
|
||||
eManager.parseJPEG(ftell(f)); // try to parse the exif data from the preview image
|
||||
const auto fpos = ftell(f);
|
||||
if (fpos >= 0) {
|
||||
eManager.parseJPEG(fpos); // try to parse the exif data from the preview image
|
||||
|
||||
if (eManager.roots.size()) {
|
||||
const TagDirectory* const previewdir = eManager.roots.at(0);
|
||||
if (previewdir->getTag ("Exif")) {
|
||||
if (previewdir->getTag ("Make")) {
|
||||
if (previewdir->getTag ("Make")->valueToString() == "Panasonic") { // "make" is not yet available here, so get it from the preview tags to assure we're doing the right thing
|
||||
Tag* t = new Tag (parent->getRoot(), lookupAttrib (ifdAttribs, "Exif")); // replace raw exif with preview exif assuming there are the same
|
||||
t->initSubDir (previewdir->getTag ("Exif")->getDirectory());
|
||||
parent->getRoot()->addTag (t);
|
||||
if (eManager.roots.size()) {
|
||||
const TagDirectory* const previewdir = eManager.roots.at(0);
|
||||
if (previewdir->getTag ("Exif")) {
|
||||
if (previewdir->getTag ("Make")) {
|
||||
if (previewdir->getTag ("Make")->valueToString() == "Panasonic") { // "make" is not yet available here, so get it from the preview tags to assure we're doing the right thing
|
||||
Tag* t = new Tag (parent->getRoot(), lookupAttrib (ifdAttribs, "Exif")); // replace raw exif with preview exif assuming there are the same
|
||||
t->initSubDir (previewdir->getTag ("Exif")->getDirectory());
|
||||
parent->getRoot()->addTag (t);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2474,7 +2477,7 @@ parse_leafdata (TagDirectory* root, ByteOrder order)
|
||||
char *val = (char *)&value[pos];
|
||||
|
||||
if (strncmp (&hdr[8], "CameraObj_ISO_speed", 19) == 0) {
|
||||
iso_speed = 25 * (1 << (atoi (val) - 1));
|
||||
iso_speed = 25 * (1 << std::max((atoi (val) - 1), 0));
|
||||
found_count++;
|
||||
} else if (strncmp (&hdr[8], "ImgProf_rotation_angle", 22) == 0) {
|
||||
rotation_angle = atoi (val);
|
||||
|
||||
Reference in New Issue
Block a user