VirtualBox

Changeset 66101 in vbox


Ignore:
Timestamp:
Mar 14, 2017 7:15:16 PM (8 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
113980
Message:

SharedFolders: Some adjustments necessary for flexible array syntax in SHFLSTRING.

File:
1 edited

Legend:

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

    r66088 r66101  
    165165    union
    166166    {
     167#if 1
    167168        uint8_t  utf8[1];
    168         uint16_t ucs2[1];
     169        RTUTF16  utf16[1];
     170        uint16_t ucs2[1];                                 /**< misnomer, use utf16. */
     171#else
     172        uint8_t  utf8[RT_FLEXIBLE_ARRAY_IN_NESTED_UNION];
     173        RTUTF16  utf16[RT_FLEXIBLE_ARRAY_IN_NESTED_UNION];
     174        RTUTF16  ucs2[RT_FLEXIBLE_ARRAY_IN_NESTED_UNION]; /**< misnomer, use utf16. */
     175#endif
    169176    } String;
    170177} SHFLSTRING;
     178AssertCompileSize(RTUTF16, 2);
    171179AssertCompileSize(SHFLSTRING, 6);
    172 
    173 #define SHFLSTRING_HEADER_SIZE RT_UOFFSETOF(SHFLSTRING, String)
     180AssertCompileMemberOffset(SHFLSTRING, String, 4);
     181/** The size of SHFLSTRING w/o the string part. */
     182#define SHFLSTRING_HEADER_SIZE  4
     183AssertCompileMemberOffset(SHFLSTRING, String, SHFLSTRING_HEADER_SIZE);
    174184
    175185/** Pointer to a shared folder string buffer. */
     
    181191DECLINLINE(uint32_t) ShflStringSizeOfBuffer(PCSHFLSTRING pString)
    182192{
    183     return pString ? (uint32_t)(sizeof(SHFLSTRING) - sizeof(pString->String) + pString->u16Size) : 0;
     193    return pString ? (uint32_t)(SHFLSTRING_HEADER_SIZE + pString->u16Size) : 0;
    184194}
    185195
Note: See TracChangeset for help on using the changeset viewer.

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