diff options
author | Ulf Lamping <ulf.lamping@web.de> | 2005-11-06 22:43:25 +0000 |
---|---|---|
committer | Ulf Lamping <ulf.lamping@web.de> | 2005-11-06 22:43:25 +0000 |
commit | c3187174bfe39f05c8aa8c6b411952e4b502477d (patch) | |
tree | 0eb95991cb932d74ca534ed0df29a3f2f256b1b8 /filters.c | |
parent | 4e954caec384454ebf4eb61140c466e8787daabe (diff) |
replace *a lot* of file related calls by their GLib counterparts. This is necessary for the switch to GTK 2.6 (at least on WIN32).
to do this, I've added file_util.h to wiretap (would file_compat.h be a better name?), and provide compat_macros like eth_open() instead of open(). While at it, move other file related things there, like #include <io.h>, definition of O_BINARY and alike, so it's all in one place.
deleted related things from config.h.win32
As of these massive changes, I'm almost certain that this will break the Unix build. I'll keep an eye on the buildbot so hopefully everything is working again soon.
svn path=/trunk/; revision=16403
Diffstat (limited to 'filters.c')
-rw-r--r-- | filters.c | 21 |
1 files changed, 11 insertions, 10 deletions
@@ -40,6 +40,7 @@ #include <epan/filesystem.h> #include "filters.h" +#include "file_util.h" /* * Old filter file name. @@ -114,7 +115,7 @@ read_filter_list(filter_list_type_t list, char **pref_path_return, /* try to open personal "cfilters"/"dfilters" file */ ff_path = get_persconffile_path(ff_name, FALSE); - if ((ff = fopen(ff_path, "r")) == NULL) { + if ((ff = eth_fopen(ff_path, "r")) == NULL) { /* * Did that fail because the file didn't exist? */ @@ -137,7 +138,7 @@ read_filter_list(filter_list_type_t list, char **pref_path_return, */ g_free(ff_path); ff_path = get_persconffile_path(FILTER_FILE_NAME, FALSE); - if ((ff = fopen(ff_path, "r")) == NULL) { + if ((ff = eth_fopen(ff_path, "r")) == NULL) { /* * Did that fail because the file didn't exist? */ @@ -153,7 +154,7 @@ read_filter_list(filter_list_type_t list, char **pref_path_return, /* * Try to open the global "cfilters/dfilters" file */ ff_path = get_datafile_path(ff_name); - if ((ff = fopen(ff_path, "r")) == NULL) { + if ((ff = eth_fopen(ff_path, "r")) == NULL) { /* * Well, that didn't work, either. Just give up. @@ -460,7 +461,7 @@ save_filter_list(filter_list_type_t list, char **pref_path_return, completely. */ ff_path_new = g_strdup_printf("%s.new", ff_path); - if ((ff = fopen(ff_path_new, "w")) == NULL) { + if ((ff = eth_fopen(ff_path_new, "w")) == NULL) { *pref_path_return = ff_path; *errno_return = errno; g_free(ff_path_new); @@ -489,7 +490,7 @@ save_filter_list(filter_list_type_t list, char **pref_path_return, *pref_path_return = ff_path; *errno_return = errno; fclose(ff); - unlink(ff_path_new); + eth_unlink(ff_path_new); g_free(ff_path_new); return; } @@ -498,7 +499,7 @@ save_filter_list(filter_list_type_t list, char **pref_path_return, if (fclose(ff) == EOF) { *pref_path_return = ff_path; *errno_return = errno; - unlink(ff_path_new); + eth_unlink(ff_path_new); g_free(ff_path_new); return; } @@ -508,22 +509,22 @@ save_filter_list(filter_list_type_t list, char **pref_path_return, exists; the Win32 call to rename files doesn't do so, which I infer is the reason why the MSVC++ "rename()" doesn't do so. We must therefore remove the target file first, on Windows. */ - if (remove(ff_path) < 0 && errno != ENOENT) { + if (eth_remove(ff_path) < 0 && errno != ENOENT) { /* It failed for some reason other than "it's not there"; if it's not there, we don't need to remove it, so we just drive on. */ *pref_path_return = ff_path; *errno_return = errno; - unlink(ff_path_new); + eth_unlink(ff_path_new); g_free(ff_path_new); return; } #endif - if (rename(ff_path_new, ff_path) < 0) { + if (eth_rename(ff_path_new, ff_path) < 0) { *pref_path_return = ff_path; *errno_return = errno; - unlink(ff_path_new); + eth_unlink(ff_path_new); g_free(ff_path_new); return; } |