src/file_dir.c: improve Frama-C annotations
This commit is contained in:
parent
c241c41e10
commit
a08792b5ee
1 changed files with 11 additions and 13 deletions
|
@ -36,7 +36,7 @@
|
|||
#include "common.h"
|
||||
#include "fat_common.h"
|
||||
|
||||
/*@ requires \valid(file_stat); */
|
||||
/*@ requires valid_register_header_check(file_stat); */
|
||||
static void register_header_check_dir(file_stat_t *file_stat);
|
||||
|
||||
const file_hint_t file_hint_dir= {
|
||||
|
@ -49,9 +49,9 @@ const file_hint_t file_hint_dir= {
|
|||
};
|
||||
|
||||
/*@
|
||||
@ requires \valid(file_recovery);
|
||||
@ requires valid_file_recovery(file_recovery);
|
||||
@ requires file_recovery->file_rename==&file_rename_fatdir;
|
||||
@ requires valid_file_rename_param(file_recovery);
|
||||
@ ensures valid_file_rename_result(file_recovery);
|
||||
@*/
|
||||
static void file_rename_fatdir(file_recovery_t *file_recovery)
|
||||
{
|
||||
|
@ -69,16 +69,17 @@ static void file_rename_fatdir(file_recovery_t *file_recovery)
|
|||
/*@ assert buffer_size >= 32; */
|
||||
cluster=fat_get_cluster_from_entry((const struct msdos_dir_entry *)&buffer[0]);
|
||||
sprintf(buffer_cluster, "cluster_%u", cluster);
|
||||
#if defined(__FRAMAC__)
|
||||
buffer_cluster[sizeof(buffer_cluster)-1]='\0';
|
||||
#endif
|
||||
file_rename(file_recovery, buffer_cluster, strlen(buffer_cluster), 0, NULL, 1);
|
||||
}
|
||||
|
||||
/*@
|
||||
@ requires buffer_size >= 2;
|
||||
@ requires (buffer_size&1)==0;
|
||||
@ requires \valid_read((char *)buffer+(0..buffer_size-1));
|
||||
@ requires \valid(file_recovery);
|
||||
@ requires file_recovery->data_check == &data_check_fatdir;
|
||||
@ requires file_recovery->calculated_file_size <= PHOTOREC_MAX_FILE_SIZE;
|
||||
@ requires buffer_size >= 2;
|
||||
@ requires valid_data_check_param(buffer, buffer_size, file_recovery);
|
||||
@ ensures valid_data_check_result(\result, file_recovery);
|
||||
@ ensures \result == DC_STOP;
|
||||
@ assigns file_recovery->calculated_file_size;
|
||||
@*/
|
||||
|
@ -91,13 +92,10 @@ static data_check_t data_check_fatdir(const unsigned char *buffer, const unsigne
|
|||
|
||||
/*@
|
||||
@ requires buffer_size >= sizeof(struct msdos_dir_entry);
|
||||
@ requires \valid_read(buffer+(0..buffer_size-1));
|
||||
@ requires valid_file_recovery(file_recovery);
|
||||
@ requires \valid(file_recovery_new);
|
||||
@ requires file_recovery_new->blocksize > 0;
|
||||
@ requires separation: \separated(&file_hint_dir, buffer+(..), file_recovery, file_recovery_new);
|
||||
@ requires valid_header_check_param(buffer, buffer_size, safe_header_only, file_recovery, file_recovery_new);
|
||||
@ ensures valid_header_check_result(\result, file_recovery_new);
|
||||
@ assigns *file_recovery_new;
|
||||
@ ensures \result!=0 ==> valid_file_recovery(file_recovery_new);
|
||||
@*/
|
||||
static int header_check_dir(const unsigned char *buffer, const unsigned int buffer_size, const unsigned int safe_header_only, const file_recovery_t *file_recovery, file_recovery_t *file_recovery_new)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue