mirror of
https://github.com/introlab/rtabmap_ros.git
synced 2026-10-12 20:49:50 +08:00
fixed issue #30
This commit is contained in:
@@ -19,6 +19,8 @@
|
|||||||
|
|
||||||
#include "rtabmap/utilite/UVariant.h"
|
#include "rtabmap/utilite/UVariant.h"
|
||||||
#include "rtabmap/utilite/UConversion.h"
|
#include "rtabmap/utilite/UConversion.h"
|
||||||
|
#include <limits>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
UVariant::UVariant() :
|
UVariant::UVariant() :
|
||||||
type_(kUndef)
|
type_(kUndef)
|
||||||
@@ -171,7 +173,7 @@ char UVariant::toChar(bool * ok) const
|
|||||||
else if(type_ == kUInt)
|
else if(type_ == kUInt)
|
||||||
{
|
{
|
||||||
unsigned int tmp = toUInt();
|
unsigned int tmp = toUInt();
|
||||||
if(tmp <= std::numeric_limits<char>::max())
|
if(tmp <= (unsigned int)std::numeric_limits<char>::max())
|
||||||
{
|
{
|
||||||
v = (char)tmp;
|
v = (char)tmp;
|
||||||
if(ok)
|
if(ok)
|
||||||
@@ -317,7 +319,7 @@ short UVariant::toShort(bool * ok) const
|
|||||||
else if(type_ == kUInt)
|
else if(type_ == kUInt)
|
||||||
{
|
{
|
||||||
unsigned int tmp = toUInt();
|
unsigned int tmp = toUInt();
|
||||||
if(tmp <= std::numeric_limits<short>::max())
|
if(tmp <= (unsigned int)std::numeric_limits<short>::max())
|
||||||
{
|
{
|
||||||
v = (short)tmp;
|
v = (short)tmp;
|
||||||
if(ok)
|
if(ok)
|
||||||
@@ -451,7 +453,7 @@ int UVariant::toInt(bool * ok) const
|
|||||||
else if(type_ == kUInt)
|
else if(type_ == kUInt)
|
||||||
{
|
{
|
||||||
unsigned int tmp = toUInt();
|
unsigned int tmp = toUInt();
|
||||||
if(tmp <= std::numeric_limits<int>::max())
|
if(tmp <= (unsigned int)std::numeric_limits<int>::max())
|
||||||
{
|
{
|
||||||
v = (int)tmp;
|
v = (int)tmp;
|
||||||
if(ok)
|
if(ok)
|
||||||
|
|||||||
Reference in New Issue
Block a user