Bug 1091594 - Added explicit integer casts to char16ptr_t. r=jmathies

--HG--
extra : rebase_source : b351ddfcd263c8dfee436f00ab8a917d8bfc36e2
This commit is contained in:
Jacek Caban 2014-11-03 14:09:48 +01:00
parent 12d083ae32
commit 9117e49fc5

View File

@ -105,6 +105,30 @@ public:
{
return const_cast<wchar_t*>(static_cast<const wchar_t*>(*this));
}
explicit operator int() const
{
return reinterpret_cast<intptr_t>(mPtr);
}
explicit operator unsigned int() const
{
return reinterpret_cast<uintptr_t>(mPtr);
}
explicit operator long() const
{
return reinterpret_cast<intptr_t>(mPtr);
}
explicit operator unsigned long() const
{
return reinterpret_cast<uintptr_t>(mPtr);
}
explicit operator long long() const
{
return reinterpret_cast<intptr_t>(mPtr);
}
explicit operator unsigned long long() const
{
return reinterpret_cast<uintptr_t>(mPtr);
}
/**
* Some Windows API calls accept BYTE* but require that data actually be
@ -150,7 +174,27 @@ public:
{
return mPtr != nullptr;
}
char16ptr_t operator+(size_t aValue) const
char16ptr_t operator+(int aValue) const
{
return char16ptr_t(mPtr + aValue);
}
char16ptr_t operator+(unsigned int aValue) const
{
return char16ptr_t(mPtr + aValue);
}
char16ptr_t operator+(long aValue) const
{
return char16ptr_t(mPtr + aValue);
}
char16ptr_t operator+(unsigned long aValue) const
{
return char16ptr_t(mPtr + aValue);
}
char16ptr_t operator+(long long aValue) const
{
return char16ptr_t(mPtr + aValue);
}
char16ptr_t operator+(unsigned long long aValue) const
{
return char16ptr_t(mPtr + aValue);
}