src/filegen.c: add more Frama-C annotations
This commit is contained in:
parent
6d4908eb2f
commit
b0ca4399a9
1 changed files with 5 additions and 1 deletions
|
@ -492,6 +492,7 @@ static int file_rename_aux(file_recovery_t *file_recovery, const char *new_ext)
|
||||||
@ requires \valid_read((char *)buffer+(0..buffer_size-1));
|
@ requires \valid_read((char *)buffer+(0..buffer_size-1));
|
||||||
@ requires new_ext==\null || valid_read_string(new_ext);
|
@ requires new_ext==\null || valid_read_string(new_ext);
|
||||||
@ ensures valid_read_string((char*)&file_recovery->filename);
|
@ ensures valid_read_string((char*)&file_recovery->filename);
|
||||||
|
@ ensures new_ext==\null || valid_read_string(new_ext);
|
||||||
@*/
|
@*/
|
||||||
static int _file_rename(file_recovery_t *file_recovery, const void *buffer, const int buffer_size, const int offset, const char *new_ext, const int append_original_ext)
|
static int _file_rename(file_recovery_t *file_recovery, const void *buffer, const int buffer_size, const int offset, const char *new_ext, const int append_original_ext)
|
||||||
{
|
{
|
||||||
|
@ -608,9 +609,12 @@ static int _file_rename(file_recovery_t *file_recovery, const void *buffer, cons
|
||||||
/* The original filename begins at offset in buffer and is null terminated */
|
/* The original filename begins at offset in buffer and is null terminated */
|
||||||
int file_rename(file_recovery_t *file_recovery, const void *buffer, const int buffer_size, const int offset, const char *new_ext, const int append_original_ext)
|
int file_rename(file_recovery_t *file_recovery, const void *buffer, const int buffer_size, const int offset, const char *new_ext, const int append_original_ext)
|
||||||
{
|
{
|
||||||
|
/*@ assert new_ext==\null || valid_read_string(new_ext); */
|
||||||
if(buffer!=NULL && 0 <= offset && offset < buffer_size &&
|
if(buffer!=NULL && 0 <= offset && offset < buffer_size &&
|
||||||
_file_rename(file_recovery, buffer, buffer_size, offset, new_ext, append_original_ext)==0)
|
_file_rename(file_recovery, buffer, buffer_size, offset, new_ext, append_original_ext)==0)
|
||||||
return 0;
|
return 0;
|
||||||
|
/*@ assert valid_read_string((char const *)(&file_recovery->filename)); */
|
||||||
|
/*@ assert new_ext==\null || valid_read_string(new_ext); */
|
||||||
if(new_ext==NULL)
|
if(new_ext==NULL)
|
||||||
return 0;
|
return 0;
|
||||||
/* Try without the original filename */
|
/* Try without the original filename */
|
||||||
|
|
Loading…
Reference in a new issue