summaryrefslogtreecommitdiffstats
path: root/src/file_txt.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2013-12-14 21:36:24 +0100
committerChristophe Grenier <grenier@cgsecurity.org>2013-12-14 21:40:04 +0100
commit3213247d998d58627eb4029afce6be8680de3b30 (patch)
tree96d4a64aca2201410703b5c15589715fe1557aa1 /src/file_txt.c
parent5de0329f2184bdf89e087f414b651448df096c1f (diff)
PhotoRec: use an enum for values returned by data_check()
rename .m2ts and .ts using pid from header
Diffstat (limited to 'src/file_txt.c')
-rw-r--r--src/file_txt.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/file_txt.c b/src/file_txt.c
index 1ce5021..4debec8 100644
--- a/src/file_txt.c
+++ b/src/file_txt.c
@@ -418,7 +418,7 @@ static int UTFsize(const unsigned char *buffer, const unsigned int buf_len)
return i;
}
-static int data_check_html(const unsigned char *buffer, const unsigned int buffer_size, file_recovery_t *file_recovery)
+static data_check_t data_check_html(const unsigned char *buffer, const unsigned int buffer_size, file_recovery_t *file_recovery)
{
const char sign_html_end[] = "</html>";
const unsigned int i=UTFsize(&buffer[buffer_size/2], buffer_size/2);
@@ -430,33 +430,33 @@ static int data_check_html(const unsigned char *buffer, const unsigned int buffe
if(buffer[j]=='<' && strncasecmp((const char *)&buffer[j], sign_html_end, sizeof(sign_html_end)-1)==0)
{
file_recovery->calculated_file_size+=j-buffer_size/2+sizeof(sign_html_end)-1;
- return 2;
+ return DC_STOP;
}
}
if(i<buffer_size/2)
{
if(i>=10)
file_recovery->calculated_file_size=file_recovery->file_size+i;
- return 2;
+ return DC_STOP;
}
file_recovery->calculated_file_size=file_recovery->file_size+(buffer_size/2);
- return 1;
+ return DC_CONTINUE;
}
-static int data_check_txt(const unsigned char *buffer, const unsigned int buffer_size, file_recovery_t *file_recovery)
+static data_check_t data_check_txt(const unsigned char *buffer, const unsigned int buffer_size, file_recovery_t *file_recovery)
{
const unsigned int i=UTFsize(&buffer[buffer_size/2], buffer_size/2);
if(i<buffer_size/2)
{
if(i>=10)
file_recovery->calculated_file_size=file_recovery->file_size+i;
- return 2;
+ return DC_STOP;
}
file_recovery->calculated_file_size=file_recovery->file_size+(buffer_size/2);
- return 1;
+ return DC_CONTINUE;
}
-static int data_check_ttd(const unsigned char *buffer, const unsigned int buffer_size, file_recovery_t *file_recovery)
+static data_check_t data_check_ttd(const unsigned char *buffer, const unsigned int buffer_size, file_recovery_t *file_recovery)
{
unsigned int i;
for(i=buffer_size/2; i<buffer_size; i++)
@@ -465,10 +465,10 @@ static int data_check_ttd(const unsigned char *buffer, const unsigned int buffer
if((car>='A' && car<='F') || (car >='0' && car <='9') || car==' ' || car=='\n')
continue;
file_recovery->calculated_file_size=file_recovery->file_size + i - buffer_size/2;
- return 2;
+ return DC_STOP;
}
file_recovery->calculated_file_size=file_recovery->file_size+(buffer_size/2);
- return 1;
+ return DC_CONTINUE;
}
static int header_check_ttd(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)