diff options
| -rw-r--r-- | gvfs/gvfs.c | 19 | ||||
| -rw-r--r-- | libarchive/libarchive.c | 17 | ||||
| -rw-r--r-- | unrar/unrar.c | 17 | ||||
| -rw-r--r-- | zip/zip.cpp | 17 |
4 files changed, 44 insertions, 26 deletions
diff --git a/gvfs/gvfs.c b/gvfs/gvfs.c index c9a8a7e..3f0ccd5 100644 --- a/gvfs/gvfs.c +++ b/gvfs/gvfs.c @@ -56,11 +56,6 @@ struct TVFSGlobs { }; -int -VFSAllocNeeded () -{ - return sizeof (struct TVFSGlobs); -} static TVFSResult g_error_to_TVFSResult (GError *error) @@ -206,9 +201,14 @@ vfs_handle_mount (struct TVFSGlobs *globs, GFile *file) return globs->mount_result; } -void -VFSInit (struct TVFSGlobs *globs, TVFSLogFunc log_func) +struct TVFSGlobs * +VFSNew (TVFSLogFunc log_func) { + struct TVFSGlobs * globs; + + globs = (struct TVFSGlobs *) malloc (sizeof (struct TVFSGlobs)); + memset (globs, 0, sizeof (struct TVFSGlobs)); + globs->log_func = log_func; globs->log_func ("GVFS plugin: VFSInit"); @@ -217,12 +217,15 @@ VFSInit (struct TVFSGlobs *globs, TVFSLogFunc log_func) globs->break_get_dir_size = FALSE; globs->block_size = DEFAULT_BLOCK_SIZE; + + return globs; } void -VFSDestroy (struct TVFSGlobs *globs) +VFSFree (struct TVFSGlobs *globs) { globs->log_func ("GVFS plugin: VFSDestroy"); + free (globs); } int diff --git a/libarchive/libarchive.c b/libarchive/libarchive.c index dac84d4..4a360bd 100644 --- a/libarchive/libarchive.c +++ b/libarchive/libarchive.c @@ -83,21 +83,26 @@ struct TVFSGlobs { //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////// // Basic initialization functions -int VFSAllocNeeded() +struct TVFSGlobs * +VFSNew (TVFSLogFunc log_func) { - return sizeof(struct TVFSGlobs); -} + struct TVFSGlobs * globs; + + globs = (struct TVFSGlobs *) malloc (sizeof (struct TVFSGlobs)); + memset (globs, 0, sizeof (struct TVFSGlobs)); -void VFSInit(struct TVFSGlobs *globs, TVFSLogFunc log_func) -{ globs->block_size = DEFAULT_BLOCK_SIZE; globs->log_func = log_func; if (globs->log_func != NULL) globs->log_func((char*)"libarchive plugin: VFSInit"); + + return globs; } -void VFSDestroy(struct TVFSGlobs *globs) +void +VFSFree (struct TVFSGlobs *globs) { if (globs->log_func != NULL) globs->log_func((char*)"libarchive plugin: VFSDestroy"); + free (globs); } int VFSVersion() diff --git a/unrar/unrar.c b/unrar/unrar.c index 5468b94..8793dc4 100644 --- a/unrar/unrar.c +++ b/unrar/unrar.c @@ -101,13 +101,14 @@ struct TVFSGlobs { //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////// // Basic initialization functions -int VFSAllocNeeded() +struct TVFSGlobs * +VFSNew (TVFSLogFunc log_func) { - return sizeof(struct TVFSGlobs); -} + struct TVFSGlobs * globs; + + globs = (struct TVFSGlobs *) malloc (sizeof (struct TVFSGlobs)); + memset (globs, 0, sizeof (struct TVFSGlobs)); -void VFSInit(struct TVFSGlobs *globs, TVFSLogFunc log_func) -{ globs->block_size = DEFAULT_BLOCK_SIZE; globs->extract_callback_data = NULL; globs->extract_callback_func = NULL; @@ -116,11 +117,15 @@ void VFSInit(struct TVFSGlobs *globs, TVFSLogFunc log_func) globs->log_func = log_func; if (globs->log_func != NULL) globs->log_func((char*)"unrar plugin: VFSInit"); + + return globs; } -void VFSDestroy(struct TVFSGlobs *globs) +void +VFSFree (struct TVFSGlobs *globs) { if (globs->log_func != NULL) globs->log_func((char*)"unrar plugin: VFSDestroy"); + free (globs); } int VFSVersion() diff --git a/zip/zip.cpp b/zip/zip.cpp index dc52c05..8b61068 100644 --- a/zip/zip.cpp +++ b/zip/zip.cpp @@ -228,13 +228,14 @@ void build_global_filelist(struct TVFSGlobs *globs) //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Basic initialization functions -int VFSAllocNeeded() +struct TVFSGlobs * +VFSNew (TVFSLogFunc log_func) { - return sizeof(struct TVFSGlobs); -} + struct TVFSGlobs * globs; + + globs = (struct TVFSGlobs *) malloc (sizeof (struct TVFSGlobs)); + memset (globs, 0, sizeof (struct TVFSGlobs)); -void VFSInit(struct TVFSGlobs *globs, TVFSLogFunc log_func) -{ globs->archive_opened = false; globs->block_size = DEFAULT_BLOCK_SIZE; globs->archive_modified = false; @@ -242,11 +243,15 @@ void VFSInit(struct TVFSGlobs *globs, TVFSLogFunc log_func) globs->log_func = log_func; if (globs->log_func != NULL) globs->log_func((char*)"zip plugin: VFSInit"); + + return globs; } -void VFSDestroy(struct TVFSGlobs *globs) +void +VFSFree (struct TVFSGlobs *globs) { if (globs->log_func != NULL) globs->log_func((char*)"zip plugin: VFSDestroy"); + free (globs); } int VFSVersion() |
