Author: anevilyak Date: 2011-11-02 10:19:24 +0100 (Wed, 02 Nov 2011) New Revision: 43100 Changeset: https://dev.haiku-os.org/changeset/43100 Modified: haiku/trunk/headers/private/shared/Variant.h haiku/trunk/src/kits/shared/Variant.cpp Log: Make rect data part of union as suggested by Ingo. Modified: haiku/trunk/headers/private/shared/Variant.h =================================================================== --- haiku/trunk/headers/private/shared/Variant.h 2011-11-02 09:17:38 UTC (rev 43099) +++ haiku/trunk/headers/private/shared/Variant.h 2011-11-02 09:19:24 UTC (rev 43100) @@ -159,13 +159,14 @@ void* fPointer; char* fString; BReferenceable* fReferenceable; - uint8 fBytes[8]; + struct { + float left; + float top; + float right; + float bottom; + } fRect; + uint8 fBytes[sizeof(float) * 4]; }; - - float fLeft; - float fTop; - float fRight; - float fBottom; }; Modified: haiku/trunk/src/kits/shared/Variant.cpp =================================================================== --- haiku/trunk/src/kits/shared/Variant.cpp 2011-11-02 09:17:38 UTC (rev 43099) +++ haiku/trunk/src/kits/shared/Variant.cpp 2011-11-02 09:19:24 UTC (rev 43100) @@ -177,8 +177,9 @@ return fString == other.fString; return strcmp(fString, other.fString) == 0; case B_RECT_TYPE: - return BRect(fLeft, fTop, fRight, fBottom) == BRect( - other.fLeft, other.fTop, other.fRight, other.fBottom); + return BRect(fRect.left, fRect.top, fRect.right, fRect.bottom) + == BRect(other.fRect.left, other.fRect.top, other.fRect.right, + other.fRect.bottom); default: return false; } @@ -316,7 +317,7 @@ BRect BVariant::ToRect() const { - return BRect(fLeft, fTop, fRight, fBottom); + return BRect(fRect.left, fRect.top, fRect.right, fRect.bottom); } @@ -405,8 +406,8 @@ case B_STRING_TYPE: return message.AddString(fieldName, fString); case B_RECT_TYPE: - return message.AddRect(fieldName, BRect(fLeft, fTop, fRight, - fBottom)); + return message.AddRect(fieldName, BRect(fRect.left, fRect.top, + fRect.right, fRect.bottom)); default: return B_UNSUPPORTED; } @@ -633,10 +634,10 @@ { fType = B_RECT_TYPE; fFlags = 0; - fLeft = left; - fTop = top; - fRight = right; - fBottom = bottom; + fRect.left = left; + fRect.top = top; + fRect.right = right; + fRect.bottom = bottom; }