src/file_myo.c: add frama-c annotations
This commit is contained in:
parent
22b1e66917
commit
651ebcea7d
1 changed files with 11 additions and 3 deletions
|
@ -31,8 +31,8 @@
|
|||
#include "types.h"
|
||||
#include "filegen.h"
|
||||
|
||||
/*@ requires \valid(file_stat); */
|
||||
static void register_header_check_myo(file_stat_t *file_stat);
|
||||
static int header_check_myo(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);
|
||||
|
||||
const file_hint_t file_hint_myo= {
|
||||
.extension="myo",
|
||||
|
@ -43,7 +43,16 @@ const file_hint_t file_hint_myo= {
|
|||
.register_header_check=®ister_header_check_myo
|
||||
};
|
||||
|
||||
|
||||
/*@
|
||||
@ requires buffer_size >= 4;
|
||||
@ 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_myo, buffer+(..), file_recovery, file_recovery_new);
|
||||
@ ensures \result == 0 || \result == 1;
|
||||
@ ensures \result!=0 ==> valid_file_recovery(file_recovery_new);
|
||||
@*/
|
||||
static int header_check_myo(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)
|
||||
{
|
||||
const uint64_t size=(uint64_t)buffer[0]+(((uint64_t)buffer[1])<<8)+(((uint64_t)buffer[2])<<16)+(((uint64_t)buffer[3])<<24)+1;
|
||||
|
@ -63,7 +72,6 @@ static int header_check_myo(const unsigned char *buffer, const unsigned int buff
|
|||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static void register_header_check_myo(file_stat_t *file_stat)
|
||||
{
|
||||
register_header_check(0x9ce, "FC!DEF", 6, &header_check_myo, file_stat);
|
||||
|
|
Loading…
Reference in a new issue