mirror of https://git.ffmpeg.org/ffmpeg.git
Cosmetics: consistently apply K&R style.
Make me and Diego happy. Originally committed as revision 23404 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
9711439b44
commit
0cd28d9494
|
@ -71,13 +71,13 @@ static const int8_t si_prefixes['z' - 'E' + 1]={
|
||||||
['Y'-'E']= 24,
|
['Y'-'E']= 24,
|
||||||
};
|
};
|
||||||
|
|
||||||
double av_strtod(const char *numstr, char **tail) {
|
double av_strtod(const char *numstr, char **tail)
|
||||||
|
{
|
||||||
double d;
|
double d;
|
||||||
char *next;
|
char *next;
|
||||||
d = strtod(numstr, &next);
|
d = strtod(numstr, &next);
|
||||||
/* if parsing succeeded, check for and interpret postfixes */
|
/* if parsing succeeded, check for and interpret postfixes */
|
||||||
if (next!=numstr) {
|
if (next!=numstr) {
|
||||||
|
|
||||||
if (*next >= 'E' && *next <= 'z') {
|
if (*next >= 'E' && *next <= 'z') {
|
||||||
int e= si_prefixes[*next - 'E'];
|
int e= si_prefixes[*next - 'E'];
|
||||||
if (e) {
|
if (e) {
|
||||||
|
@ -103,7 +103,8 @@ double av_strtod(const char *numstr, char **tail) {
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int strmatch(const char *s, const char *prefix){
|
static int strmatch(const char *s, const char *prefix)
|
||||||
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i=0; prefix[i]; i++) {
|
for (i=0; prefix[i]; i++) {
|
||||||
if (prefix[i] != s[i]) return 0;
|
if (prefix[i] != s[i]) return 0;
|
||||||
|
@ -129,7 +130,8 @@ struct AVExpr {
|
||||||
struct AVExpr *param[2];
|
struct AVExpr *param[2];
|
||||||
};
|
};
|
||||||
|
|
||||||
static double eval_expr(Parser * p, AVExpr * e) {
|
static double eval_expr(Parser *p, AVExpr *e)
|
||||||
|
{
|
||||||
switch (e->type) {
|
switch (e->type) {
|
||||||
case e_value: return e->value;
|
case e_value: return e->value;
|
||||||
case e_const: return e->value * p->const_values[e->a.const_index];
|
case e_const: return e->value * p->const_values[e->a.const_index];
|
||||||
|
@ -169,7 +171,8 @@ static double eval_expr(Parser * p, AVExpr * e) {
|
||||||
|
|
||||||
static int parse_expr(AVExpr **e, Parser *p);
|
static int parse_expr(AVExpr **e, Parser *p);
|
||||||
|
|
||||||
void ff_free_expr(AVExpr * e) {
|
void ff_free_expr(AVExpr *e)
|
||||||
|
{
|
||||||
if (!e) return;
|
if (!e) return;
|
||||||
ff_free_expr(e->param[0]);
|
ff_free_expr(e->param[0]);
|
||||||
ff_free_expr(e->param[1]);
|
ff_free_expr(e->param[1]);
|
||||||
|
@ -296,7 +299,8 @@ static int parse_primary(AVExpr **e, Parser *p)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static AVExpr * new_eval_expr(int type, int value, AVExpr *p0, AVExpr *p1){
|
static AVExpr *new_eval_expr(int type, int value, AVExpr *p0, AVExpr *p1)
|
||||||
|
{
|
||||||
AVExpr *e = av_mallocz(sizeof(AVExpr));
|
AVExpr *e = av_mallocz(sizeof(AVExpr));
|
||||||
if (!e)
|
if (!e)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -419,7 +423,8 @@ static int parse_expr(AVExpr **e, Parser *p)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int verify_expr(AVExpr * e) {
|
static int verify_expr(AVExpr *e)
|
||||||
|
{
|
||||||
if (!e) return 0;
|
if (!e) return 0;
|
||||||
switch (e->type) {
|
switch (e->type) {
|
||||||
case e_value:
|
case e_value:
|
||||||
|
@ -476,7 +481,8 @@ end:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
double ff_eval_expr(AVExpr *e, const double *const_values, void *opaque) {
|
double ff_eval_expr(AVExpr *e, const double *const_values, void *opaque)
|
||||||
|
{
|
||||||
Parser p;
|
Parser p;
|
||||||
|
|
||||||
p.const_values = const_values;
|
p.const_values = const_values;
|
||||||
|
@ -514,7 +520,8 @@ static const char *const_names[]={
|
||||||
"E",
|
"E",
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
int main(void){
|
int main(void)
|
||||||
|
{
|
||||||
int i;
|
int i;
|
||||||
double d;
|
double d;
|
||||||
ff_parse_and_eval_expr(&d, "1+(5-2)^(3-1)+1/2+sin(PI)-max(-2.2,-3.1)", const_names, const_values, NULL, NULL, NULL, NULL, NULL, 0, NULL);
|
ff_parse_and_eval_expr(&d, "1+(5-2)^(3-1)+1/2+sin(PI)-max(-2.2,-3.1)", const_names, const_values, NULL, NULL, NULL, NULL, NULL, 0, NULL);
|
||||||
|
|
Loading…
Reference in New Issue