Diff for /rpl/src/controle.c between versions 1.5 and 1.39

version 1.5, 2010/04/21 13:45:44 version 1.39, 2012/10/01 11:04:59
Line 1 Line 1
 /*  /*
 ================================================================================  ================================================================================
   RPL/2 (R) version 4.0.15    RPL/2 (R) version 4.1.11
   Copyright (C) 1989-2010 Dr. BERTRAND Joël    Copyright (C) 1989-2012 Dr. BERTRAND Joël
   
   This file is part of RPL/2.    This file is part of RPL/2.
   
Line 20 Line 20
 */  */
   
   
 #include "rpl.conv.h"  #include "rpl-conv.h"
   
   
 /*  /*
Line 56  controle(struct_processus *s_etat_proces Line 56  controle(struct_processus *s_etat_proces
     struct stat         stat_buf;      struct stat         stat_buf;
   
     unsigned char       *chaine;      unsigned char       *chaine;
       unsigned char       *registre;
     unsigned char       somme[EVP_MAX_MD_SIZE];      unsigned char       somme[EVP_MAX_MD_SIZE];
     unsigned char       somme_hexadecimale[2 * EVP_MAX_MD_SIZE];      unsigned char       somme_hexadecimale[2 * EVP_MAX_MD_SIZE];
   
     unsigned int        i;      unsigned int        i;
     unsigned int        longueur_somme;      unsigned int        longueur_somme;
   
       registre = fichier;
   
   #   ifdef OS2
       unsigned char       *tampon;
   
       if ((tampon = malloc((strlen(fichier) + 5) * sizeof(unsigned char)))
               == NULL)
       {
           (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
           return(d_faux);
       }
   
       sprintf(tampon, "%s.exe", fichier);
       fichier = tampon;
   #   endif
   
     if (stat(fichier, &stat_buf) != 0)      if (stat(fichier, &stat_buf) != 0)
     {      {
   #       ifdef OS2
           free(fichier);
   #       endif
   
         (*s_etat_processus).erreur_systeme = d_es_erreur_fichier;          (*s_etat_processus).erreur_systeme = d_es_erreur_fichier;
         return(d_faux);          return(d_faux);
     }      }
Line 72  controle(struct_processus *s_etat_proces Line 93  controle(struct_processus *s_etat_proces
   
     if ((chaine = malloc(taille_fichier)) == NULL)      if ((chaine = malloc(taille_fichier)) == NULL)
     {      {
   #       ifdef OS2
           free(fichier);
   #       endif
   
         (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;          (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
         return(d_faux);          return(d_faux);
     }      }
   
     if ((in_fd = open(fichier, 0, O_RDONLY)) < 0)      if ((in_fd = open(fichier, 0, O_RDONLY)) < 0)
     {      {
   #       ifdef OS2
           free(fichier);
   #       endif
   
         free(chaine);          free(chaine);
   
         (*s_etat_processus).erreur_systeme = d_es_erreur_fichier;          (*s_etat_processus).erreur_systeme = d_es_erreur_fichier;
         return(d_faux);          return(d_faux);
     }      }
   
   #   ifdef OS2
       free(fichier);
   #   endif
   
     if ((octets_lus = read(in_fd, chaine, taille_fichier)) != taille_fichier)      if ((octets_lus = read(in_fd, chaine, taille_fichier)) != taille_fichier)
     {      {
   #       ifndef OS2
         close(in_fd);          close(in_fd);
         free(chaine);          free(chaine);
   
         (*s_etat_processus).erreur_systeme = d_es_erreur_fichier;          (*s_etat_processus).erreur_systeme = d_es_erreur_fichier;
         return(d_faux);          return(d_faux);
   #       endif
     }      }
   
     close(in_fd);      close(in_fd);
Line 172  controle(struct_processus *s_etat_proces Line 207  controle(struct_processus *s_etat_proces
     }      }
     else      else
     {      {
           if ((*s_etat_processus).langue == 'F')
           {
               printf("+++Fatal : Somme de contrôle invalide\n");
               printf("Fonction %s(%s)\n", type, registre);
               printf("Résultat obtenu  : %s\n", somme_hexadecimale);
               printf("Résultat attendu : %s\n", somme_candidate);
           }
           else
           {
               printf("+++Fatal : Hash code mismatch\n");
               printf("Function %s(%s)\n", type, registre);
               printf("Computed hash code : %s\n", somme_hexadecimale);
               printf("Expected hash code : %s\n", somme_candidate);
           }
   
         drapeau = d_faux;          drapeau = d_faux;
     }      }
   

Removed from v.1.5  
changed lines
  Added in v.1.39


CVSweb interface <joel.bertrand@systella.fr>