diff options
author | Cyrille Henry <nusmuk@users.sourceforge.net> | 2014-01-22 20:16:38 +0000 |
---|---|---|
committer | Cyrille Henry <nusmuk@users.sourceforge.net> | 2014-01-22 20:16:38 +0000 |
commit | b50621a88288a2024fc107673ad0f594a4ba3790 (patch) | |
tree | 5981e09258618b113e9ce447b1e894b485761d33 | |
parent | a11aaea4ba7d393d4b419b1a550dee5c4555e41d (diff) |
more arguments check
svn path=/trunk/externals/pmpd/; revision=17241
-rw-r--r-- | pmpd_set.c | 50 |
1 files changed, 25 insertions, 25 deletions
@@ -2,13 +2,13 @@ void pmpd_setK(t_pmpd *x, t_symbol *s, int argc, t_atom *argv) { int tmp, i; - if ( ( argv[0].a_type == A_FLOAT ) && ( argv[1].a_type == A_FLOAT ) ) + if ( (argc == 2) && ( argv[0].a_type == A_FLOAT ) && ( argv[1].a_type == A_FLOAT ) ) { tmp = atom_getfloatarg(0, argc, argv); tmp = max(0, min( x->nb_link-1, tmp)); x->link[tmp].K = atom_getfloatarg(1, argc, argv); } - if ( ( argv[0].a_type == A_SYMBOL ) && ( argv[1].a_type == A_FLOAT ) ) + if ( (argc == 2) && ( argv[0].a_type == A_SYMBOL ) && ( argv[1].a_type == A_FLOAT ) ) { for (i=0; i< x->nb_link; i++) { @@ -24,13 +24,13 @@ void pmpd_setD(t_pmpd *x, t_symbol *s, int argc, t_atom *argv) { int tmp, i; - if ( ( argv[0].a_type == A_FLOAT ) && ( argv[1].a_type == A_FLOAT ) ) + if ( (argc == 2) && ( argv[0].a_type == A_FLOAT ) && ( argv[1].a_type == A_FLOAT ) ) { tmp = atom_getfloatarg(0, argc, argv); tmp = max(0, min( x->nb_link-1, tmp)); x->link[tmp].D = atom_getfloatarg(1, argc, argv); } - if ( ( argv[0].a_type == A_SYMBOL ) && ( argv[1].a_type == A_FLOAT ) ) + if ( (argc == 2) && ( argv[0].a_type == A_SYMBOL ) && ( argv[1].a_type == A_FLOAT ) ) { for (i=0; i< x->nb_link; i++) { @@ -46,13 +46,13 @@ void pmpd_setD2(t_pmpd *x, t_symbol *s, int argc, t_atom *argv) { int tmp, i; - if ( ( argv[0].a_type == A_FLOAT ) && ( argv[1].a_type == A_FLOAT ) ) + if ( (argc == 2) && ( argv[0].a_type == A_FLOAT ) && ( argv[1].a_type == A_FLOAT ) ) { tmp = atom_getfloatarg(0, argc, argv); tmp = max(0, min( x->nb_mass-1, tmp)); x->mass[tmp].D2 = atom_getfloatarg(1, argc, argv); } - if ( ( argv[0].a_type == A_SYMBOL ) && ( argv[1].a_type == A_FLOAT ) ) + if ( (argc == 2) && ( argv[0].a_type == A_SYMBOL ) && ( argv[1].a_type == A_FLOAT ) ) { for (i=0; i< x->nb_mass; i++) { @@ -62,7 +62,7 @@ void pmpd_setD2(t_pmpd *x, t_symbol *s, int argc, t_atom *argv) } } } - if ( ( argv[0].a_type == A_FLOAT ) && ( argc == 1 ) ) + if ( (argc == 2) && ( argv[0].a_type == A_FLOAT ) && ( argc == 1 ) ) { for (i=0; i< x->nb_mass; i++) { @@ -76,13 +76,13 @@ void pmpd_setL(t_pmpd *x, t_symbol *s, int argc, t_atom *argv) { int tmp, i; - if ( ( argv[0].a_type == A_FLOAT ) && ( argv[1].a_type == A_FLOAT ) ) + if ( (argc == 2) && ( argv[0].a_type == A_FLOAT ) && ( argv[1].a_type == A_FLOAT ) ) { tmp = atom_getfloatarg(0, argc, argv); tmp = max(0, min( x->nb_link-1, tmp)); x->link[tmp].L = atom_getfloatarg(1, argc, argv); } - if ( ( argv[0].a_type == A_SYMBOL ) && ( argv[1].a_type == A_FLOAT ) ) + if ( (argc == 2) && ( argv[0].a_type == A_SYMBOL ) && ( argv[1].a_type == A_FLOAT ) ) { for (i=0; i< x->nb_link; i++) { @@ -153,13 +153,13 @@ void pmpd_setLKTab(t_pmpd *x, t_symbol *s, int argc, t_atom *argv) int tmp, i; t_float K_l = atom_getfloatarg(1, argc, argv); if (K_l <= 0) K_l = 1; - if ( ( argv[0].a_type == A_FLOAT ) && ( argv[1].a_type == A_FLOAT ) ) + if ( (argc == 2) && ( argv[0].a_type == A_FLOAT ) && ( argv[1].a_type == A_FLOAT ) ) { tmp = atom_getfloatarg(0, argc, argv); tmp = max(0, min( x->nb_link-1, tmp)); x->link[tmp].K_L = K_l; } - if ( ( argv[0].a_type == A_SYMBOL ) && ( argv[1].a_type == A_FLOAT ) ) + if ( (argc == 2) && ( argv[0].a_type == A_SYMBOL ) && ( argv[1].a_type == A_FLOAT ) ) { for (i=0; i< x->nb_link; i++) { @@ -176,13 +176,13 @@ void pmpd_setLDTab(t_pmpd *x, t_symbol *s, int argc, t_atom *argv) int tmp, i; t_float D_l = atom_getfloatarg(1, argc, argv); if (D_l <= 0) D_l = 1; - if ( ( argv[0].a_type == A_FLOAT ) && ( argv[1].a_type == A_FLOAT ) ) + if ( (argc == 2) && ( argv[0].a_type == A_FLOAT ) && ( argv[1].a_type == A_FLOAT ) ) { tmp = atom_getfloatarg(0, argc, argv); tmp = max(0, min( x->nb_link-1, tmp)); x->link[tmp].D_L = D_l; } - if ( ( argv[0].a_type == A_SYMBOL ) && ( argv[1].a_type == A_FLOAT ) ) + if ( (argc == 2) && ( argv[0].a_type == A_SYMBOL ) && ( argv[1].a_type == A_FLOAT ) ) { for (i=0; i< x->nb_link; i++) { @@ -198,13 +198,13 @@ void pmpd_setLinkId(t_pmpd *x, t_symbol *s, int argc, t_atom *argv) { int tmp, i; - if ( ( argv[0].a_type == A_FLOAT ) && ( argv[1].a_type == A_SYMBOL ) ) + if ( (argc == 2) && ( argv[0].a_type == A_FLOAT ) && ( argv[1].a_type == A_SYMBOL ) ) { tmp = atom_getfloatarg(0, argc, argv); tmp = max(0, min( x->nb_link-1, tmp)); x->link[tmp].Id = atom_getsymbolarg(1, argc, argv); } - if ( ( argv[0].a_type == A_SYMBOL ) && ( argv[1].a_type == A_SYMBOL ) ) + if ( (argc == 2) && ( argv[0].a_type == A_SYMBOL ) && ( argv[1].a_type == A_SYMBOL ) ) { for (i=0; i< x->nb_link; i++) { @@ -220,13 +220,13 @@ void pmpd_setMassId(t_pmpd *x, t_symbol *s, int argc, t_atom *argv) { int tmp, i; - if ( ( argv[0].a_type == A_FLOAT ) && ( argv[1].a_type == A_SYMBOL ) ) + if ( (argc == 2) && ( argv[0].a_type == A_FLOAT ) && ( argv[1].a_type == A_SYMBOL ) ) { tmp = atom_getfloatarg(0, argc, argv); tmp = max(0, min( x->nb_mass-1, tmp)); x->mass[tmp].Id = atom_getsymbolarg(1, argc, argv); } - if ( ( argv[0].a_type == A_SYMBOL ) && ( argv[1].a_type == A_SYMBOL ) ) + if ( (argc == 2) && ( argv[0].a_type == A_SYMBOL ) && ( argv[1].a_type == A_SYMBOL ) ) { for (i=0; i< x->nb_mass; i++) { @@ -241,13 +241,13 @@ void pmpd_setFixed(t_pmpd *x, t_symbol *s, int argc, t_atom *argv) { int tmp, i; - if ( argv[0].a_type == A_FLOAT ) + if ( (argc == 2) && (argc == 1) && (argv[0].a_type == A_FLOAT) ) { tmp = atom_getfloatarg(0, argc, argv); tmp = max(0, min( x->nb_mass-1, tmp)); x->mass[tmp].mobile = 0; } - if ( argv[0].a_type == A_SYMBOL ) + if ( (argc == 2) && (argc == 1) && (argv[0].a_type == A_SYMBOL) ) { for (i=0; i< x->nb_mass; i++) { @@ -263,13 +263,13 @@ void pmpd_setMobile(t_pmpd *x, t_symbol *s, int argc, t_atom *argv) { int tmp, i; - if ( argv[0].a_type == A_FLOAT ) + if ( (argc == 2) && (argc == 1) && (argv[0].a_type == A_FLOAT) ) { tmp = atom_getfloatarg(0, argc, argv); tmp = max(0, min( x->nb_mass-1, tmp)); x->mass[tmp].mobile = 1; } - if ( argv[0].a_type == A_SYMBOL ) + if ( (argc == 2) && (argc == 1) && (argv[0].a_type == A_SYMBOL) ) { for (i=0; i< x->nb_mass; i++) { @@ -285,13 +285,13 @@ void pmpd_setSpeedX(t_pmpd *x, t_symbol *s, int argc, t_atom *argv) { int tmp, i; - if ( ( argv[0].a_type == A_FLOAT ) && ( argv[1].a_type == A_FLOAT ) ) + if ( (argc == 2) && ( argv[0].a_type == A_FLOAT ) && ( argv[1].a_type == A_FLOAT ) ) { tmp = atom_getfloatarg(0, argc, argv); tmp = max(0, min( x->nb_mass-1, tmp)); x->mass[tmp].speedX = atom_getfloatarg(1, argc, argv); } - if ( ( argv[0].a_type == A_SYMBOL ) && ( argv[1].a_type == A_FLOAT ) ) + if ( (argc == 2) && ( argv[0].a_type == A_SYMBOL ) && ( argv[1].a_type == A_FLOAT ) ) { for (i=0; i< x->nb_mass; i++) { @@ -306,13 +306,13 @@ void pmpd_setForceX(t_pmpd *x, t_symbol *s, int argc, t_atom *argv) { int tmp, i; - if ( ( argv[0].a_type == A_FLOAT ) && ( argv[1].a_type == A_FLOAT ) ) + if ( (argc == 2) && ( argv[0].a_type == A_FLOAT ) && ( argv[1].a_type == A_FLOAT ) ) { tmp = atom_getfloatarg(0, argc, argv); tmp = max(0, min( x->nb_mass-1, tmp)); x->mass[tmp].forceX = atom_getfloatarg(1, argc, argv); } - if ( ( argv[0].a_type == A_SYMBOL ) && ( argv[1].a_type == A_FLOAT ) ) + if ( (argc == 2) && ( argv[0].a_type == A_SYMBOL ) && ( argv[1].a_type == A_FLOAT ) ) { for (i=0; i< x->nb_mass; i++) { |