Changeset 77734 in vbox for trunk/src/VBox/Runtime
- Timestamp:
- Mar 16, 2019 3:53:06 AM (6 years ago)
- Location:
- trunk/src/VBox/Runtime/common/fs
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/fs/isomaker.cpp
r77733 r77734 705 705 *********************************************************************************************************************************/ 706 706 static int rtFsIsoMakerObjSetName(PRTFSISOMAKERINT pThis, PRTFSISOMAKERNAMESPACE pNamespace, PRTFSISOMAKEROBJ pObj, 707 PRTFSISOMAKERNAME pParent, const char *pchSpec, size_t cchSpec, PPRTFSISOMAKERNAME ppNewName); 707 PRTFSISOMAKERNAME pParent, const char *pchSpec, size_t cchSpec, bool fNoNormalize, 708 PPRTFSISOMAKERNAME ppNewName); 708 709 static int rtFsIsoMakerObjUnsetName(PRTFSISOMAKERINT pThis, PRTFSISOMAKERNAMESPACE pNamespace, PRTFSISOMAKEROBJ pObj); 709 710 static int rtFsIsoMakerAddUnnamedDirWorker(PRTFSISOMAKERINT pThis, PCRTFSOBJINFO pObjInfo, PRTFSISOMAKERDIR *ppDir); … … 1879 1880 * 1880 1881 * @returns IPRT status code. 1881 * @param pThis The ISO maker instance. 1882 * @param pParent The parent directory. NULL if root. 1883 * @param pchSrc The specified name to normalize (not necessarily zero 1884 * terminated). 1885 * @param cchSrc The length of the specified name. 1886 * @param fIsDir Indicates whether it's a directory or file (like). 1887 * @param pszDst The output buffer. Must be at least 32 bytes. 1888 * @param cbDst The size of the output buffer. 1889 * @param pcchDst Where to return the length of the returned string (i.e. 1890 * not counting the terminator). 1891 * @param pcbInDirRec Where to return the name size in the directory record. 1882 * @param pThis The ISO maker instance. 1883 * @param pParent The parent directory. NULL if root. 1884 * @param pchSrc The specified name to normalize (not necessarily zero 1885 * terminated). 1886 * @param cchSrc The length of the specified name. 1887 * @param fNoNormalize Don't normalize the name very strictly (imported or 1888 * such). 1889 * @param fIsDir Indicates whether it's a directory or file (like). 1890 * @param pszDst The output buffer. Must be at least 32 bytes. 1891 * @param cbDst The size of the output buffer. 1892 * @param pcchDst Where to return the length of the returned string (i.e. 1893 * not counting the terminator). 1894 * @param pcbInDirRec Where to return the name size in the directory record. 1892 1895 */ 1893 1896 static int rtFsIsoMakerNormalizeNameForPrimaryIso9660(PRTFSISOMAKERINT pThis, PRTFSISOMAKERNAME pParent, 1894 const char *pchSrc, size_t cchSrc, bool f IsDir,1897 const char *pchSrc, size_t cchSrc, bool fNoNormalize, bool fIsDir, 1895 1898 char *pszDst, size_t cbDst, size_t *pcchDst, size_t *pcbInDirRec) 1896 1899 { … … 1909 1912 * Produce a first name. 1910 1913 */ 1911 uint8_t const uIsoLevel = pThis->PrimaryIso.uLevel;1914 uint8_t const uIsoLevel = !fNoNormalize ? pThis->PrimaryIso.uLevel : RT_MAX(pThis->PrimaryIso.uLevel, 3); 1912 1915 size_t cchDst; 1913 1916 size_t offDstDot; 1914 if (fIsDir )1917 if (fIsDir && !fNoNormalize) 1915 1918 offDstDot = cchDst = rtFsIsoMakerCopyIso9660Name(pszDst, uIsoLevel >= 2 ? ISO9660_MAX_NAME_LEN : 8, 1916 1919 pchSrc, cchSrc); … … 1923 1926 offLastDot = off; 1924 1927 1925 if (offLastDot == cchSrc) 1928 if (fNoNormalize) 1929 { 1930 /* Try preserve the imported name, though, put the foot down if too long. */ 1931 offDstDot = offLastDot; 1932 cchDst = cchSrc; 1933 if (cchSrc > ISO9660_MAX_NAME_LEN) 1934 { 1935 cchDst = ISO9660_MAX_NAME_LEN; 1936 if (offDstDot > cchDst) 1937 offDstDot = cchDst; 1938 } 1939 memcpy(pszDst, pchSrc, cchDst); 1940 pszDst[cchDst] = '\0'; 1941 } 1942 else if (offLastDot == cchSrc) 1926 1943 offDstDot = cchDst = rtFsIsoMakerCopyIso9660Name(pszDst, uIsoLevel >= 2 ? ISO9660_MAX_NAME_LEN : 8, 1927 1944 pchSrc, cchSrc); … … 2019 2036 * 2020 2037 * @returns IPRT status code. 2021 * @param pThis The ISO maker instance. 2022 * @param pNamespace The namespace which rules to normalize it according to. 2023 * @param pParent The parent directory. NULL if root. 2024 * @param pchSrc The specified name to normalize (not necessarily zero 2025 * terminated). 2026 * @param cchSrc The length of the specified name. 2027 * @param fIsDir Indicates whether it's a directory or file (like). 2028 * @param pszDst The output buffer. Must be at least 32 bytes. 2029 * @param cbDst The size of the output buffer. 2030 * @param pcchDst Where to return the length of the returned string (i.e. 2031 * not counting the terminator). 2032 * @param pcbInDirRec Where to return the name size in the directory record. 2038 * @param pThis The ISO maker instance. 2039 * @param pNamespace The namespace which rules to normalize it according to. 2040 * @param pParent The parent directory. NULL if root. 2041 * @param pchSrc The specified name to normalize (not necessarily zero 2042 * terminated). 2043 * @param cchSrc The length of the specified name. 2044 * @param fIsDir Indicates whether it's a directory or file (like). 2045 * @param fNoNormalize Don't normalize the name very strictly (imported or 2046 * such). 2047 * @param pszDst The output buffer. Must be at least 32 bytes. 2048 * @param cbDst The size of the output buffer. 2049 * @param pcchDst Where to return the length of the returned string (i.e. 2050 * not counting the terminator). 2051 * @param pcbInDirRec Where to return the name size in the directory record. 2033 2052 */ 2034 2053 static int rtFsIsoMakerNormalizeNameForNamespace(PRTFSISOMAKERINT pThis, PRTFSISOMAKERNAMESPACE pNamespace, 2035 PRTFSISOMAKERNAME pParent, const char *pchSrc, size_t cchSrc, bool fIsDir, 2054 PRTFSISOMAKERNAME pParent, const char *pchSrc, size_t cchSrc, 2055 bool fNoNormalize, bool fIsDir, 2036 2056 char *pszDst, size_t cbDst, size_t *pcchDst, size_t *pcbInDirRec) 2037 2057 { … … 2048 2068 */ 2049 2069 case RTFSISOMAKER_NAMESPACE_ISO_9660: 2050 return rtFsIsoMakerNormalizeNameForPrimaryIso9660(pThis, pParent, pchSrc, cchSrc, f IsDir,2070 return rtFsIsoMakerNormalizeNameForPrimaryIso9660(pThis, pParent, pchSrc, cchSrc, fNoNormalize, fIsDir, 2051 2071 pszDst, cbDst, pcchDst, pcbInDirRec); 2052 2072 … … 2121 2141 */ 2122 2142 PRTFSISOMAKERNAME pTransTblNm; 2123 rc = rtFsIsoMakerObjSetName(pThis, pNamespace, &pFile->Core, pDirName, 2124 pNamespace->pszTransTbl, strlen(pNamespace->pszTransTbl), &pTransTblNm);2143 rc = rtFsIsoMakerObjSetName(pThis, pNamespace, &pFile->Core, pDirName, pNamespace->pszTransTbl, 2144 strlen(pNamespace->pszTransTbl), false /*fNoNormalize*/, &pTransTblNm); 2125 2145 if (RT_SUCCESS(rc)) 2126 2146 { … … 2147 2167 * 2148 2168 * @returns IPRT status code. 2149 * @param pThis The ISO maker instance. 2150 * @param pNamespace The namespace. 2151 * @param pObj The object to name. 2152 * @param pParent The parent namespace entry 2153 * @param pchSpec The specified name (not necessarily terminated). 2154 * @param cchSpec The specified name length. 2155 * @param ppNewName Where to return the name entry. Optional. 2169 * @param pThis The ISO maker instance. 2170 * @param pNamespace The namespace. 2171 * @param pObj The object to name. 2172 * @param pParent The parent namespace entry 2173 * @param pchSpec The specified name (not necessarily terminated). 2174 * @param cchSpec The specified name length. 2175 * @param fNoNormalize Don't normalize the name (imported or such). 2176 * @param ppNewName Where to return the name entry. Optional. 2156 2177 */ 2157 2178 static int rtFsIsoMakerObjSetName(PRTFSISOMAKERINT pThis, PRTFSISOMAKERNAMESPACE pNamespace, PRTFSISOMAKEROBJ pObj, 2158 PRTFSISOMAKERNAME pParent, const char *pchSpec, size_t cchSpec, PPRTFSISOMAKERNAME ppNewName) 2179 PRTFSISOMAKERNAME pParent, const char *pchSpec, size_t cchSpec, bool fNoNormalize, 2180 PPRTFSISOMAKERNAME ppNewName) 2159 2181 { 2160 2182 Assert(cchSpec < _32K); … … 2219 2241 size_t cbNameInDirRec = 0; 2220 2242 char szName[RTFSISOMAKER_MAX_NAME_BUF]; 2221 int rc = rtFsIsoMakerNormalizeNameForNamespace(pThis, pNamespace, pParent, pchSpec, cchSpec, 2243 int rc = rtFsIsoMakerNormalizeNameForNamespace(pThis, pNamespace, pParent, pchSpec, cchSpec, fNoNormalize, 2222 2244 pObj->enmType == RTFSISOMAKEROBJTYPE_DIR, 2223 2245 szName, sizeof(szName), &cchName, &cbNameInDirRec); … … 2376 2398 #endif 2377 2399 2378 rc = rtFsIsoMakerObjSetName(pThis, pNamespace, &pDir->Core, NULL /*pParent*/, "", 0, &pParent);2400 rc = rtFsIsoMakerObjSetName(pThis, pNamespace, &pDir->Core, NULL /*pParent*/, "", 0, false /*fNoNormalize*/, &pParent); 2379 2401 AssertRCReturn(rc, rc); 2380 2402 pParent = pNamespace->pRoot; … … 2451 2473 if (!*ppChildName) 2452 2474 { 2453 rc = rtFsIsoMakerObjSetName(pThis, pNamespace, &pChildObj->Core, pParent, pszPath, cchComponent, &pChild); 2475 rc = rtFsIsoMakerObjSetName(pThis, pNamespace, &pChildObj->Core, pParent, pszPath, cchComponent, 2476 false /*fNoNormalize*/, &pChild); 2454 2477 if (RT_FAILURE(rc)) 2455 2478 return rc; … … 2462 2485 rc = rtFsIsoMakerAddUnnamedDirWorker(pThis, NULL /*pObjInfo*/, &pChildObj); 2463 2486 if (RT_SUCCESS(rc)) 2464 rc = rtFsIsoMakerObjSetName(pThis, pNamespace, &pChildObj->Core, pParent, pszPath, cchComponent, &pChild); 2487 rc = rtFsIsoMakerObjSetName(pThis, pNamespace, &pChildObj->Core, pParent, pszPath, cchComponent, 2488 false /*fNoNormalize*/, &pChild); 2465 2489 if (RT_FAILURE(rc)) 2466 2490 return rc; … … 2524 2548 AssertReturn(!RTPATH_IS_SLASH(pszEntry[cchEntry]) || pObj->enmType == RTFSISOMAKEROBJTYPE_DIR, 2525 2549 VERR_NOT_A_DIRECTORY); 2526 rc = rtFsIsoMakerObjSetName(pThis, pNamespace, pObj, pParent, pszEntry, cchEntry, NULL);2550 rc = rtFsIsoMakerObjSetName(pThis, pNamespace, pObj, pParent, pszEntry, cchEntry, false /*fNoNormalize*/, NULL); 2527 2551 } 2528 2552 return rc; … … 2836 2860 * (RTFSISOMAKER_NAMESPACE_XXX). 2837 2861 * @param pszName The name. 2862 * @param fNoNormalize Don't normalize the name (imported or such). 2838 2863 */ 2839 2864 RTDECL(int) RTFsIsoMakerObjSetNameAndParent(RTFSISOMAKER hIsoMaker, uint32_t idxObj, uint32_t idxParentObj, 2840 uint32_t fNamespaces, const char *pszName )2865 uint32_t fNamespaces, const char *pszName, bool fNoNormalize) 2841 2866 { 2842 2867 /* … … 2870 2895 if (pParentName) 2871 2896 { 2872 int rc2 = rtFsIsoMakerObjSetName(pThis, pNamespace, pObj, pParentName, pszName, cchName, NULL /*ppNewName*/); 2897 int rc2 = rtFsIsoMakerObjSetName(pThis, pNamespace, pObj, pParentName, pszName, cchName, 2898 fNoNormalize, NULL /*ppNewName*/); 2873 2899 if (RT_SUCCESS(rc2)) 2874 2900 cAdded++; -
trunk/src/VBox/Runtime/common/fs/isomakercmd.cpp
r77732 r77734 1811 1811 pOpts->cItemsAdded++; 1812 1812 rc = RTFsIsoMakerObjSetNameAndParent(pOpts->hIsoMaker, idxObj, idxDirObj, fNamespaces, 1813 pDirEntry->szName );1813 pDirEntry->szName, false /*fNoNormalize*/); 1814 1814 if (RT_FAILURE(rc)) 1815 1815 rc = rtFsIsoMakerCmdErrorRc(pOpts, rc, "Error setting parent & name on file '%s' to '%s': %Rrc", … … 1831 1831 pOpts->cItemsAdded++; 1832 1832 rc = RTFsIsoMakerObjSetNameAndParent(pOpts->hIsoMaker, idxObj, idxDirObj, fNamespaces, 1833 pDirEntry->szName );1833 pDirEntry->szName, false /*fNoNormalize*/); 1834 1834 if (RT_SUCCESS(rc)) 1835 1835 /* Recurse into the sub-directory. */ -
trunk/src/VBox/Runtime/common/fs/isomakerimport.cpp
r76553 r77734 400 400 * Enter the object into the namespace. 401 401 */ 402 rc = RTFsIsoMakerObjSetNameAndParent(pThis->hIsoMaker, idxObj, idxParent, fNamespace, pszName );402 rc = RTFsIsoMakerObjSetNameAndParent(pThis->hIsoMaker, idxObj, idxParent, fNamespace, pszName, true /*fNoNormalize*/); 403 403 if (RT_SUCCESS(rc)) 404 404 { … … 454 454 * Enter the object into the namespace. 455 455 */ 456 rc = RTFsIsoMakerObjSetNameAndParent(pThis->hIsoMaker, idxObj, idxParent, fNamespace, pszName );456 rc = RTFsIsoMakerObjSetNameAndParent(pThis->hIsoMaker, idxObj, idxParent, fNamespace, pszName, true /*fNoNormalize*/); 457 457 if (RT_SUCCESS(rc)) 458 458 { … … 603 603 * Enter the object into the namespace. 604 604 */ 605 rc = RTFsIsoMakerObjSetNameAndParent(pThis->hIsoMaker, idxObj, idxParent, fNamespace, pszName );605 rc = RTFsIsoMakerObjSetNameAndParent(pThis->hIsoMaker, idxObj, idxParent, fNamespace, pszName, true /*fNoNormalize*/); 606 606 if (RT_SUCCESS(rc)) 607 607 {
Note:
See TracChangeset
for help on using the changeset viewer.