MCPcopy Create free account
hub / github.com/Scobalula/Greyhound / ParseOpenParams

Function ParseOpenParams

src/External/CascLib/src/CascOpenStorage.cpp:1306–1358  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1304}
1305
1306static DWORD ParseOpenParams(LPTSTR szParams, PCASC_OPEN_STORAGE_ARGS pArgs)
1307{
1308 LPTSTR szParamsPtr = szParams;
1309 LPTSTR szParamsTmp;
1310
1311 //
1312 // Format of the params:
1313 //
1314 // Local: local_path*code_name ("C:\\Games\\World of Warcraft*wowt")
1315 // Online: local_cache_path[*cdn_url]*code_name*region" ("C:\\Cache*wowt*us)
1316 //
1317
1318 // If the caller supplied the local_path/local_cache_path
1319 // both in szParams and pArgs, it's a conflict
1320 if(pArgs->szLocalPath && pArgs->szLocalPath[0])
1321 return ERROR_INVALID_PARAMETER;
1322 pArgs->szLocalPath = szParams;
1323
1324 // Extract the optional CDN path. If present, then we put it
1325 // into CASC_OPEN_STORAGE_ARGS::szCdnHostUrl
1326 if((szParamsTmp = GetNextParam(szParamsPtr, true)) != NULL)
1327 {
1328 if(pArgs->szCdnHostUrl && pArgs->szCdnHostUrl[0])
1329 return ERROR_INVALID_PARAMETER;
1330 pArgs->szCdnHostUrl = szParamsTmp;
1331 szParamsPtr = szParamsTmp;
1332 }
1333
1334 // The next must be the code name of the product
1335 if((szParamsPtr = GetNextParam(szParamsPtr)) != NULL)
1336 {
1337 if(pArgs->szCodeName && pArgs->szCodeName[0])
1338 return ERROR_INVALID_PARAMETER;
1339 pArgs->szCodeName = szParamsPtr;
1340 }
1341
1342 // There could be region appended at the end
1343 if((szParamsPtr = GetNextParam(szParamsPtr)) != NULL)
1344 {
1345 if(pArgs->szRegion && pArgs->szRegion[0])
1346 return ERROR_INVALID_PARAMETER;
1347 pArgs->szRegion = szParamsPtr;
1348 }
1349
1350 // There could be region appended at the end
1351 if((szParamsPtr = GetNextParam(szParamsPtr)) != NULL)
1352 {
1353 if(pArgs->szBuildKey && pArgs->szBuildKey[0])
1354 return ERROR_INVALID_PARAMETER;
1355 pArgs->szBuildKey = szParamsPtr;
1356 }
1357 return ERROR_SUCCESS;
1358}
1359
1360//-----------------------------------------------------------------------------
1361// Public functions

Callers 1

CascOpenStorageExFunction · 0.85

Calls 1

GetNextParamFunction · 0.85

Tested by

no test coverage detected