diff --git a/src/ObjSignature.h b/src/ObjSignature.h index 80bcdb9c..2ad347be 100644 --- a/src/ObjSignature.h +++ b/src/ObjSignature.h @@ -93,7 +93,7 @@ public: std::vector bytes; cv::imencode(".png", image_, bytes); - streamPtr << QByteArray((char*)bytes.data(), bytes.size()); + streamPtr << QByteArray((char*)bytes.data(), (int)bytes.size()); } void load(QDataStream & streamPtr) diff --git a/src/Vocabulary.cpp b/src/Vocabulary.cpp index d69cce0f..5fd7e1e9 100644 --- a/src/Vocabulary.cpp +++ b/src/Vocabulary.cpp @@ -286,8 +286,8 @@ void Vocabulary::search(const cv::Mat & descriptors, cv::Mat & results, cv::Mat } //convert back to matrix style - results = cv::Mat(matches.size(), k, CV_32SC1); - dists = cv::Mat(matches.size(), k, CV_32FC1); + results = cv::Mat((int)matches.size(), k, CV_32SC1); + dists = cv::Mat((int)matches.size(), k, CV_32FC1); for(unsigned int i=0; i uHex2Bytes(const std::string & hex) { - return uHex2Bytes(&hex[0], hex.length()); + return uHex2Bytes(&hex[0], (int)hex.length()); } std::vector uHex2Bytes(const char * hex, int hexLen) @@ -270,7 +270,12 @@ std::string uFormatv (const char *fmt, va_list args) #endif // Try to vsnprintf into our buffer. - int needed = vsnprintf (buf, size, fmt, argsTmp); +#ifdef _MSC_VER + int needed = (int)vsnprintf_s(buf, size, _TRUNCATE, fmt, argsTmp); +#else + int needed = (int)vsnprintf(buf, size, fmt, argsTmp); +#endif + va_end(argsTmp); // NB. C99 (which modern Linux and OS X follow) says vsnprintf // failure returns the length it would have needed. But older diff --git a/src/utilite/UDirectory.cpp b/src/utilite/UDirectory.cpp index 99f6b684..7ada8ade 100644 --- a/src/utilite/UDirectory.cpp +++ b/src/utilite/UDirectory.cpp @@ -262,7 +262,7 @@ bool UDirectory::exists(const std::string & dirPath) std::string UDirectory::getDir(const std::string & filePath) { std::string dir = filePath; - int i=dir.size()-1; + int i=(int)dir.size()-1; for(; i>=0; --i) { if(dir[i] == '/' || dir[i] == '\\') diff --git a/src/utilite/UFile.cpp b/src/utilite/UFile.cpp index 3f9a395f..0de771ba 100644 --- a/src/utilite/UFile.cpp +++ b/src/utilite/UFile.cpp @@ -65,14 +65,14 @@ int UFile::erase(const std::string &filePath) int UFile::rename(const std::string &oldFilePath, const std::string &newFilePath) { - return rename(oldFilePath.c_str(), newFilePath.c_str()); + return ::rename(oldFilePath.c_str(), newFilePath.c_str()); } std::string UFile::getName(const std::string & filePath) { std::string fullPath = filePath; std::string name; - for(int i=fullPath.size()-1; i>=0; --i) + for(int i=(int)fullPath.size()-1; i>=0; --i) { if(fullPath[i] == '/' || fullPath[i] == '\\') { diff --git a/tools/similarity/main.cpp b/tools/similarity/main.cpp index 22e83bad..61da202e 100644 --- a/tools/similarity/main.cpp +++ b/tools/similarity/main.cpp @@ -127,7 +127,7 @@ int main(int argc, char * argv[]) //////////////////////////// // Find correspondences by NNDR (Nearest Neighbor Distance Ratio) - float nndrRatio = 0.6; + float nndrRatio = 0.6f; std::vector mpts_1, mpts_2; // Used for homography std::vector indexes_1, indexes_2; // Used for homography std::vector outlier_mask; // Used for homography @@ -176,7 +176,7 @@ int main(int argc, char * argv[]) } else { - value = mpts_1.size(); + value = (int)mpts_1.size(); } } else