src/file_bpg.c: improve Frama-C annotations
This commit is contained in:
parent
f4a95b0f45
commit
053fc5b5f9
1 changed files with 3 additions and 18 deletions
|
@ -37,7 +37,7 @@
|
||||||
|
|
||||||
#define MAX_BPG_SIZE 0x800000
|
#define MAX_BPG_SIZE 0x800000
|
||||||
|
|
||||||
/*@ requires \valid(file_stat); */
|
/*@ requires valid_register_header_check(file_stat); */
|
||||||
static void register_header_check_bpg(file_stat_t *file_stat);
|
static void register_header_check_bpg(file_stat_t *file_stat);
|
||||||
|
|
||||||
const file_hint_t file_hint_bpg= {
|
const file_hint_t file_hint_bpg= {
|
||||||
|
@ -82,30 +82,15 @@ static unsigned int getue32(const unsigned char *buffer, const unsigned int buff
|
||||||
}
|
}
|
||||||
|
|
||||||
/*@
|
/*@
|
||||||
@ requires buffer_size > 0;
|
|
||||||
@ requires \valid_read(buffer+(0..buffer_size-1));
|
|
||||||
@ requires \valid_read(file_recovery);
|
|
||||||
@ requires file_recovery->file_stat==\null || valid_read_string((char*)file_recovery->filename);
|
|
||||||
@ requires \valid(file_recovery_new);
|
|
||||||
@ requires file_recovery_new->blocksize > 0;
|
|
||||||
@
|
|
||||||
@ requires buffer_size >= 6+3*5;
|
@ requires buffer_size >= 6+3*5;
|
||||||
@ requires separation: \separated(&file_hint_bpg, buffer+(..), file_recovery, file_recovery_new);
|
@ requires separation: \separated(&file_hint_bpg, buffer+(..), file_recovery, file_recovery_new);
|
||||||
@
|
@ requires valid_header_check_param(buffer, buffer_size, safe_header_only, file_recovery, file_recovery_new);
|
||||||
@ ensures \result == 0 || \result == 1;
|
@ ensures valid_header_check_result(\result, file_recovery_new);
|
||||||
@ ensures (\result == 1) ==> (file_recovery_new->file_stat == \null);
|
|
||||||
@ ensures (\result == 1) ==> (file_recovery_new->handle == \null);
|
|
||||||
@ ensures (\result == 1) ==> \initialized(&file_recovery_new->time);
|
|
||||||
@ ensures (\result == 1) ==> \initialized(&file_recovery_new->calculated_file_size);
|
|
||||||
@ ensures (\result == 1) ==> file_recovery_new->file_size == 0;
|
@ ensures (\result == 1) ==> file_recovery_new->file_size == 0;
|
||||||
@ ensures (\result == 1) ==> \initialized(&file_recovery_new->min_filesize);
|
|
||||||
@ ensures (\result != 0) ==> file_recovery_new->extension != \null;
|
|
||||||
@
|
|
||||||
@ ensures (\result == 1) ==> (file_recovery_new->time == 0);
|
@ ensures (\result == 1) ==> (file_recovery_new->time == 0);
|
||||||
@ ensures (\result == 1) ==> (file_recovery_new->extension == file_hint_bpg.extension);
|
@ ensures (\result == 1) ==> (file_recovery_new->extension == file_hint_bpg.extension);
|
||||||
@ ensures (\result == 1) ==> (file_recovery_new->data_check== &data_check_size);
|
@ ensures (\result == 1) ==> (file_recovery_new->data_check== &data_check_size);
|
||||||
@ ensures (\result == 1) ==> (file_recovery_new->file_check == &file_check_size);
|
@ ensures (\result == 1) ==> (file_recovery_new->file_check == &file_check_size);
|
||||||
@ ensures \result!=0 ==> valid_file_recovery(file_recovery_new);
|
|
||||||
@ assigns *file_recovery_new;
|
@ assigns *file_recovery_new;
|
||||||
@*/
|
@*/
|
||||||
static int header_check_bpg(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)
|
static int header_check_bpg(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