Adopted to latest upstream changes

This commit is contained in:
Alexander Stillich 2018-11-05 16:41:52 +01:00
parent af8d8982de
commit 076dd575bd
8 changed files with 28 additions and 28 deletions

View File

@ -179,7 +179,7 @@ ArrayRef<zxing::byte> CameraImageWrapper::getMatrixP() const
return imageBytes; return imageBytes;
} }
byte CameraImageWrapper::gray(unsigned int r, unsigned int g, unsigned int b) zxing::byte CameraImageWrapper::gray(unsigned int r, unsigned int g, unsigned int b)
{ {
//the values are not masked with (x & 0xFF) because functions qRed, qGreen, qBlue already do it //the values are not masked with (x & 0xFF) because functions qRed, qGreen, qBlue already do it
return R_TO_GREYSCALE[r] + G_TO_GREYSCALE[g] + B_TO_GREYSCALE[b]; return R_TO_GREYSCALE[r] + G_TO_GREYSCALE[g] + B_TO_GREYSCALE[b];
@ -197,7 +197,7 @@ void CameraImageWrapper::updateImageAsGrayscale(const QImage &origin)
imageBytes = ArrayRef<zxing::byte>(height*width); imageBytes = ArrayRef<zxing::byte>(height*width);
imageBytesPerRow = ArrayRef<ArrayRef<zxing::byte>>(height); imageBytesPerRow = ArrayRef<ArrayRef<zxing::byte>>(height);
byte* m = &imageBytes[0]; zxing::byte* m = &imageBytes[0];
for(int j=0; j<height; j++) for(int j=0; j<height; j++)
{ {

View File

@ -263,7 +263,7 @@ void BitArray::xor_(const BitArray& other)
} }
} }
void BitArray::toBytes(int bitOffset, std::vector<byte>& array, int offset, int numBytes) const void BitArray::toBytes(int bitOffset, std::vector<zxing::byte>& array, int offset, int numBytes) const
{ {
if(int(array.size()) < (numBytes + offset)) if(int(array.size()) < (numBytes + offset))
array.resize(size_t(numBytes + offset)); array.resize(size_t(numBytes + offset));
@ -276,7 +276,7 @@ void BitArray::toBytes(int bitOffset, std::vector<byte>& array, int offset, int
} }
bitOffset++; bitOffset++;
} }
array[size_t(offset + i)] = byte(theByte); array[size_t(offset + i)] = zxing::byte(theByte);
} }
} }

View File

