mirror of https://github.com/status-im/qzxing.git
added various casts to avoid LGTM warning
This commit is contained in:
parent
0f768f98e9
commit
777391c1cf
|
@ -195,7 +195,7 @@ void CameraImageWrapper::updateImageAsGrayscale(const QImage &origin)
|
|||
const int width = getWidth();
|
||||
const int height = getHeight();
|
||||
|
||||
imageBytes = QSharedPointer<std::vector<zxing::byte>>(new std::vector<zxing::byte>(height*width));
|
||||
imageBytes = QSharedPointer<std::vector<zxing::byte>>(new std::vector<zxing::byte>((size_t)height * (size_t)width));
|
||||
imageBytesPerRow = QSharedPointer<std::vector<QSharedPointer<std::vector<zxing::byte>>>>(new std::vector<QSharedPointer<std::vector<zxing::byte>>>(height));
|
||||
zxing::byte* m = &(*imageBytes)[0];
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ void BitMatrix::init(int width, int height) {
|
|||
this->width = width;
|
||||
this->height = height;
|
||||
this->rowSize = (width + 31) >> 5;
|
||||
bits.reset(new std::vector<int>(rowSize * height));
|
||||
bits.reset(new std::vector<int>((size_t)rowSize * (size_t)height));
|
||||
}
|
||||
|
||||
BitMatrix::BitMatrix(int dimension) {
|
||||
|
|
|
@ -64,7 +64,7 @@ QSharedPointer<std::vector<zxing::byte>> GreyscaleLuminanceSource::getMatrix() c
|
|||
int size = getWidth() * getHeight();
|
||||
QSharedPointer<std::vector<zxing::byte>> result (new std::vector<zxing::byte>(size));
|
||||
for (int row = 0; row < getHeight(); row++) {
|
||||
memcpy(&(*result)[row * getWidth()], &(*greyData_)[(top_ + row) * dataWidth_ + left_], getWidth());
|
||||
memcpy(&(*result)[(size_t)row * (size_t)getWidth()], &(*greyData_)[(top_ + row) * dataWidth_ + left_], getWidth());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -69,9 +69,9 @@ GreyscaleRotatedLuminanceSource::getRow(int y, QSharedPointer<std::vector<zxing:
|
|||
}
|
||||
|
||||
QSharedPointer<std::vector<zxing::byte>> GreyscaleRotatedLuminanceSource::getMatrix() const {
|
||||
QSharedPointer<std::vector<zxing::byte>> result (new std::vector<zxing::byte>(getWidth() * getHeight()));
|
||||
QSharedPointer<std::vector<zxing::byte>> result (new std::vector<zxing::byte>((size_t)getWidth() * (size_t)getHeight()));
|
||||
for (int y = 0; y < getHeight(); y++) {
|
||||
zxing::byte* row = &(*result)[y * getWidth()];
|
||||
zxing::byte* row = &(*result)[(size_t)y * (size_t)getWidth()];
|
||||
int offset = (left_ * dataWidth_) + (dataWidth_ - 1 - (y + top_));
|
||||
for (int x = 0; x < getWidth(); x++) {
|
||||
row[x] = (*greyData_)[offset];
|
||||
|
|
|
@ -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)[(size_t)(top + z) * (size_t)subWidth];
|
||||
sum += blackRow[left - 2];
|
||||
sum += blackRow[left - 1];
|
||||
sum += blackRow[left];
|
||||
|
@ -164,7 +164,7 @@ QSharedPointer<std::vector<int>> HybridBinarizer::calculateBlackPoints(QSharedPo
|
|||
int height) {
|
||||
const int minDynamicRange = 24;
|
||||
|
||||
QSharedPointer<std::vector<int>> blackPoints (new std::vector<int>(subHeight * subWidth));
|
||||
QSharedPointer<std::vector<int>> blackPoints (new std::vector<int>((size_t)subHeight * (size_t)subWidth));
|
||||
for (int y = 0; y < subHeight; y++) {
|
||||
int yoffset = y << BLOCK_SIZE_POWER;
|
||||
int maxYOffset = height - BLOCK_SIZE;
|
||||
|
|
Loading…
Reference in New Issue