From d8787c2016ddd716e990e6b9b1a2cea539140247 Mon Sep 17 00:00:00 2001 From: Chris Moeller Date: Sun, 29 Sep 2013 17:28:58 -0700 Subject: [PATCH] Only keep DUMBFILE and DUMBFILESYSTEM local to open function, and eliminate unnecessary close callback --- Plugins/Dumb/DumbDecoder.h | 2 -- Plugins/Dumb/DumbDecoder.m | 26 +++++++++++++++----------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/Plugins/Dumb/DumbDecoder.h b/Plugins/Dumb/DumbDecoder.h index 8e4fbc4bb..032b3b5ce 100755 --- a/Plugins/Dumb/DumbDecoder.h +++ b/Plugins/Dumb/DumbDecoder.h @@ -17,8 +17,6 @@ #import "Plugin.h" @interface DumbDecoder : NSObject { - DUMBFILE *df; - DUMBFILE_SYSTEM dfs; DUH *duh; DUH_SIGRENDERER *dsr; diff --git a/Plugins/Dumb/DumbDecoder.m b/Plugins/Dumb/DumbDecoder.m index d0f0c4392..2579c9c0a 100755 --- a/Plugins/Dumb/DumbDecoder.m +++ b/Plugins/Dumb/DumbDecoder.m @@ -43,12 +43,6 @@ long readCallback(char *ptr, long n, void *f) return [[decoder source] read:ptr amount:n]; } -void closeCallback(void *f) -{ -// DumbDecoder *decoder = (DumbDecoder *)f; - NSLog(@"CLOSE"); //I DO NOTHING -} - int seekCallback(void *f, long n) { DumbDecoder *decoder = (DumbDecoder *)f; @@ -76,15 +70,27 @@ long getsizeCallback(void *f) return size; } +void oneTimeInit() +{ + static bool initialized = false; + if (!initialized) + { + + } +} + - (BOOL)open:(id)s { [self setSource:s]; + DUMBFILE *df; + DUMBFILE_SYSTEM dfs; + dfs.open = NULL; dfs.skip = skipCallback; dfs.getc = getCharCallback; dfs.getnc = readCallback; - dfs.close = closeCallback; + dfs.close = NULL; dfs.seek = seekCallback; dfs.get_size = getsizeCallback; @@ -102,8 +108,10 @@ long getsizeCallback(void *f) if (!duh) { NSLog(@"Failed to create duh"); + dumbfile_close(df); return NO; } + dumbfile_close(df); length = duh_get_length(duh); @@ -178,10 +186,6 @@ long getsizeCallback(void *f) unload_duh(duh); duh = NULL; } - if (df) { - dumbfile_close(df); - df = NULL; - } } - (void)close