summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2019-10-13 11:30:39 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2019-10-13 11:30:39 +0200
commit62c0d6c34d27383bf000945a0cf809af25e513c3 (patch)
treea5141681dc6121b36e6eacdba4a6aa2bee5d8fcc
parent54fb54dd4b0e16438a5e415f988a979ab8659ee7 (diff)
move get_prev_location_smart() from src/photorec.h to src/filegen.h
Avoid using ftello and fseeko when using frama-c
-rw-r--r--src/common.c2
-rw-r--r--src/filegen.c5
-rw-r--r--src/filegen.h6
-rw-r--r--src/photorec.h1
4 files changed, 9 insertions, 5 deletions
diff --git a/src/common.c b/src/common.c
index 1cb866a..a7d170d 100644
--- a/src/common.c
+++ b/src/common.c
@@ -247,7 +247,7 @@ int date_dos2unix(const unsigned short f_time, const unsigned short f_date)
void set_secwest(void)
{
const time_t t = time(NULL);
-#if defined(__MINGW32__)
+#if defined(__MINGW32__) || defined(__FRAMAC__)
const struct tm *tmptr = localtime(&t);
#else
struct tm tmp;
diff --git a/src/filegen.c b/src/filegen.c
index 8e90985..800727c 100644
--- a/src/filegen.c
+++ b/src/filegen.c
@@ -38,7 +38,6 @@
#include "types.h"
#include "common.h"
#include "filegen.h"
-#include "photorec.h"
#include "log.h"
static file_check_t file_check_plist={
@@ -748,7 +747,7 @@ int header_ignored_adv(const file_recovery_t *file_recovery, const file_recovery
}
memcpy(&fr_test, file_recovery, sizeof(fr_test));
-#ifdef HAVE_FTELLO
+#if defined(HAVE_FTELLO) && !defined(__FRAMAC__)
if((offset=ftello(file_recovery->handle)) < 0)
offset=ftell(file_recovery->handle);
#else
@@ -832,7 +831,7 @@ void get_prev_location_smart(alloc_data_t *list_search_space, alloc_data_t **cur
int my_fseek(FILE *stream, off_t offset, int whence)
{
-#if defined(HAVE_FSEEKO) && !defined(__MINGW32__) && !defined(__ARM_EABI__)
+#if defined(HAVE_FSEEKO) && !defined(__MINGW32__) && !defined(__ARM_EABI__) && !defined(__FRAMAC__)
{
int res;
if((res=fseeko(stream, offset, whence))>=0)
diff --git a/src/filegen.h b/src/filegen.h
index 75f66b8..2436fc6 100644
--- a/src/filegen.h
+++ b/src/filegen.h
@@ -286,6 +286,12 @@ time_t get_time_from_YYYY_MM_DD_HHMMSS(const char *date_asc);
@*/
time_t get_time_from_YYYYMMDD_HHMMSS(const char *date_asc);
+/*@
+ @ requires \valid(list_search_space);
+ @ requires \valid(current_search_space);
+ @ requires \valid(offset);
+ @*/
+void get_prev_location_smart(alloc_data_t *list_search_space, alloc_data_t **current_search_space, uint64_t *offset, const uint64_t prev_location);
#ifdef __cplusplus
} /* closing brace for extern "C" */
#endif
diff --git a/src/photorec.h b/src/photorec.h
index ed1c08d..a6ab7ed 100644
--- a/src/photorec.h
+++ b/src/photorec.h
@@ -64,7 +64,6 @@ struct ph_param
uint64_t offset;
};
-void get_prev_location_smart(alloc_data_t *list_search_space, alloc_data_t **current_search_space, uint64_t *offset, const uint64_t prev_location);
int get_prev_file_header(alloc_data_t *list_search_space, alloc_data_t **current_search_space, uint64_t *offset);
int file_finish_bf(file_recovery_t *file_recovery, struct ph_param *params,
alloc_data_t *list_search_space);