fixed some warnings on Windows

git-svn-id: http://find-object.googlecode.com/svn/trunk/find_object@425 620bd6b2-0a58-f614-fd9a-1bd335dccda9
This commit is contained in:
matlabbe 2015-03-02 16:39:48 +00:00
parent 58f130fc62
commit 683acafa4a
6 changed files with 15 additions and 10 deletions

View File

@ -93,7 +93,7 @@ public:
std::vector<unsigned char> 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)

View File

@ -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<matches.size(); ++i)
{
for(int j=0; j<k; ++j)

View File

@ -155,7 +155,7 @@ std::string uBytes2Hex(const char * bytes, unsigned int bytesLen)
std::vector<char> uHex2Bytes(const std::string & hex)
{
return uHex2Bytes(&hex[0], hex.length());
return uHex2Bytes(&hex[0], (int)hex.length());
}
std::vector<char> 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

View File

@ -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] == '\\')

View File

@ -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] == '\\')
{

View File

@ -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<cv::Point2f> mpts_1, mpts_2; // Used for homography
std::vector<int> indexes_1, indexes_2; // Used for homography
std::vector<uchar> 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