VirtualBox

Changeset 70584 in vbox for trunk/src/VBox/Devices/Audio


Ignore:
Timestamp:
Jan 15, 2018 11:46:27 AM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
120281
Message:

Audio/DrvAudioCommon: Cleaned up DrvAudioHlpGetFileName().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Audio/DrvAudioCommon.cpp

    r70143 r70584  
    11031103        }
    11041104
     1105        char szFileName[RTPATH_MAX + 1];
     1106        szFileName[0] = '\0';
     1107
    11051108        if (fFlags & PDMAUDIOFILENAME_FLAG_TS)
    11061109        {
    1107             char szTime[64];
    11081110            RTTIMESPEC time;
    1109             if (!RTTimeSpecToString(RTTimeNow(&time), szTime, sizeof(szTime)))
     1111            if (!RTTimeSpecToString(RTTimeNow(&time), szFileName, sizeof(szFileName)))
    11101112            {
    11111113                rc = VERR_BUFFER_OVERFLOW;
     
    11131115            }
    11141116
    1115             rc = DrvAudioHlpSanitizeFileName(szTime, sizeof(szTime));
     1117            rc = DrvAudioHlpSanitizeFileName(szFileName, sizeof(szFileName));
    11161118            if (RT_FAILURE(rc))
    11171119                break;
    11181120
    1119             rc = RTStrCat(szFilePath, sizeof(szFilePath), szTime);
     1121            rc = RTStrCat(szFileName, sizeof(szFileName), "-");
    11201122            if (RT_FAILURE(rc))
    11211123                break;
    1122 
    1123             rc = RTStrCat(szFilePath, sizeof(szFilePath), "-");
    1124             if (RT_FAILURE(rc))
    1125                 break;
    1126         }
    1127 
    1128         rc = RTStrCat(szFilePath, sizeof(szFilePath), pszName);
     1124        }
     1125
     1126        rc = RTStrCat(szFileName, sizeof(szFileName), pszName);
    11291127        if (RT_FAILURE(rc))
    11301128            break;
    11311129
    1132         rc = RTStrCat(szFilePath, sizeof(szFilePath), "-");
     1130        rc = RTStrCat(szFileName, sizeof(szFileName), "-");
    11331131        if (RT_FAILURE(rc))
    11341132            break;
     
    11361134        char szInst[16];
    11371135        RTStrPrintf2(szInst, sizeof(szInst), "%RU32", uInstance);
    1138         rc = RTStrCat(szFilePath, sizeof(szFilePath), szInst);
     1136        rc = RTStrCat(szFileName, sizeof(szFileName), szInst);
    11391137        if (RT_FAILURE(rc))
    11401138            break;
     
    11431141        {
    11441142            case PDMAUDIOFILETYPE_RAW:
    1145                 rc = RTStrCat(szFilePath, sizeof(szFilePath), ".pcm");
     1143                rc = RTStrCat(szFileName, sizeof(szFileName), ".pcm");
    11461144                break;
    11471145
    11481146            case PDMAUDIOFILETYPE_WAV:
    1149                 rc = RTStrCat(szFilePath, sizeof(szFilePath), ".wav");
     1147                rc = RTStrCat(szFileName, sizeof(szFileName), ".wav");
    11501148                break;
    11511149
     
    11551153        }
    11561154
     1155        if (RT_FAILURE(rc))
     1156            break;
     1157
     1158        rc = RTPathAppend(szFilePath, sizeof(szFilePath), szFileName);
    11571159        if (RT_FAILURE(rc))
    11581160            break;
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