diff options
author | Christophe Grenier <[email protected]> | 2016-07-25 07:26:57 +0200 |
---|---|---|
committer | Christophe Grenier <[email protected]> | 2016-07-25 07:26:57 +0200 |
commit | d0c0bf21ddadd60c7bb2188a66d39039d5cd2f9c (patch) | |
tree | 8c4cf61e172709fe0f50542297b8830115f4acb6 | |
parent | 9e2e4af2dcdcfc3593c28846e4cd945d7c96008f (diff) |
PhotoRec: recover Cinema 4d .c4d files
-rw-r--r-- | src/Makefile.am | 1 | ||||
-rw-r--r-- | src/file_c4d.c | 54 | ||||
-rw-r--r-- | src/file_list.c | 2 |
3 files changed, 57 insertions, 0 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index f653601d..56758faf 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -66,6 +66,7 @@ file_C = filegen.c \ file_bmp.c \ file_bpg.c \ file_bz2.c \ + file_c4d.c \ file_cab.c \ file_caf.c \ file_cam.c \ diff --git a/src/file_c4d.c b/src/file_c4d.c new file mode 100644 index 00000000..aafadedd --- /dev/null +++ b/src/file_c4d.c @@ -0,0 +1,54 @@ +/* + + File: file_c4d.c + + Copyright (C) 2016 Christophe GRENIER <[email protected]> + + This software is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write the Free Software Foundation, Inc., 51 + Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif +#ifdef HAVE_STRING_H +#include <string.h> +#endif +#include <stdio.h> +#include "types.h" +#include "filegen.h" + +static void register_header_check_c4d(file_stat_t *file_stat); + +const file_hint_t file_hint_c4d= { + .extension="c4d", + .description="Cinema 4d", + .max_filesize=PHOTOREC_MAX_FILE_SIZE, + .recover=1, + .enable_by_default=1, + .register_header_check=®ister_header_check_c4d +}; + +static int header_check_c4d(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_c4d.extension; + return 1; +} + +static void register_header_check_c4d(file_stat_t *file_stat) +{ + register_header_check(0, "QC4DC4D6", 8, &header_check_c4d, file_stat); +} diff --git a/src/file_list.c b/src/file_list.c index 2be0b593..e3af553f 100644 --- a/src/file_list.c +++ b/src/file_list.c @@ -67,6 +67,7 @@ extern const file_hint_t file_hint_blend; extern const file_hint_t file_hint_bmp; extern const file_hint_t file_hint_bpg; extern const file_hint_t file_hint_bz2; +extern const file_hint_t file_hint_c4d; extern const file_hint_t file_hint_cab; extern const file_hint_t file_hint_caf; extern const file_hint_t file_hint_cam; @@ -384,6 +385,7 @@ file_enable_t list_file_enable[]= { .enable=0, .file_hint=&file_hint_bmp }, { .enable=0, .file_hint=&file_hint_bpg }, { .enable=0, .file_hint=&file_hint_bz2 }, + { .enable=0, .file_hint=&file_hint_c4d }, { .enable=0, .file_hint=&file_hint_cab }, { .enable=0, .file_hint=&file_hint_caf }, { .enable=0, .file_hint=&file_hint_cam }, |