MCPcopy Create free account
hub / github.com/cgsecurity/testdisk / file_found

Function file_found

src/file_found.c:46–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44#include "file_found.h"
45
46alloc_data_t *file_found(alloc_data_t *current_search_space, const uint64_t offset, file_stat_t *file_stat)
47{
48 if(current_search_space==NULL)
49 return current_search_space;
50 if(current_search_space->start == offset)
51 {
52 current_search_space->file_stat=file_stat;
53 current_search_space->data=1;
54 return current_search_space;
55 }
56 if(current_search_space->start < offset && offset <= current_search_space->end)
57 {
58 alloc_data_t *next_search_space;
59 next_search_space=(alloc_data_t*)MALLOC(sizeof(*next_search_space));
60 memcpy(next_search_space, current_search_space, sizeof(*next_search_space));
61 current_search_space->end=offset-1;
62 next_search_space->start=offset;
63 next_search_space->file_stat=file_stat;
64 next_search_space->data=1;
65 td_list_add(&next_search_space->list, &current_search_space->list);
66 return next_search_space;
67 }
68 return current_search_space;
69}

Callers 2

photorec_find_blocksizeFunction · 0.85

Calls 2

MALLOCFunction · 0.85
td_list_addFunction · 0.85

Tested by

no test coverage detected