Commit 07aa03dc46d2ae041c8b2730696b32daa2fb0dbe
1 parent
3669305b
BEE use size_t
Showing
1 changed file
with
4 additions
and
4 deletions
openbr/core/bee.cpp
| @@ -150,7 +150,7 @@ Mat readMatrix(const File &matrix, QString *targetSigset, QString *querySigset) | @@ -150,7 +150,7 @@ Mat readMatrix(const File &matrix, QString *targetSigset, QString *querySigset) | ||
| 150 | const int rows = words[1].toInt(); | 150 | const int rows = words[1].toInt(); |
| 151 | const int cols = words[2].toInt(); | 151 | const int cols = words[2].toInt(); |
| 152 | const bool isMask = words[0][1] == 'B'; | 152 | const bool isMask = words[0][1] == 'B'; |
| 153 | - const int typeSize = isMask ? sizeof(BEE::MaskValue) : sizeof(BEE::SimmatValue); | 153 | + const size_t typeSize = isMask ? sizeof(BEE::MaskValue) : sizeof(BEE::SimmatValue); |
| 154 | 154 | ||
| 155 | // Get matrix data | 155 | // Get matrix data |
| 156 | Mat m; | 156 | Mat m; |
| @@ -159,7 +159,7 @@ Mat readMatrix(const File &matrix, QString *targetSigset, QString *querySigset) | @@ -159,7 +159,7 @@ Mat readMatrix(const File &matrix, QString *targetSigset, QString *querySigset) | ||
| 159 | else | 159 | else |
| 160 | m.create(rows, cols, OpenCVType<BEE::SimmatValue,1>::make()); | 160 | m.create(rows, cols, OpenCVType<BEE::SimmatValue,1>::make()); |
| 161 | 161 | ||
| 162 | - const qint64 bytesPerRow = m.cols * typeSize; | 162 | + const size_t bytesPerRow = (size_t)m.cols * typeSize; |
| 163 | for (int i=0; i<m.rows; i++) { | 163 | for (int i=0; i<m.rows; i++) { |
| 164 | Mat aRow = m.row(i); | 164 | Mat aRow = m.row(i); |
| 165 | qint64 bytesRead = file.read((char *)aRow.data, bytesPerRow); | 165 | qint64 bytesRead = file.read((char *)aRow.data, bytesPerRow); |
| @@ -184,7 +184,7 @@ void writeMatrix(const Mat &m, const QString &fileName, const QString &targetSig | @@ -184,7 +184,7 @@ void writeMatrix(const Mat &m, const QString &fileName, const QString &targetSig | ||
| 184 | else if (m.type() != OpenCVType<BEE::SimmatValue,1>::make()) | 184 | else if (m.type() != OpenCVType<BEE::SimmatValue,1>::make()) |
| 185 | qFatal("Invalid matrix type, .mtx files can only contain single channel float or uchar matrices."); | 185 | qFatal("Invalid matrix type, .mtx files can only contain single channel float or uchar matrices."); |
| 186 | 186 | ||
| 187 | - const int elemSize = isMask ? sizeof(BEE::MaskValue) : sizeof(BEE::SimmatValue); | 187 | + const size_t elemSize = isMask ? sizeof(BEE::MaskValue) : sizeof(BEE::SimmatValue); |
| 188 | const QString matrixType = isMask ? "B" : "F"; | 188 | const QString matrixType = isMask ? "B" : "F"; |
| 189 | 189 | ||
| 190 | char buff[4]; | 190 | char buff[4]; |
| @@ -208,7 +208,7 @@ void writeMatrix(const Mat &m, const QString &fileName, const QString &targetSig | @@ -208,7 +208,7 @@ void writeMatrix(const Mat &m, const QString &fileName, const QString &targetSig | ||
| 208 | memcpy(&buff, &endian, 4); | 208 | memcpy(&buff, &endian, 4); |
| 209 | file.write(buff, 4); | 209 | file.write(buff, 4); |
| 210 | file.write("\n"); | 210 | file.write("\n"); |
| 211 | - file.write((const char*)m.data, (qint64)m.rows*m.cols*elemSize); | 211 | + file.write((const char*)m.data, (size_t)m.rows*m.cols*elemSize); |
| 212 | file.close(); | 212 | file.close(); |
| 213 | } | 213 | } |
| 214 | 214 |