Changeset 59994 in vbox
- Timestamp:
- Mar 11, 2016 1:49:46 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DrvAudio.cpp
r59989 r59994 181 181 } 182 182 183 static int drvAudioProcessOptions(PCFGMNODE pCfgHandle, const char *pszPrefix, struct audio_option *opt)183 static int drvAudioProcessOptions(PCFGMNODE pCfgHandle, const char *pszPrefix, audio_option *paOpts, size_t cOpts) 184 184 { 185 185 AssertPtrReturn(pCfgHandle, VERR_INVALID_POINTER); 186 AssertPtrReturn(pszPrefix, VERR_INVALID_POINTER);187 AssertPtrReturn(opt, VERR_INVALID_POINTER);186 AssertPtrReturn(pszPrefix, VERR_INVALID_POINTER); 187 /* oaOpts and cOpts are optional. */ 188 188 189 189 PCFGMNODE pCfgChildHandle = NULL; … … 220 220 } 221 221 222 for (; opt->name; opt++) 223 { 224 LogFlowFunc(("Option value pointer for `%s' is not set\n", 225 opt->name)); 226 if (!opt->valp) { 227 LogFlowFunc(("Option value pointer for `%s' is not set\n", 228 opt->name)); 222 for (size_t i = 0; i < cOpts; i++) 223 { 224 audio_option *pOpt = &paOpts[i]; 225 if (!pOpt->valp) 226 { 227 LogFlowFunc(("Option value pointer for `%s' is not set\n", pOpt->name)); 229 228 continue; 230 229 } … … 232 231 bool fUseDefault; 233 232 234 switch ( opt->tag)233 switch (pOpt->tag) 235 234 { 236 235 case AUD_OPT_BOOL: 237 236 case AUD_OPT_INT: 238 237 { 239 int *intp = (int *) opt->valp;240 *intp = drvAudioGetConfInt(pCfgHandle, opt->name, *intp, &fUseDefault);238 int *intp = (int *)pOpt->valp; 239 *intp = drvAudioGetConfInt(pCfgHandle, pOpt->name, *intp, &fUseDefault); 241 240 242 241 break; … … 245 244 case AUD_OPT_FMT: 246 245 { 247 PDMAUDIOFMT *fmtp = (PDMAUDIOFMT *) opt->valp;248 *fmtp = drvAudioGetConfFormat(pCfgHandle, opt->name, *fmtp, &fUseDefault);246 PDMAUDIOFMT *fmtp = (PDMAUDIOFMT *)pOpt->valp; 247 *fmtp = drvAudioGetConfFormat(pCfgHandle, pOpt->name, *fmtp, &fUseDefault); 249 248 250 249 break; … … 253 252 case AUD_OPT_STR: 254 253 { 255 const char **strp = (const char **) opt->valp;256 *strp = drvAudioGetConfStr(pCfgHandle, opt->name, *strp, &fUseDefault);254 const char **strp = (const char **)pOpt->valp; 255 *strp = drvAudioGetConfStr(pCfgHandle, pOpt->name, *strp, &fUseDefault); 257 256 258 257 break; … … 260 259 261 260 default: 262 LogFlowFunc(("Bad value tag for option `%s' - %d\n", opt->name, opt->tag));261 LogFlowFunc(("Bad value tag for option `%s' - %d\n", pOpt->name, pOpt->tag)); 263 262 fUseDefault = false; 264 263 break; 265 264 } 266 265 267 if (! opt->overridenp)268 opt->overridenp = &opt->overriden;269 270 * opt->overridenp = !fUseDefault;266 if (!pOpt->overridenp) 267 pOpt->overridenp = &pOpt->overriden; 268 269 *pOpt->overridenp = !fUseDefault; 271 270 } 272 271 … … 1777 1776 if (RT_SUCCESS(rc)) 1778 1777 { 1779 rc = drvAudioProcessOptions(pCfgHandle, "AUDIO", audio_options );1778 rc = drvAudioProcessOptions(pCfgHandle, "AUDIO", audio_options, RT_ELEMENTS(audio_options)); 1780 1779 /** @todo Check for invalid options? */ 1781 1780
Note:
See TracChangeset
for help on using the changeset viewer.