VirtualBox

Changeset 98217 in vbox for trunk/include


Ignore:
Timestamp:
Jan 22, 2023 11:01:16 PM (2 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
155406
Message:

VMMDevCoreTypes.h: Follow up to r155045 (Made HGCMFunctionParameter.GetUInt32/64 return VERR_WRONG_PARAMETER_TYPE instead of VERR_INVALID_PARAMETER (a tiny bit risky)) applying it to the two other copies of the stupid code.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/VMMDevCoreTypes.h

    r98103 r98217  
    336336    int GetUInt32(uint32_t RT_FAR *pu32)
    337337    {
    338         if (type == VMMDevHGCMParmType_32bit)
    339         {
    340             *pu32 = u.value32;
    341             return VINF_SUCCESS;
    342         }
    343         return VERR_INVALID_PARAMETER;
     338        AssertMsgReturnStmt(type == VMMDevHGCMParmType_32bit, ("type=%d\n", type),
     339                            *pu32 = UINT32_MAX /* shut up gcc */, VERR_WRONG_PARAMETER_TYPE);
     340        *pu32 = u.value32;
     341        return VINF_SUCCESS;
    344342    }
    345343
     
    352350    int GetUInt64(uint64_t RT_FAR *pu64)
    353351    {
    354         if (type == VMMDevHGCMParmType_64bit)
    355         {
    356             *pu64 = u.value64;
    357             return VINF_SUCCESS;
    358         }
    359         return VERR_INVALID_PARAMETER;
     352        AssertMsgReturnStmt(type == VMMDevHGCMParmType_64bit, ("type=%d\n", type),
     353                            *pu64 = UINT64_MAX /* shut up gcc */, VERR_WRONG_PARAMETER_TYPE);
     354        *pu64 = u.value64;
     355        return VINF_SUCCESS;
    360356    }
    361357
     
    420416    int GetUInt32(uint32_t RT_FAR *pu32)
    421417    {
    422         if (type == VMMDevHGCMParmType_32bit)
    423         {
    424             *pu32 = u.value32;
    425             return VINF_SUCCESS;
    426         }
    427         return VERR_INVALID_PARAMETER;
     418        AssertMsgReturnStmt(type == VMMDevHGCMParmType_32bit, ("type=%d\n", type),
     419                            *pu32 = UINT32_MAX /* shut up gcc */, VERR_WRONG_PARAMETER_TYPE);
     420        *pu32 = u.value32;
     421        return VINF_SUCCESS;
    428422    }
    429423
     
    436430    int GetUInt64(uint64_t RT_FAR *pu64)
    437431    {
    438         if (type == VMMDevHGCMParmType_64bit)
    439         {
    440             *pu64 = u.value64;
    441             return VINF_SUCCESS;
    442         }
    443         return VERR_INVALID_PARAMETER;
     432        AssertMsgReturnStmt(type == VMMDevHGCMParmType_64bit, ("type=%d\n", type),
     433                            *pu64 = UINT64_MAX /* shut up gcc */, VERR_WRONG_PARAMETER_TYPE);
     434        *pu64 = u.value64;
     435        return VINF_SUCCESS;
    444436    }
    445437
     
    519511    int GetUInt32(uint32_t *pu32)
    520512    {
    521         AssertMsgReturnStmt(type == VMMDevHGCMParmType_32bit, ("type=-%d\n", type),
     513        AssertMsgReturnStmt(type == VMMDevHGCMParmType_32bit, ("type=%d\n", type),
    522514                            *pu32 = UINT32_MAX /* shut up gcc */, VERR_WRONG_PARAMETER_TYPE)
    523515        *pu32 = u.value32;
     
    534526    {
    535527        AssertMsgReturnStmt(type == VMMDevHGCMParmType_64bit, ("type=%d\n", type),
    536                             *pu64 = UINT32_MAX /* shut up gcc */, VERR_WRONG_PARAMETER_TYPE);
     528                            *pu64 = UINT64_MAX /* shut up gcc */, VERR_WRONG_PARAMETER_TYPE);
    537529        *pu64 = u.value64;
    538530        return VINF_SUCCESS;
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