VirtualBox

Changeset 72904 in vbox for trunk/include/VBox


Ignore:
Timestamp:
Jul 4, 2018 9:52:10 PM (7 years ago)
Author:
vboxsync
Message:

com::Guid: fix circular logic in isZero()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/com/Guid.h

    r72894 r72904  
    8181    Guid(const RTUUID &that)
    8282    {
    83         mGuidState = GUID_NORMAL;
    8483        mUuid = that;
    85         if (isZero())
    86             mGuidState = GUID_ZERO;
     84        updateState();
    8785        dbg_refresh();
    8886    }
     
    9290        AssertCompileSize(GUID, sizeof(RTUUID));
    9391        ::memcpy(&mUuid, &that, sizeof(GUID));
    94         mGuidState = GUID_NORMAL;
    95         if (isZero())
    96             mGuidState = GUID_ZERO;
     92        updateState();
    9793        dbg_refresh();
    9894    }
     
    176172    {
    177173        mUuid = guid;
    178         mGuidState = GUID_NORMAL;
    179         if (isZero())
    180             mGuidState = GUID_ZERO;
     174        updateState();
    181175        dbg_refresh();
    182176        return *this;
     
    187181        AssertCompileSize(GUID, sizeof(RTUUID));
    188182        ::memcpy(&mUuid, &guid, sizeof(GUID));
    189         mGuidState = GUID_NORMAL;
    190         if (isZero())
    191             mGuidState = GUID_ZERO;
     183        updateState();
    192184        dbg_refresh();
    193185        return *this;
     
    409401
    410402private:
     403    void updateState()
     404    {
     405        if (::RTUuidIsNull(&mUuid))
     406            mGuidState = GUID_ZERO;
     407        else
     408            mGuidState = GUID_NORMAL;
     409    }
     410
    411411    void initString(const char *that)
    412412    {
     
    418418        else
    419419        {
    420             mGuidState = GUID_NORMAL;
    421420            int rc = ::RTUuidFromStr(&mUuid, that);
    422421            if (RT_FAILURE(rc))
     
    425424                mGuidState = GUID_INVALID;
    426425            }
    427             else if (isZero())
    428                 mGuidState = GUID_ZERO;
     426            else
     427                updateState();
    429428        }
    430429        dbg_refresh();
     
    440439        else
    441440        {
    442             mGuidState = GUID_NORMAL;
    443441            int rc = ::RTUuidFromUtf16(&mUuid, that);
    444442            if (RT_FAILURE(rc))
     
    447445                mGuidState = GUID_INVALID;
    448446            }
    449             else if (isZero())
    450                 mGuidState = GUID_ZERO;
     447            else
     448                updateState();
    451449        }
    452450        dbg_refresh();
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette