fixing compilation errors

This commit is contained in:
Nikolaos Ftylitakis 2021-08-07 00:31:24 +03:00
parent 4af0dd58f1
commit 5cb7431435
23 changed files with 71 additions and 82 deletions

View File

@ -360,10 +360,10 @@ QRectF getTagRect(const QSharedPointer<std::vector<QSharedPointer<ResultPoint>>
if (resultRectPoints.size() != 4) if (resultRectPoints.size() != 4)
return QRectF(); return QRectF();
qreal xMin = qreal(resultPoints[0]->getX()); qreal xMin = qreal((*resultPoints)[0]->getX());
qreal xMax = xMin; qreal xMax = xMin;
for (int i = 1; i < resultPoints->size(); ++i) { for (int i = 1; i < resultPoints->size(); ++i) {
qreal x = qreal(resultPoints[i]->getX()); qreal x = qreal((*resultPoints)[i]->getX());
if (x < xMin) if (x < xMin)
xMin = x; xMin = x;
if (x > xMax) if (x > xMax)
@ -385,13 +385,13 @@ QRectF getTagRect(const QSharedPointer<std::vector<QSharedPointer<ResultPoint>>
// 2D QR code // 2D QR code
if (resultPoints->size() == 4) { if (resultPoints->size() == 4) {
qreal xMin = qreal(resultPoints[0]->getX()); qreal xMin = qreal((*resultPoints)[0]->getX());
qreal xMax = xMin; qreal xMax = xMin;
qreal yMin = qreal(resultPoints[0]->getY()); qreal yMin = qreal((*resultPoints)[0]->getY());
qreal yMax = yMin; qreal yMax = yMin;
for (int i = 1; i < resultPoints->size(); ++i) { for (int i = 1; i < resultPoints->size(); ++i) {
qreal x = qreal(resultPoints[i]->getX()); qreal x = qreal((*resultPoints)[i]->getX());
qreal y = qreal(resultPoints[i]->getY()); qreal y = qreal((*resultPoints)[i]->getY());
if (x < xMin) if (x < xMin)
xMin = x; xMin = x;
if (x > xMax) if (x > xMax)

View File

@ -41,7 +41,6 @@ namespace zxing {
bool initialized; bool initialized;
GenericGF(int primitive, size_t size, int b); GenericGF(int primitive, size_t size, int b);
~GenericGF();
void initialize(); void initialize();
void checkInit(); void checkInit();
@ -56,6 +55,8 @@ namespace zxing {
static QSharedPointer<GenericGF> DATA_MATRIX_FIELD_256; static QSharedPointer<GenericGF> DATA_MATRIX_FIELD_256;
static QSharedPointer<GenericGF> MAXICODE_FIELD_64; static QSharedPointer<GenericGF> MAXICODE_FIELD_64;
~GenericGF();
QSharedPointer<GenericGFPoly> getZero(); QSharedPointer<GenericGFPoly> getZero();
QSharedPointer<GenericGFPoly> getOne(); QSharedPointer<GenericGFPoly> getOne();
size_t getSize(); size_t getSize();

View File

@ -84,7 +84,7 @@ void GenericMultipleBarcodeReader::doDecodeMultiple(QSharedPointer<BinaryBitmap>
float maxX = 0.0f; float maxX = 0.0f;
float maxY = 0.0f; float maxY = 0.0f;
for (int i = 0; i < resultPoints->size(); i++) { for (int i = 0; i < resultPoints->size(); i++) {
QSharedPointer<ResultPoint> point = resultPoints[i]; QSharedPointer<ResultPoint> point = (*resultPoints)[i];
float x = point->getX(); float x = point->getX();
float y = point->getY(); float y = point->getY();
if (x < minX) { if (x < minX) {
@ -130,8 +130,8 @@ QSharedPointer<Result> GenericMultipleBarcodeReader::translateResultPoints(QShar
} }
QSharedPointer<std::vector<QSharedPointer<ResultPoint>> > newResultPoints; QSharedPointer<std::vector<QSharedPointer<ResultPoint>> > newResultPoints;
for (int i = 0; i < oldResultPoints->size(); i++) { for (int i = 0; i < oldResultPoints->size(); i++) {
QSharedPointer<ResultPoint> oldPoint = oldResultPoints[i]; QSharedPointer<ResultPoint> oldPoint = (*oldResultPoints)[i];
newResultPoints->values().push_back(QSharedPointer<ResultPoint>(new ResultPoint(oldPoint->getX() + xOffset, oldPoint->getY() + yOffset))); newResultPoints->push_back(QSharedPointer<ResultPoint>(new ResultPoint(oldPoint->getX() + xOffset, oldPoint->getY() + yOffset)));
} }
return QSharedPointer<Result>(new Result(result->getText(), result->getRawBytes(), newResultPoints, result->getBarcodeFormat())); return QSharedPointer<Result>(new Result(result->getText(), result->getRawBytes(), newResultPoints, result->getBarcodeFormat()));
} }

View File

@ -154,11 +154,9 @@ QSharedPointer<Result> CodaBarReader::decodeRow(int rowNumber, QSharedPointer<Bi
} }
float right = (float) runningCount; float right = (float) runningCount;
QSharedPointer<std::vector<QSharedPointer<ResultPoint>> > resultPoints(2); QSharedPointer<std::vector<QSharedPointer<ResultPoint>>> resultPoints(new std::vector<QSharedPointer<ResultPoint>>(2));
resultPoints[0] = (*resultPoints)[0].reset(new OneDResultPoint(left, (float) rowNumber));
QSharedPointer<OneDResultPoint>(new OneDResultPoint(left, (float) rowNumber)); (*resultPoints)[1].reset(new OneDResultPoint(right, (float) rowNumber));
resultPoints[1] =
QSharedPointer<OneDResultPoint>(new OneDResultPoint(right, (float) rowNumber));
return QSharedPointer<Result>(new Result(QSharedPointer<String>(new String(decodeRowResult)), return QSharedPointer<Result>(new Result(QSharedPointer<String>(new String(decodeRowResult)),
QSharedPointer<std::vector<zxing::byte>>(), QSharedPointer<std::vector<zxing::byte>>(),

View File

@ -532,16 +532,14 @@ QSharedPointer<Result> Code128Reader::decodeRow(int rowNumber, QSharedPointer<Bi
float right = lastStart + lastPatternSize / 2.0f; float right = lastStart + lastPatternSize / 2.0f;
int rawCodesSize = rawCodes.size(); int rawCodesSize = rawCodes.size();
QSharedPointer<std::vector<zxing::byte>> rawBytes (rawCodesSize); QSharedPointer<std::vector<zxing::byte>> rawBytes (new std::vector<zxing::byte>(rawCodesSize));
for (int i = 0; i < rawCodesSize; i++) { for (int i = 0; i < rawCodesSize; i++) {
rawBytes[i] = rawCodes[i]; (*rawBytes)[i] = rawCodes[i];
} }
QSharedPointer<std::vector<QSharedPointer<ResultPoint>> > resultPoints(2); QSharedPointer<std::vector<QSharedPointer<ResultPoint>>> resultPoints(new std::vector<QSharedPointer<ResultPoint>>(2));
resultPoints[0] = (*resultPoints)[0].reset(new OneDResultPoint(left, (float) rowNumber));
QSharedPointer<OneDResultPoint>(new OneDResultPoint(left, (float) rowNumber)); (*resultPoints)[1].reset(new OneDResultPoint(right, (float) rowNumber));
resultPoints[1] =
QSharedPointer<OneDResultPoint>(new OneDResultPoint(right, (float) rowNumber));
return QSharedPointer<Result>(new Result(QSharedPointer<String>(new String(result)), rawBytes, resultPoints, return QSharedPointer<Result>(new Result(QSharedPointer<String>(new String(result)), rawBytes, resultPoints,
BarcodeFormat::CODE_128)); BarcodeFormat::CODE_128));

View File

@ -164,11 +164,9 @@ QSharedPointer<Result> Code39Reader::decodeRow(int rowNumber, QSharedPointer<Bit
float left = (float) (start[1] + start[0]) / 2.0f; float left = (float) (start[1] + start[0]) / 2.0f;
float right = lastStart + lastPatternSize / 2.0f; float right = lastStart + lastPatternSize / 2.0f;
QSharedPointer<std::vector<QSharedPointer<ResultPoint>> > resultPoints (2); QSharedPointer<std::vector<QSharedPointer<ResultPoint>>> resultPoints (new std::vector<QSharedPointer<ResultPoint>>(2));
resultPoints[0] = (*resultPoints)[0].reset(new OneDResultPoint(left, (float) rowNumber));
QSharedPointer<OneDResultPoint>(new OneDResultPoint(left, (float) rowNumber)); (*resultPoints)[1].reset(new OneDResultPoint(right, (float) rowNumber));
resultPoints[1] =
QSharedPointer<OneDResultPoint>(new OneDResultPoint(right, (float) rowNumber));
return QSharedPointer<Result>( return QSharedPointer<Result>(
new Result(resultString, QSharedPointer<std::vector<zxing::byte>>(), resultPoints, BarcodeFormat::CODE_39) new Result(resultString, QSharedPointer<std::vector<zxing::byte>>(), resultPoints, BarcodeFormat::CODE_39)

View File

@ -122,11 +122,9 @@ QSharedPointer<Result> Code93Reader::decodeRow(int rowNumber, QSharedPointer<Bit
float left = (float) (start[1] + start[0]) / 2.0f; float left = (float) (start[1] + start[0]) / 2.0f;
float right = lastStart + lastPatternSize / 2.0f; float right = lastStart + lastPatternSize / 2.0f;
QSharedPointer<std::vector<QSharedPointer<ResultPoint>> > resultPoints (2); QSharedPointer<std::vector<QSharedPointer<ResultPoint>>> resultPoints (new std::vector<QSharedPointer<ResultPoint>>(2));
resultPoints[0] = (*resultPoints)[0].reset(new OneDResultPoint(left, (float) rowNumber));
QSharedPointer<OneDResultPoint>(new OneDResultPoint(left, (float) rowNumber)); (*resultPoints)[1].reset(new OneDResultPoint(right, (float) rowNumber));
resultPoints[1] =
QSharedPointer<OneDResultPoint>(new OneDResultPoint(right, (float) rowNumber));
return QSharedPointer<Result>(new Result( return QSharedPointer<Result>(new Result(
resultString, resultString,

View File

@ -26,8 +26,6 @@
using std::vector; using std::vector;
using zxing::Array;
using zxing::FormatException; using zxing::FormatException;
using zxing::NotFoundException; using zxing::NotFoundException;
using zxing::Result; using zxing::Result;
@ -106,7 +104,7 @@ QSharedPointer<Result> ITFReader::decodeRow(int rowNumber, QSharedPointer<BitArr
bool lengthOK = false; bool lengthOK = false;
for (int i = 0, e = allowedLengths->size(); i < e; i++) for (int i = 0, e = allowedLengths->size(); i < e; i++)
{ {
if (length == allowedLengths[i]) if (length == (*allowedLengths)[i])
{ {
lengthOK = true; lengthOK = true;
break; break;
@ -118,11 +116,9 @@ QSharedPointer<Result> ITFReader::decodeRow(int rowNumber, QSharedPointer<BitArr
throw FormatException(); throw FormatException();
} }
QSharedPointer<std::vector<QSharedPointer<ResultPoint>>> resultPoints(2); QSharedPointer<std::vector<QSharedPointer<ResultPoint>>> resultPoints(new std::vector<QSharedPointer<ResultPoint>>(2));
resultPoints[0] = (*resultPoints)[0].reset(new OneDResultPoint(float(startRange[1]), float(rowNumber)));
QSharedPointer<OneDResultPoint>(new OneDResultPoint(float(startRange[1]), float(rowNumber))); (*resultPoints)[1].reset(new OneDResultPoint(float(endRange[0]), float(rowNumber)));
resultPoints[1] =
QSharedPointer<OneDResultPoint>(new OneDResultPoint(float(endRange[0]), float(rowNumber)));
return QSharedPointer<Result>(new Result(resultString, QSharedPointer<std::vector<zxing::byte>>(), resultPoints, BarcodeFormat::ITF)); return QSharedPointer<Result>(new Result(resultString, QSharedPointer<std::vector<zxing::byte>>(), resultPoints, BarcodeFormat::ITF));
} }

View File

@ -97,7 +97,7 @@ QSharedPointer<Result> MultiFormatOneDReader::decodeRow(int rowNumber, QSharedPo
int size = int(readers.size()); int size = int(readers.size());
for (int i = 0; i < size; i++) for (int i = 0; i < size; i++)
{ {
OneDReader *reader = readers[i]; OneDReader *reader = readers[i].data();
try try
{ {
QSharedPointer<Result> result = reader->decodeRow(rowNumber, row, hints); QSharedPointer<Result> result = reader->decodeRow(rowNumber, row, hints);

View File

@ -88,7 +88,7 @@ QSharedPointer<Result> MultiFormatUPCEANReader::decodeRow(int rowNumber, QShared
//added this because reader->decodeRow returns null if row is null //added this because reader->decodeRow returns null if row is null
//TODO: investigate why the execution reaches here with empty row. //TODO: investigate why the execution reaches here with empty row.
if (result.empty()) if (result.isNull())
continue; continue;
// Special case: a 12-digit code encoded in UPC-A is identical // Special case: a 12-digit code encoded in UPC-A is identical

View File

@ -58,7 +58,7 @@ QSharedPointer<Result> OneDReader::decode(QSharedPointer<BinaryBitmap> image, De
int height = rotatedImage->getHeight(); int height = rotatedImage->getHeight();
for (int i = 0; i < points->size(); i++) for (int i = 0; i < points->size(); i++)
{ {
points[i].reset(new OneDResultPoint(height - points[i]->getY() - 1, points[i]->getX())); (*points)[i].reset(new OneDResultPoint(height - (*points)[i]->getY() - 1, (*points)[i]->getX()));
} }
} }
// std::cerr << "tried harder" << std::endl; // std::cerr << "tried harder" << std::endl;
@ -153,10 +153,10 @@ QSharedPointer<Result> OneDReader::doDecode(QSharedPointer<BinaryBitmap> image,
QSharedPointer<std::vector<QSharedPointer<ResultPoint>>> points(result->getResultPoints()); QSharedPointer<std::vector<QSharedPointer<ResultPoint>>> points(result->getResultPoints());
if (points) if (points)
{ {
points[0] = QSharedPointer<ResultPoint>(new OneDResultPoint(width - points[0]->getX() - 1, (*points)[0] = QSharedPointer<ResultPoint>(new OneDResultPoint(width - (*points)[0]->getX() - 1,
points[0]->getY())); (*points)[0]->getY()));
points[1] = QSharedPointer<ResultPoint>(new OneDResultPoint(width - points[1]->getX() - 1, (*points)[1] = QSharedPointer<ResultPoint>(new OneDResultPoint(width - (*points)[1]->getX() - 1,
points[1]->getY())); (*points)[1]->getY()));
} }
} }
return result; return result;

View File

@ -53,7 +53,7 @@ int UPCAReader::decodeMiddle(QSharedPointer<BitArray> row,
} }
QSharedPointer<Result> UPCAReader::maybeReturnResult(QSharedPointer<Result> result) { QSharedPointer<Result> UPCAReader::maybeReturnResult(QSharedPointer<Result> result) {
if (result.empty()) { if (result.isNull()) {
return result; return result;
} }
const std::string& text = (result->getText())->getText(); const std::string& text = (result->getText())->getText();

View File

@ -79,10 +79,10 @@ QSharedPointer<Result> UPCEANExtension2Support::decodeRow(int rowNumber, QShared
ResultMetadata metadata; ResultMetadata metadata;
metadata.put(ResultMetadata::ISSUE_NUMBER, std::atoi(resultString.c_str())); metadata.put(ResultMetadata::ISSUE_NUMBER, std::atoi(resultString.c_str()));
QSharedPointer<std::vector<QSharedPointer<ResultPoint>> > resultPoints(2); QSharedPointer<std::vector<QSharedPointer<ResultPoint>>> resultPoints(new std::vector<QSharedPointer<ResultPoint>>(2));
resultPoints[0] = QSharedPointer<OneDResultPoint>(new OneDResultPoint((extStartRangeBegin + extStartRangeEnd) / 2.0f, (*resultPoints)[0].reset(new OneDResultPoint((extStartRangeBegin + extStartRangeEnd) / 2.0f,
static_cast<float> (rowNumber))); static_cast<float> (rowNumber)));
resultPoints[1] = QSharedPointer<OneDResultPoint>(new OneDResultPoint(static_cast<float> (range), (*resultPoints)[1].reset(new OneDResultPoint(static_cast<float> (range),
static_cast<float> (rowNumber))); static_cast<float> (rowNumber)));
return QSharedPointer<Result>(new Result(QSharedPointer<String>(new String(resultString)), return QSharedPointer<Result>(new Result(QSharedPointer<String>(new String(resultString)),
QSharedPointer<std::vector<zxing::byte>>(), QSharedPointer<std::vector<zxing::byte>>(),

View File

@ -147,10 +147,10 @@ QSharedPointer<Result> UPCEANExtension5Support::decodeRow(int rowNumber, QShared
metadata.put(ResultMetadata::SUGGESTED_PRICE, value); metadata.put(ResultMetadata::SUGGESTED_PRICE, value);
} }
QSharedPointer<std::vector<QSharedPointer<ResultPoint>> > resultPoints(2); QSharedPointer<std::vector<QSharedPointer<ResultPoint>>> resultPoints(new std::vector<QSharedPointer<ResultPoint>>(2));
resultPoints[0] = QSharedPointer<OneDResultPoint>(new OneDResultPoint((extStartRangeBegin + extStartRangeEnd) / 2.0f, (*resultPoints)[0] = QSharedPointer<OneDResultPoint>(new OneDResultPoint((extStartRangeBegin + extStartRangeEnd) / 2.0f,
static_cast<float> (rowNumber))); static_cast<float> (rowNumber)));
resultPoints[1] = QSharedPointer<OneDResultPoint>(new OneDResultPoint(static_cast<float> (range), (*resultPoints)[1] = QSharedPointer<OneDResultPoint>(new OneDResultPoint(static_cast<float> (range),
static_cast<float> (rowNumber))); static_cast<float> (rowNumber)));
return QSharedPointer<Result>(new Result(QSharedPointer<String>(new String(resultString)), return QSharedPointer<Result>(new Result(QSharedPointer<String>(new String(resultString)),

View File

@ -156,9 +156,9 @@ QSharedPointer<Result> UPCEANReader::decodeRow(int rowNumber,
float right = (float)(endRange[1] + endRange[0]) / 2.0f; float right = (float)(endRange[1] + endRange[0]) / 2.0f;
BarcodeFormat format = getBarcodeFormat(); BarcodeFormat format = getBarcodeFormat();
QSharedPointer<std::vector<QSharedPointer<ResultPoint>>> resultPoints(2); QSharedPointer<std::vector<QSharedPointer<ResultPoint>>> resultPoints(new std::vector<QSharedPointer<ResultPoint>>(2));
resultPoints[0] = QSharedPointer<ResultPoint>(new OneDResultPoint(left, static_cast<float>(rowNumber))); (*resultPoints)[0] = QSharedPointer<ResultPoint>(new OneDResultPoint(left, static_cast<float>(rowNumber)));
resultPoints[1] = QSharedPointer<ResultPoint>(new OneDResultPoint(right, static_cast<float>(rowNumber))); (*resultPoints)[1] = QSharedPointer<ResultPoint>(new OneDResultPoint(right, static_cast<float>(rowNumber)));
QSharedPointer<Result> decodeResult(new Result(resultString, QSharedPointer<std::vector<zxing::byte>>(), resultPoints, format)); QSharedPointer<Result> decodeResult(new Result(resultString, QSharedPointer<std::vector<zxing::byte>>(), resultPoints, format));
int extensionLength = 0; int extensionLength = 0;
@ -172,7 +172,7 @@ QSharedPointer<Result> UPCEANReader::decodeRow(int rowNumber,
decodeResult->getMetadata().putAll(extensionResult->getMetadata()); decodeResult->getMetadata().putAll(extensionResult->getMetadata());
extensionLength = extensionResult->getText()->length(); extensionLength = extensionResult->getText()->length();
for (const QSharedPointer<ResultPoint> &resultPoint : extensionResult->getResultPoints()->values()) for (const QSharedPointer<ResultPoint> &resultPoint : (*extensionResult->getResultPoints()))
{ {
decodeResult->getResultPoints()->push_back(resultPoint); decodeResult->getResultPoints()->push_back(resultPoint);
} }

View File

@ -8,9 +8,9 @@ FinderPattern::FinderPattern(int value, std::vector<int> startEnd, int start, in
: m_value(value), : m_value(value),
m_startEnd(startEnd) m_startEnd(startEnd)
{ {
QSharedPointer<std::vector<QSharedPointer<ResultPoint>> > resultPoints(2); QSharedPointer<std::vector<QSharedPointer<ResultPoint>>> resultPoints(new std::vector<QSharedPointer<ResultPoint>>(2));
resultPoints[0] = QSharedPointer<ResultPoint>(new OneDResultPoint(start, rowNumber)); (*resultPoints)[0].reset(new OneDResultPoint(start, rowNumber));
resultPoints[1] = QSharedPointer<ResultPoint>(new OneDResultPoint(end, rowNumber)); (*resultPoints)[1].reset(new OneDResultPoint(end, rowNumber));
m_resultPoints = resultPoints; m_resultPoints = resultPoints;
} }

View File

@ -112,11 +112,11 @@ QSharedPointer<Result> RSS14Reader::constructResult(Pair leftPair, Pair rightPai
QSharedPointer<std::vector<QSharedPointer<ResultPoint>> > leftPoints = leftPair.getFinderPattern().getResultPoints(); QSharedPointer<std::vector<QSharedPointer<ResultPoint>> > leftPoints = leftPair.getFinderPattern().getResultPoints();
QSharedPointer<std::vector<QSharedPointer<ResultPoint>> > rightPoints = rightPair.getFinderPattern().getResultPoints(); QSharedPointer<std::vector<QSharedPointer<ResultPoint>> > rightPoints = rightPair.getFinderPattern().getResultPoints();
QSharedPointer<std::vector<QSharedPointer<ResultPoint>> > resultPoints(4); QSharedPointer<std::vector<QSharedPointer<ResultPoint>>> resultPoints(new std::vector<QSharedPointer<ResultPoint>>(4));
resultPoints[0] = leftPoints[0]; (*resultPoints)[0] = (*leftPoints)[0];
resultPoints[1] = leftPoints[1]; (*resultPoints)[1] = (*leftPoints)[1];
resultPoints[2] = rightPoints[0]; (*resultPoints)[2] = (*rightPoints)[0];
resultPoints[3] = rightPoints[1]; (*resultPoints)[3] = (*rightPoints)[1];
return QSharedPointer<Result>(new Result( return QSharedPointer<Result>(new Result(
QSharedPointer<String>(new String(buffer)), QSharedPointer<String>(new String(buffer)),

View File

@ -326,11 +326,11 @@ QSharedPointer<Result> RSSExpandedReader::constructResult(std::vector<ExpandedPa
QSharedPointer<std::vector<QSharedPointer<ResultPoint>> > firstPoints = pairs[0].getFinderPattern().getResultPoints(); QSharedPointer<std::vector<QSharedPointer<ResultPoint>> > firstPoints = pairs[0].getFinderPattern().getResultPoints();
QSharedPointer<std::vector<QSharedPointer<ResultPoint>> > lastPoints = pairs[pairs.size() - 1].getFinderPattern().getResultPoints(); QSharedPointer<std::vector<QSharedPointer<ResultPoint>> > lastPoints = pairs[pairs.size() - 1].getFinderPattern().getResultPoints();
QSharedPointer<std::vector<QSharedPointer<ResultPoint>> > resultPoints(4); QSharedPointer<std::vector<QSharedPointer<ResultPoint>>> resultPoints(new std::vector<QSharedPointer<ResultPoint>>(4));
resultPoints[0] = firstPoints[0]; (*resultPoints)[0] = (*firstPoints)[0];
resultPoints[1] = firstPoints[1]; (*resultPoints)[1] = (*firstPoints)[1];
resultPoints[2] = lastPoints[0]; (*resultPoints)[2] = (*lastPoints)[0];
resultPoints[3] = lastPoints[1]; (*resultPoints)[3] = (*lastPoints)[1];
return QSharedPointer<Result>(new Result( return QSharedPointer<Result>(new Result(
QSharedPointer<String>(new String(resultingString)), QSharedPointer<String>(new String(resultingString)),

View File

@ -51,7 +51,7 @@ private:
std::string& result, std::string& result,
int count, int count,
common::CharacterSetECI const *currentCharacterSetECI, common::CharacterSetECI const *currentCharacterSetECI,
QSharedPointer<std::vector<QSharedPointer<std::vector<zxing::byte>> > &byteSegments, QSharedPointer<std::vector<QSharedPointer<std::vector<zxing::byte>> >> &byteSegments,
Hashtable const& hints); Hashtable const& hints);
static void decodeAlphanumericSegment(QSharedPointer<BitSource> bits, std::string &result, int count, bool fc1InEffect); static void decodeAlphanumericSegment(QSharedPointer<BitSource> bits, std::string &result, int count, bool fc1InEffect);
static void decodeNumericSegment(QSharedPointer<BitSource> bits, std::string &result, int count); static void decodeNumericSegment(QSharedPointer<BitSource> bits, std::string &result, int count);

View File

@ -138,7 +138,7 @@ QSharedPointer<std::vector<zxing::byte>> BitMatrixParser::readCodewords() {
// cout << *functionPattern << endl; // cout << *functionPattern << endl;
bool readingUp = true; bool readingUp = true;
QSharedPointer<std::vector<zxing::byte>> result(version->getTotalCodewords()); QSharedPointer<std::vector<zxing::byte>> result(new std::vector<zxing::byte>(version->getTotalCodewords()));
int resultOffset = 0; int resultOffset = 0;
int currentByte = 0; int currentByte = 0;
int bitsRead = 0; int bitsRead = 0;
@ -163,7 +163,7 @@ QSharedPointer<std::vector<zxing::byte>> BitMatrixParser::readCodewords() {
} }
// If we've made a whole byte, save it off // If we've made a whole byte, save it off
if (bitsRead == 8) { if (bitsRead == 8) {
result[resultOffset++] = (zxing::byte)currentByte; (*result)[resultOffset++] = (zxing::byte)currentByte;
bitsRead = 0; bitsRead = 0;
currentByte = 0; currentByte = 0;
} }

View File

@ -55,7 +55,7 @@ protected:
float allowanceFactor); float allowanceFactor);
QSharedPointer<DetectorResult> processFinderPatternInfo(QSharedPointer<FinderPatternInfo> info); QSharedPointer<DetectorResult> processFinderPatternInfo(QSharedPointer<FinderPatternInfo> info);
public: public:
virtual QSharedPointer<PerspectiveTransform> createTransform(QSharedPointer<ResultPoint> topLeft, QSharedPointer<ResultPoint> topRight, Ref < virtual QSharedPointer<PerspectiveTransform> createTransform(QSharedPointer<ResultPoint> topLeft, QSharedPointer<ResultPoint> topRight, QSharedPointer <
ResultPoint > bottomLeft, QSharedPointer<ResultPoint> alignmentPattern, int dimension); ResultPoint > bottomLeft, QSharedPointer<ResultPoint> alignmentPattern, int dimension);
Detector(QSharedPointer<BitMatrix> image); Detector(QSharedPointer<BitMatrix> image);

View File

@ -119,18 +119,18 @@ QSharedPointer<DetectorResult> Detector::processFinderPatternInfo(QSharedPointer
QSharedPointer<PerspectiveTransform> transform = createTransform(topLeft, topRight, bottomLeft, alignmentPattern, dimension); QSharedPointer<PerspectiveTransform> transform = createTransform(topLeft, topRight, bottomLeft, alignmentPattern, dimension);
QSharedPointer<BitMatrix> bits(sampleGrid(image_, dimension, transform)); QSharedPointer<BitMatrix> bits(sampleGrid(image_, dimension, transform));
QSharedPointer<std::vector<QSharedPointer<ResultPoint>> > points(new std::vector< QSharedPointer<ResultPoint> >(alignmentPattern == 0 ? 3 : 4)); QSharedPointer<std::vector<QSharedPointer<ResultPoint>> > points(new std::vector< QSharedPointer<ResultPoint> >(alignmentPattern == 0 ? 3 : 4));
points[0].reset(bottomLeft); (*points)[0] = bottomLeft;
points[1].reset(topLeft); (*points)[1] = topLeft;
points[2].reset(topRight); (*points)[2] = topRight;
if (alignmentPattern != 0) { if (alignmentPattern != 0) {
points[3].reset(alignmentPattern); (*points)[3] = alignmentPattern;
} }
QSharedPointer<DetectorResult> result(new DetectorResult(bits, points)); QSharedPointer<DetectorResult> result(new DetectorResult(bits, points));
return result; return result;
} }
QSharedPointer<PerspectiveTransform> Detector::createTransform(QSharedPointer<ResultPoint> topLeft, QSharedPointer<ResultPoint> topRight, Ref < QSharedPointer<PerspectiveTransform> Detector::createTransform(QSharedPointer<ResultPoint> topLeft, QSharedPointer<ResultPoint> topRight, QSharedPointer <
ResultPoint > bottomLeft, QSharedPointer<ResultPoint> alignmentPattern, int dimension) { ResultPoint > bottomLeft, QSharedPointer<ResultPoint> alignmentPattern, int dimension) {
float dimMinusThree = (float)dimension - 3.5f; float dimMinusThree = (float)dimension - 3.5f;

View File

@ -130,9 +130,9 @@ void ReedSolomonTests::testDecoder(QSharedPointer<GenericGF> field,
message = referenceMessage; message = referenceMessage;
corrupt(message, i, field->getSize()); corrupt(message, i, field->getSize());
QSharedPointer<std::vector<int>> messageArrayRef(message.size()); QSharedPointer<std::vector<int>> messageArrayRef(new std::vector<int>(message.size()));
for(int i=0; i<int(message.size()); i++) for(int i=0; i<int(message.size()); i++)
messageArrayRef[i] = message[i]; (*messageArrayRef)[i] = message[i];
try { try {
decoder.decode(messageArrayRef, ecWords.size()); decoder.decode(messageArrayRef, ecWords.size());