зеркало из https://github.com/mozilla/pjs.git
Bug 504660 Make sEmptyBuffer non-const so EnsureMutable can safely use it for an empty string r=bsmedberg
This commit is contained in:
Родитель
fa6223397a
Коммит
c0e25d3e1d
|
@ -151,7 +151,7 @@ struct nsCharTraits<PRUnichar>
|
|||
typedef PRUint16 unsigned_char_type;
|
||||
typedef char incompatible_char_type;
|
||||
|
||||
NS_COM static const char_type *sEmptyBuffer;
|
||||
NS_COM static char_type *sEmptyBuffer;
|
||||
|
||||
static
|
||||
void
|
||||
|
@ -441,7 +441,7 @@ struct nsCharTraits<char>
|
|||
typedef unsigned char unsigned_char_type;
|
||||
typedef PRUnichar incompatible_char_type;
|
||||
|
||||
NS_COM static const char_type *sEmptyBuffer;
|
||||
NS_COM static char_type *sEmptyBuffer;
|
||||
|
||||
static
|
||||
void
|
||||
|
|
|
@ -560,11 +560,11 @@ class nsTXPIDLString_CharT : public nsTString_CharT
|
|||
public:
|
||||
|
||||
nsTXPIDLString_CharT()
|
||||
: string_type(const_cast<char_type*>(char_traits::sEmptyBuffer), 0, F_TERMINATED | F_VOIDED) {}
|
||||
: string_type(char_traits::sEmptyBuffer, 0, F_TERMINATED | F_VOIDED) {}
|
||||
|
||||
// copy-constructor required to avoid default
|
||||
nsTXPIDLString_CharT( const self_type& str )
|
||||
: string_type(const_cast<char_type*>(char_traits::sEmptyBuffer), 0, F_TERMINATED | F_VOIDED)
|
||||
: string_type(char_traits::sEmptyBuffer, 0, F_TERMINATED | F_VOIDED)
|
||||
{
|
||||
Assign(str);
|
||||
}
|
||||
|
|
|
@ -54,10 +54,10 @@
|
|||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
static const PRUnichar gNullChar = 0;
|
||||
static PRUnichar gNullChar = 0;
|
||||
|
||||
const char* nsCharTraits<char> ::sEmptyBuffer = (const char*) &gNullChar;
|
||||
const PRUnichar* nsCharTraits<PRUnichar>::sEmptyBuffer = &gNullChar;
|
||||
char* nsCharTraits<char> ::sEmptyBuffer = (char*) &gNullChar;
|
||||
PRUnichar* nsCharTraits<PRUnichar>::sEmptyBuffer = &gNullChar;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ nsTSubstring_CharT::nsTSubstring_CharT(const substring_tuple_type& tuple)
|
|||
}
|
||||
|
||||
nsTSubstring_CharT::nsTSubstring_CharT()
|
||||
: mData(const_cast<char_type*>(char_traits::sEmptyBuffer)),
|
||||
: mData(char_traits::sEmptyBuffer),
|
||||
mLength(0),
|
||||
mFlags(F_TERMINATED) {}
|
||||
|
||||
|
@ -563,7 +563,7 @@ nsTSubstring_CharT::SetCapacity( size_type capacity )
|
|||
if (capacity == 0)
|
||||
{
|
||||
::ReleaseData(mData, mFlags);
|
||||
mData = const_cast<char_type*>(char_traits::sEmptyBuffer);
|
||||
mData = char_traits::sEmptyBuffer;
|
||||
mLength = 0;
|
||||
SetDataFlags(F_TERMINATED);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче