fixing compilation errors

This commit is contained in:
Nikolaos Ftylitakis 2021-08-06 21:40:19 +03:00
parent d601d8e74c
commit 7eb571c2ae
46 changed files with 107 additions and 107 deletions

View File

@ -101,7 +101,7 @@ CameraImageWrapper *CameraImageWrapper::Factory(const QImage &sourceImage, int m
return new CameraImageWrapper(sourceImage);
}
QSharedPointer<std::vector<QSharedPointer<std::vector<zxing::byte>> > CameraImageWrapper::getOriginalImage()
QSharedPointer<std::vector<QSharedPointer<std::vector<zxing::byte>>>> CameraImageWrapper::getOriginalImage()
{
return imageBytesPerRow;
}
@ -167,11 +167,11 @@ QSharedPointer<std::vector<zxing::byte>> CameraImageWrapper::getRowP(int y, QSha
int width = getWidth();
if (row->size() != width)
row.reset(QSharedPointer<std::vector<zxing::byte>>(width));
row.reset(new std::vector<zxing::byte>(width));
Q_ASSERT(y >= 0 && y < getHeight());
return imageBytesPerRow[y];
return (*imageBytesPerRow)[y];
}
QSharedPointer<std::vector<zxing::byte>> CameraImageWrapper::getMatrixP() const
@ -195,13 +195,13 @@ void CameraImageWrapper::updateImageAsGrayscale(const QImage &origin)
const int width = getWidth();
const int height = getHeight();
imageBytes = QSharedPointer<std::vector<zxing::byte>>(height*width);
imageBytesPerRow = QSharedPointer<std::vector<QSharedPointer<std::vector<zxing::byte>>>(height);
zxing::byte* m = &imageBytes[0];
imageBytes = QSharedPointer<std::vector<zxing::byte>>(new std::vector<zxing::byte>(height*width));
imageBytesPerRow = QSharedPointer<std::vector<QSharedPointer<std::vector<zxing::byte>>>>(new std::vector<QSharedPointer<std::vector<zxing::byte>>>(height));
zxing::byte* m = &(*imageBytes)[0];
for(int j=0; j<height; j++)
{
QSharedPointer<std::vector<zxing::byte>> line(width);
QSharedPointer<std::vector<zxing::byte>> line(new std::vector<zxing::byte>(width));
for(int i=0; i<width; i++)
{
pixel = origin.pixel(i,j);
@ -209,12 +209,12 @@ void CameraImageWrapper::updateImageAsGrayscale(const QImage &origin)
pixelGrayscale = gray(qRed(pixel),qGreen(pixel),qBlue(pixel));
else
pixelGrayscale = pixel & 0xFF;
line[i] = pixelGrayscale;
(*line)[i] = pixelGrayscale;
}
imageBytesPerRow[j] = line;
(*imageBytesPerRow)[j] = line;
#if __cplusplus > 199711L
memcpy(m, line->values().data(), width);
memcpy(m, (*line).data(), width); ///the below line is also usable
#else
memcpy(m, &line[0], width);
#endif

View File

@ -33,7 +33,7 @@ public:
static CameraImageWrapper* Factory(const QImage& image, int maxWidth=-1, int maxHeight=-1, bool smoothTransformation=false);
QSharedPointer<std::vector<QSharedPointer<std::vector<zxing::byte>> > getOriginalImage();
QSharedPointer<std::vector<QSharedPointer<std::vector<zxing::byte>> > > getOriginalImage();
QSharedPointer<GreyscaleLuminanceSource> getDelegate() { return delegate; }
QSharedPointer<std::vector<zxing::byte>> getRow(int y, QSharedPointer<std::vector<zxing::byte>> row) const;
@ -53,7 +53,7 @@ private:
void updateImageAsGrayscale(const QImage &origin);
QSharedPointer<GreyscaleLuminanceSource> delegate;
QSharedPointer<std::vector<QSharedPointer<std::vector<zxing::byte>>> imageBytesPerRow;
QSharedPointer<std::vector<QSharedPointer<std::vector<zxing::byte>>>> imageBytesPerRow;
QSharedPointer<std::vector<zxing::byte>> imageBytes;
static const zxing::byte B_TO_GREYSCALE[256];

View File

@ -33,7 +33,7 @@ namespace zxing
int width = getWidth();
for (int i = 0; i < width; i++)
{
row[i] = 0xFF - row[i];
(*row)[i] = 0xFF - (*row)[i];
}
return row;
}
@ -42,10 +42,10 @@ namespace zxing
{
QSharedPointer<std::vector<zxing::byte>> matrix = delegate->getMatrix();
int length = getWidth() * getHeight();
QSharedPointer<std::vector<zxing::byte>> invertedMatrix(length);
QSharedPointer<std::vector<zxing::byte>> invertedMatrix(new std::vector<zxing::byte>(length));
for (int i = 0; i < length; i++)
{
invertedMatrix[i] = 0xFF - matrix[i];
(*invertedMatrix)[i] = 0xFF - (*matrix)[i];
}
return invertedMatrix;
}

