summaryrefslogtreecommitdiffstats
path: root/src/file_dwg.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2014-07-24 23:43:50 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2014-07-24 23:45:07 +0200
commite1d8877998358ea54dd425d1c6d55e3085d8b9d5 (patch)
tree2ad9d61b8060169ccd83ec335297627614d22e4d /src/file_dwg.c
parent1af19422ebcd82a6165599e71082a18c2d0813ca (diff)
PhotoRec: remove useless check for .dwg
Diffstat (limited to 'src/file_dwg.c')
-rw-r--r--src/file_dwg.c40
1 files changed, 14 insertions, 26 deletions
diff --git a/src/file_dwg.c b/src/file_dwg.c
index 3ef883b..59f434d 100644
--- a/src/file_dwg.c
+++ b/src/file_dwg.c
@@ -31,7 +31,6 @@
#include "filegen.h"
static void register_header_check_dwg(file_stat_t *file_stat);
-static int header_check_dwg(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_dwg= {
.extension="dwg",
@@ -43,17 +42,23 @@ const file_hint_t file_hint_dwg= {
.register_header_check=&register_header_check_dwg
};
-static const unsigned char dwg_header_12[11]= {'A', 'C', '1', '0', '1', '2', 0x00, 0x00, 0x00, 0x00, 0x00};
-static const unsigned char dwg_header_13[11]= {'A', 'C', '1', '0', '1', '3', 0x00, 0x00, 0x00, 0x00, 0x00};
-static const unsigned char dwg_header_14[11]= {'A', 'C', '1', '0', '1', '4', 0x00, 0x00, 0x00, 0x00, 0x00};
-static const unsigned char dwg_header_15[11]= {'A', 'C', '1', '0', '1', '5', 0x00, 0x00, 0x00, 0x00, 0x00};
-static const unsigned char dwg_header_18[11]= {'A', 'C', '1', '0', '1', '8', 0x00, 0x00, 0x00, 0x00, 0x00};
-static const unsigned char dwg_header_21[11]= {'A', 'C', '1', '0', '2', '1', 0x00, 0x00, 0x00, 0x00, 0x00};
-static const unsigned char dwg_header_23[11]= {'A', 'C', '1', '0', '2', '3', 0x00, 0x00, 0x00, 0x00, 0x00};
-static const unsigned char dwg_header_24[11]= {'A', 'C', '1', '0', '2', '4', 0x00, 0x00, 0x00, 0x00, 0x00};
+static int header_check_dwg(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)
+{
+ reset_file_recovery(file_recovery_new);
+ file_recovery_new->extension=file_hint_dwg.extension;
+ return 1;
+}
static void register_header_check_dwg(file_stat_t *file_stat)
{
+ static const unsigned char dwg_header_12[11]= {'A', 'C', '1', '0', '1', '2', 0x00, 0x00, 0x00, 0x00, 0x00};
+ static const unsigned char dwg_header_13[11]= {'A', 'C', '1', '0', '1', '3', 0x00, 0x00, 0x00, 0x00, 0x00};
+ static const unsigned char dwg_header_14[11]= {'A', 'C', '1', '0', '1', '4', 0x00, 0x00, 0x00, 0x00, 0x00};
+ static const unsigned char dwg_header_15[11]= {'A', 'C', '1', '0', '1', '5', 0x00, 0x00, 0x00, 0x00, 0x00};
+ static const unsigned char dwg_header_18[11]= {'A', 'C', '1', '0', '1', '8', 0x00, 0x00, 0x00, 0x00, 0x00};
+ static const unsigned char dwg_header_21[11]= {'A', 'C', '1', '0', '2', '1', 0x00, 0x00, 0x00, 0x00, 0x00};
+ static const unsigned char dwg_header_23[11]= {'A', 'C', '1', '0', '2', '3', 0x00, 0x00, 0x00, 0x00, 0x00};
+ static const unsigned char dwg_header_24[11]= {'A', 'C', '1', '0', '2', '4', 0x00, 0x00, 0x00, 0x00, 0x00};
register_header_check(0, dwg_header_12,sizeof(dwg_header_12), &header_check_dwg, file_stat);
register_header_check(0, dwg_header_13,sizeof(dwg_header_13), &header_check_dwg, file_stat);
register_header_check(0, dwg_header_14,sizeof(dwg_header_14), &header_check_dwg, file_stat);
@@ -63,20 +68,3 @@ static void register_header_check_dwg(file_stat_t *file_stat)
register_header_check(0, dwg_header_23,sizeof(dwg_header_23), &header_check_dwg, file_stat);
register_header_check(0, dwg_header_24,sizeof(dwg_header_24), &header_check_dwg, file_stat);
}
-
-static int header_check_dwg(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)
-{
- if(memcmp(buffer,dwg_header_12,sizeof(dwg_header_12))==0 ||
- memcmp(buffer,dwg_header_13,sizeof(dwg_header_13))==0 ||
- memcmp(buffer,dwg_header_14,sizeof(dwg_header_14))==0 ||
- memcmp(buffer,dwg_header_15,sizeof(dwg_header_15))==0 ||
- memcmp(buffer,dwg_header_18,sizeof(dwg_header_18))==0 ||
- memcmp(buffer,dwg_header_21,sizeof(dwg_header_21))==0 ||
- memcmp(buffer,dwg_header_24,sizeof(dwg_header_24))==0)
- {
- reset_file_recovery(file_recovery_new);
- file_recovery_new->extension=file_hint_dwg.extension;
- return 1;
- }
- return 0;
-}