mirror of
https://github.com/status-im/qzxing.git
synced 2025-02-12 19:06:50 +00:00
More signed / unsigned warning fixes
This commit is contained in:
parent
d2242ac24a
commit
36ac7dd520
@ -783,7 +783,7 @@ win_iconv(iconv_t _cd, char **inbuf, size_t *inbytesleft, char **outbuf, size_t
|
||||
if (outbuf != NULL && *outbuf != NULL && cd->to.flush != NULL)
|
||||
{
|
||||
tomode = cd->to.mode;
|
||||
outsize = cd->to.flush(&cd->to, (uchar *)*outbuf, *outbytesleft);
|
||||
outsize = cd->to.flush(&cd->to, (uchar *)*outbuf, (int)*outbytesleft);
|
||||
if (outsize == -1)
|
||||
{
|
||||
if ((cd->to.flags & FLAG_IGNORE) && errno != E2BIG)
|
||||
@ -810,7 +810,7 @@ win_iconv(iconv_t _cd, char **inbuf, size_t *inbytesleft, char **outbuf, size_t
|
||||
tomode = cd->to.mode;
|
||||
wsize = MB_CHAR_MAX;
|
||||
|
||||
insize = cd->from.mbtowc(&cd->from, (const uchar *)*inbuf, *inbytesleft, wbuf, &wsize);
|
||||
insize = cd->from.mbtowc(&cd->from, (const uchar *)*inbuf, (int)*inbytesleft, wbuf, &wsize);
|
||||
if (insize == -1)
|
||||
{
|
||||
if (cd->to.flags & FLAG_IGNORE)
|
||||
@ -861,7 +861,7 @@ win_iconv(iconv_t _cd, char **inbuf, size_t *inbytesleft, char **outbuf, size_t
|
||||
}
|
||||
}
|
||||
|
||||
outsize = cd->to.wctomb(&cd->to, wbuf, wsize, (uchar *)*outbuf, *outbytesleft);
|
||||
outsize = cd->to.wctomb(&cd->to, wbuf, wsize, (uchar *)*outbuf, (int)*outbytesleft);
|
||||
if (outsize == -1)
|
||||
{
|
||||
if ((cd->to.flags & FLAG_IGNORE) && errno != E2BIG)
|
||||
|
@ -441,7 +441,7 @@ Ref<BitArray> Decoder::extractBits(Ref<zxing::BitMatrix> matrix) {
|
||||
|
||||
}
|
||||
|
||||
Ref<BitArray> returnValue(new BitArray(rawbits.size()));
|
||||
Ref<BitArray> returnValue(new BitArray(int(rawbits.size())));
|
||||
for (int i = 0; i < (int)rawbits.size(); i++) {
|
||||
if (rawbits[i]) returnValue->set(i);
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ public:
|
||||
return values_[i];
|
||||
}
|
||||
int size() const {
|
||||
return values_.size();
|
||||
return int(values_.size());
|
||||
}
|
||||
bool empty() const {
|
||||
return values_.size() == 0;
|
||||
|
@ -36,7 +36,7 @@ Ref<BitMatrix> GridSampler::sampleGrid(Ref<BitMatrix> image, int dimension, Ref<
|
||||
Ref<BitMatrix> bits(new BitMatrix(dimension));
|
||||
vector<float> points(dimension << 1, (const float)0.0f);
|
||||
for (int y = 0; y < dimension; y++) {
|
||||
int max = points.size();
|
||||
int max = int(points.size());
|
||||
float yValue = (float)y + 0.5f;
|
||||
for (int x = 0; x < max; x += 2) {
|
||||
points[x] = (float)(x >> 1) + 0.5f;
|
||||
@ -57,7 +57,7 @@ Ref<BitMatrix> GridSampler::sampleGrid(Ref<BitMatrix> image, int dimensionX, int
|
||||
Ref<BitMatrix> bits(new BitMatrix(dimensionX, dimensionY));
|
||||
vector<float> points(dimensionX << 1, (const float)0.0f);
|
||||
for (int y = 0; y < dimensionY; y++) {
|
||||
int max = points.size();
|
||||
int max = int(points.size());
|
||||
float yValue = (float)y + 0.5f;
|
||||
for (int x = 0; x < max; x += 2) {
|
||||
points[x] = (float)(x >> 1) + 0.5f;
|
||||
|
@ -87,7 +87,7 @@ Ref<PerspectiveTransform> PerspectiveTransform::times(Ref<PerspectiveTransform>
|
||||
}
|
||||
|
||||
void PerspectiveTransform::transformPoints(vector<float> &points) {
|
||||
int max = points.size();
|
||||
int max = int(points.size());
|
||||
for (int i = 0; i < max; i += 2) {
|
||||
float x = points[i];
|
||||
float y = points[i + 1];
|
||||
|
@ -39,9 +39,9 @@ const std::string& String::getText() const {
|
||||
|
||||
char String::charAt(int i) const { return text_[i]; }
|
||||
|
||||
int String::size() const { return text_.size(); }
|
||||
int String::size() const { return int(text_.size()); }
|
||||
|
||||
int String::length() const { return text_.size(); }
|
||||
int String::length() const { return int(text_.size()); }
|
||||
|
||||
Ref<String> String::substring(int i) const {
|
||||
return Ref<String>(new String(text_.substr(i)));
|
||||
|
@ -193,7 +193,7 @@ int Version::buildVersions() {
|
||||
new ECBlocks(24, new ECB(1, 32)))));
|
||||
VERSIONS.push_back(Ref<Version>(new Version(30, 16, 48, 14, 22,
|
||||
new ECBlocks(28, new ECB(1, 49)))));
|
||||
return VERSIONS.size();
|
||||
return int(VERSIONS.size());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ namespace zxing {
|
||||
namespace datamatrix {
|
||||
|
||||
int BitMatrixParser::copyBit(size_t x, size_t y, int versionBits) {
|
||||
return bitMatrix_->get(x, y) ? (versionBits << 1) | 0x1 : versionBits << 1;
|
||||
return bitMatrix_->get(int(x), int(y)) ? (versionBits << 1) | 0x1 : versionBits << 1;
|
||||
}
|
||||
|
||||
BitMatrixParser::BitMatrixParser(Ref<BitMatrix> bitMatrix) : bitMatrix_(NULL),
|
||||
|
@ -67,7 +67,7 @@ std::vector<Ref<DataBlock> > DataBlock::getDataBlocks(ArrayRef<byte> rawCodeword
|
||||
// All blocks have the same amount of data, except that the last n
|
||||
// (where n may be 0) have 1 more byte. Figure out where these start.
|
||||
int shorterBlocksTotalCodewords = result[0]->codewords_->size();
|
||||
int longerBlocksStartAt = result.size() - 1;
|
||||
int longerBlocksStartAt = int(result.size()) - 1;
|
||||
while (longerBlocksStartAt >= 0) {
|
||||
int numCodewords = result[longerBlocksStartAt]->codewords_->size();
|
||||
if (numCodewords == shorterBlocksTotalCodewords) {
|
||||
|
@ -72,7 +72,7 @@ Ref<DecoderResult> Decoder::decode(Ref<BitMatrix> bits) {
|
||||
// Separate into data blocks
|
||||
std::vector<Ref<DataBlock> > dataBlocks = DataBlock::getDataBlocks(codewords, version);
|
||||
|
||||
int dataBlocksCount = dataBlocks.size();
|
||||
int dataBlocksCount = int(dataBlocks.size());
|
||||
|
||||
// Count total number of data bytes
|
||||
int totalBytes = 0;
|
||||
|
@ -425,7 +425,7 @@ Ref<BitMatrix> Detector::sampleGrid(Ref<BitMatrix> image, int dimensionX, int di
|
||||
}
|
||||
|
||||
void Detector::insertionSort(std::vector<Ref<ResultPointsAndTransitions> > &vector) {
|
||||
int max = vector.size();
|
||||
int max = int(vector.size());
|
||||
bool swapped = true;
|
||||
Ref<ResultPointsAndTransitions> value;
|
||||
Ref<ResultPointsAndTransitions> valueB;
|
||||
|
@ -138,7 +138,7 @@ vector<Ref<FinderPatternInfo> > MultiFinderPatternFinder::findMulti(DecodeHints
|
||||
vector<vector<Ref<FinderPattern> > > MultiFinderPatternFinder::selectBestPatterns(){
|
||||
vector<Ref<FinderPattern> > possibleCenters = possibleCenters_;
|
||||
|
||||
int size = possibleCenters.size();
|
||||
int size = int(possibleCenters.size());
|
||||
|
||||
if (size < 3) {
|
||||
// Couldn't find enough finder patterns
|
||||
|
@ -79,7 +79,7 @@ CodaBarReader::CodaBarReader()
|
||||
Ref<Result> CodaBarReader::decodeRow(int rowNumber, Ref<BitArray> row, zxing::DecodeHints /*hints*/) {
|
||||
|
||||
{ // Arrays.fill(counters, 0);
|
||||
int size = counters.size();
|
||||
int size = int(counters.size());
|
||||
counters.resize(0);
|
||||
counters.resize(size); }
|
||||
|
||||
@ -170,7 +170,7 @@ void CodaBarReader::validatePattern(int start) {
|
||||
// First, sum up the total size of our four categories of stripe sizes;
|
||||
vector<int> sizes (4, 0);
|
||||
vector<int> counts (4, 0);
|
||||
int end = decodeRowResult.length() - 1;
|
||||
int end = int(decodeRowResult.length()) - 1;
|
||||
|
||||
// We break out of this loop in the middle, in order to handle
|
||||
// inter-character spaces properly.
|
||||
|
@ -187,7 +187,7 @@ vector<int> Code128Reader::findStartPattern(Ref<BitArray> row){
|
||||
vector<int> counters (6, 0);
|
||||
int patternStart = rowOffset;
|
||||
bool isWhite = false;
|
||||
int patternLength = counters.size();
|
||||
int patternLength = int(counters.size());
|
||||
|
||||
for (int i = rowOffset; i < width; i++) {
|
||||
if (row->get(i) ^ isWhite) {
|
||||
@ -312,7 +312,7 @@ Ref<Result> Code128Reader::decodeRow(int rowNumber, Ref<BitArray> row, zxing::De
|
||||
|
||||
// Advance to where the next code will to start
|
||||
lastStart = nextStart;
|
||||
for (int i = 0, e = counters.size(); i < e; i++) {
|
||||
for (int i = 0, e = int(counters.size()); i < e; i++) {
|
||||
nextStart += counters[i];
|
||||
}
|
||||
|
||||
@ -512,7 +512,7 @@ Ref<Result> Code128Reader::decodeRow(int rowNumber, Ref<BitArray> row, zxing::De
|
||||
}
|
||||
|
||||
// Need to pull out the check digits from string
|
||||
int resultLength = result.length();
|
||||
int resultLength = int(result.length());
|
||||
if (resultLength == 0) {
|
||||
// false positive
|
||||
throw NotFoundException();
|
||||
@ -531,7 +531,7 @@ Ref<Result> Code128Reader::decodeRow(int rowNumber, Ref<BitArray> row, zxing::De
|
||||
float left = (float) (startPatternInfo[1] + startPatternInfo[0]) / 2.0f;
|
||||
float right = lastStart + lastPatternSize / 2.0f;
|
||||
|
||||
int rawCodesSize = rawCodes.size();
|
||||
int rawCodesSize = int(rawCodes.size());
|
||||
ArrayRef<byte> rawBytes (rawCodesSize);
|
||||
for (int i = 0; i < rawCodesSize; i++) {
|
||||
rawBytes[i] = rawCodes[i];
|
||||
|
@ -95,7 +95,7 @@ Code39Reader::Code39Reader(bool usingCheckDigit_, bool extendedMode_) {
|
||||
Ref<Result> Code39Reader::decodeRow(int rowNumber, Ref<BitArray> row, zxing::DecodeHints /*hints*/) {
|
||||
std::vector<int>& theCounters (counters);
|
||||
{ // Arrays.fill(counters, 0);
|
||||
int size = theCounters.size();
|
||||
int size = int(theCounters.size());
|
||||
theCounters.resize(0);
|
||||
theCounters.resize(size); }
|
||||
std::string& result (decodeRowResult);
|
||||
@ -117,7 +117,7 @@ Ref<Result> Code39Reader::decodeRow(int rowNumber, Ref<BitArray> row, zxing::Dec
|
||||
decodedChar = patternToChar(pattern);
|
||||
result.append(1, decodedChar);
|
||||
lastStart = nextStart;
|
||||
for (int i = 0, end=theCounters.size(); i < end; i++) {
|
||||
for (int i = 0, end=int(theCounters.size()); i < end; i++) {
|
||||
nextStart += theCounters[i];
|
||||
}
|
||||
// Read off white space
|
||||
@ -127,7 +127,7 @@ Ref<Result> Code39Reader::decodeRow(int rowNumber, Ref<BitArray> row, zxing::Dec
|
||||
|
||||
// Look for whitespace after pattern:
|
||||
int lastPatternSize = 0;
|
||||
for (int i = 0, e = theCounters.size(); i < e; i++) {
|
||||
for (int i = 0, e = int(theCounters.size()); i < e; i++) {
|
||||
lastPatternSize += theCounters[i];
|
||||
}
|
||||
int whiteSpaceAfterEnd = nextStart - lastStart - lastPatternSize;
|
||||
@ -138,10 +138,10 @@ Ref<Result> Code39Reader::decodeRow(int rowNumber, Ref<BitArray> row, zxing::Dec
|
||||
}
|
||||
|
||||
if (usingCheckDigit) {
|
||||
int max = result.length() - 1;
|
||||
int max = int(result.length()) - 1;
|
||||
int total = 0;
|
||||
for (int i = 0; i < max; i++) {
|
||||
total += alphabet_string.find_first_of(decodeRowResult[i], 0);
|
||||
total += int(alphabet_string.find_first_of(decodeRowResult[i], 0));
|
||||
}
|
||||
if (result[max] != ALPHABET[total % 43]) {
|
||||
throw ChecksumException();
|
||||
@ -182,7 +182,7 @@ vector<int> Code39Reader::findAsteriskPattern(Ref<BitArray> row, vector<int>& co
|
||||
int counterPosition = 0;
|
||||
int patternStart = rowOffset;
|
||||
bool isWhite = false;
|
||||
int patternLength = counters.size();
|
||||
int patternLength = int(counters.size());
|
||||
|
||||
for (int i = rowOffset; i < width; i++) {
|
||||
if (row->get(i) ^ isWhite) {
|
||||
@ -218,7 +218,7 @@ vector<int> Code39Reader::findAsteriskPattern(Ref<BitArray> row, vector<int>& co
|
||||
// For efficiency, returns -1 on failure. Not throwing here saved as many as
|
||||
// 700 exceptions per image when using some of our blackbox images.
|
||||
int Code39Reader::toNarrowWidePattern(vector<int>& counters){
|
||||
int numCounters = counters.size();
|
||||
int numCounters = int(counters.size());
|
||||
int maxNarrowCounter = 0;
|
||||
int wideCounters;
|
||||
do {
|
||||
@ -272,7 +272,7 @@ char Code39Reader::patternToChar(int pattern){
|
||||
}
|
||||
|
||||
Ref<String> Code39Reader::decodeExtended(std::string encoded){
|
||||
int length = encoded.length();
|
||||
int length = int(encoded.length());
|
||||
std::string tmpDecoded;
|
||||
for (int i = 0; i < length; i++) {
|
||||
char c = encoded[i];
|
||||
|
@ -72,7 +72,7 @@ Ref<Result> Code93Reader::decodeRow(int rowNumber, Ref<BitArray> row, zxing::Dec
|
||||
|
||||
vector<int>& theCounters (counters);
|
||||
{ // Arrays.fill(counters, 0);
|
||||
int size = theCounters.size();
|
||||
int size = int(theCounters.size());
|
||||
theCounters.resize(0);
|
||||
theCounters.resize(size); }
|
||||
string& result (decodeRowResult);
|
||||
@ -89,7 +89,7 @@ Ref<Result> Code93Reader::decodeRow(int rowNumber, Ref<BitArray> row, zxing::Dec
|
||||
decodedChar = patternToChar(pattern);
|
||||
result.append(1, decodedChar);
|
||||
lastStart = nextStart;
|
||||
for(int i=0, e=theCounters.size(); i < e; ++i) {
|
||||
for(int i=0, e=int(theCounters.size()); i < e; ++i) {
|
||||
nextStart += theCounters[i];
|
||||
}
|
||||
// Read off white space
|
||||
@ -99,7 +99,7 @@ Ref<Result> Code93Reader::decodeRow(int rowNumber, Ref<BitArray> row, zxing::Dec
|
||||
|
||||
// Look for whitespace after pattern:
|
||||
int lastPatternSize = 0;
|
||||
for (int i = 0, e = theCounters.size(); i < e; i++) {
|
||||
for (int i = 0, e = int(theCounters.size()); i < e; i++) {
|
||||
lastPatternSize += theCounters[i];
|
||||
}
|
||||
|
||||
@ -140,14 +140,14 @@ Code93Reader::Range Code93Reader::findAsteriskPattern(Ref<BitArray> row) {
|
||||
int rowOffset = row->getNextSet(0);
|
||||
|
||||
{ // Arrays.fill(counters, 0);
|
||||
int size = counters.size();
|
||||
int size = int(counters.size());
|
||||
counters.resize(0);
|
||||
counters.resize(size); }
|
||||
vector<int>& theCounters (counters);
|
||||
|
||||
int patternStart = rowOffset;
|
||||
bool isWhite = false;
|
||||
int patternLength = theCounters.size();
|
||||
int patternLength = int(theCounters.size());
|
||||
|
||||
int counterPosition = 0;
|
||||
for (int i = rowOffset; i < width; i++) {
|
||||
@ -176,9 +176,9 @@ Code93Reader::Range Code93Reader::findAsteriskPattern(Ref<BitArray> row) {
|
||||
}
|
||||
|
||||
int Code93Reader::toPattern(vector<int>& counters) {
|
||||
int max = counters.size();
|
||||
int max = int(counters.size());
|
||||
int sum = 0;
|
||||
for(int i=0, e=counters.size(); i<e; ++i) {
|
||||
for(int i=0, e=int(counters.size()); i<e; ++i) {
|
||||
sum += counters[i];
|
||||
}
|
||||
int pattern = 0;
|
||||
@ -212,7 +212,7 @@ char Code93Reader::patternToChar(int pattern) {
|
||||
}
|
||||
|
||||
Ref<String> Code93Reader::decodeExtended(string const& encoded) {
|
||||
int length = encoded.length();
|
||||
int length = int(encoded.length());
|
||||
string decoded;
|
||||
for (int i = 0; i < length; i++) {
|
||||
char c = encoded[i];
|
||||
@ -271,7 +271,7 @@ Ref<String> Code93Reader::decodeExtended(string const& encoded) {
|
||||
}
|
||||
|
||||
void Code93Reader::checkChecksums(string const& result) {
|
||||
int length = result.length();
|
||||
int length = int(result.length());
|
||||
checkOneChecksum(result, length - 2, 20);
|
||||
checkOneChecksum(result, length - 1, 15);
|
||||
}
|
||||
@ -282,7 +282,7 @@ void Code93Reader::checkOneChecksum(string const& result,
|
||||
int weight = 1;
|
||||
int total = 0;
|
||||
for (int i = checkPosition - 1; i >= 0; i--) {
|
||||
total += weight * ALPHABET_STRING.find_first_of(result[i]);
|
||||
total += weight * int(ALPHABET_STRING.find_first_of(result[i]));
|
||||
if (++weight > weightMax) {
|
||||
weight = 1;
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ int EAN13Reader::decodeMiddle(Ref<BitArray> row,
|
||||
for (int x = 0; x < 6 && rowOffset < end; x++) {
|
||||
int bestMatch = decodeDigit(row, counters, rowOffset, L_AND_G_PATTERNS);
|
||||
resultString.append(1, (byte) ('0' + bestMatch % 10));
|
||||
for (int i = 0, end = counters.size(); i <end; i++) {
|
||||
for (int i = 0, end = int(counters.size()); i <end; i++) {
|
||||
rowOffset += counters[i];
|
||||
}
|
||||
if (bestMatch >= 10) {
|
||||
@ -62,7 +62,7 @@ int EAN13Reader::decodeMiddle(Ref<BitArray> row,
|
||||
int bestMatch =
|
||||
decodeDigit(row, counters, rowOffset, L_PATTERNS);
|
||||
resultString.append(1, (byte) ('0' + bestMatch));
|
||||
for (int i = 0, end = counters.size(); i < end; i++) {
|
||||
for (int i = 0, end = int(counters.size()); i < end; i++) {
|
||||
rowOffset += counters[i];
|
||||
}
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ int EAN8Reader::decodeMiddle(Ref<BitArray> row,
|
||||
for (int x = 0; x < 4 && rowOffset < end; x++) {
|
||||
int bestMatch = decodeDigit(row, counters, rowOffset, L_PATTERNS);
|
||||
result.append(1, (byte) ('0' + bestMatch));
|
||||
for (int i = 0, end = counters.size(); i < end; i++) {
|
||||
for (int i = 0, end = int(counters.size()); i < end; i++) {
|
||||
rowOffset += counters[i];
|
||||
}
|
||||
}
|
||||
@ -53,7 +53,7 @@ int EAN8Reader::decodeMiddle(Ref<BitArray> row,
|
||||
for (int x = 0; x < 4 && rowOffset < end; x++) {
|
||||
int bestMatch = decodeDigit(row, counters, rowOffset, L_PATTERNS);
|
||||
result.append(1, (byte) ('0' + bestMatch));
|
||||
for (int i = 0, end = counters.size(); i < end; i++) {
|
||||
for (int i = 0, end = int(counters.size()); i < end; i++) {
|
||||
rowOffset += counters[i];
|
||||
}
|
||||
}
|
||||
|
@ -155,7 +155,7 @@ void ITFReader::decodeMiddle(Ref<BitArray> row,
|
||||
bestMatch = decodeDigit(counterWhite);
|
||||
resultString.append(1, (byte) ('0' + bestMatch));
|
||||
|
||||
for (int i = 0, e = counterDigitPair.size(); i < e; i++) {
|
||||
for (int i = 0, e = int(counterDigitPair.size()); i < e; i++) {
|
||||
payloadStart += counterDigitPair[i];
|
||||
}
|
||||
}
|
||||
@ -274,7 +274,7 @@ ITFReader::Range ITFReader::findGuardPattern(Ref<BitArray> row,
|
||||
vector<int> const& pattern) {
|
||||
// TODO: This is very similar to implementation in UPCEANReader. Consider if they can be
|
||||
// merged to a single method.
|
||||
int patternLength = pattern.size();
|
||||
int patternLength = int(pattern.size());
|
||||
vector<int> counters(patternLength);
|
||||
int width = row->getSize();
|
||||
bool isWhite = false;
|
||||
|
@ -81,7 +81,7 @@ MultiFormatOneDReader::MultiFormatOneDReader(DecodeHints hints) : readers() {
|
||||
#include <typeinfo>
|
||||
|
||||
Ref<Result> MultiFormatOneDReader::decodeRow(int rowNumber, Ref<BitArray> row, zxing::DecodeHints hints) {
|
||||
int size = readers.size();
|
||||
int size = int(readers.size());
|
||||
for (int i = 0; i < size; i++) {
|
||||
OneDReader* reader = readers[i];
|
||||
try {
|
||||
|
@ -64,7 +64,7 @@ MultiFormatUPCEANReader::MultiFormatUPCEANReader(DecodeHints hints) : readers()
|
||||
Ref<Result> MultiFormatUPCEANReader::decodeRow(int rowNumber, Ref<BitArray> row, zxing::DecodeHints /*hints*/) {
|
||||
// Compute this location once and reuse it on multiple implementations
|
||||
UPCEANReader::Range startGuardPattern = UPCEANReader::findStartGuardPattern(row);
|
||||
for (int i = 0, e = readers.size(); i < e; i++) {
|
||||
for (int i = 0, e = int(readers.size()); i < e; i++) {
|
||||
Ref<UPCEANReader> reader = readers[i];
|
||||
Ref<Result> result;
|
||||
try {
|
||||
|
@ -155,7 +155,7 @@ int OneDReader::patternMatchVariance(vector<int>& counters,
|
||||
int OneDReader::patternMatchVariance(vector<int>& counters,
|
||||
int const pattern[],
|
||||
int maxIndividualVariance) {
|
||||
int numCounters = counters.size();
|
||||
int numCounters = int(counters.size());
|
||||
unsigned int total = 0;
|
||||
unsigned int patternLength = 0;
|
||||
for (int i = 0; i < numCounters; i++) {
|
||||
@ -189,7 +189,7 @@ int OneDReader::patternMatchVariance(vector<int>& counters,
|
||||
void OneDReader::recordPattern(Ref<BitArray> row,
|
||||
int start,
|
||||
vector<int>& counters) {
|
||||
int numCounters = counters.size();
|
||||
int numCounters = int(counters.size());
|
||||
for (int i = 0; i < numCounters; i++) {
|
||||
counters[i] = 0;
|
||||
}
|
||||
|
@ -206,7 +206,7 @@ UPCEANReader::Range UPCEANReader::findGuardPattern(Ref<BitArray> row,
|
||||
}
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
int patternLength = pattern.size();
|
||||
int patternLength = int(pattern.size());
|
||||
int width = row->getSize();
|
||||
bool isWhite = whiteFirst;
|
||||
rowOffset = whiteFirst ? row->getNextUnset(rowOffset) : row->getNextSet(rowOffset);
|
||||
@ -249,7 +249,7 @@ int UPCEANReader::decodeDigit(Ref<BitArray> row,
|
||||
recordPattern(row, rowOffset, counters);
|
||||
int bestVariance = MAX_AVG_VARIANCE; // worst variance we'll accept
|
||||
int bestMatch = -1;
|
||||
int max = patterns.size();
|
||||
int max = int(patterns.size());
|
||||
for (int i = 0; i < max; i++) {
|
||||
int const* pattern (patterns[i]);
|
||||
int variance = patternMatchVariance(counters, pattern, MAX_INDIVIDUAL_VARIANCE);
|
||||
@ -281,7 +281,7 @@ bool UPCEANReader::checkChecksum(Ref<String> const& s) {
|
||||
*/
|
||||
bool UPCEANReader::checkStandardUPCEANChecksum(Ref<String> const& s_) {
|
||||
std::string const& s (s_->getText());
|
||||
int length = s.length();
|
||||
int length = int(s.length());
|
||||
if (length == 0) {
|
||||
return false;
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ int UPCEReader::decodeMiddle(Ref<BitArray> row, Range const& startRange, string&
|
||||
for (int x = 0; x < 6 && rowOffset < end; x++) {
|
||||
int bestMatch = decodeDigit(row, counters, rowOffset, L_AND_G_PATTERNS);
|
||||
result.append(1, (byte) ('0' + bestMatch % 10));
|
||||
for (int i = 0, e = counters.size(); i < e; i++) {
|
||||
for (int i = 0, e = int(counters.size()); i < e; i++) {
|
||||
rowOffset += counters[i];
|
||||
}
|
||||
if (bestMatch >= 10) {
|
||||
|
@ -190,7 +190,7 @@ Ref<BitMatrix> LinesSampler::sample() {
|
||||
detectedCodeWords.resize(rowCount);
|
||||
|
||||
// XXX
|
||||
Ref<BitMatrix> grid(new BitMatrix(dimension_, detectedCodeWords.size()));
|
||||
Ref<BitMatrix> grid(new BitMatrix(dimension_, int(detectedCodeWords.size())));
|
||||
codewordsToBitMatrix(detectedCodeWords, grid);
|
||||
|
||||
return grid;
|
||||
@ -712,7 +712,7 @@ int LinesSampler::decodeRowCount(const int symbolsPerLine, vector<vector<int> >
|
||||
detectedCodeWords.insert(detectedCodeWords.begin() + insertLinesAt[i] + i, vector<int>(symbolsPerLine, 0));
|
||||
}
|
||||
|
||||
int rowCount = getValueWithMaxVotes(rowCountVotes,detectedCodeWords.size()).getVote();
|
||||
int rowCount = getValueWithMaxVotes(rowCountVotes, int(detectedCodeWords.size())).getVote();
|
||||
// int ecLevel = getValueWithMaxVotes(ecLevelVotes);
|
||||
|
||||
#if PDF417_DIAG && OUTPUT_EC_LEVEL
|
||||
|
@ -59,7 +59,7 @@ int ECBlocks::getECCodewordsPerBloc()
|
||||
|
||||
int ECBlocks::getTotalECCodewords()
|
||||
{
|
||||
return ecCodewordsPerBloc_ * ecBlocks_.size();
|
||||
return ecCodewordsPerBloc_ * int(ecBlocks_.size());
|
||||
}
|
||||
|
||||
std::vector<ECB*>& ECBlocks::getECBlocks() {
|
||||
@ -166,7 +166,7 @@ Ref<Version> Version::decodeVersionInformation(unsigned int versionBits) {
|
||||
// We can tolerate up to 3 bits of error since no two version info codewords will
|
||||
// differ in less than 4 bits.
|
||||
if (bestDifference <= 3) {
|
||||
return getVersionForNumber(bestVersion);
|
||||
return getVersionForNumber(int(bestVersion));
|
||||
}
|
||||
// If we didn't find a close enough match, fail
|
||||
return Ref<Version>(NULL);
|
||||
@ -559,7 +559,7 @@ int Version::buildVersions() {
|
||||
new ECB(34, 25)),
|
||||
new ECBlocks(30, new ECB(20, 15),
|
||||
new ECB(61, 16)))));
|
||||
return VERSIONS.size();
|
||||
return int(VERSIONS.size());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ namespace zxing {
|
||||
namespace qrcode {
|
||||
|
||||
int BitMatrixParser::copyBit(size_t x, size_t y, int versionBits) {
|
||||
return bitMatrix_->get(x, y) ? (versionBits << 1) | 0x1 : versionBits << 1;
|
||||
return bitMatrix_->get(int(x), int(y)) ? (versionBits << 1) | 0x1 : versionBits << 1;
|
||||
}
|
||||
|
||||
BitMatrixParser::BitMatrixParser(Ref<BitMatrix> bitMatrix) :
|
||||
|
@ -72,7 +72,7 @@ std::vector<Ref<DataBlock> > DataBlock::getDataBlocks(ArrayRef<byte> rawCodeword
|
||||
// All blocks have the same amount of data, except that the last n
|
||||
// (where n may be 0) have 1 more byte. Figure out where these start.
|
||||
int shorterBlocksTotalCodewords = result[0]->codewords_->size();
|
||||
int longerBlocksStartAt = result.size() - 1;
|
||||
int longerBlocksStartAt = int(result.size()) - 1;
|
||||
while (longerBlocksStartAt >= 0) {
|
||||
int numCodewords = result[longerBlocksStartAt]->codewords_->size();
|
||||
if (numCodewords == shorterBlocksTotalCodewords) {
|
||||
|
@ -48,7 +48,7 @@ void DataMask::unmaskBitMatrix(BitMatrix& bits, size_t dimension) {
|
||||
for (size_t x = 0; x < dimension; x++) {
|
||||
// TODO: check why the coordinates have to be swapped
|
||||
if (isMasked(y, x)) {
|
||||
bits.flip(x, y);
|
||||
bits.flip(int(x), int(y));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -152,7 +152,7 @@ int DataMask::buildDataMasks() {
|
||||
DATA_MASKS.push_back(Ref<DataMask> (new DataMask101()));
|
||||
DATA_MASKS.push_back(Ref<DataMask> (new DataMask110()));
|
||||
DATA_MASKS.push_back(Ref<DataMask> (new DataMask111()));
|
||||
return DATA_MASKS.size();
|
||||
return int(DATA_MASKS.size());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ void DecodedBitStreamParser::append(std::string &result,
|
||||
return;
|
||||
}
|
||||
|
||||
const int maxOut = 4 * nIn + 1;
|
||||
const int maxOut = 4 * int(nIn) + 1;
|
||||
char* bufOut = new char[maxOut];
|
||||
|
||||
ICONV_CONST char *fromPtr = (ICONV_CONST char *)bufIn;
|
||||
@ -97,7 +97,7 @@ void DecodedBitStreamParser::append(std::string &result,
|
||||
}
|
||||
iconv_close(cd);
|
||||
|
||||
int nResult = maxOut - nTo;
|
||||
int nResult = maxOut - int(nTo);
|
||||
bufOut[nResult] = '\0';
|
||||
result.append((const char *)bufOut);
|
||||
delete[] bufOut;
|
||||
|
@ -102,7 +102,7 @@ Ref<AlignmentPattern> AlignmentPatternFinder::handlePossibleCenter(vector<int> &
|
||||
float centerI = crossCheckVertical(i, (int)centerJ, 2 * stateCount[1], stateCountTotal);
|
||||
if (!isnan_z(centerI)) {
|
||||
float estimatedModuleSize = (float)(stateCount[0] + stateCount[1] + stateCount[2]) / 3.0f;
|
||||
int max = possibleCenters_->size();
|
||||
int max = int(possibleCenters_->size());
|
||||
for (int index = 0; index < max; index++) {
|
||||
Ref<AlignmentPattern> center((*possibleCenters_)[index]);
|
||||
// Look for about the same center and module size:
|
||||
|
@ -125,15 +125,15 @@ float FinderPatternFinder::crossCheckVertical(size_t startI, size_t centerJ, int
|
||||
int *stateCount = getCrossCheckStateCount();
|
||||
|
||||
// Start counting up from center
|
||||
int i = startI;
|
||||
while (i >= 0 && image_->get(centerJ, i)) {
|
||||
int i = int(startI);
|
||||
while (i >= 0 && image_->get(int(centerJ), i)) {
|
||||
stateCount[2]++;
|
||||
i--;
|
||||
}
|
||||
if (i < 0) {
|
||||
return nan();
|
||||
}
|
||||
while (i >= 0 && !image_->get(centerJ, i) && stateCount[1] <= maxCount) {
|
||||
while (i >= 0 && !image_->get(int(centerJ), i) && stateCount[1] <= maxCount) {
|
||||
stateCount[1]++;
|
||||
i--;
|
||||
}
|
||||
@ -141,7 +141,7 @@ float FinderPatternFinder::crossCheckVertical(size_t startI, size_t centerJ, int
|
||||
if (i < 0 || stateCount[1] > maxCount) {
|
||||
return nan();
|
||||
}
|
||||
while (i >= 0 && image_->get(centerJ, i) && stateCount[0] <= maxCount) {
|
||||
while (i >= 0 && image_->get(int(centerJ), i) && stateCount[0] <= maxCount) {
|
||||
stateCount[0]++;
|
||||
i--;
|
||||
}
|
||||
@ -150,22 +150,22 @@ float FinderPatternFinder::crossCheckVertical(size_t startI, size_t centerJ, int
|
||||
}
|
||||
|
||||
// Now also count down from center
|
||||
i = startI + 1;
|
||||
while (i < maxI && image_->get(centerJ, i)) {
|
||||
i = int(startI) + 1;
|
||||
while (i < maxI && image_->get(int(centerJ), i)) {
|
||||
stateCount[2]++;
|
||||
i++;
|
||||
}
|
||||
if (i == maxI) {
|
||||
return nan();
|
||||
}
|
||||
while (i < maxI && !image_->get(centerJ, i) && stateCount[3] < maxCount) {
|
||||
while (i < maxI && !image_->get(int(centerJ), i) && stateCount[3] < maxCount) {
|
||||
stateCount[3]++;
|
||||
i++;
|
||||
}
|
||||
if (i == maxI || stateCount[3] >= maxCount) {
|
||||
return nan();
|
||||
}
|
||||
while (i < maxI && image_->get(centerJ, i) && stateCount[4] < maxCount) {
|
||||
while (i < maxI && image_->get(int(centerJ), i) && stateCount[4] < maxCount) {
|
||||
stateCount[4]++;
|
||||
i++;
|
||||
}
|
||||
@ -189,22 +189,22 @@ float FinderPatternFinder::crossCheckHorizontal(size_t startJ, size_t centerI, i
|
||||
int maxJ = image_->getWidth();
|
||||
int *stateCount = getCrossCheckStateCount();
|
||||
|
||||
int j = startJ;
|
||||
while (j >= 0 && image_->get(j, centerI)) {
|
||||
int j = int(startJ);
|
||||
while (j >= 0 && image_->get(j, int(centerI))) {
|
||||
stateCount[2]++;
|
||||
j--;
|
||||
}
|
||||
if (j < 0) {
|
||||
return nan();
|
||||
}
|
||||
while (j >= 0 && !image_->get(j, centerI) && stateCount[1] <= maxCount) {
|
||||
while (j >= 0 && !image_->get(j, int(centerI)) && stateCount[1] <= maxCount) {
|
||||
stateCount[1]++;
|
||||
j--;
|
||||
}
|
||||
if (j < 0 || stateCount[1] > maxCount) {
|
||||
return nan();
|
||||
}
|
||||
while (j >= 0 && image_->get(j, centerI) && stateCount[0] <= maxCount) {
|
||||
while (j >= 0 && image_->get(j, int(centerI)) && stateCount[0] <= maxCount) {
|
||||
stateCount[0]++;
|
||||
j--;
|
||||
}
|
||||
@ -212,22 +212,22 @@ float FinderPatternFinder::crossCheckHorizontal(size_t startJ, size_t centerI, i
|
||||
return nan();
|
||||
}
|
||||
|
||||
j = startJ + 1;
|
||||
while (j < maxJ && image_->get(j, centerI)) {
|
||||
j = int(startJ) + 1;
|
||||
while (j < maxJ && image_->get(j, int(centerI))) {
|
||||
stateCount[2]++;
|
||||
j++;
|
||||
}
|
||||
if (j == maxJ) {
|
||||
return nan();
|
||||
}
|
||||
while (j < maxJ && !image_->get(j, centerI) && stateCount[3] < maxCount) {
|
||||
while (j < maxJ && !image_->get(j, int(centerI)) && stateCount[3] < maxCount) {
|
||||
stateCount[3]++;
|
||||
j++;
|
||||
}
|
||||
if (j == maxJ || stateCount[3] >= maxCount) {
|
||||
return nan();
|
||||
}
|
||||
while (j < maxJ && image_->get(j, centerI) && stateCount[4] < maxCount) {
|
||||
while (j < maxJ && image_->get(j, int(centerI)) && stateCount[4] < maxCount) {
|
||||
stateCount[4]++;
|
||||
j++;
|
||||
}
|
||||
@ -247,7 +247,7 @@ float FinderPatternFinder::crossCheckHorizontal(size_t startJ, size_t centerI, i
|
||||
|
||||
bool FinderPatternFinder::handlePossibleCenter(int* stateCount, size_t i, size_t j) {
|
||||
int stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2] + stateCount[3] + stateCount[4];
|
||||
float centerJ = centerFromEnd(stateCount, j);
|
||||
float centerJ = centerFromEnd(stateCount, int(j));
|
||||
float centerI = crossCheckVertical(i, (size_t)centerJ, stateCount[2], stateCountTotal);
|
||||
if (!isnan_z(centerI)) {
|
||||
// Re-cross check
|
||||
@ -459,7 +459,7 @@ Ref<FinderPatternInfo> FinderPatternFinder::find(DecodeHints const& hints) {
|
||||
// modules in size. This gives the smallest number of pixels the center
|
||||
// could be, so skip this often. When trying harder, look for all
|
||||
// QR versions regardless of how dense they are.
|
||||
int iSkip = (3 * maxI) / (4 * MAX_MODULES);
|
||||
int iSkip = (3 * int(maxI)) / (4 * MAX_MODULES);
|
||||
if (iSkip < MIN_SKIP || tryHarder) {
|
||||
iSkip = MIN_SKIP;
|
||||
}
|
||||
@ -473,7 +473,7 @@ Ref<FinderPatternInfo> FinderPatternFinder::find(DecodeHints const& hints) {
|
||||
memset(stateCount, 0, sizeof(stateCount));
|
||||
int currentState = 0;
|
||||
for (size_t j = 0; j < maxJ; j++) {
|
||||
if (matrix.get(j, i)) {
|
||||
if (matrix.get(int(j), int(i))) {
|
||||
// Black pixel
|
||||
if ((currentState & 1) == 1) { // Counting white pixels
|
||||
currentState++;
|
||||
|
Loading…
x
Reference in New Issue
Block a user