summaryrefslogtreecommitdiffstats
path: root/src/file_als.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/file_als.c')
-rw-r--r--src/file_als.c56
1 files changed, 25 insertions, 31 deletions
diff --git a/src/file_als.c b/src/file_als.c
index c83c3df..1218805 100644
--- a/src/file_als.c
+++ b/src/file_als.c
@@ -31,8 +31,6 @@
#include "filegen.h"
static void register_header_check_als(file_stat_t *file_stat);
-static int header_check_als(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);
-static void file_check_als(file_recovery_t *file_recovery);
const file_hint_t file_hint_als= {
.extension="als",
@@ -44,42 +42,38 @@ const file_hint_t file_hint_als= {
.register_header_check=&register_header_check_als
};
-/* Header
- * 0000 ab 1e 56 78 03 XX 00 00 00 00 XX 0c 4c 69 76 65 | Vx Live|
- * 0010 44 6f 63 75 6d 65 6e 74 XX 00 00 00 00 XX XX XX |Document |
- */
-static const unsigned char als_header[5]= {
- 0xab, 0x1e, 'V', 'x', 0x03
-};
-static const unsigned char als_header2[13]= {
- 0x0c, 'L', 'i', 'v', 'e', 'D', 'o', 'c',
- 'u', 'm', 'e', 'n', 't'
-};
-
-static void register_header_check_als(file_stat_t *file_stat)
+static void file_check_als(file_recovery_t *file_recovery)
{
- register_header_check(0, als_header,sizeof(als_header), &header_check_als, file_stat);
+ static const unsigned char als_footer[0x16]= {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
+ 0x80, 0x00, 0x00, 0x00, 0x80, 0x01
+ };
+ file_search_footer(file_recovery, als_footer, sizeof(als_footer), 7);
}
static int header_check_als(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,als_header,sizeof(als_header))==0 &&
- memcmp(buffer+11,als_header2,sizeof(als_header2))==0)
- {
- reset_file_recovery(file_recovery_new);
- file_recovery_new->extension=file_hint_als.extension;
- file_recovery_new->file_check=file_check_als;
- return 1;
- }
- return 0;
+ static const unsigned char als_header2[13]= {
+ 0x0c, 'L', 'i', 'v', 'e', 'D', 'o', 'c',
+ 'u', 'm', 'e', 'n', 't'
+ };
+ if(memcmp(buffer+11,als_header2,sizeof(als_header2))!=0)
+ return 0;
+ reset_file_recovery(file_recovery_new);
+ file_recovery_new->extension=file_hint_als.extension;
+ file_recovery_new->file_check=file_check_als;
+ return 1;
}
-static void file_check_als(file_recovery_t *file_recovery)
+/* Header
+ * 0000 ab 1e 56 78 03 XX 00 00 00 00 XX 0c 4c 69 76 65 | Vx Live|
+ * 0010 44 6f 63 75 6d 65 6e 74 XX 00 00 00 00 XX XX XX |Document |
+ */
+static void register_header_check_als(file_stat_t *file_stat)
{
- static const unsigned char als_footer[0x16]= {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
- 0x80, 0x00, 0x00, 0x00, 0x80, 0x01
+ static const unsigned char als_header[5]= {
+ 0xab, 0x1e, 'V', 'x', 0x03
};
- file_search_footer(file_recovery, als_footer, sizeof(als_footer), 7);
+ register_header_check(0, als_header,sizeof(als_header), &header_check_als, file_stat);
}