Bug 656607 - Let the compiler do the pointer arithmetic, instead of manually performing it; r=sicking

This commit is contained in:
Ehsan Akhgari 2011-06-08 22:02:49 -04:00
parent 98194a2e93
commit 53103940ec

View File

@ -106,7 +106,7 @@ class nsStringBuffer
*/
static nsStringBuffer* FromData(void* data)
{
return (nsStringBuffer*) ( ((char*) data) - sizeof(nsStringBuffer) );
return reinterpret_cast<nsStringBuffer*> (data) - 1;
}
/**
@ -114,7 +114,7 @@ class nsStringBuffer
*/
void* Data() const
{
return (void*) ( ((char*) this) + sizeof(nsStringBuffer) );
return const_cast<char*> (reinterpret_cast<const char*> (this + 1));
}
/**