Changeset 25963 in vbox
- Timestamp:
- Jan 22, 2010 12:17:32 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/VHDHDDCore.cpp
r24527 r25963 113 113 uint32_t ParentTimeStamp; 114 114 uint32_t Reserved0; 115 uint 8_t ParentUnicodeName[512];115 uint16_t ParentUnicodeName[256]; 116 116 VHDPLE ParentLocatorEntry[VHD_MAX_LOCATOR_ENTRIES]; 117 117 uint8_t Reserved1[256]; … … 401 401 } 402 402 403 static int vhdFilenameToUtf16(const char *pszFilename, void *pvBuf, uint32_t cbBufSize, uint32_t *pcbActualSize)403 static int vhdFilenameToUtf16(const char *pszFilename, uint16_t *pu16Buf, uint32_t cbBufSize, uint32_t *pcbActualSize, bool fBigEndian) 404 404 { 405 405 int rc; … … 416 416 goto out; 417 417 } 418 memcpy(pvBuf, tmp16, cTmp16Len * sizeof(*tmp16)); 418 419 if (fBigEndian) 420 for (unsigned i = 0; i < cTmp16Len; i++) 421 pu16Buf[i] = RT_H2BE_U16(tmp16[i]); 422 else 423 memcpy(pu16Buf, tmp16, cTmp16Len * sizeof(*tmp16)); 419 424 if (pcbActualSize) 420 425 *pcbActualSize = (uint32_t)(cTmp16Len * sizeof(*tmp16)); … … 464 469 case VHD_PLATFORM_CODE_W2RU: 465 470 /* Update unicode relative name. */ 466 rc = vhdFilenameToUtf16(pszFilename, pvBuf, cbMaxLen, &cb);471 rc = vhdFilenameToUtf16(pszFilename, (uint16_t *)pvBuf, cbMaxLen, &cb, false); 467 472 if (RT_FAILURE(rc)) 468 473 goto out; … … 483 488 goto out; 484 489 } 485 rc = vhdFilenameToUtf16(pszTmp, pvBuf, cbMaxLen, &cb);490 rc = vhdFilenameToUtf16(pszTmp, (uint16_t *)pvBuf, cbMaxLen, &cb, false); 486 491 RTMemTmpFree(pszTmp); 487 492 if (RT_FAILURE(rc)) … … 530 535 { 531 536 rc = vhdFilenameToUtf16(RTPathFilename(pImage->pszParentFilename), 532 ddh.ParentUnicodeName, sizeof(ddh.ParentUnicodeName) - 1, NULL );537 ddh.ParentUnicodeName, sizeof(ddh.ParentUnicodeName) - 1, NULL, true); 533 538 if (RT_FAILURE(rc)) 534 539 return rc; … … 1885 1890 1886 1891 Footer.DataOffset = RT_H2BE_U64(pImage->u64DataOffset); 1887 pImage->vhdFooterCopy = Footer;1888 1892 1889 1893 /* Compute and update the footer checksum. */ 1890 1894 Footer.Checksum = 0; 1891 1895 Footer.Checksum = RT_H2BE_U32(vhdChecksum(&Footer, sizeof(Footer))); 1896 1897 pImage->vhdFooterCopy = Footer; 1892 1898 1893 1899 /* Store the footer */
Note:
See TracChangeset
for help on using the changeset viewer.