Finalized .BPG support.
This commit is contained in:
parent
a74c454175
commit
7966d8555f
2 changed files with 15 additions and 42 deletions
33
.gitignore
vendored
33
.gitignore
vendored
|
@ -1,33 +0,0 @@
|
|||
# Generated files
|
||||
*.o
|
||||
*.in
|
||||
*.8
|
||||
config/
|
||||
config.*
|
||||
Makefile
|
||||
.deps/
|
||||
|
||||
/autom4te.cache
|
||||
/autoscan.log
|
||||
/autoscan-*.log
|
||||
/aclocal.m4
|
||||
/compile
|
||||
/configure
|
||||
/configure.scan
|
||||
/depcomp
|
||||
/install-sh
|
||||
/missing
|
||||
/stamp-h1
|
||||
|
||||
/linux/testdisk.spec
|
||||
/src/fidentify
|
||||
/src/moc_qphotorec.cpp
|
||||
/src/photorec
|
||||
/src/photorec.ses
|
||||
/src/qphotorec
|
||||
/src/rcc_qphotorec.cpp
|
||||
/src/testdisk
|
||||
|
||||
# OS specific files
|
||||
*~
|
||||
.DS_Store
|
|
@ -5,6 +5,9 @@
|
|||
Copyright (C) 1998-2007 Christophe GRENIER <grenier@cgsecurity.org>
|
||||
Copyright (C) 2016 Dmitry Brant <me@dmitrybrant.com>
|
||||
|
||||
BPG specification can be found at:
|
||||
http://bellard.org/bpg/bpg_spec.txt
|
||||
|
||||
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
|
||||
|
@ -31,18 +34,20 @@
|
|||
#include "types.h"
|
||||
#include "filegen.h"
|
||||
|
||||
#define MAX_BPG_SIZE 0x800000
|
||||
|
||||
static void register_header_check_bpg(file_stat_t *file_stat);
|
||||
|
||||
const file_hint_t file_hint_bpg= {
|
||||
.extension="bpg",
|
||||
.description="Better Portable Graphics image",
|
||||
.max_filesize=PHOTOREC_MAX_FILE_SIZE,
|
||||
.max_filesize=MAX_BPG_SIZE,
|
||||
.recover=1,
|
||||
.enable_by_default=1,
|
||||
.register_header_check=®ister_header_check_bpg
|
||||
};
|
||||
|
||||
static int getue32(const unsigned char *buffer, const unsigned int buffer_size, unsigned int *buf_ptr)
|
||||
static unsigned int getue32(const unsigned char *buffer, const unsigned int buffer_size, unsigned int *buf_ptr)
|
||||
{
|
||||
unsigned int value = 0;
|
||||
unsigned int b;
|
||||
|
@ -66,14 +71,15 @@ static int header_check_bpg(const unsigned char *buffer, const unsigned int buff
|
|||
{
|
||||
unsigned int buf_ptr = 6;
|
||||
// get image width, and throw it away
|
||||
int width = getue32(buffer, buffer_size, &buf_ptr);
|
||||
printf(">>>> width...%d\n", width);
|
||||
unsigned int width = getue32(buffer, buffer_size, &buf_ptr);
|
||||
// get image height, and throw it away
|
||||
int height = getue32(buffer, buffer_size, &buf_ptr);
|
||||
printf(">>>> height...%d\n", height);
|
||||
int size = getue32(buffer, buffer_size, &buf_ptr);
|
||||
printf(">>>> size...%d\n", size);
|
||||
|
||||
unsigned int height = getue32(buffer, buffer_size, &buf_ptr);
|
||||
unsigned int size = getue32(buffer, buffer_size, &buf_ptr);
|
||||
if (size == 0) {
|
||||
size = MAX_BPG_SIZE;
|
||||
} else {
|
||||
size += buf_ptr;
|
||||
}
|
||||
reset_file_recovery(file_recovery_new);
|
||||
file_recovery_new->calculated_file_size=size;
|
||||
file_recovery_new->data_check=&data_check_size;
|
||||
|
|
Loading…
Reference in a new issue