Fixed some warnings on VisualStudio2010

This commit is contained in:
Mathieu Labbé
2015-04-01 10:38:59 -04:00
parent 6089a44589
commit 37c34e8186
10 changed files with 27 additions and 23 deletions
+2 -2
View File
@@ -99,7 +99,7 @@ cv::Mat compressImage2(const cv::Mat & image, const std::string & format)
std::vector<unsigned char> bytes = compressImage(image, format);
if(bytes.size())
{
return cv::Mat(1, bytes.size(), CV_8UC1, bytes.data()).clone();
return cv::Mat(1, (int)bytes.size(), CV_8UC1, bytes.data()).clone();
}
return cv::Mat();
}
@@ -201,7 +201,7 @@ cv::Mat uncompressData(const cv::Mat & bytes)
cv::Mat uncompressData(const std::vector<unsigned char> & bytes)
{
return uncompressData(bytes.data(), bytes.size());
return uncompressData(bytes.data(), (unsigned long)bytes.size());
}
cv::Mat uncompressData(const unsigned char * bytes, unsigned long size)
+2 -2
View File
@@ -1016,7 +1016,7 @@ void Memory::clear()
// Save some stats to the db, save only when the mem is not empty
if(_dbDriver && (_stMem.size() || _workingMem.size()))
{
unsigned int memSize = _workingMem.size() + _stMem.size();
unsigned int memSize = (unsigned int)(_workingMem.size() + _stMem.size());
if(_workingMem.size() && _workingMem.begin()->first < 0)
{
--memSize;
@@ -1863,7 +1863,7 @@ Transform Memory::computeVisualTransform(
true, 3.0, 10,
&inliersV,
variance);
inliersCount = inliersV.size();
inliersCount = (int)inliersV.size();
if(!t.isNull() && inliersCount >= _bowMinInliers)
{
transform = t;
+2 -2
View File
@@ -2057,8 +2057,8 @@ void Rtabmap::setWorkingDirectory(std::string path)
}
}
void Rtabmap::deleteLocation(int locationId)
{
if(_memory)
+1 -1
View File
@@ -95,7 +95,7 @@ void TreeOptimizer3::iterate(TreePoseGraph3::EdgeSet* eset, bool noPreconditione
maxRotationalErrors.push_back(mre);
int interval=3;
if ((int)maxRotationalErrors.size()>=interval){
uint s=maxRotationalErrors.size();
uint s=(uint)maxRotationalErrors.size();
double re0 = maxRotationalErrors[s-interval];
double re1 = maxRotationalErrors[s-1];
+2 -2
View File
@@ -129,8 +129,8 @@ void DataRecorder::addData(const rtabmap::SensorData & data)
UTimer time;
memory_->update(data);
const Signature * s = memory_->getLastWorkingSignature();
totalSizeKB_ += s->getImageCompressed().total()/1000;
totalSizeKB_ += s->getDepthCompressed().total()/1000;
totalSizeKB_ += (int)s->getImageCompressed().total()/1000;
totalSizeKB_ += (int)s->getDepthCompressed().total()/1000;
memory_->cleanup();
if(++count_ % 30)
+1 -1
View File
@@ -23,7 +23,7 @@ INCLUDE_DIRECTORIES(${INCLUDE_DIRS})
ADD_LIBRARY(rtabmap_utilite ${SRC_FILES})
IF(MINGW)
TARGET_LINK_LIBRARIES(rtabmap_utilite ${PTHREADS_LIBRARY} "-lpsapi")
ELSEIF(WIN32)
ELSEIF(WIN32 OR MSVC)
FIND_LIBRARY(PSAPI_LIBRARIES NAMES psapi libpsapi.dll.a libpsapi.a libpsapi.lib )
TARGET_LINK_LIBRARIES(rtabmap_utilite ${PSAPI_LIBRARIES})
ELSE()
+5 -1
View File
@@ -172,7 +172,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)
@@ -287,7 +287,11 @@ std::string uFormatv (const char *fmt, va_list args)
#endif
// Try to vsnprintf into our buffer.
#ifdef _MSC_VER
int needed = vsnprintf_s(buf, size, size, fmt, argsTmp);
#else
int needed = 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
+5 -5
View File
@@ -249,7 +249,7 @@ void UDirectory::rewind()
bool UDirectory::exists(const std::string & dirPath)
{
bool r = false;
#if WIN32
#ifdef _WIN32
#ifdef UNICODE
wchar_t * wDirPath = createWCharFromChar(dirPath.c_str());
DWORD dwAttrib = GetFileAttributes(wDirPath);
@@ -273,7 +273,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] == '\\')
@@ -333,7 +333,7 @@ std::string UDirectory::currentDir(bool trailingSeparator)
bool UDirectory::makeDir(const std::string & dirPath)
{
int status;
#if WIN32
#ifdef _WIN32
status = _mkdir(dirPath.c_str());
#else
status = mkdir(dirPath.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
@@ -344,7 +344,7 @@ bool UDirectory::makeDir(const std::string & dirPath)
bool UDirectory::removeDir(const std::string & dirPath)
{
int status;
#if WIN32
#ifdef _WIN32
status = _rmdir(dirPath.c_str());
#else
status = rmdir(dirPath.c_str());
@@ -355,7 +355,7 @@ bool UDirectory::removeDir(const std::string & dirPath)
std::string UDirectory::homeDir()
{
std::string path;
#if WIN32
#ifdef _WIN32
#ifdef UNICODE
wchar_t wProfilePath[250];
ExpandEnvironmentStrings(L"%userprofile%",wProfilePath,250);
+6 -6
View File
@@ -36,12 +36,12 @@ bool UFile::exists(const std::string &filePath)
long UFile::length(const std::string &filePath)
{
long fileSize = 0;
FILE* fp = 0;
long fileSize = 0;
FILE* fp = 0;
#ifdef _MSC_VER
fopen_s(&fp, filePath.c_str(), "rb");
#else
fp = fopen(filePath.c_str(), "rb");
fopen_s(&fp, filePath.c_str(), "rb");
#else
fp = fopen(filePath.c_str(), "rb");
#endif
if(fp == NULL)
{
@@ -70,7 +70,7 @@ 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] == '\\')
{
+1 -1
View File
@@ -90,7 +90,7 @@ void UThread::join(bool killFirst)
uSleep(1);
}
#if WIN32
#ifdef _WIN32
#if PRINT_DEBUG
UDEBUG("Thread %d joining %d", UThreadC<void>::Self(), threadId_);
#endif