Changeset 101344 in vbox for trunk/src/VBox/Main/xml
- Timestamp:
- Oct 4, 2023 7:35:14 PM (19 months ago)
- svn:sync-xref-src-repo-rev:
- 159345
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/xml/Settings.cpp
r101274 r101344 6826 6826 } 6827 6827 6828 const struct { 6828 static struct 6829 { 6829 6830 const char *pcszOld; 6830 6831 const char *pcszNew; 6831 } aConvertGuestOSTypesPre1_5[] =6832 } const g_aConvertGuestOSTypesPre1_5[] = 6832 6833 { 6833 6834 { "unknown", "Other" }, … … 6868 6869 }; 6869 6870 6871 /* static */ 6870 6872 void MachineConfigFile::convertGuestOSTypeFromPre1_5(Utf8Str &str) 6871 6873 { 6872 for (size_t u = 0; u < RT_ELEMENTS(aConvertGuestOSTypesPre1_5); ++u)6873 if (str == aConvertGuestOSTypesPre1_5[u].pcszOld)6874 { 6875 str = aConvertGuestOSTypesPre1_5[u].pcszNew;6874 for (size_t idx = 0; idx < RT_ELEMENTS(g_aConvertGuestOSTypesPre1_5); ++idx) 6875 if (str == g_aConvertGuestOSTypesPre1_5[idx].pcszOld) 6876 { 6877 str = g_aConvertGuestOSTypesPre1_5[idx].pcszNew; 6876 6878 break; 6877 6879 } … … 6881 6883 * Static function to convert a guest OS type ID suffix. 6882 6884 * 6883 * @returns \c true if suffix got converted, or \c false if not.6884 6885 * @param strOsType Guest OS type ID to convert. 6885 6886 * @param pszToReplace Suffix to replace. … … 6887 6888 */ 6888 6889 /* static */ 6889 bool MachineConfigFile::convertGuestOSTypeSuffix(com::Utf8Str &strOsType, const char *pszToReplace, const char *pszReplacement) 6890 { 6891 AssertPtrReturn(pszToReplace, false); 6892 AssertPtrReturn(pszReplacement, false); 6893 6894 size_t const cchSuffix = strlen(pszToReplace); 6895 size_t const idxSuffix = strOsType.find(pszToReplace); 6896 if (idxSuffix == strOsType.length() - cchSuffix) /* Be extra cautious to only replace the real suffix. */ 6897 { 6898 strOsType.replace(idxSuffix, cchSuffix, pszReplacement); 6899 return true; 6900 } 6901 return false; 6890 void MachineConfigFile::convertGuestOSTypeSuffix(com::Utf8Str &strOsType, const char *pszToReplace, const char *pszReplacement) 6891 { 6892 size_t const cchToReplace = strlen(pszToReplace); 6893 if (strOsType.endsWith(pszToReplace, cchToReplace)) 6894 strOsType.replace(strOsType.length() - cchToReplace, cchToReplace, pszReplacement); 6902 6895 } 6903 6896 … … 6913 6906 * compatibility with older VBox versions. 6914 6907 */ 6908 /* static */ 6915 6909 void MachineConfigFile::convertGuestOSTypeFromPre1_20(Utf8Str &str) 6916 6910 { … … 6927 6921 * know about the new suffix. 6928 6922 */ 6923 /* static */ 6929 6924 void MachineConfigFile::convertGuestOSTypeToPre1_20(Utf8Str &str) 6930 6925 {
Note:
See TracChangeset
for help on using the changeset viewer.