# HG changeset patch # User Matti Hamalainen # Date 1365759257 -10800 # Node ID 15cd5b8a29b28d0e2b213d8c49010773bc8901c6 # Parent 696f03f30c0ea888476559fa3593b931e70f346a Add DRF_USE_STDIO flag for resources. diff -r 696f03f30c0e -r 15cd5b8a29b2 dmres.c --- a/dmres.c Fri Apr 12 12:33:49 2013 +0300 +++ b/dmres.c Fri Apr 12 12:34:17 2013 +0300 @@ -579,15 +579,14 @@ #ifdef DM_USE_PACKFS if (handle->lib->flags & DRF_USE_PACK) handle->fops = &dfPackFileOps; + # ifdef DM_USE_STDIO else + if (handle->lib->flags & DRF_USE_STDIO) handle->fops = &dfStdioFileOps; # else handle->fops = &dfPackFileOps; # endif - -#else - handle->fops = NULL; #endif dmf_reset(handle); @@ -660,13 +659,18 @@ if ((handle = dmres_find(lib, filename)) == NULL) { #ifdef DM_USE_STDIO - // Hmm.. does not exist? Fall back to a stdio file - handle = dmres_new(lib, filename, 0, 0); - if (handle == NULL) + if (lib->flags & DRF_USE_STDIO) + { + // Hmm.. does not exist? Fall back to a stdio file + handle = dmres_new(lib, filename, 0, 0); + if (handle == NULL) + return NULL; + + handle->fops = &dfStdioFileOps; + dmres_insert(lib, handle); + } + else return NULL; - - handle->fops = &dfStdioFileOps; - dmres_insert(lib, handle); #else // Stdio not enabled, fail return NULL; diff -r 696f03f30c0e -r 15cd5b8a29b2 dmres.h --- a/dmres.h Fri Apr 12 12:33:49 2013 +0300 +++ b/dmres.h Fri Apr 12 12:34:17 2013 +0300 @@ -30,8 +30,9 @@ enum { DRF_USE_PACK = 0x0001, - DRF_PRELOAD_ALL = 0x0002, - DRF_PRELOAD_RES = 0x0004, + DRF_USE_STDIO = 0x0002, + DRF_PRELOAD_ALL = 0x0004, + DRF_PRELOAD_RES = 0x0008, }; enum