summaryrefslogtreecommitdiffstats
path: root/src/file_tz.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/file_tz.c')
-rw-r--r--src/file_tz.c55
1 files changed, 24 insertions, 31 deletions
diff --git a/src/file_tz.c b/src/file_tz.c
index 1aaaee6..c1d6a76 100644
--- a/src/file_tz.c
+++ b/src/file_tz.c
@@ -35,7 +35,6 @@
#include "filegen.h"
static void register_header_check_tz(file_stat_t *file_stat);
-static int header_check_tz(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_tz= {
.extension="tz",
@@ -47,39 +46,33 @@ const file_hint_t file_hint_tz= {
.register_header_check=&register_header_check_tz
};
-/* man 5 tzfile */
-static const unsigned char tz_header[20]=
-{
- 'T', 'Z', 'i', 'f',
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char tz2_header[20]=
-{
- 'T', 'Z', 'i', 'f',
- '2', 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-};
-
-static void register_header_check_tz(file_stat_t *file_stat)
+static int header_check_tz(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)
{
- register_header_check(0, tz_header, sizeof(tz_header), &header_check_tz, file_stat);
- register_header_check(0, tz2_header, sizeof(tz2_header), &header_check_tz, file_stat);
+ reset_file_recovery(file_recovery_new);
+ file_recovery_new->extension=file_hint_tz.extension;
+ return 1;
}
-static int header_check_tz(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 register_header_check_tz(file_stat_t *file_stat)
{
- if(memcmp(buffer,tz_header,sizeof(tz_header))==0 ||
- memcmp(buffer,tz2_header,sizeof(tz2_header))==0)
+ /* man 5 tzfile */
+ static const unsigned char tz_header[20]=
{
- reset_file_recovery(file_recovery_new);
- file_recovery_new->extension=file_hint_tz.extension;
- return 1;
- }
- return 0;
+ 'T', 'Z', 'i', 'f',
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ };
+
+ static const unsigned char tz2_header[20]=
+ {
+ 'T', 'Z', 'i', 'f',
+ '2', 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ };
+ register_header_check(0, tz_header, sizeof(tz_header), &header_check_tz, file_stat);
+ register_header_check(0, tz2_header, sizeof(tz2_header), &header_check_tz, file_stat);
}