Changeset 95797 in vbox
- Timestamp:
- Jul 25, 2022 12:21:58 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxGuest/lib/VBoxGuestR3LibVideo.cpp
r93115 r95797 36 36 #include <iprt/mem.h> 37 37 #include <iprt/string.h> 38 39 #include <stdio.h>40 38 41 39 #ifdef VBOX_VBGLR3_XFREE86 … … 50 48 #endif /* VBOX_VBGLR3_XFREE86 */ 51 49 50 51 /********************************************************************************************************************************* 52 * Defined Constants And Macros * 53 *********************************************************************************************************************************/ 52 54 #define VIDEO_PROP_PREFIX "/VirtualBox/GuestAdd/Vbgl/Video/" 55 53 56 54 57 /** … … 538 541 if (RT_SUCCESS(rc)) 539 542 { 540 unsigned cx = 0; 541 unsigned cy = 0; 542 unsigned cBits = 0; 543 unsigned x = 0; 544 unsigned y = 0; 545 unsigned fEnabled = 1; 546 char ch1 = 0; 547 char ch2 = 0; 548 int cMatches = sscanf(szModeParms, "%5ux%5ux%2u%c%5ux%5u,%1u%c", &cx, &cy, &cBits, &ch1, &x, &y, &fEnabled, &ch2); 549 if ( (cMatches == 7 && ch1 == ',') 550 || cMatches == 3) 543 /* Mandatory chunk: 640x480x32 */ 544 char *pszNext; 545 uint32_t cx = 0; 546 rc = VERR_PARSE_ERROR; 547 rc2 = RTStrToUInt32Ex(szModeParms, &pszNext, 10, &cx); 548 if (rc2 == VWRN_TRAILING_CHARS && *pszNext == 'x') 551 549 { 552 if (pcx) 553 *pcx = cx; 554 if (pcy) 555 *pcy = cy; 556 if (pcBits) 557 *pcBits = cBits; 558 if (px) 559 *px = x; 560 if (py) 561 *py = y; 562 if (pfEnabled) 563 *pfEnabled = RT_BOOL(fEnabled); 564 rc = VINF_SUCCESS; 550 uint32_t cy = 0; 551 rc2 = RTStrToUInt32Ex(pszNext + 1, &pszNext, 10, &cy); 552 if (rc2 == VWRN_TRAILING_CHARS && *pszNext == 'x') 553 { 554 uint8_t cBits = 0; 555 rc2 = RTStrToUInt8Ex(pszNext + 1, &pszNext, 10, &cBits); 556 if (rc2 == VINF_SUCCESS || rc2 == VWRN_TRAILING_CHARS) 557 { 558 /* Optional chunk: ,32x64,1 (we fail if this is partially there) */ 559 uint32_t x = 0; 560 uint32_t y = 0; 561 uint8_t fEnabled = 1; 562 if (rc2 == VINF_SUCCESS) 563 rc = VINF_SUCCESS; 564 else if (*pszNext == ',') 565 { 566 rc2 = RTStrToUInt32Ex(pszNext + 1, &pszNext, 10, &x); 567 if (rc2 == VWRN_TRAILING_CHARS && *pszNext == 'x') 568 { 569 rc2 = RTStrToUInt32Ex(pszNext + 1, &pszNext, 10, &y); 570 if (rc2 == VWRN_TRAILING_CHARS && *pszNext == ',') 571 { 572 rc2 = RTStrToUInt8Ex(pszNext + 1, &pszNext, 10, &fEnabled); 573 if (rc2 == VINF_SUCCESS) 574 rc = VINF_SUCCESS; 575 } 576 } 577 } 578 579 /* 580 * Set result if successful. 581 */ 582 if (rc == VINF_SUCCESS) 583 { 584 if (pcx) 585 *pcx = cx; 586 if (pcy) 587 *pcy = cy; 588 if (pcBits) 589 *pcBits = cBits; 590 if (px) 591 *px = x; 592 if (py) 593 *py = y; 594 if (pfEnabled) 595 *pfEnabled = RT_BOOL(fEnabled); 596 } 597 } 598 } 565 599 } 566 else if (cMatches < 0)567 rc = VERR_READ_ERROR;568 else569 rc = VERR_PARSE_ERROR;570 600 } 571 601 }
Note:
See TracChangeset
for help on using the changeset viewer.