VirtualBox

Changeset 101379 in vbox for trunk/src/VBox/Main/xml


Ignore:
Timestamp:
Oct 6, 2023 8:45:30 AM (19 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
159382
Message:

Main: Prep for backing out the '_64' -> '_x64' change. bugref:10384

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/xml/Settings.cpp

    r101344 r101379  
    68816881
    68826882/**
    6883  * Static function to convert a guest OS type ID suffix.
    6884  *
    6885  * @param   strOsType               Guest OS type ID to convert.
    6886  * @param   pszToReplace            Suffix to replace.
    6887  * @param   pszReplacement          What to replace the suffix with.
     6883 * Worker function that converts the suffix of a guest OS type ID.
     6884 *
     6885 * @param   a_rstrOsType        Guest OS type ID to convert.
     6886 * @param   a_pszToReplace      Suffix to replace.
     6887 * @param   a_pszReplacement    What to replace the suffix with.
    68886888 */
    68896889/* static */
    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);
    6895 }
     6890void MachineConfigFile::convertGuestOSTypeSuffix(com::Utf8Str &a_rstrOsType,
     6891                                                 const char *a_pszToReplace, const char *a_pszReplacement)
     6892{
     6893    size_t const cchToReplace = strlen(a_pszToReplace);
     6894    if (a_rstrOsType.endsWith(a_pszToReplace, cchToReplace))
     6895        a_rstrOsType.replace(a_rstrOsType.length() - cchToReplace, cchToReplace, a_pszReplacement);
     6896}
     6897
     6898#ifdef GUEST_OS_ID_STYLE_PARTIAL_CLEANUP
    68966899
    68976900/**
     
    69266929    convertGuestOSTypeSuffix(str, "_x64", "_64");
    69276930}
     6931
     6932#else  /* !GUEST_OS_ID_STYLE_PARTIAL_CLEANUP */
     6933
     6934/**
     6935 * Undoes effects of the 'OSTYPEID_64' to 'OSTYPEID_x64' renaming attempt from
     6936 * the VBox v7.1 development cycle on @a a_rstrOsType.
     6937 *
     6938 * @see     @bugref{10384#c18}
     6939 */
     6940/* static */
     6941void MachineConfigFile::convertGuestOSTypeFromDev1_20(Utf8Str &a_rstrOsType)
     6942{
     6943    convertGuestOSTypeSuffix(a_rstrOsType, "_x64", "_64");
     6944}
     6945
     6946#endif /* !GUEST_OS_ID_STYLE_PARTIAL_CLEANUP */
     6947
    69286948
    69296949/**
     
    69486968        if (m->sv < SettingsVersion_v1_5)
    69496969            convertGuestOSTypeFromPre1_5(machineUserData.strOsType);
     6970#ifdef GUEST_OS_ID_STYLE_PARTIAL_CLEANUP
    69506971        if (m->sv <= SettingsVersion_v1_19)
    69516972            convertGuestOSTypeFromPre1_20(machineUserData.strOsType);
    6952 
     6973#else
     6974        if (m->sv == SettingsVersion_v1_20)
     6975            convertGuestOSTypeFromDev1_20(machineUserData.strOsType);
     6976#endif
    69536977        elmMachine.getAttributeValue("stateKeyId", strStateKeyId);
    69546978        elmMachine.getAttributeValue("stateKeyStore", strStateKeyStore);
     
    91189142        elmMachine.createChild("Description")->addContent(machineUserData.strDescription);
    91199143
     9144#ifdef GUEST_OS_ID_STYLE_PARTIAL_CLEANUP
    91209145    com::Utf8Str strOsType = machineUserData.strOsType;
    91219146    if (m->sv < SettingsVersion_v1_20)
    91229147        convertGuestOSTypeToPre1_20(strOsType);
    9123     /* else use the unmodified guest OS type ID. */
    91249148    elmMachine.setAttribute("OSType", strOsType);
     9149#else
     9150    elmMachine.setAttribute("OSType", machineUserData.strOsType);
     9151#endif
    91259152
    91269153    if (m->sv >= SettingsVersion_v1_19)
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette