src/file_m2ts.c: improve Frama-C annotations
This commit is contained in:
parent
f53cf3a494
commit
cf3d5b6791
1 changed files with 18 additions and 34 deletions
|
@ -31,9 +31,9 @@
|
|||
#include "types.h"
|
||||
#include "filegen.h"
|
||||
|
||||
/*@ requires \valid(file_stat); */
|
||||
/*@ requires valid_register_header_check(file_stat); */
|
||||
static void register_header_check_m2ts(file_stat_t *file_stat);
|
||||
/*@ requires \valid(file_stat); */
|
||||
/*@ requires valid_register_header_check(file_stat); */
|
||||
static void register_header_check_ts(file_stat_t *file_stat);
|
||||
|
||||
const file_hint_t file_hint_m2ts= {
|
||||
|
@ -60,14 +60,9 @@ static const unsigned char tshv_header[4] = { 'T','S','H','V'};
|
|||
static const unsigned char sdvs_header[4] = { 'S','D','V','S'};
|
||||
|
||||
/*@
|
||||
@ requires buffer_size > 0;
|
||||
@ requires (buffer_size&1)==0;
|
||||
@ requires \valid_read(buffer+(0..buffer_size-1));
|
||||
@ requires \valid(file_recovery);
|
||||
@ requires file_recovery->data_check==&data_check_ts_192;
|
||||
@ requires file_recovery->calculated_file_size <= PHOTOREC_MAX_FILE_SIZE;
|
||||
@ requires \separated(buffer + (..), file_recovery);
|
||||
@ ensures \result == DC_CONTINUE || \result == DC_STOP;
|
||||
@ requires valid_data_check_param(buffer, buffer_size, file_recovery);
|
||||
@ ensures valid_data_check_result(\result, file_recovery);
|
||||
@ assigns file_recovery->calculated_file_size;
|
||||
@*/
|
||||
static data_check_t data_check_ts_192(const unsigned char *buffer, const unsigned int buffer_size, file_recovery_t *file_recovery)
|
||||
|
@ -86,8 +81,9 @@ static data_check_t data_check_ts_192(const unsigned char *buffer, const unsigne
|
|||
}
|
||||
|
||||
/*@
|
||||
@ requires \valid(file_recovery);
|
||||
@ requires valid_file_recovery(file_recovery);
|
||||
@ requires file_recovery->file_rename==&file_rename_ts_188;
|
||||
@ requires valid_file_rename_param(file_recovery);
|
||||
@ ensures valid_file_rename_result(file_recovery);
|
||||
@*/
|
||||
static void file_rename_ts_188(file_recovery_t *file_recovery)
|
||||
{
|
||||
|
@ -116,8 +112,9 @@ static void file_rename_ts_188(file_recovery_t *file_recovery)
|
|||
}
|
||||
|
||||
/*@
|
||||
@ requires \valid(file_recovery);
|
||||
@ requires valid_file_recovery(file_recovery);
|
||||
@ requires file_recovery->file_rename==&file_rename_ts_192;
|
||||
@ requires valid_file_rename_param(file_recovery);
|
||||
@ ensures valid_file_rename_result(file_recovery);
|
||||
@*/
|
||||
static void file_rename_ts_192(file_recovery_t *file_recovery)
|
||||
{
|
||||
|
@ -146,14 +143,10 @@ static void file_rename_ts_192(file_recovery_t *file_recovery)
|
|||
}
|
||||
|
||||
/*@
|
||||
@ requires buffer_size > 0;
|
||||
@ 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 buffer_size >= 0xe8 + 4;
|
||||
@ requires separation: \separated(&file_hint_m2ts, &file_hint_ts, buffer+(..), file_recovery, file_recovery_new);
|
||||
@ ensures \result == 0 || \result == 1;
|
||||
@ ensures \result!=0 ==> valid_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);
|
||||
@*/
|
||||
static int header_check_m2ts(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)
|
||||
{
|
||||
|
@ -202,14 +195,9 @@ static int header_check_m2ts(const unsigned char *buffer, const unsigned int buf
|
|||
}
|
||||
|
||||
/*@
|
||||
@ requires buffer_size > 0;
|
||||
@ requires (buffer_size&1)==0;
|
||||
@ requires \valid_read(buffer+(0..buffer_size-1));
|
||||
@ requires \valid(file_recovery);
|
||||
@ requires file_recovery->data_check==&data_check_ts_188;
|
||||
@ requires file_recovery->calculated_file_size <= PHOTOREC_MAX_FILE_SIZE;
|
||||
@ requires \separated(buffer + (..), file_recovery);
|
||||
@ ensures \result == DC_CONTINUE || \result == DC_STOP;
|
||||
@ requires valid_data_check_param(buffer, buffer_size, file_recovery);
|
||||
@ ensures valid_data_check_result(\result, file_recovery);
|
||||
@ assigns file_recovery->calculated_file_size;
|
||||
@*/
|
||||
static data_check_t data_check_ts_188(const unsigned char *buffer, const unsigned int buffer_size, file_recovery_t *file_recovery)
|
||||
|
@ -228,14 +216,10 @@ static data_check_t data_check_ts_188(const unsigned char *buffer, const unsigne
|
|||
}
|
||||
|
||||
/*@
|
||||
@ requires buffer_size > 0;
|
||||
@ 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 buffer_size >= 0x18b+sizeof(tshv_header);
|
||||
@ requires separation: \separated(&file_hint_m2ts, &file_hint_ts, buffer+(..), file_recovery, file_recovery_new);
|
||||
@ ensures \result == 0 || \result == 1;
|
||||
@ ensures \result!=0 ==> valid_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;
|
||||
@*/
|
||||
static int header_check_m2t(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