Fix compilation and more C++11 (fixes #5368)

This commit is contained in:
Flössie 2019-07-06 17:37:49 +02:00
parent c39a79802f
commit 6cbcb9fee5
2 changed files with 7 additions and 6 deletions

View File

@ -235,7 +235,7 @@ void dfInfo::updateBadPixelList( RawImage *df )
df->data[row + 2][col - 2] + df->data[row + 2][col] + df->data[row + 2][col + 2]); df->data[row + 2][col - 2] + df->data[row + 2][col] + df->data[row + 2][col + 2]);
if( df->data[row][col] > m * threshold ) { if( df->data[row][col] > m * threshold ) {
badPixelsThread.push_back( badPix(col, row) ); badPixelsThread.emplace_back(col, row);
} }
} }
@ -566,7 +566,7 @@ int DFManager::scanBadPixelsFile( Glib::ustring filename )
if( numparms == 1 ) { // only one number in first line means, that this is the offset. if( numparms == 1 ) { // only one number in first line means, that this is the offset.
offset = x; offset = x;
} else if(numparms == 2) { } else if(numparms == 2) {
bp.push_back( badPix(x + offset, y + offset) ); bp.emplace_back(x + offset, y + offset);
} }
while( fgets(line, sizeof(line), file ) ) { while( fgets(line, sizeof(line), file ) ) {

View File

@ -20,6 +20,7 @@
*/ */
#include <cstdint> #include <cstdint>
#include <cstring>
#include <vector> #include <vector>
#include "noncopyable.h" #include "noncopyable.h"
@ -77,8 +78,8 @@ public:
// set pixels from a list // set pixels from a list
int set(const std::vector<badPix>& bp) int set(const std::vector<badPix>& bp)
{ {
for (std::vector<badPix>::const_iterator iter = bp.begin(); iter != bp.end(); ++iter) { for (const auto& bad_pix : bp) {
set(iter->x, iter->y); set(bad_pix.x, bad_pix.y);
} }
return bp.size(); return bp.size();
@ -86,7 +87,7 @@ public:
void clear() void clear()
{ {
memset(pm, 0, h * w * base_t_size); std::memset(pm, 0, h * w * base_t_size);
} }
// return 0 if at least one pixel in the word(base_t) is set, otherwise return the number of pixels to skip to the next word base_t // return 0 if at least one pixel in the word(base_t) is set, otherwise return the number of pixels to skip to the next word base_t
int skipIfZero(int x, int y) const int skipIfZero(int x, int y) const