VirtualBox

Ignore:
Timestamp:
Jul 24, 2019 3:41:32 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
132392
Message:

Main/MediumImpl.cpp: Suffix strings that skips over the dot are called extensions in IPRT parlence. Simplified no-suffix check. bugref:8344

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-server/MediumImpl.cpp

    r79954 r79961  
    29512951            destFName.stripPath();
    29522952
    2953             Utf8Str suffix(destFName);
    2954             suffix.stripSuffix();
    2955 
    2956             if (suffix.equals(destFName) && !destFName.isEmpty())
     2953            if (destFName.isNotEmpty() && !RTPathHasSuffix(destFName.c_str()))
    29572954            {
    29582955                /*
    29592956                 * The target path has no filename: Either "/path/to/new/location" or
    2960                  * just "newname" (no trailing backslash or there is no filename with
    2961                  * extension(suffix)).
     2957                 * just "newname" (no trailing backslash or there is no filename extension).
    29622958                 */
    29632959                if (destPath.equals(destFName))
     
    29932989                }
    29942990
    2995                 suffix = RTPathSuffix(sourceFName.c_str());
     2991                const char *pszSuffix = RTPathSuffix(sourceFName.c_str());
    29962992
    29972993                /* Suffix is empty and one is deduced from the medium format */
    2998                 if (suffix.isEmpty())
     2994                if (pszSuffix == NULL)
    29992995                {
    3000                     suffix = i_getFormat();
    3001                     if (suffix.compare("RAW", Utf8Str::CaseInsensitive) == 0)
     2996                    Utf8Str strExt = i_getFormat();
     2997                    if (strExt.compare("RAW", Utf8Str::CaseInsensitive) == 0)
    30022998                    {
    30032999                        DeviceType_T devType = i_getDeviceType();
     
    30053001                        {
    30063002                            case DeviceType_DVD:
    3007                                 suffix = "iso";
     3003                                strExt = "iso";
    30083004                                break;
    30093005                            case DeviceType_Floppy:
    3010                                 suffix = "img";
     3006                                strExt = "img";
    30113007                                break;
    30123008                            default:
    3013                                 rc = setError(VERR_NOT_A_FILE,
     3009                                rc = setError(VERR_NOT_A_FILE, /** @todo r=bird: Mixing status codes again. */
    30143010                                       tr("Medium '%s' has RAW type. \"Move\" operation isn't supported for this type."),
    30153011                                       i_getLocationFull().c_str());
     
    30173013                        }
    30183014                    }
    3019                     else if (suffix.compare("Parallels", Utf8Str::CaseInsensitive) == 0)
     3015                    else if (strExt.compare("Parallels", Utf8Str::CaseInsensitive) == 0)
    30203016                    {
    3021                         suffix = "hdd";
     3017                        strExt = "hdd";
    30223018                    }
    30233019
    30243020                    /* Set the target extension like on the source. Any conversions are prohibited */
    3025                     suffix.toLower();
    3026                     destPath.stripSuffix().append('.').append(suffix);
     3021                    strExt.toLower();
     3022                    destPath.stripSuffix().append('.').append(strExt);
    30273023                }
    30283024                else
    3029                     destPath.stripSuffix().append(suffix);
     3025                    destPath.stripSuffix().append(pszSuffix);
    30303026            }
    30313027
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