Rework ND_DataStruct_Check_I() and ND_Index_Check_I() functions.

This commit is contained in:
agibert 2002-02-27 16:08:07 +00:00
parent 2a80300887
commit b649d3b5ea

View File

@ -1,18 +1,20 @@
/*---------------------------------------------------------------------------------*/
/* $RCSfile: libnode.c,v $ */
/*---------------------------------------------------------------------------------*/
/* $Revision: 2.2 $ */
/* $Revision: 2.3 $ */
/* $Name: $ */
/* $Date: 2002/02/26 16:38:19 $ */
/* $Date: 2002/02/27 16:08:07 $ */
/* $Author: agibert $ */
/*---------------------------------------------------------------------------------*/
#define _LIBNODE_C_
#include <libnode.h>
#ifdef _LIBVER
VER_INFO_EXPORT (libnode,"$Revision: 2.2 $", "$Name: $",__FILE__,"$Author: agibert $")
VER_INFO_EXPORT (libnode,"$Revision: 2.3 $", "$Name: $",__FILE__,"$Author: agibert $")
#endif
@ -21,7 +23,6 @@ VER_INFO_EXPORT (libnode,"$Revision: 2.2 $", "$Name: $",__FILE__,"$Author: agib
/*------------------------------------------------------------------------------*/
/*------------------------------------------------------------------------------*/
/* Node Manager Template */
@ -42,7 +43,7 @@ NDT_Status ND_Default_Manager( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, NDT
Command_Name = "NDD_CMD_MANAGER_VERSION";
*Version_Name_Ptr = "$Revision: 2.2 $ $Name: $ $Date: 2002/02/26 16:38:19 $ $Author: agibert $";
*Version_Name_Ptr = "$Revision: 2.3 $ $Name: $ $Date: 2002/02/27 16:08:07 $ $Author: agibert $";
return( NDS_OK);
}
@ -872,45 +873,42 @@ NDT_Status ND_DataStruct_Flush_C( NDT_Root *Root_Ptr)
/* (I) Out : flux de sortie du rapport */
/*------------------------------------------------------------------------------*/
NDT_Status ND_Index_Check_I( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, int *Nb_Detected_Ptr, int *Nb_Corrected_Ptr, FILE *Out)
NDT_Status ND_Index_Check_I( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, int *Detected_Nb_Ptr, int *Corrected_Nb_Ptr, FILE *Out)
{
*Detected_Nb_Ptr = 0;
*Corrected_Nb_Ptr = 0;
if( ND_INDEX_STATUS_OPENED_IS( Root_Ptr, Index_Id))
{
if( ND_INDEX_TYPE_LIST_IS( Root_Ptr, Index_Id))
{
ND_List_Check( Root_Ptr, Index_Id, Nb_Detected_Ptr, Nb_Corrected_Ptr, Out);
ND_List_Check( Root_Ptr, Index_Id, Detected_Nb_Ptr, Corrected_Nb_Ptr, Out);
}
else if( ND_INDEX_TYPE_TREE_IS( Root_Ptr, Index_Id))
{
ND_Tree_Check( Root_Ptr, Index_Id, Nb_Detected_Ptr, Nb_Corrected_Ptr, Out);
ND_Tree_Check( Root_Ptr, Index_Id, Detected_Nb_Ptr, Corrected_Nb_Ptr, Out);
}
else
{
sprintf( ND_Error_Msg, "Error ND_DataStruct_Check : unknown structure type (%d) in structure (%p:%d)\n", Root_Ptr->Index_Tab[Index_Id].Type, Root_Ptr, Index_Id);
ND_Error_Print();
(*Nb_Detected_Ptr)++;
return(NDS_ERRAPI);
}
}
else
{
Nb_Detected_Ptr = 0;
Nb_Corrected_Ptr = 0;
(*Detected_Nb_Ptr)++;
return( NDS_OK);
}
/* Affichage du résultat de la procédure de vérification */
if(*Nb_Detected_Ptr == 0)
if( *Detected_Nb_Ptr == 0)
{
fprintf( Out, "No error detected in the node structure (%p:%d)\n", Root_Ptr, Index_Id);
}
else
{
fprintf (Out, "%d/%d error(s) corrected in the node structure (%p:%d)\n", *Nb_Corrected_Ptr, *Nb_Detected_Ptr, Root_Ptr, Index_Id);
fprintf( Out, "%d/%d error(s) corrected in the node structure (%p:%d)\n", *Corrected_Nb_Ptr, *Detected_Nb_Ptr, Root_Ptr, Index_Id);
}
}
if( *Nb_Corrected_Ptr < *Nb_Detected_Ptr) return( NDS_KO);
return( NDS_OK);
}
@ -965,19 +963,23 @@ NDT_Status ND_Index_Check_C( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, int
/* (I) Out : flux de sortie du rapport */
/*------------------------------------------------------------------------------*/
NDT_Status ND_DataStruct_Check_I( NDT_Root *Root_Ptr, int *Nb_Detected_Ptr, int *Nb_Corrected_Ptr, FILE *Out)
NDT_Status ND_DataStruct_Check_I( NDT_Root *Root_Ptr, int *Error_Detected_Nb_Ptr, int *Error_Corrected_Nb_Ptr, FILE *Out)
{
NDT_Status status;
NDT_Index_Id index_id;
int index_error_detected_nb, index_error_corrected_nb;
for( index_id = 0; index_id < Root_Ptr->Index_Nb; index_id++)
{
status = ND_Index_Check_I( Root_Ptr, index_id, Nb_Detected_Ptr, Nb_Corrected_Ptr, Out);
status = ND_Index_Check_I( Root_Ptr, index_id, &index_error_detected_nb, &index_error_corrected_nb, Out);
if( ND_ERROR(status)) return(status);
*Error_Detected_Nb_Ptr = *Error_Detected_Nb_Ptr + index_error_detected_nb;
*Error_Corrected_Nb_Ptr = *Error_Corrected_Nb_Ptr + index_error_corrected_nb;
}
return NDS_OK;
return( NDS_OK);
}