VirtualBox

Ignore:
Timestamp:
Dec 5, 2014 2:43:21 PM (10 years ago)
Author:
vboxsync
Message:

Additions/common/VBoxGuestLib: fix mode hint backwards compatibility.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibVideo.cpp

    r53454 r53463  
    383383    {
    384384        rc = VbglR3GuestPropWriteValue(u32ClientId, szModeName, szModeParms);
    385         if (cScreen == 0)  /* Write out the mode using the legacy name too, in
    386                             * case the user installs older Additions. */
     385        /* Write out the mode using the legacy name too, in case the user
     386         * re-installs older Additions. */
     387        if (cScreen == 0)
     388        {
     389            RTStrPrintf(szModeParms, sizeof(szModeParms), "%ux%ux%u", cx, cy,
     390                        cBits);
    387391            VbglR3GuestPropWriteValue(u32ClientId, VIDEO_PROP_PREFIX"SavedMode",
    388392                                      szModeParms);
     393        }
    389394    }
    390395    if (u32ClientId != 0)
     
    447452    uint32_t u32ClientId = 0;
    448453    int cMatches;
    449     unsigned cx, cy, cBits, x, y, fEnabled;
    450     int rc, rc2 = VERR_UNRESOLVED_ERROR;
     454    unsigned cx, cy, cBits;
     455    unsigned x = 0;
     456    unsigned y = 0;
     457    unsigned fEnabled = 1;
     458    int rc;
     459    int rc2 = VERR_UNRESOLVED_ERROR;
    451460
    452461    /** @todo add a VbglR3GuestPropReadValueF/FV that does the RTStrPrintf for you. */
     
    457466        rc = VbglR3GuestPropReadValue(u32ClientId, szModeName, szModeParms,
    458467                                      sizeof(szModeParms), NULL);
    459         if (rc == VERR_NOT_FOUND)  /* Try legacy single screen name. */
     468        /* Try legacy single screen name. */
     469        if (rc == VERR_NOT_FOUND && cScreen == 0)
    460470            rc = VbglR3GuestPropReadValue(u32ClientId,
    461471                                          VIDEO_PROP_PREFIX"SavedMode",
     
    473483    if (RT_SUCCESS(rc))
    474484    {
    475         cMatches = sscanf(szModeParms, "%ux%ux%u,%ux%u,%u\n", &cx, &cy, &cBits,
    476                           &x, &y, &fEnabled);
    477         if (cMatches == 6)
     485        char c1, c2;
     486        cMatches = sscanf(szModeParms, "%ux%ux%u%c%ux%u,%u%c", &cx, &cy, &cBits,
     487                          &c1, &x, &y, &fEnabled, &c2);
     488        if ((cMatches == 7 && c1 == ',') || cMatches == 3)
    478489            rc = VINF_SUCCESS;
    479490        else if (cMatches < 0)
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