aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dfilter
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2012-12-26 05:57:06 +0000
committerGuy Harris <guy@alum.mit.edu>2012-12-26 05:57:06 +0000
commit8ed7a73e22c049a2e013bb436e599bff41fc5b9b (patch)
treead4a4cc6fb4ff4d3e3ffe3a3f8e3d056e441ae46 /epan/dfilter
parent8ede6b7dc09aa636f87147ab432a137c209e8aca (diff)
Fix a bunch of warnings.
Cast away some implicit 64-bit-to-32-bit conversion errors due to use of sizeof. Cast away some implicit 64-bit-to-32-bit conversion errors due to use of strtol() and strtoul(). Change some data types to avoid those implicit conversion warnings. When assigning a constant to a float, make sure the constant isn't a double, by appending "f" to the constant. Constify a bunch of variables, parameters, and return values to eliminate warnings due to strings being given const qualifiers. Cast away those warnings in some cases where an API we don't control forces us to do so. Enable a bunch of additional warnings by default. Note why at least some of the other warnings aren't enabled. randpkt.c and text2pcap.c are used to build programs, so they don't need to be in EXTRA_DIST. If the user specifies --enable-warnings-as-errors, add -Werror *even if the user specified --enable-extra-gcc-flags; assume they know what they're doing and are willing to have the compile fail due to the extra GCC warnings being treated as errors. svn path=/trunk/; revision=46748
Diffstat (limited to 'epan/dfilter')
-rw-r--r--epan/dfilter/dfilter-macro.c16
-rw-r--r--epan/dfilter/dfilter-macro.h2
2 files changed, 9 insertions, 9 deletions
diff --git a/epan/dfilter/dfilter-macro.c b/epan/dfilter/dfilter-macro.c
index b3f04df317..3c43191515 100644
--- a/epan/dfilter/dfilter-macro.c
+++ b/epan/dfilter/dfilter-macro.c
@@ -149,14 +149,14 @@ void dfilter_macro_dump(void) {
#endif
}
-static gchar* dfilter_macro_resolve(gchar* name, gchar** args, const gchar** error) {
+static const gchar* dfilter_macro_resolve(gchar* name, gchar** args, const gchar** error) {
GString* text;
int argc = 0;
dfilter_macro_t* m = NULL;
fvt_cache_entry_t* e;
int* arg_pos_p;
gchar** parts;
- gchar* ret;
+ const gchar* ret;
guint i;
for (i = 0; i < num_macros; i++) {
@@ -215,7 +215,7 @@ static gchar* dfilter_macro_resolve(gchar* name, gchar** args, const gchar** err
}
-static gchar* dfilter_macro_apply_recurse(const gchar* text, guint depth, const gchar** error) {
+static const gchar* dfilter_macro_apply_recurse(const gchar* text, guint depth, const gchar** error) {
enum { OUTSIDE, STARTING, NAME, ARGS } state = OUTSIDE;
GString* out;
GString* name = NULL;
@@ -293,7 +293,7 @@ static gchar* dfilter_macro_apply_recurse(const gchar* text, guint depth, const
} else if ( c == ':') {
state = ARGS;
} else if ( c == '}') {
- gchar* resolved;
+ const gchar* resolved;
g_ptr_array_add(args,NULL);
@@ -339,7 +339,7 @@ static gchar* dfilter_macro_apply_recurse(const gchar* text, guint depth, const
g_string_append_c(arg,c);
break;
} case '}': {
- gchar* resolved;
+ const gchar* resolved;
g_ptr_array_add(args,arg->str);
g_ptr_array_add(args,NULL);
@@ -369,11 +369,11 @@ finish:
FREE_ALL();
if (changed) {
- gchar* resolved = dfilter_macro_apply_recurse(out->str, depth + 1, error);
+ const gchar* resolved = dfilter_macro_apply_recurse(out->str, depth + 1, error);
g_string_free(out,TRUE);
return (*error) ? NULL : resolved;
} else {
- gchar* out_str = ep_strdup(out->str);
+ const gchar* out_str = ep_strdup(out->str);
g_string_free(out,TRUE);
return out_str;
}
@@ -387,7 +387,7 @@ on_error:
}
}
-gchar* dfilter_macro_apply(const gchar* text, const gchar** error) {
+const gchar* dfilter_macro_apply(const gchar* text, const gchar** error) {
return dfilter_macro_apply_recurse(text, 0, error);
}
diff --git a/epan/dfilter/dfilter-macro.h b/epan/dfilter/dfilter-macro.h
index 6a41dc45d6..9b03c46bdc 100644
--- a/epan/dfilter/dfilter-macro.h
+++ b/epan/dfilter/dfilter-macro.h
@@ -48,7 +48,7 @@ void dfilter_macro_save(const gchar*, gchar**);
void dfilter_macro_dump(void);
/* applies all macros to the given text and returns the resulting string or NULL on failure */
-gchar* dfilter_macro_apply(const gchar* text, const gchar** error);
+const gchar* dfilter_macro_apply(const gchar* text, const gchar** error);
void dfilter_macro_init(void);