View File

@ -63,7 +63,7 @@ LuminanceSource::operator std::string() const
row = getRow(y, row);
for (int x = 0; x < getWidth(); x++)
{
int luminance = row[x]; // & 0xFF;
int luminance = (*row)[x]; // & 0xFF;
char c;
if (luminance < 0x40)
{

View File

@ -22,7 +22,7 @@
#include <zxing/Result.h>
using zxing::Result;
using zxing::Ref;
using zxing::String;
using zxing::ResultPoint;

View File

@ -33,7 +33,7 @@ using std::vector;
using zxing::aztec::Detector;
using zxing::aztec::Point;
using zxing::aztec::AztecDetectorResult;
using zxing::Ref;
using zxing::ResultPoint;
using zxing::BitArray;

View File

@ -25,7 +25,7 @@ using zxing::BitArray;
// VC++
using zxing::Ref;
namespace zxing {

View File

@ -47,15 +47,15 @@ public:
int getSizeInBytes() const;
bool get(int i) const {
return (bits[i / 32] & (1 << (i & 0x1F))) != 0;
return ((*bits)[i / 32] & (1 << (i & 0x1F))) != 0;
}
void set(int i) {
bits[i / 32] |= 1 << (i & 0x1F);
(*bits)[i / 32] |= 1 << (i & 0x1F);
}
void flip(int i) {
bits[i / 32] ^= 1 << (i & 0x1F);
(*bits)[i / 32] ^= 1 << (i & 0x1F);
}
int getNextSet(int from);
@ -79,7 +79,7 @@ public:
std::string toString() const;
static QSharedPointer<std::vector<int>> makeArray(int size) {
return QSharedPointer<std::vector<int>>((size + 31) / 32);
return QSharedPointer<std::vector<int>>(new std::vector<int>((size + 31) / 32));
}
void reverse();

View File

@ -28,7 +28,7 @@ using std::ostringstream;
using zxing::BitMatrix;
using zxing::BitArray;
using zxing::Ref;
void BitMatrix::init(int width, int height) {
if (width < 1 || height < 1) {

View File

@ -46,12 +46,12 @@ public:
bool get(int x, int y) const {
int offset = y * rowSize + (x >> 5);
return ((((unsigned)bits[offset]) >> (x & 0x1f)) & 1) != 0;
return ((((unsigned)(*bits)[offset]) >> (x & 0x1f)) & 1) != 0;
}
void set(int x, int y) {
int offset = y * rowSize + (x >> 5);
bits[offset] |= 1 << (x & 0x1f);
(*bits)[offset] |= 1 << (x & 0x1f);
}
void flip(int x, int y);

View File

@ -1,36 +1,36 @@
#include "Counted.h"
//#include "Counted.h"
namespace zxing {
//namespace zxing {
Counted::Counted() :
count_(0)
{
}
//Counted::Counted() :
// count_(0)
//{
//}
Counted::~Counted()
{
}
//Counted::~Counted()
//{
//}
Counted *Counted::retain()
{
count_++;
return this;
}
//Counted *Counted::retain()
//{
// count_++;
// return this;
//}
void Counted::release()
{
count_--;
if (count_ == 0) {
count_ = 0xDEADF001;
delete this;
}
}
//void Counted::release()
//{
// count_--;
// if (count_ == 0) {
// count_ = 0xDEADF001;
// delete this;
// }
//}
size_t Counted::count() const
{
return count_;
}
//size_t Counted::count() const
//{
// return count_;
//}
}
//}

View File

@ -26,7 +26,7 @@ using namespace zxing;
DecoderResult::DecoderResult(QSharedPointer<std::vector<zxing::byte>> rawBytes,
QSharedPointer<String> text,
QSharedPointer<std::vector< QSharedPointer<std::vector<zxing::byte>> >& byteSegments,
QSharedPointer<std::vector< QSharedPointer<std::vector<zxing::byte>>>>& byteSegments,
string const& ecLevel, string charSet) :
rawBytes_(rawBytes),
text_(text),

View File

@ -32,14 +32,14 @@ class DecoderResult {
private:
QSharedPointer<std::vector<zxing::byte>> rawBytes_;
QSharedPointer<String> text_;
QSharedPointer<std::vector< QSharedPointer<std::vector<zxing::byte>> > byteSegments_;
QSharedPointer<std::vector< QSharedPointer<std::vector<zxing::byte>>>> byteSegments_;
std::string ecLevel_;
std::string charSet_;
public:
DecoderResult(QSharedPointer<std::vector<zxing::byte>> rawBytes,
QSharedPointer<String> text,
QSharedPointer<std::vector< QSharedPointer<std::vector<zxing::byte>> >& byteSegments,
QSharedPointer<std::vector< QSharedPointer<std::vector<zxing::byte>>>>& byteSegments,
std::string const& ecLevel,
std::string charSet = "");

View File

@ -24,7 +24,7 @@
using zxing::Binarizer;
using zxing::Ref;
using zxing::BitArray;
using zxing::BitMatrix;

View File

@ -22,7 +22,7 @@
#include <zxing/common/GreyscaleRotatedLuminanceSource.h>
#include <zxing/common/IllegalArgumentException.h>
using zxing::Ref;
using zxing::LuminanceSource;

View File

@ -51,7 +51,7 @@ GreyscaleRotatedLuminanceSource::getRow(int y, QSharedPointer<std::vector<zxing:
throw IllegalArgumentException("Requested row is outside the image.");
}
if (!row || row->size() < getWidth()) {
row = QSharedPointer<std::vector<zxing::byte>>(getWidth());
row.reset(new std::vector<zxing::byte>(getWidth()));
}
int offset = (left_ * dataWidth_) + (dataWidth_ - 1 - (y + top_));
using namespace std;
@ -62,19 +62,19 @@ GreyscaleRotatedLuminanceSource::getRow(int y, QSharedPointer<std::vector<zxing:
<< y << endl;
}
for (int x = 0; x < getWidth(); x++) {
row[x] = greyData_[offset];
(*row)[x] = (*greyData_)[offset];
offset += dataWidth_;
}
return row;
}
QSharedPointer<std::vector<zxing::byte>> GreyscaleRotatedLuminanceSource::getMatrix() const {
QSharedPointer<std::vector<zxing::byte>> result (getWidth() * getHeight());
QSharedPointer<std::vector<zxing::byte>> result (new std::vector<zxing::byte>(getWidth() * getHeight()));
for (int y = 0; y < getHeight(); y++) {
zxing::byte* row = &result[y * getWidth()];
zxing::byte* row = &(*result)[y * getWidth()];
int offset = (left_ * dataWidth_) + (dataWidth_ - 1 - (y + top_));
for (int x = 0; x < getWidth(); x++) {
row[x] = greyData_[offset];
row[x] = (*greyData_)[offset];
offset += dataWidth_;
}
}

View File

@ -117,7 +117,7 @@ HybridBinarizer::calculateThresholdForBlock(QSharedPointer<std::vector<zxing::by
int top = cap(y, 2, subHeight - 3);
int sum = 0;
for (int z = -2; z <= 2; z++) {
int *blackRow = &blackPoints[(top + z) * subWidth];
int *blackRow = &(*blackPoints)[(top + z) * subWidth];
sum += blackRow[left - 2];
sum += blackRow[left - 1];
sum += blackRow[left];
@ -140,7 +140,7 @@ void HybridBinarizer::thresholdBlock(QSharedPointer<std::vector<zxing::byte>> lu
y < BLOCK_SIZE;
y++, offset += stride) {
for (int x = 0; x < BLOCK_SIZE; x++) {
int pixel = luminances[offset + x] & 0xff;
int pixel = (*luminances)[offset + x] & 0xff;
if (pixel <= threshold) {
matrix->set(xoffset + x, yoffset + y);
}
@ -150,9 +150,9 @@ void HybridBinarizer::thresholdBlock(QSharedPointer<std::vector<zxing::byte>> lu
namespace {
inline int getBlackPointFromNeighbors(QSharedPointer<std::vector<int>> blackPoints, int subWidth, int x, int y) {
return (blackPoints[(y-1)*subWidth+x] +
2*blackPoints[y*subWidth+x-1] +
blackPoints[(y-1)*subWidth+x-1]) >> 2;
return ((*blackPoints)[(y-1)*subWidth+x] +
2*(*blackPoints)[y*subWidth+x-1] +
(*blackPoints)[(y-1)*subWidth+x-1]) >> 2;
}
}
@ -164,7 +164,7 @@ QSharedPointer<std::vector<int>> HybridBinarizer::calculateBlackPoints(QSharedPo
int height) {
const int minDynamicRange = 24;
QSharedPointer<std::vector<int>> blackPoints (subHeight * subWidth);
QSharedPointer<std::vector<int>> blackPoints (new std::vector<int>(subHeight * subWidth));
for (int y = 0; y < subHeight; y++) {
int yoffset = y << BLOCK_SIZE_POWER;
int maxYOffset = height - BLOCK_SIZE;
@ -184,7 +184,7 @@ QSharedPointer<std::vector<int>> HybridBinarizer::calculateBlackPoints(QSharedPo
yy < BLOCK_SIZE;
yy++, offset += width) {
for (int xx = 0; xx < BLOCK_SIZE; xx++) {
int pixel = luminances[offset + xx] & 0xFF;
int pixel = (*luminances)[offset + xx] & 0xFF;
sum += pixel;
// still looking for good contrast
if (pixel < min) {
@ -200,8 +200,8 @@ QSharedPointer<std::vector<int>> HybridBinarizer::calculateBlackPoints(QSharedPo
// finish the rest of the rows quickly
for (yy++, offset += width; yy < BLOCK_SIZE; yy++, offset += width) {
for (int xx = 0; xx < BLOCK_SIZE; xx += 2) {
sum += luminances[offset + xx] & 0xFF;
sum += luminances[offset + xx + 1] & 0xFF;
sum += (*luminances)[offset + xx] & 0xFF;
sum += (*luminances)[offset + xx + 1] & 0xFF;
}
}
}
@ -218,7 +218,7 @@ QSharedPointer<std::vector<int>> HybridBinarizer::calculateBlackPoints(QSharedPo
}
}
}
blackPoints[y * subWidth + x] = average;
(*blackPoints)[y * subWidth + x] = average;
}
}
return blackPoints;

View File

@ -46,8 +46,8 @@ QSharedPointer<PerspectiveTransform> PerspectiveTransform::squareToQuadrilateral
float dy3 = y0 - y1 + y2 - y3;
QSharedPointer<PerspectiveTransform> result;
if (dx3 == 0.0f && dy3 == 0.0f) {
result = new PerspectiveTransform(x1 - x0, x2 - x1, x0, y1 - y0, y2 - y1, y0, 0.0f,
0.0f, 1.0f);
result.reset(new PerspectiveTransform(x1 - x0, x2 - x1, x0, y1 - y0, y2 - y1, y0, 0.0f,
0.0f, 1.0f));
}
else
{
@ -58,8 +58,8 @@ QSharedPointer<PerspectiveTransform> PerspectiveTransform::squareToQuadrilateral
float denominator = dx1 * dy2 - dx2 * dy1;
float a13 = (dx3 * dy2 - dx2 * dy3) / denominator;
float a23 = (dx1 * dy3 - dx3 * dy1) / denominator;
result = new PerspectiveTransform(x1 - x0 + a13 * x1, x3 - x0 + a23 * x3, x0, y1 - y0
+ a13 * y1, y3 - y0 + a23 * y3, y0, a13, a23, 1.0f);
result.reset(new PerspectiveTransform(x1 - x0 + a13 * x1, x3 - x0 + a23 * x3, x0, y1 - y0
+ a13 * y1, y3 - y0 + a23 * y3, y0, a13, a23, 1.0f));
}
return result;

View File

@ -23,7 +23,7 @@
using std::string;
using zxing::String;
using zxing::Ref;
String::String(const std::string &text) :
text_(text) {

View File

@ -25,7 +25,7 @@
#include <algorithm>
using std::vector;
using zxing::Ref;
using zxing::ResultPoint;
using zxing::TwoInts;
using zxing::MonochromeRectangleDetector;

View File

@ -25,7 +25,7 @@
#include <sstream>
using std::vector;
using zxing::Ref;
using zxing::ResultPoint;
using zxing::WhiteRectangleDetector;
using zxing::common::detector::MathUtils;

View File

@ -26,7 +26,7 @@
using zxing::GenericGF;
using zxing::GenericGFPoly;
using zxing::Ref;
QSharedPointer<GenericGF> GenericGF::AZTEC_DATA_12(new GenericGF(0x1069, 4096, 1));
QSharedPointer<GenericGF> GenericGF::AZTEC_DATA_10(new GenericGF(0x409, 1024, 1));

View File

@ -26,7 +26,7 @@
using zxing::GenericGFPoly;
using zxing::Ref;
// VC++
using zxing::GenericGF;

View File

@ -25,7 +25,7 @@
#include <zxing/IllegalStateException.h>
using std::vector;
using zxing::Ref;
using zxing::ReedSolomonDecoder;
using zxing::GenericGFPoly;

View File

@ -27,7 +27,7 @@
#include <zxing/ChecksumException.h>
#include <zxing/common/reedsolomon/ReedSolomonException.h>
using zxing::Ref;
using zxing::DecoderResult;
//using zxing::datamatrix::Decoder;
//using zxing::datamatrix::DataBlock;

View File

@ -30,7 +30,7 @@
#include <algorithm>
using std::abs;
using zxing::Ref;
using zxing::BitMatrix;
using zxing::ResultPoint;
using zxing::DetectorResult;

View File

@ -20,7 +20,7 @@
#include <zxing/ResultPoint.h>
using std::vector;
using zxing::Ref;
using zxing::Result;
using zxing::multi::GenericMultipleBarcodeReader;

View File

@ -25,7 +25,7 @@ using std::abs;
using std::min;
using std::sort;
using std::vector;
using zxing::Ref;
using zxing::BitMatrix;
using zxing::ReaderException;
using zxing::qrcode::FinderPattern;

View File

@ -31,7 +31,7 @@ using std::string;
using zxing::NotFoundException;
using zxing::FormatException;
using zxing::ChecksumException;
using zxing::Ref;
using zxing::Result;
using zxing::oned::CodaBarReader;

View File

@ -35,7 +35,7 @@ using std::string;
using zxing::NotFoundException;
using zxing::FormatException;
using zxing::ChecksumException;
using zxing::Ref;
using zxing::Result;
using zxing::oned::Code128Reader;

View File

@ -26,7 +26,7 @@
#include <algorithm>
using std::vector;
using zxing::Ref;
using zxing::Result;
using zxing::String;
using zxing::NotFoundException;

View File

@ -27,7 +27,7 @@
using std::vector;
using std::string;
using zxing::Ref;
using zxing::Result;
using zxing::String;
using zxing::NotFoundException;

View File

@ -22,7 +22,7 @@ using std::vector;
using zxing::oned::EAN8Reader;
// VC++
using zxing::Ref;
using zxing::BitArray;
EAN8Reader::EAN8Reader() : decodeMiddleCounters(4, 0) {}

View File

@ -22,7 +22,7 @@
#include <zxing/ReaderException.h>
using zxing::oned::UPCAReader;
using zxing::Ref;
using zxing::Result;
// VC++

View File

@ -21,7 +21,7 @@
using std::string;
using std::vector;
using zxing::Ref;
using zxing::String;
using zxing::oned::UPCEReader;

View File

@ -30,7 +30,7 @@ using zxing::pdf417::decoder::BitMatrixParser;
// VC++
using zxing::Ref;
using zxing::BitMatrix;
const int BitMatrixParser::MAX_ROWS = 90;

View File

@ -24,7 +24,7 @@
using std::string;
using zxing::pdf417::DecodedBitStreamParser;
using zxing::Ref;
using zxing::DecoderResult;
using zxing::String;

View File

@ -28,7 +28,7 @@
using zxing::pdf417::decoder::Decoder;
using zxing::pdf417::decoder::ec::ErrorCorrection;
using zxing::Ref;
using zxing::DecoderResult;
// VC++

View File

@ -22,7 +22,7 @@
#include <zxing/pdf417/decoder/ec/ModulusGF.h>
using std::vector;
using zxing::Ref;
using zxing::pdf417::decoder::ec::ErrorCorrection;
using zxing::pdf417::decoder::ec::ModulusPoly;

View File

@ -20,7 +20,7 @@
#include <zxing/pdf417/decoder/ec/ModulusGF.h>
#include <zxing/pdf417/decoder/ec/ModulusPoly.h>
using zxing::Ref;
using zxing::pdf417::decoder::ec::ModulusGF;
using zxing::pdf417::decoder::ec::ModulusPoly;

View File

@ -29,7 +29,7 @@ using std::min;
using std::abs;
using zxing::pdf417::detector::LinesSampler;
using zxing::pdf417::decoder::BitMatrixParser;
using zxing::Ref;
using zxing::BitMatrix;
using zxing::NotFoundException;
using zxing::Point;

View File

@ -28,7 +28,7 @@ using std::numeric_limits;
using zxing::pdf417::detector::Detector;
using zxing::common::detector::Math;
using zxing::common::detector::MathUtils;
using zxing::Ref;
using zxing::DetectorResult;
using zxing::ResultPoint;

View File

@ -22,7 +22,7 @@
#include <zxing/qrcode/detector/AlignmentPattern.h>
using std::abs;
using zxing::Ref;
using zxing::qrcode::AlignmentPattern;
AlignmentPattern::AlignmentPattern(float posX, float posY, float estimatedModuleSize) :

View File

@ -37,7 +37,7 @@ using std::abs;
using std::min;
using std::max;
using zxing::qrcode::Detector;
using zxing::Ref;
using zxing::BitMatrix;
using zxing::ResultPointCallback;
using zxing::DetectorResult;

View File

@ -133,7 +133,7 @@ protected:
assertTrue(false);
for (size_t i = 0; i < expected.size(); i++) {
if (expected[i] != received[i]) {
if (expected[i] != (*received)[i]) {
qDebug() << QString::fromStdString(message) << ". Mismatch at " << QString::number(i) /*<< ". Expected " + arrayToString(expected) + ", got " +
arrayToString(Arrays.copyOf(received, expected.length)))*/;
assertTrue(false);
@ -145,9 +145,9 @@ protected:
const std::vector<zxing::byte> &expected,
const QSharedPointer<std::vector<int>> &received)
{
QSharedPointer<std::vector<zxing::byte>> received_copy(received->size());
QSharedPointer<std::vector<zxing::byte>> received_copy(new std::vector<zxing::byte>(received->size()));
for(int i=0; i<received_copy->size(); i++)
received_copy[i] = received[i];
(*received_copy)[i] = (*received)[i];
assertDataEquals(message, expected, received_copy);
}

View File

@ -43,7 +43,7 @@ void QRCodeTests::test()
// Set the matrix.
qrCode.setMatrix(matrix);
assertSame(matrix, qrCode.getMatrix());
assertSame(matrix.data(), qrCode.getMatrix().data());
}
void QRCodeTests::testToString1() {