MCPcopy Create free account
hub / github.com/BZFlag-Dev/bzflag / finalization

Method finalization

src/clientbase/WorldDownLoader.cpp:382–412  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

380
381
382void WorldDownLoader::finalization(char* data, unsigned int length, bool good) {
383 if (good) {
384 worldDatabase = data;
385 theData = NULL;
386 MD5 md5;
387 md5.update((unsigned char*)worldDatabase, length);
388 md5.finalize();
389 std::string digest = md5.hexdigest();
390 if (digest != md5Digest) {
391 showError("Download from URL failed");
392 askToBZFS();
393 }
394 else {
395 std::ostream* cache =
396 FILEMGR.createDataOutStream(worldCachePath, true, true);
397 if (cache != NULL) {
398 cache->write(worldDatabase, length);
399 delete cache;
400 cache = NULL;
401 loadCached();
402 }
403 else {
404 showError("Problem writing cache");
405 askToBZFS();
406 }
407 }
408 }
409 else {
410 askToBZFS();
411 }
412}

Callers

nothing calls this directly

Calls 6

hexdigestMethod · 0.80
createDataOutStreamMethod · 0.80
showErrorFunction · 0.50
updateMethod · 0.45
finalizeMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected