Mercurial > hg > dmlib
comparison dmres.c @ 613:15cd5b8a29b2
Add DRF_USE_STDIO flag for resources.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 12 Apr 2013 12:34:17 +0300 |
parents | 877dba1b8a1f |
children | e8fc083b7499 |
comparison
equal
deleted
inserted
replaced
612:696f03f30c0e | 613:15cd5b8a29b2 |
---|---|
577 if (handle->fops == NULL) | 577 if (handle->fops == NULL) |
578 { | 578 { |
579 #ifdef DM_USE_PACKFS | 579 #ifdef DM_USE_PACKFS |
580 if (handle->lib->flags & DRF_USE_PACK) | 580 if (handle->lib->flags & DRF_USE_PACK) |
581 handle->fops = &dfPackFileOps; | 581 handle->fops = &dfPackFileOps; |
582 | |
582 # ifdef DM_USE_STDIO | 583 # ifdef DM_USE_STDIO |
583 else | 584 else |
585 if (handle->lib->flags & DRF_USE_STDIO) | |
584 handle->fops = &dfStdioFileOps; | 586 handle->fops = &dfStdioFileOps; |
585 # else | 587 # else |
586 handle->fops = &dfPackFileOps; | 588 handle->fops = &dfPackFileOps; |
587 # endif | 589 # endif |
588 | |
589 #else | |
590 handle->fops = NULL; | |
591 #endif | 590 #endif |
592 | 591 |
593 dmf_reset(handle); | 592 dmf_reset(handle); |
594 } | 593 } |
595 } | 594 } |
658 | 657 |
659 // Check master directory for resource | 658 // Check master directory for resource |
660 if ((handle = dmres_find(lib, filename)) == NULL) | 659 if ((handle = dmres_find(lib, filename)) == NULL) |
661 { | 660 { |
662 #ifdef DM_USE_STDIO | 661 #ifdef DM_USE_STDIO |
663 // Hmm.. does not exist? Fall back to a stdio file | 662 if (lib->flags & DRF_USE_STDIO) |
664 handle = dmres_new(lib, filename, 0, 0); | 663 { |
665 if (handle == NULL) | 664 // Hmm.. does not exist? Fall back to a stdio file |
665 handle = dmres_new(lib, filename, 0, 0); | |
666 if (handle == NULL) | |
667 return NULL; | |
668 | |
669 handle->fops = &dfStdioFileOps; | |
670 dmres_insert(lib, handle); | |
671 } | |
672 else | |
666 return NULL; | 673 return NULL; |
667 | |
668 handle->fops = &dfStdioFileOps; | |
669 dmres_insert(lib, handle); | |
670 #else | 674 #else |
671 // Stdio not enabled, fail | 675 // Stdio not enabled, fail |
672 return NULL; | 676 return NULL; |
673 #endif | 677 #endif |
674 } | 678 } |