comparison dmres.c @ 731:0e164aaa7409

Work on getting the resource subsystem working again ..
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 21 Apr 2013 19:46:52 +0300
parents 3d813c81f33c
children 2f02d9b4caa3
comparison
equal deleted inserted replaced
730:3d813c81f33c 731:0e164aaa7409
47 } 47 }
48 48
49 49
50 void dmResourceFreeRawData(DMResource *node) 50 void dmResourceFreeRawData(DMResource *node)
51 { 51 {
52 dmFree(node->rawData); 52 if ((node->flags & DMF_UNALLOCATED) == 0)
53 node->rawData = NULL; 53 {
54 node->flags &= ~DMF_LOADED_RAW; 54 dmFree(node->rawData);
55 node->rawData = NULL;
56 node->flags &= ~DMF_LOADED_RAW;
57 }
55 } 58 }
56 59
57 60
58 void dmResourceFree(DMResource *node) 61 void dmResourceFree(DMResource *node)
59 { 62 {
538 } 541 }
539 return nmemb; 542 return nmemb;
540 } 543 }
541 544
542 545
543
544 #ifdef DM_USE_PACKFS 546 #ifdef DM_USE_PACKFS
545 DMResourceOps dfPackFileOps = 547 DMResourceOps dfPackFileOps =
546 { 548 {
547 "PackFS", 549 "PackFS",
548 550
695 if ((*phandle = handle = dmResourceFind(lib, filename)) == NULL) 697 if ((*phandle = handle = dmResourceFind(lib, filename)) == NULL)
696 { 698 {
697 if ((*phandle = handle = dmResourceNew(lib, filename, size)) == NULL) 699 if ((*phandle = handle = dmResourceNew(lib, filename, size)) == NULL)
698 return DMERR_MALLOC; 700 return DMERR_MALLOC;
699 701
700 handle->flags = DMF_LOADED_RAW; 702 handle->flags = DMF_LOADED_RAW | DMF_UNALLOCATED;
701 handle->fops = &dfMemIOFileOps; 703 handle->fops = &dfMemIOFileOps;
702 handle->rawData = buf; 704 handle->rawData = buf;
703 dmResourceInsert(lib, handle); 705 dmResourceInsert(lib, handle);
704 } 706 }
705 707