MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / fx_parseURLPushPath

Function fx_parseURLPushPath

modules/data/url/url.c:1394–1448  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1392}
1393
1394void fx_parseURLPushPath(txMachine* the, txSlot* path, txStringStream* dst, txBoolean flag)
1395{
1396 txSize size;
1397 txString string;
1398 if ((c_strcmp(dst->slot->value.string, "..") == 0)
1399 || (c_strcmp(dst->slot->value.string, ".%2E") == 0)
1400 || (c_strcmp(dst->slot->value.string, "%2E.") == 0)
1401 || (c_strcmp(dst->slot->value.string, "%2E%2E") == 0)
1402 || (c_strcmp(dst->slot->value.string, ".%2e") == 0)
1403 || (c_strcmp(dst->slot->value.string, "%2e.") == 0)
1404 || (c_strcmp(dst->slot->value.string, "%2e%2e") == 0)) {
1405 fx_parseURLShortenPath(the, path);
1406 if (flag) {
1407 dst->slot->value.string[0] = 0;
1408 dst->offset = 0;
1409 }
1410 }
1411 else if ((c_strcmp(dst->slot->value.string, ".") == 0)
1412 || (c_strcmp(dst->slot->value.string, "%2E") == 0)
1413 || (c_strcmp(dst->slot->value.string, "%2e") == 0)) {
1414 if (flag) {
1415 dst->slot->value.string[0] = 0;
1416 dst->offset = 0;
1417 }
1418 }
1419 else {
1420 txIndex length;
1421 mxPushSlot(path);
1422 mxGetID(mxID(_length));
1423 length = (txIndex)fxToLength(the, the->stack);
1424 mxPop();
1425 if ((length == 0) && fx_parseURLIsWindowsDriveLetter(the, dst->slot->value.string, 0))
1426 dst->slot->value.string[1] = ':';
1427 flag = 1;
1428 }
1429 if (flag) {
1430 mxPushSlot(path);
1431 mxDub();
1432 mxGetID(mxID(_push));
1433 mxCall();
1434 size = dst->offset + 1;
1435 string = fxRenewChunk(the, dst->slot->value.string, size);
1436 if (!string) {
1437 string = (txString)fxNewChunk(the, size);
1438 c_memcpy(string, dst->slot->value.string, size);
1439 }
1440 mxPushString(string);
1441 mxRunCount(1);
1442 mxPop();
1443 }
1444 dst->slot->value.string = fxNewChunk(the, mx_parseURLBufferSize);
1445 dst->size = mx_parseURLBufferSize;
1446 dst->offset = 0;
1447 dst->slot->value.string[0] = 0;
1448}
1449
1450txInteger fx_parseURLSpecialScheme(txMachine* the, txString scheme)
1451{

Callers 1

fx_parseURLFunction · 0.85

Calls 5

fx_parseURLShortenPathFunction · 0.85
fxToLengthFunction · 0.85
fxRenewChunkFunction · 0.85
fxNewChunkFunction · 0.85

Tested by

no test coverage detected