diff --git a/epan/prefs-int.h b/epan/prefs-int.h index e785a5d144..bfce87bb52 100644 --- a/epan/prefs-int.h +++ b/epan/prefs-int.h @@ -40,8 +40,8 @@ struct pref_module { }; /* - * Module used for protocol preferences. With MSVC and a - * libwireshark.dll, we need a special declaration. + * Module used for protocol preferences. + * With MSVC and a libwireshark.dll, we need a special declaration. */ WS_VAR_IMPORT module_t *protocols_module; diff --git a/epan/prefs.c b/epan/prefs.c index 282b642aed..5ee9225049 100644 --- a/epan/prefs.c +++ b/epan/prefs.c @@ -136,7 +136,7 @@ module_compare_title(gconstpointer p1_arg, gconstpointer p2_arg) * the title used in the tab for it in a preferences dialog box, and a * routine to call back when we apply the preferences. */ -module_t * +static module_t * prefs_register_module(module_t *parent, const char *name, const char *title, const char *description, void (*apply_cb)(void)) { @@ -1319,11 +1319,11 @@ read_prefs_file(const char *pf_path, FILE *pf, pref_set_pair_cb pref_set_pair_fc * question. Return an indication of whether it succeeded or failed * in some fashion. */ -int +prefs_set_pref_e prefs_set_pref(char *prefarg) { gchar *p, *colonp; - int ret; + prefs_set_pref_e ret; /* * Set the counters of "mgcp.{tcp,udp}.port" entries we've @@ -1499,7 +1499,7 @@ string_to_name_resolve(char *string, guint32 *name_resolve) return '\0'; } -static int +static prefs_set_pref_e set_pref(gchar *pref_name, gchar *value, void *private_data _U_) { GList *col_l, *col_l_elt; diff --git a/epan/prefs.h b/epan/prefs.h index 2fbeccd4e3..d8c5b89615 100644 --- a/epan/prefs.h +++ b/epan/prefs.h @@ -40,6 +40,7 @@ #define MAX_VAL_LEN 1024 /* only GTK1 *or* GTK2 font_name should be used */ +/* (we need to keep both in the preferences file but will only use the one suitable for the programs GTK version used) */ #if GTK_MAJOR_VERSION < 2 #define PREFS_GUI_FONT_NAME gui_font_name1 #else @@ -243,6 +244,7 @@ extern void prefs_apply_all(void); */ extern void prefs_apply(module_t *module); + struct preference; typedef struct preference pref_t; @@ -257,6 +259,16 @@ extern gboolean prefs_is_registered_protocol(const char *name); */ extern const char *prefs_get_title_by_name(const char *name); +/** Given a module name, return a pointer to its pref_module struct, + * or NULL if it's not found. + * + * @param name The preference module name. Usually the same as the protocol + * name, e.g. "tcp". + * @return A pointer to the corresponding preference module, or NULL if it + * wasn't found. + */ +extern module_t *prefs_find_module(const char *name); + /* * Register a preference with an unsigned integral value. */ @@ -354,21 +366,13 @@ extern void free_prefs(e_prefs *pr); * XXX - should supply, for syntax errors, a detailed explanation of * the syntax error. */ -#define PREFS_SET_OK 0 /* succeeded */ -#define PREFS_SET_SYNTAX_ERR 1 /* syntax error in string */ -#define PREFS_SET_NO_SUCH_PREF 2 /* no such preference */ -#define PREFS_SET_OBSOLETE 3 /* preference used to exist but no longer does */ +typedef enum { + PREFS_SET_OK, /* succeeded */ + PREFS_SET_SYNTAX_ERR, /* syntax error in string */ + PREFS_SET_NO_SUCH_PREF, /* no such preference */ + PREFS_SET_OBSOLETE /* preference used to exist but no longer does */ +} prefs_set_pref_e; -/** Given a module name, return a pointer to its pref_module struct, - * or NULL if it's not found. - * - * @param name The preference module name. Usually the same as the protocol - * name, e.g. "tcp". - * @return A pointer to the corresponding preference module, or NULL if it - * wasn't found. - */ -module_t *prefs_find_module(const char *name); - -extern int prefs_set_pref(char *prefarg); +extern prefs_set_pref_e prefs_set_pref(char *prefarg); #endif /* prefs.h */