MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / onLoaded

Method onLoaded

test/test_emscripten_async_wget2.cpp:271–293  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

269}
270
271void http::onLoaded(const char* file) {
272 if (strstr(file,"prepare")) {
273 FILE* f = fopen(file,"rb");
274 if (f) {
275 fseek (f, 0, SEEK_END);
276 int size=ftell (f);
277 fseek (f, 0, SEEK_SET);
278
279 char* data = new char[size];
280 fread(data,size,1,f);
281 _content = data;
282 delete[] data;
283 fclose(f);
284 } else {
285 _content = file;
286 }
287 } else {
288 _content = file;
289 }
290
291 _progressValue = 100;
292 _status = ST_OK;
293}
294
295void http::onError(int error) {
296 printf("onError status: %d\n",error);

Callers 1

onLoadedMethod · 0.45

Calls 6

fopenFunction · 0.85
fseekFunction · 0.85
ftellFunction · 0.85
freadFunction · 0.85
fcloseFunction · 0.85
strstrFunction · 0.50

Tested by

no test coverage detected