--- rpl/src/instructions_w1.c 2013/03/10 17:01:05 1.75 +++ rpl/src/instructions_w1.c 2013/03/20 17:11:45 1.78 @@ -390,13 +390,13 @@ instruction_write(struct_processus *s_et integer8 clef; integer8 compteur; integer8 id; + integer8 longueur_effective; integer8 ordre; logical1 format_degenere; logical1 mise_a_jour; long longueur; - long longueur_effective; long recursivite; sqlite3_stmt *ppStmt; @@ -1310,6 +1310,16 @@ instruction_write(struct_processus *s_et if ((*((struct_fichier *) (*s_objet_argument_1).objet)).acces == 'S') { + if ((*s_objet_argument_2).type != LST) + { + liberation(s_etat_processus, s_objet_argument_2); + liberation(s_etat_processus, s_objet_argument_1); + + (*s_etat_processus).erreur_execution = + d_ex_erreur_type_argument; + return; + } + if ((chaine = formateur_fichier(s_etat_processus, s_objet_argument_2, (*((struct_fichier *) (*s_objet_argument_1).objet)).format, 0, 0, ' ', 'U', @@ -1344,6 +1354,34 @@ instruction_write(struct_processus *s_et else if ((*((struct_fichier *) (*s_objet_argument_1).objet)).acces == 'D') { + if ((*s_objet_argument_2).type != INT) + { + liberation(s_etat_processus, s_objet_argument_2); + liberation(s_etat_processus, s_objet_argument_1); + + (*s_etat_processus).erreur_execution = + d_ex_erreur_type_argument; + return; + } + + if (depilement(s_etat_processus, &((*s_etat_processus) + .l_base_pile), &s_objet_argument_3) == d_erreur) + { + (*s_etat_processus).erreur_execution = d_ex_manque_argument; + return; + } + + if ((*s_objet_argument_3).type != LST) + { + liberation(s_etat_processus, s_objet_argument_3); + liberation(s_etat_processus, s_objet_argument_2); + liberation(s_etat_processus, s_objet_argument_1); + + (*s_etat_processus).erreur_execution = + d_ex_erreur_type_argument; + return; + } + if ((chaine = formateur_fichier(s_etat_processus, s_objet_argument_2, (*((struct_fichier *) (*s_objet_argument_1).objet)).format, 0, 0, ' ', 'U', @@ -1357,6 +1395,16 @@ instruction_write(struct_processus *s_et } else // Fichiers indexés { + if ((*s_objet_argument_2).type != LST) + { + liberation(s_etat_processus, s_objet_argument_2); + liberation(s_etat_processus, s_objet_argument_1); + + (*s_etat_processus).erreur_execution = + d_ex_erreur_type_argument; + return; + } + if ((chaine = formateur_fichier(s_etat_processus, s_objet_argument_2, (*((struct_fichier *) (*s_objet_argument_1).objet)).format, 0, 0, ' ', 'U', @@ -1597,7 +1645,16 @@ instruction_write(struct_processus *s_et * Sockets non formatées */ - chaine = NULL; + if ((chaine = formateur_fichier(s_etat_processus, + s_objet_argument_2, (*((struct_socket *) + (*s_objet_argument_1).objet)).format, 0, 0, ' ', 'U', + &longueur_effective, &recursivite, d_faux)) == NULL) + { + liberation(s_etat_processus, s_objet_argument_2); + liberation(s_etat_processus, s_objet_argument_1); + + return; + } } else {