@ -71,7 +71,7 @@ GreyscaleRotatedLuminanceSource::getRow(int y, ArrayRef<zxing::byte> row) const
ArrayRef<zxing::byte> GreyscaleRotatedLuminanceSource::getMatrix() const { ArrayRef<zxing::byte> GreyscaleRotatedLuminanceSource::getMatrix() const {
ArrayRef<zxing::byte> result (getWidth() * getHeight()); ArrayRef<zxing::byte> result (getWidth() * getHeight());
for (int y = 0; y < getHeight(); y++) { for (int y = 0; y < getHeight(); y++) {
byte* row = &result[y * getWidth()]; zxing::byte* row = &result[y * getWidth()];
int offset = (left_ * dataWidth_) + (dataWidth_ - 1 - (y + top_)); int offset = (left_ * dataWidth_) + (dataWidth_ - 1 - (y + top_));
for (int x = 0; x < getWidth(); x++) { for (int x = 0; x < getWidth(); x++) {
row[x] = greyData_[offset]; row[x] = greyData_[offset];

View File

@ -36,7 +36,7 @@ char const* const StringUtils::ISO88591 = "ISO8859-1";
const bool StringUtils::ASSUME_SHIFT_JIS = false; const bool StringUtils::ASSUME_SHIFT_JIS = false;
string string
StringUtils::guessEncoding(byte* bytes, int length, StringUtils::guessEncoding(zxing::byte* bytes, int length,
Hashtable const& hints) { Hashtable const& hints) {
Hashtable::const_iterator i = hints.find(DecodeHints::CHARACTER_SET); Hashtable::const_iterator i = hints.find(DecodeHints::CHARACTER_SET);
if (i != hints.end()) { if (i != hints.end()) {
@ -65,7 +65,7 @@ StringUtils::guessEncoding(byte* bytes, int length,
//int isoHighChars = 0; //int isoHighChars = 0;
int isoHighOther = 0; int isoHighOther = 0;
typedef byte byte; typedef zxing::byte byte;
boolean utf8bom = length > 3 && boolean utf8bom = length > 3 &&
bytes[0] == (zxing::byte) 0xEF && bytes[0] == (zxing::byte) 0xEF &&
bytes[1] == (zxing::byte) 0xBB && bytes[1] == (zxing::byte) 0xBB &&

View File

@ -183,7 +183,7 @@ int MaskUtil::applyMaskPenaltyRule1Internal(const ByteMatrix& matrix, bool isHor
int penalty = 0; int penalty = 0;
int iLimit = int(isHorizontal ? matrix.getHeight() : matrix.getWidth()); int iLimit = int(isHorizontal ? matrix.getHeight() : matrix.getWidth());
int jLimit = int(isHorizontal ? matrix.getWidth() : matrix.getHeight()); int jLimit = int(isHorizontal ? matrix.getWidth() : matrix.getHeight());
const std::vector<std::vector<byte> >& array = matrix.getArray(); const std::vector<std::vector<zxing::byte> >& array = matrix.getArray();
for (int i = 0; i < iLimit; i++) { for (int i = 0; i < iLimit; i++) {
int numSameBitCells = 0; int numSameBitCells = 0;
int prevBit = -1; int prevBit = -1;

View File

@ -420,7 +420,7 @@ BitArray* Encoder::interleaveWithECBytes(const BitArray& bits,
return result; return result;
} }
ArrayRef<byte> Encoder::generateECBytes(const std::vector<zxing::byte>& dataBytes, int numEcBytesInBlock) ArrayRef<zxing::byte> Encoder::generateECBytes(const std::vector<zxing::byte>& dataBytes, int numEcBytesInBlock)
{ {
size_t numDataBytes = dataBytes.size(); size_t numDataBytes = dataBytes.size();
std::vector<zxing::byte> dataBytesCopy(dataBytes); std::vector<zxing::byte> dataBytesCopy(dataBytes);

View File

@ -43,7 +43,7 @@ void ReedSolomonTests::testQRCode()
// testEncodeDecodeRandom(GenericGF::QR_CODE_FIELD_256, 220, 35); // testEncodeDecodeRandom(GenericGF::QR_CODE_FIELD_256, 220, 35);
} }
void ReedSolomonTests::corrupt(std::vector<byte> &received, int howMany, int max) void ReedSolomonTests::corrupt(std::vector<zxing::byte> &received, int howMany, int max)
{ {
std::vector<bool> corrupted(received.size(), false); std::vector<bool> corrupted(received.size(), false);
for (int j = 0; j < howMany; j++) { for (int j = 0; j < howMany; j++) {
@ -63,9 +63,9 @@ void ReedSolomonTests::testEncodeDecodeRandom(Ref<GenericGF> field, int dataSize
assertTrue(dataSize > 0 && dataSize <= field->getSize() - 3); /*"Invalid data size for " + field, */ assertTrue(dataSize > 0 && dataSize <= field->getSize() - 3); /*"Invalid data size for " + field, */
assertTrue(ecSize > 0 && ecSize + dataSize <= field->getSize()); /*"Invalid ECC size for " + field, */ assertTrue(ecSize > 0 && ecSize + dataSize <= field->getSize()); /*"Invalid ECC size for " + field, */
ReedSolomonEncoder encoder(field); ReedSolomonEncoder encoder(field);
std::vector<byte> message;//(dataSize + ecSize); std::vector<zxing::byte> message;//(dataSize + ecSize);
std::vector<byte> dataWords(dataSize); std::vector<zxing::byte> dataWords(dataSize);
std::vector<byte> ecWords(ecSize); std::vector<zxing::byte> ecWords(ecSize);
initializeRandom(); initializeRandom();
int iterations = field->getSize() > 256 ? 1 : DECODER_RANDOM_TEST_ITERATIONS; int iterations = field->getSize() > 256 ? 1 : DECODER_RANDOM_TEST_ITERATIONS;
for (int i = 0; i < iterations; i++) { for (int i = 0; i < iterations; i++) {
@ -83,20 +83,20 @@ void ReedSolomonTests::testEncodeDecodeRandom(Ref<GenericGF> field, int dataSize
} }
void ReedSolomonTests::testEncodeDecode(Ref<GenericGF> field, void ReedSolomonTests::testEncodeDecode(Ref<GenericGF> field,
const std::vector<byte> &dataWords, const std::vector<zxing::byte> &dataWords,
const std::vector<byte> &ecWords) const std::vector<zxing::byte> &ecWords)
{ {
testEncoder(field, dataWords, ecWords); testEncoder(field, dataWords, ecWords);
testDecoder(field, dataWords, ecWords); testDecoder(field, dataWords, ecWords);
} }
void ReedSolomonTests::testEncoder(Ref<GenericGF> field, void ReedSolomonTests::testEncoder(Ref<GenericGF> field,
const std::vector<byte> &dataWords, const std::vector<zxing::byte> &dataWords,
const std::vector<byte> &ecWords) const std::vector<zxing::byte> &ecWords)
{ {
ReedSolomonEncoder encoder(field); ReedSolomonEncoder encoder(field);
std::vector<byte> messageExpected; std::vector<zxing::byte> messageExpected;
std::vector<byte> message(dataWords); std::vector<zxing::byte> message(dataWords);
messageExpected = dataWords; messageExpected = dataWords;
messageExpected.insert(std::end(messageExpected), std::begin(ecWords), std::end(ecWords)); messageExpected.insert(std::end(messageExpected), std::begin(ecWords), std::end(ecWords));
@ -107,11 +107,11 @@ void ReedSolomonTests::testEncoder(Ref<GenericGF> field,
} }
void ReedSolomonTests::testDecoder(Ref<GenericGF> field, void ReedSolomonTests::testDecoder(Ref<GenericGF> field,
const std::vector<byte> &dataWords, const std::vector<zxing::byte> &dataWords,
const std::vector<byte> &ecWords) { const std::vector<zxing::byte> &ecWords) {
ReedSolomonDecoder decoder(field); ReedSolomonDecoder decoder(field);
std::vector<byte> message; std::vector<zxing::byte> message;
std::vector<byte> referenceMessage; std::vector<zxing::byte> referenceMessage;
int maxErrors = ecWords.size() / 2; int maxErrors = ecWords.size() / 2;
initializeRandom(); initializeRandom();

View File

@ -263,7 +263,7 @@ void EncoderTests::testGetNumDataBytesAndNumECBytesForBlockID()
void EncoderTests::testInterleaveWithECBytes() void EncoderTests::testInterleaveWithECBytes()
{ {
const byte arr[] = {32, 65, 205, 69, 41, 220, 46, 128, 236}; const byte arr[] = {32, 65, 205, 69, 41, 220, 46, 128, 236};
std::vector<byte> dataBytes (arr, arr + getArrayLength(arr)); std::vector<zxing::byte> dataBytes (arr, arr + getArrayLength(arr));
BitArray in; BitArray in;
for (byte dataByte: dataBytes) { for (byte dataByte: dataBytes) {
@ -280,7 +280,7 @@ void EncoderTests::testInterleaveWithECBytes()
}; };
int expectedLength = getArrayLength(expected); int expectedLength = getArrayLength(expected);
assertEquals(expectedLength, out->getSizeInBytes()); assertEquals(expectedLength, out->getSizeInBytes());
std::vector<byte> outArray; std::vector<zxing::byte> outArray;
out->toBytes(0, outArray, 0, expectedLength); out->toBytes(0, outArray, 0, expectedLength);
// Can't use Arrays.equals(), because outArray may be longer than out.sizeInBytes() // Can't use Arrays.equals(), because outArray may be longer than out.sizeInBytes()
@ -297,7 +297,7 @@ void EncoderTests::testInterleaveWithECBytes()
135, 151, 160, 236, 17, 236, 17, 236, 17, 236, 135, 151, 160, 236, 17, 236, 17, 236, 17, 236,
17 17
}; };
dataBytes = std::vector<byte>(arr2, arr2 + getArrayLength(arr2)); dataBytes = std::vector<zxing::byte>(arr2, arr2 + getArrayLength(arr2));
in = BitArray(); in = BitArray();
foreach (byte dataByte, dataBytes) { foreach (byte dataByte, dataBytes) {
@ -392,9 +392,9 @@ void EncoderTests::testAppend8BitBytes()
void EncoderTests::testGenerateECBytes() void EncoderTests::testGenerateECBytes()
{ {
std::vector<byte> dataBytes = {32, 65, 205, 69, 41, 220, 46, 128, 236}; std::vector<zxing::byte> dataBytes = {32, 65, 205, 69, 41, 220, 46, 128, 236};
ArrayRef<byte> ecBytes = Encoder::generateECBytes(dataBytes, 17); ArrayRef<zxing::byte> ecBytes = Encoder::generateECBytes(dataBytes, 17);
byte expected[] = { byte expected[] = {
42, 159, 74, 221, 244, 169, 239, 150, 138, 70, 237, 85, 224, 96, 74, 219, 61 42, 159, 74, 221, 244, 169, 239, 150, 138, 70, 237, 85, 224, 96, 74, 219, 61
}; };