changeset 11616:1461e6044153 libavcodec

Fix constness for func[12] parameters in ff_parse_expr() and ff_parse_and_eval_expr(). Change func[12] attributes from "** func" to "* const * func". This is consistent with the semantics of the provided arrays of functions, which are not supposed to be changed by the ff_parse_* functions. Also fix the GCC compilation warnings: libavcodec/ratecontrol.c: In function ¡Æff_rate_control_init¡Ç: libavcodec/ratecontrol.c:109: warning: passing argument 3 of ¡Æff_parse_expr¡Ç discards qualifiers from pointer target type libavcodec/eval.h:69: note: expected ¡Ædouble (**)(void *, double)¡Ç but argument is of type ¡Ædouble (* const*)(void *, double)¡Ç
author stefano
date Mon, 12 Apr 2010 20:22:55 +0000
parents 17ce5438a9c9
children bb17732c00ef
files eval.c eval.h
diffstat 2 files changed, 11 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/eval.c	Mon Apr 12 19:21:19 2010 +0000
+++ b/eval.c	Mon Apr 12 20:22:55 2010 +0000
@@ -34,9 +34,9 @@
     char *s;
     const double *const_value;
     const char * const *const_name;          // NULL terminated
-    double (**func1)(void *, double a); // NULL terminated
+    double (* const *func1)(void *, double a);           // NULL terminated
     const char * const *func1_name;          // NULL terminated
-    double (**func2)(void *, double a, double b); // NULL terminated
+    double (* const *func2)(void *, double a, double b); // NULL terminated
     const char * const *func2_name;          // NULL terminated
     void *opaque;
     const char **error;
@@ -370,8 +370,8 @@
 }
 
 AVExpr *ff_parse_expr(const char *s, const char * const *const_name,
-               double (**func1)(void *, double), const char * const *func1_name,
-               double (**func2)(void *, double, double), const char * const *func2_name,
+               double (* const *func1)(void *, double), const char * const *func1_name,
+               double (* const *func2)(void *, double, double), const char * const *func2_name,
                const char **error){
     Parser p;
     AVExpr *e = NULL;
@@ -413,8 +413,8 @@
 }
 
 double ff_parse_and_eval_expr(const char *s, const double *const_value, const char * const *const_name,
-               double (**func1)(void *, double), const char * const *func1_name,
-               double (**func2)(void *, double, double), const char * const *func2_name,
+               double (* const *func1)(void *, double), const char * const *func1_name,
+               double (* const *func2)(void *, double, double), const char * const *func2_name,
                void *opaque, const char **error){
     AVExpr * e = ff_parse_expr(s, const_name, func1, func1_name, func2, func2_name, error);
     double d;
--- a/eval.h	Mon Apr 12 19:21:19 2010 +0000
+++ b/eval.h	Mon Apr 12 20:22:55 2010 +0000
@@ -44,8 +44,8 @@
  * @return the value of the expression
  */
 double ff_parse_and_eval_expr(const char *s, const double *const_value, const char * const *const_name,
-               double (**func1)(void *, double), const char * const *func1_name,
-               double (**func2)(void *, double, double), const char * const *func2_name,
+               double (* const *func1)(void *, double), const char * const *func1_name,
+               double (* const *func2)(void *, double, double), const char * const *func2_name,
                void *opaque, const char **error);
 
 /**
@@ -61,9 +61,10 @@
  * @return AVExpr which must be freed with ff_free_expr() by the user when it is not needed anymore
  *         NULL if anything went wrong
  */
+
 AVExpr *ff_parse_expr(const char *s, const char * const *const_name,
-               double (**func1)(void *, double), const char * const *func1_name,
-               double (**func2)(void *, double, double), const char * const *func2_name,
+               double (* const *func1)(void *, double), const char * const *func1_name,
+               double (* const *func2)(void *, double, double), const char * const *func2_name,
                const char **error);
 
 /**