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

Function fxGetArchiveData

xs/sources/xsAPI.c:2112–2134  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2110}
2111
2112void* fxGetArchiveData(txMachine* the, void* archive, txString path, size_t* size)
2113{
2114 txU4 atomSize;
2115 txU1 *p = fxGetArchiveResources(the, archive, &atomSize), *q;
2116 if (!p)
2117 return NULL;
2118 q = p + atomSize;
2119 while (p < q) {
2120 // PATH
2121 atomSize = c_read32be(p);
2122 if (!c_strcmp(path, (txString)(p + sizeof(Atom)))) {
2123 p += atomSize;
2124 atomSize = c_read32be(p);
2125 *size = atomSize - sizeof(Atom);
2126 return p + sizeof(Atom);
2127 }
2128 p += atomSize;
2129 // DATA
2130 atomSize = c_read32be(p);
2131 p += atomSize;
2132 }
2133 return C_NULL;
2134}
2135
2136txInteger fxGetArchiveDataCount(txMachine* the, void* archive)
2137{

Callers 4

Resource_indexFunction · 0.85
Resource_constructorFunction · 0.85
Resource_existsFunction · 0.85
fxGetResourceFunction · 0.85

Calls 1

fxGetArchiveResourcesFunction · 0.85

Tested by

no test coverage detected