summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2020-09-11 12:58:00 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2020-09-11 12:58:00 +0200
commit79e2b889daf9992e4ed2c08b572a1544d62ed119 (patch)
treeb145c002378162534b656bfb1c622acf9ee53318
parent4ba942d12e7094004074b6808f2532b8f877019e (diff)
PhotoRec: add an ifdef in each file for easier frama-c testing
-rw-r--r--src/Makefile.am48
-rw-r--r--src/file_3dm.c8
-rw-r--r--src/file_3ds.c76
-rw-r--r--src/file_DB.c2
-rw-r--r--src/file_a.c2
-rw-r--r--src/file_ab.c15
-rw-r--r--src/file_abr.c15
-rw-r--r--src/file_acb.c2
-rw-r--r--src/file_ado.c2
-rw-r--r--src/file_afdesign.c2
-rw-r--r--src/file_ahn.c2
-rw-r--r--src/file_aif.c2
-rw-r--r--src/file_all.c2
-rw-r--r--src/file_als.c2
-rw-r--r--src/file_amd.c2
-rw-r--r--src/file_amr.c15
-rw-r--r--src/file_apa.c2
-rw-r--r--src/file_ape.c2
-rw-r--r--src/file_apple.c2
-rw-r--r--src/file_ari.c2
-rw-r--r--src/file_arj.c2
-rw-r--r--src/file_asf.c2
-rw-r--r--src/file_asl.c2
-rw-r--r--src/file_asm.c19
-rw-r--r--src/file_atd.c2
-rw-r--r--src/file_au.c2
-rw-r--r--src/file_axp.c15
-rw-r--r--src/file_axx.c2
-rw-r--r--src/file_bac.c38
-rw-r--r--src/file_bdm.c2
-rw-r--r--src/file_berkeley.c2
-rw-r--r--src/file_bfa.c78
-rw-r--r--src/file_bim.c2
-rw-r--r--src/file_bin.c2
-rw-r--r--src/file_binvox.c2
-rw-r--r--src/file_bkf.c2
-rw-r--r--src/file_bld.c85
-rw-r--r--src/file_bmp.c2
-rw-r--r--src/file_bpg.c2
-rw-r--r--src/file_bvr.c5
-rw-r--r--src/file_bz2.c2
-rw-r--r--src/file_c4d.c2
-rw-r--r--src/file_cab.c2
-rw-r--r--src/file_caf.c9
-rw-r--r--src/file_cam.c2
-rw-r--r--src/file_catdrawing.c2
-rw-r--r--src/file_cdt.c2
-rw-r--r--src/file_che.c2
-rw-r--r--src/file_chm.c2
-rw-r--r--src/file_class.c2
-rw-r--r--src/file_cm.c2
-rw-r--r--src/file_compress.c2
-rw-r--r--src/file_cow.c2
-rw-r--r--src/file_cpi.c2
-rw-r--r--src/file_crw.c2
-rw-r--r--src/file_csh.c2
-rw-r--r--src/file_ctg.c2
-rw-r--r--src/file_cwk.c2
-rw-r--r--src/file_d2s.c4
-rw-r--r--src/file_dad.c5
-rw-r--r--src/file_dar.c2
-rw-r--r--src/file_dat.c2
-rw-r--r--src/file_dbf.c2
-rw-r--r--src/file_dbn.c2
-rw-r--r--src/file_dcm.c2
-rw-r--r--src/file_ddf.c2
-rw-r--r--src/file_dex.c2
-rw-r--r--src/file_dim.c2
-rw-r--r--src/file_djv.c2
-rw-r--r--src/file_dmp.c3
-rw-r--r--src/file_doc.c17
-rw-r--r--src/file_dpx.c2
-rw-r--r--src/file_drw.c2
-rw-r--r--src/file_ds2.c2
-rw-r--r--src/file_ds_store.c2
-rw-r--r--src/file_dsc.c2
-rw-r--r--src/file_dss.c2
-rw-r--r--src/file_dst.c2
-rw-r--r--src/file_dta.c2
-rw-r--r--src/file_dump.c2
-rw-r--r--src/file_dv.c23
-rw-r--r--src/file_dvi.c2
-rw-r--r--src/file_dvr.c2
-rw-r--r--src/file_dwg.c2
-rw-r--r--src/file_dxf.c5
-rw-r--r--src/file_e01.c2
-rw-r--r--src/file_ecryptfs.c2
-rw-r--r--src/file_edb.c2
-rw-r--r--src/file_elf.c2
-rw-r--r--src/file_emf.c2
-rw-r--r--src/file_ess.c2
-rw-r--r--src/file_evt.c9
-rw-r--r--src/file_evtx.c2
-rw-r--r--src/file_exe.c2
-rw-r--r--src/file_exr.c2
-rw-r--r--src/file_exs.c4
-rw-r--r--src/file_ext.c3
-rw-r--r--src/file_ext2.c4
-rw-r--r--src/file_fbf.c2
-rw-r--r--src/file_fbk.c2
-rw-r--r--src/file_fcp.c2
-rw-r--r--src/file_fcs.c2
-rw-r--r--src/file_fdb.c2
-rw-r--r--src/file_fds.c2
-rw-r--r--src/file_fh10.c2
-rw-r--r--src/file_fh5.c2
-rw-r--r--src/file_filevault.c2
-rw-r--r--src/file_fit.c2
-rw-r--r--src/file_fits.c36
-rw-r--r--src/file_flac.c9
-rw-r--r--src/file_flp.c2
-rw-r--r--src/file_flv.c5
-rw-r--r--src/file_fm.c2
-rw-r--r--src/file_fob.c2
-rw-r--r--src/file_fos.c2
-rw-r--r--src/file_fp5.c2
-rw-r--r--src/file_fp7.c2
-rw-r--r--src/file_freeway.c2
-rw-r--r--src/file_frm.c2
-rw-r--r--src/file_fs.c5
-rw-r--r--src/file_fwd.c2
-rw-r--r--src/file_gam.c2
-rw-r--r--src/file_gct.c2
-rw-r--r--src/file_gho.c2
-rw-r--r--src/file_gi.c2
-rw-r--r--src/file_gif.c2
-rw-r--r--src/file_gm6.c2
-rw-r--r--src/file_gp2.c2
-rw-r--r--src/file_gp5.c2
-rw-r--r--src/file_gpg.c16
-rw-r--r--src/file_gpx.c2
-rw-r--r--src/file_gsm.c25
-rw-r--r--src/file_gz.c15
-rw-r--r--src/file_hdf.c2
-rw-r--r--src/file_hdr.c2
-rw-r--r--src/file_hds.c2
-rw-r--r--src/file_hfsp.c2
-rw-r--r--src/file_hm.c2
-rw-r--r--src/file_hr9.c2
-rw-r--r--src/file_http.c2
-rw-r--r--src/file_ibd.c2
-rw-r--r--src/file_icc.c2
-rw-r--r--src/file_icns.c4
-rw-r--r--src/file_ico.c2
-rw-r--r--src/file_idx.c2
-rw-r--r--src/file_ifo.c2
-rw-r--r--src/file_imb.c2
-rw-r--r--src/file_indd.c2
-rw-r--r--src/file_info.c2
-rw-r--r--src/file_iso.c2
-rw-r--r--src/file_it.c2
-rw-r--r--src/file_itu.c2
-rw-r--r--src/file_jks.c2
-rw-r--r--src/file_jpg.c66
-rw-r--r--src/file_jsonlz4.c2
-rw-r--r--src/file_kdb.c2
-rw-r--r--src/file_kdbx.c2
-rw-r--r--src/file_key.c2
-rw-r--r--src/file_ldf.c2
-rw-r--r--src/file_list.c709
-rw-r--r--src/file_lit.c2
-rw-r--r--src/file_lnk.c2
-rw-r--r--src/file_logic.c2
-rw-r--r--src/file_lso.c2
-rw-r--r--src/file_luks.c2
-rw-r--r--src/file_lxo.c2
-rw-r--r--src/file_lzh.c11
-rw-r--r--src/file_lzo.c2
-rw-r--r--src/file_m2ts.c2
-rw-r--r--src/file_mat.c2
-rw-r--r--src/file_max.c2
-rw-r--r--src/file_mb.c2
-rw-r--r--src/file_mcd.c2
-rw-r--r--src/file_mdb.c2
-rw-r--r--src/file_mdf.c2
-rw-r--r--src/file_mdp.c69
-rw-r--r--src/file_mfa.c2
-rw-r--r--src/file_mfg.c2
-rw-r--r--src/file_mft.c4
-rw-r--r--src/file_mid.c2
-rw-r--r--src/file_mig.c2
-rw-r--r--src/file_mk5.c2
-rw-r--r--src/file_mkv.c2
-rw-r--r--src/file_mlv.c43
-rw-r--r--src/file_mobi.c2
-rw-r--r--src/file_mov.c11
-rw-r--r--src/file_mp3.c14
-rw-r--r--src/file_mpg.c2
-rw-r--r--src/file_mpl.c2
-rw-r--r--src/file_mrw.c2
-rw-r--r--src/file_msa.c2
-rw-r--r--src/file_mus.c2
-rw-r--r--src/file_mxf.c2
-rw-r--r--src/file_myo.c2
-rw-r--r--src/file_mysql.c2
-rw-r--r--src/file_nd2.c2
-rw-r--r--src/file_nds.c2
-rw-r--r--src/file_nes.c2
-rw-r--r--src/file_njx.c2
-rw-r--r--src/file_nk2.c2
-rw-r--r--src/file_nsf.c2
-rw-r--r--src/file_oci.c2
-rw-r--r--src/file_ogg.c2
-rw-r--r--src/file_one.c2
-rw-r--r--src/file_orf.c2
-rw-r--r--src/file_paf.c2
-rw-r--r--src/file_pap.c2
-rw-r--r--src/file_par2.c2
-rw-r--r--src/file_pcap.c2
-rw-r--r--src/file_pcb.c2
-rw-r--r--src/file_pct.c2
-rw-r--r--src/file_pcx.c3
-rw-r--r--src/file_pdb.c2
-rw-r--r--src/file_pdf.c2
-rw-r--r--src/file_pds.c2
-rw-r--r--src/file_pf.c2
-rw-r--r--src/file_pfx.c2
-rw-r--r--src/file_pgdump.c2
-rw-r--r--src/file_plist.c2
-rw-r--r--src/file_plr.c2
-rw-r--r--src/file_plt.c2
-rw-r--r--src/file_png.c2
-rw-r--r--src/file_pnm.c2
-rw-r--r--src/file_prc.c2
-rw-r--r--src/file_prd.c2
-rw-r--r--src/file_prt.c2
-rw-r--r--src/file_ps.c2
-rw-r--r--src/file_psb.c2
-rw-r--r--src/file_psd.c2
-rw-r--r--src/file_psf.c2
-rw-r--r--src/file_psp.c2
-rw-r--r--src/file_pst.c2
-rw-r--r--src/file_ptb.c2
-rw-r--r--src/file_ptf.c2
-rw-r--r--src/file_pyc.c2
-rw-r--r--src/file_pzf.c2
-rw-r--r--src/file_pzh.c2
-rw-r--r--src/file_qbb.c9
-rw-r--r--src/file_qdf.c6
-rw-r--r--src/file_qkt.c2
-rw-r--r--src/file_qxd.c2
-rw-r--r--src/file_r3d.c2
-rw-r--r--src/file_ra.c2
-rw-r--r--src/file_raf.c2
-rw-r--r--src/file_rar.c2
-rw-r--r--src/file_raw.c2
-rw-r--r--src/file_rdc.c2
-rw-r--r--src/file_reg.c2
-rw-r--r--src/file_res.c2
-rw-r--r--src/file_rfp.c2
-rw-r--r--src/file_riff.c2
-rw-r--r--src/file_rlv.c2
-rw-r--r--src/file_rm.c2
-rw-r--r--src/file_rns.c2
-rw-r--r--src/file_rpm.c2
-rw-r--r--src/file_rw2.c2
-rw-r--r--src/file_rx2.c2
-rw-r--r--src/file_save.c2
-rw-r--r--src/file_sdsk.c2
-rw-r--r--src/file_ses.c2
-rw-r--r--src/file_sgcta.c2
-rw-r--r--src/file_shn.c2
-rw-r--r--src/file_sib.c2
-rw-r--r--src/file_sig.c7
-rw-r--r--src/file_sit.c2
-rw-r--r--src/file_skd.c2
-rw-r--r--src/file_skp.c2
-rw-r--r--src/file_snag.c2
-rw-r--r--src/file_sp3.c2
-rw-r--r--src/file_spe.c2
-rw-r--r--src/file_spf.c2
-rw-r--r--src/file_spss.c2
-rw-r--r--src/file_sql.c2
-rw-r--r--src/file_sqm.c2
-rw-r--r--src/file_steuer2014.c2
-rw-r--r--src/file_stl.c2
-rw-r--r--src/file_stu.c2
-rw-r--r--src/file_studio.c2
-rw-r--r--src/file_swf.c2
-rw-r--r--src/file_tar.c2
-rw-r--r--src/file_tax.c2
-rw-r--r--src/file_template.c2
-rw-r--r--src/file_tg.c2
-rw-r--r--src/file_tib.c2
-rw-r--r--src/file_tivo.c2
-rw-r--r--src/file_torrent.c2
-rw-r--r--src/file_tph.c2
-rw-r--r--src/file_tpl.c2
-rw-r--r--src/file_ttf.c2
-rw-r--r--src/file_txt.c34
-rw-r--r--src/file_tz.c2
-rw-r--r--src/file_v2i.c2
-rw-r--r--src/file_vault.c2
-rw-r--r--src/file_vdi.c2
-rw-r--r--src/file_vdj.c2
-rw-r--r--src/file_veg.c2
-rw-r--r--src/file_vfb.c2
-rw-r--r--src/file_vib.c2
-rw-r--r--src/file_vmdk.c2
-rw-r--r--src/file_vmg.c2
-rw-r--r--src/file_wallet.c2
-rw-r--r--src/file_wdp.c2
-rw-r--r--src/file_wee.c2
-rw-r--r--src/file_wim.c2
-rw-r--r--src/file_win.c2
-rw-r--r--src/file_wks.c2
-rw-r--r--src/file_wld.c2
-rw-r--r--src/file_wmf.c2
-rw-r--r--src/file_wnk.c2
-rw-r--r--src/file_woff.c2
-rw-r--r--src/file_wpb.c2
-rw-r--r--src/file_wpd.c2
-rw-r--r--src/file_wtv.c2
-rw-r--r--src/file_wv.c2
-rw-r--r--src/file_x3f.c2
-rw-r--r--src/file_x3i.c2
-rw-r--r--src/file_x4a.c2
-rw-r--r--src/file_xar.c2
-rw-r--r--src/file_xcf.c2
-rw-r--r--src/file_xfi.c2
-rw-r--r--src/file_xfs.c2
-rw-r--r--src/file_xm.c2
-rw-r--r--src/file_xml.c2
-rw-r--r--src/file_xpt.c2
-rw-r--r--src/file_xsv.c2
-rw-r--r--src/file_xv.c2
-rw-r--r--src/file_xz.c2
-rw-r--r--src/file_z2d.c2
-rw-r--r--src/file_zcode.c2
-rw-r--r--src/file_zip.c2
-rw-r--r--src/file_zpr.c2
-rw-r--r--src/filegen.c11
-rw-r--r--src/filegen.h1
333 files changed, 2083 insertions, 107 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index aea1b3b..5f0c86a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,4 +1,4 @@
-.PRECIOUS: session_%.framac
+.PRECIOUS: session_%.framac session_fidentify-%.framac
FRAMA_C_FLAGS=-machdep x86_64 \
-warn-left-shift-negative \
-warn-right-shift-negative \
@@ -16,7 +16,7 @@ FRAMA_C_FLAGS=-machdep x86_64 \
-wp-dynamic \
-wp-steps 100000 \
-wp-split -wp-literals \
- -wp-timeout 10 -pp-annot \
+ -wp-timeout 5 -pp-annot \
-kernel-msg-key pp
.rc.o:
@@ -50,6 +50,7 @@ file_C = filegen.c \
file_list.c \
file_1cd.c \
file_3dm.c \
+ file_3ds.c \
file_7z.c \
file_DB.c \
file_a.c \
@@ -80,6 +81,7 @@ file_C = filegen.c \
file_bac.c \
file_bdm.c \
file_berkeley.c \
+ file_bfa.c \
file_bim.c \
file_bin.c \
file_binvox.c \
@@ -224,6 +226,7 @@ file_C = filegen.c \
file_mcd.c \
file_mdb.c \
file_mdf.c \
+ file_mdp.c \
file_mfa.c \
file_mfg.c \
file_mft.c \
@@ -411,10 +414,13 @@ qphotorec_SOURCES = qmainrec.cpp qphotorec.cpp qphotorec.h qphotorec.qrc qphotor
nodist_qphotorec_SOURCES = moc_qphotorec.cpp rcc_qphotorec.cpp rcc_qphotorec_locale.cpp
-fidentify_SOURCES = fidentify.c common.c common.h misc.c misc.h phcfg.c phcfg.h setdate.c setdate.h $(file_C) $(file_H) log.c log.h crc.c crc.h ext2_common.c fat_common.c fat_common.h suspend_no.c
+fidentify_C_SOURCES = fidentify.c common.c misc.c phcfg.c setdate.c $(file_C) log.c crc.c ext2_common.c fat_common.c suspend_no.c
+fidentify_H_SOURCES = common.h misc.h phcfg.h setdate.h $(file_H) log.h crc.h fat_common.h
+fidentify_SOURCES = $(fidentify_C_SOURCES) $(fidentify_H_SOURCES)
fuzzerfidentify_SOURCES = fuzzerfidentify.cpp common.c common.h misc.c misc.h phcfg.c phcfg.h setdate.c setdate.h $(file_C) $(file_H) log.c log.h crc.c crc.h ext2_common.c fat_common.c fat_common.h suspend_no.c
+
QT_QM=$(QT_TS:.ts=.qm)
SECONDARY: $(QT_QM)
@@ -430,29 +436,41 @@ frama-c-%: session_%.framac
frama-c-gui -load $^
session_doc.framac: file_doc.c common.c filegen.c log.c setdate.c
- gcc $(CFLAGS) -DMAIN_doc -DHAVE_CONFIG_H -O -o demo -I.. $^
- frama-c $^ -cpp-extra-args="-DMAIN_doc -DHAVE_CONFIG_H -D__x86_64__ -I.." $(FRAMA_C_FLAGS) -save $@
+ gcc $(CFLAGS) -DMAIN_doc -DHAVE_CONFIG_H -DSINGLE_FORMAT -DSINGLE_FORMAT_doc -O -o demo -I.. $^
+ frama-c $^ -cpp-extra-args="-DMAIN_doc -DHAVE_CONFIG_H -DSINGLE_FORMAT -DSINGLE_FORMAT_doc -D__x86_64__ -I.." $(FRAMA_C_FLAGS) -save $@
session_jpg.framac: file_jpg.c file_tiff.c file_tiff_be.c file_tiff_le.c common.c filegen.c log.c suspend_no.c setdate.c
- gcc $(CFLAGS) -DMAIN_jpg -DHAVE_CONFIG_H -O -o demo -I.. $^ -ljpeg
- frama-c $^ -cpp-extra-args="-DMAIN_jpg -DHAVE_CONFIG_H -D__x86_64__ -I/usr/include -I.. -I $(frama-c -print-path)/libc" $(FRAMA_C_FLAGS) -save $@ 2>&1 | tee session_jpg.log
+ gcc $(CFLAGS) -DMAIN_jpg -DHAVE_CONFIG_H -DSINGLE_FORMAT -DSINGLE_FORMAT_jpg -O -o demo -I.. $^ -ljpeg
+ frama-c $^ -cpp-extra-args="-DMAIN_jpg -DHAVE_CONFIG_H -DSINGLE_FORMAT -DSINGLE_FORMAT_jpg -D__x86_64__ -I/usr/include -I.. -I $(frama-c -print-path)/libc" $(FRAMA_C_FLAGS) -save $@
+
+session_swf.framac: file_swf.c common.c filegen.c log.c
+ gcc $(CFLAGS) -DMAIN_swf -DHAVE_CONFIG_H -DSINGLE_FORMAT -DSINGLE_FORMAT_swf -O -o demo -I.. $^ -lz
+ frama-c $^ -cpp-extra-args="-DMAIN_swf -DHAVE_CONFIG_H -DSINGLE_FORMAT -DSINGLE_FORMAT_swf -D__x86_64__ -I.." $(FRAMA_C_FLAGS) -save $@
session_tiff_be.framac: file_tiff.c file_tiff_be.c file_tiff_le.c common.c filegen.c log.c
- gcc $(CFLAGS) -DMAIN_tiff_le -DHAVE_CONFIG_H -O -o demo -I.. $^
- frama-c $^ -cpp-extra-args="-DMAIN_tiff_be -DHAVE_CONFIG_H -D__x86_64__ -I.." $(FRAMA_C_FLAGS) -save $@
+ gcc $(CFLAGS) -DMAIN_tiff_le -DHAVE_CONFIG_H -DSINGLE_FORMAT -DSINGLE_FORMAT_tiff -O -o demo -I.. $^
+ frama-c $^ -cpp-extra-args="-DMAIN_tiff_be -DHAVE_CONFIG_H -DSINGLE_FORMAT -DSINGLE_FORMAT_tiff -D__x86_64__ -I.." $(FRAMA_C_FLAGS) -save $@
session_tiff_le.framac: file_tiff.c file_tiff_be.c file_tiff_le.c common.c filegen.c log.c
- gcc $(CFLAGS) -DMAIN_tiff_le -DHAVE_CONFIG_H -O -o demo -I.. $^
- frama-c $^ -cpp-extra-args="-DMAIN_tiff_le -DHAVE_CONFIG_H -D__x86_64__ -I.." $(FRAMA_C_FLAGS) -save $@
+ gcc $(CFLAGS) -DMAIN_tiff_le -DHAVE_CONFIG_H -DSINGLE_FORMAT -DSINGLE_FORMAT_tiff -O -o demo -I.. $^
+ frama-c $^ -cpp-extra-args="-DMAIN_tiff_le -DHAVE_CONFIG_H -DSINGLE_FORMAT -DSINGLE_FORMAT_tiff -D__x86_64__ -I.." $(FRAMA_C_FLAGS) -save $@
session_%.framac: file_%.c common.c filegen.c log.c
- gcc $(CFLAGS) -DMAIN_$* -DHAVE_CONFIG_H -O -o demo -I.. $^
- frama-c $^ -cpp-extra-args="-DMAIN_$* -DHAVE_CONFIG_H -D__x86_64__ -I.." $(FRAMA_C_FLAGS) -save $@
+ gcc $(CFLAGS) -DMAIN_$* -DHAVE_CONFIG_H -DSINGLE_FORMAT -DSINGLE_FORMAT_$* -O -o demo -I.. $^
+ frama-c $^ -cpp-extra-args="-DMAIN_$* -DHAVE_CONFIG_H -DSINGLE_FORMAT -DSINGLE_FORMAT_$* -D__x86_64__ -I.." $(FRAMA_C_FLAGS) -save $@
-session_fidentify.framac: fidentify.c common.c misc.c filegen.c log.c setdate.c file_bmp.c file_list.c
- gcc $(CFLAGS) -DMAIN_fidentify -DHAVE_CONFIG_H -O -o demo -I.. $^
+session_fidentify-%.framac: $(fidentify_C_SOURCES)
+ gcc -o fidentify_$* -O -DMAIN_fidentify -DHAVE_CONFIG_H -DSINGLE_FORMAT -DSINGLE_FORMAT_$* -D__x86_64__ -I.. $^
+ frama-c $^ -cpp-extra-args="-DMAIN_fidentify -DHAVE_CONFIG_H -DSINGLE_FORMAT -DSINGLE_FORMAT_$* -D__x86_64__ -I.." $(FRAMA_C_FLAGS) -save $@
+
+session_fidentify.framac: fidentify.c common.c misc.c log.c setdate.c filegen.c file_list.c file_gz.c
+ gcc -O $(CFLAGS) -DMAIN_fidentify -DHAVE_CONFIG_H -O -o demo -I.. $^
frama-c $^ -cpp-extra-args="-DMAIN_fidentify -DHAVE_CONFIG_H -D__x86_64__ -I.." $(FRAMA_C_FLAGS) -save $@
+session_photorec.framac: phmain.c $(photorec_C) filegen.c file_list.c file_bmp.c file_tar.c $(base_C) partgptro.c $(fs_C) chgtype.c pdiskseln.c phcli.c ppartseln.c askloc.c phrecn.c psearchn.c phbs.c phbf.c fat_unformat.c fat_cluster.c intrfn.c file_dir.c
+# gcc $(CFLAGS) -DMAIN_photorec -DHAVE_CONFIG_H -O -o demo -I.. $^
+ frama-c $^ -cpp-extra-args="-DMAIN_photorec -DHAVE_CONFIG_H -D__x86_64__ -I.." $(FRAMA_C_FLAGS) -save $@
+
moc_qphotorec.cpp: qphotorec.h
$(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(MOC) $< -o $@
diff --git a/src/file_3dm.c b/src/file_3dm.c
index dc1241e..1c9957b 100644
--- a/src/file_3dm.c
+++ b/src/file_3dm.c
@@ -3,23 +3,24 @@
File: file_3dm.c
Copyright (C) 2013 Christophe GRENIER <grenier@cgsecurity.org>
-
+
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.
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_3dm)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -58,3 +59,4 @@ static void register_header_check_3dm(file_stat_t *file_stat)
{
register_header_check(0, "3D Geometry File Format ", 24, &header_check_3dm, file_stat);
}
+#endif
diff --git a/src/file_3ds.c b/src/file_3ds.c
new file mode 100644
index 0000000..ee23943
--- /dev/null
+++ b/src/file_3ds.c
@@ -0,0 +1,76 @@
+/*
+
+ File: file_3ds.c
+
+ Copyright (C) 2019 Christophe GRENIER <grenier@cgsecurity.org>
+
+ 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.
+
+ */
+
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_3ds)
+#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"
+#include "common.h"
+
+static void register_header_check_3ds(file_stat_t *file_stat);
+
+const file_hint_t file_hint_3ds= {
+ .extension="3ds",
+ .description="3d Studio",
+ .max_filesize=PHOTOREC_MAX_FILE_SIZE,
+ .recover=1,
+ .enable_by_default=1,
+ .register_header_check=&register_header_check_3ds
+};
+
+struct chunk_3ds
+{
+ uint16_t chunk_id;
+ uint32_t next_chunk;
+} __attribute__ ((gcc_struct, __packed__));
+
+static int header_check_3ds(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)
+{
+ uint64_t fs;
+ const struct chunk_3ds *hdr=(const struct chunk_3ds *)buffer;
+ if(buffer_size < 0x12)
+ return 0;
+ if(buffer[0]!=0x4d || buffer[1]!=0x4d || buffer[0x10]!=0x3d || buffer[0x11]!=0x3d)
+ return 0;
+ fs=le32(hdr->next_chunk);
+ if(fs <= 0x12)
+ return 0;
+ reset_file_recovery(file_recovery_new);
+ file_recovery_new->extension=file_hint_3ds.extension;
+ file_recovery_new->calculated_file_size=fs;
+ file_recovery_new->data_check=&data_check_size;
+ file_recovery_new->file_check=&file_check_size;
+ return 1;
+}
+
+static void register_header_check_3ds(file_stat_t *file_stat)
+{
+ static const unsigned char header_3ds[4]= { 0x02, 0x00, 0x0a, 0x00 };
+ register_header_check(6, header_3ds, sizeof(header_3ds), &header_check_3ds, file_stat);
+}
+#endif
diff --git a/src/file_DB.c b/src/file_DB.c
index c9a7a42..46d6bca 100644
--- a/src/file_DB.c
+++ b/src/file_DB.c
@@ -19,6 +19,7 @@
Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_DB)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -54,3 +55,4 @@ static void register_header_check_DB(file_stat_t *file_stat)
};
register_header_check(0, DB_header,sizeof(DB_header), &header_check_DB, file_stat);
}
+#endif
diff --git a/src/file_a.c b/src/file_a.c
index 47a606c..f0cac6e 100644
--- a/src/file_a.c
+++ b/src/file_a.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_a)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -73,3 +74,4 @@ static void register_header_check_a(file_stat_t *file_stat)
static const unsigned char a_header[8] = { '!','<','a','r','c','h','>','\n'};
register_header_check(0, a_header,sizeof(a_header), &header_check_a, file_stat);
}
+#endif
diff --git a/src/file_ab.c b/src/file_ab.c
index e6e7381..011e675 100644
--- a/src/file_ab.c
+++ b/src/file_ab.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_addressbook)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -46,8 +47,21 @@ struct ab_header
uint32_t size;
} __attribute__ ((gcc_struct, __packed__));
+/*@
+ @ requires buffer_size > 0;
+ @ requires (buffer_size&1)==0;
+ @ requires \valid_read(buffer+(0..buffer_size-1));
+ @ requires \valid(file_recovery);
+ @ requires file_recovery->data_check==&data_check_ab;
+ @ requires \separated(buffer, file_recovery);
+ @ ensures \result == DC_CONTINUE || \result == DC_STOP;
+ @ assigns file_recovery->calculated_file_size;
+ @*/
static data_check_t data_check_addressbook(const unsigned char *buffer, const unsigned int buffer_size, file_recovery_t *file_recovery)
{
+ /*@
+ @ loop assigns file_recovery->calculated_file_size;
+ @*/
while(file_recovery->calculated_file_size + buffer_size/2 >= file_recovery->file_size &&
file_recovery->calculated_file_size + 8 < file_recovery->file_size + buffer_size/2)
{
@@ -92,3 +106,4 @@ static void register_header_check_ab(file_stat_t *file_stat)
static const unsigned char ab_header[2]={ 'L', 'J' };
register_header_check(0, ab_header,sizeof(ab_header), &header_check_addressbook, file_stat);
}
+#endif
diff --git a/src/file_abr.c b/src/file_abr.c
index 5d07f92..6d243ac 100644
--- a/src/file_abr.c
+++ b/src/file_abr.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_abr)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -49,8 +50,21 @@ const file_hint_t file_hint_abr= {
.register_header_check=&register_header_check_abr
};
+/*@
+ @ requires buffer_size > 0;
+ @ requires (buffer_size&1)==0;
+ @ requires \valid_read(buffer+(0..buffer_size-1));
+ @ requires \valid(file_recovery);
+ @ requires file_recovery->data_check==&data_check_abr;
+ @ requires \separated(buffer, file_recovery);
+ @ ensures \result == DC_CONTINUE || \result == DC_STOP;
+ @ assigns file_recovery->calculated_file_size;
+ @*/
static data_check_t data_check_abr(const unsigned char *buffer, const unsigned int buffer_size, file_recovery_t *file_recovery)
{
+ /*@
+ @ loop assigns file_recovery->calculated_file_size;
+ @*/
while(file_recovery->calculated_file_size + buffer_size/2 >= file_recovery->file_size &&
file_recovery->calculated_file_size + 12 < file_recovery->file_size + buffer_size/2)
{
@@ -94,3 +108,4 @@ static void register_header_check_abr(file_stat_t *file_stat)
};
register_header_check(2, abr_header, sizeof(abr_header), &header_check_abr, file_stat);
}
+#endif
diff --git a/src/file_acb.c b/src/file_acb.c
index f791fe5..0a0d4a9 100644
--- a/src/file_acb.c
+++ b/src/file_acb.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_acb)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -59,3 +60,4 @@ static void register_header_check_acb(file_stat_t *file_stat)
};
register_header_check(0, acb_header, sizeof(acb_header), &header_check_acb, file_stat);
}
+#endif
diff --git a/src/file_ado.c b/src/file_ado.c
index 74c9632..6739505 100644
--- a/src/file_ado.c
+++ b/src/file_ado.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_ado)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -54,3 +55,4 @@ static void register_header_check_ado(file_stat_t *file_stat)
{
register_header_check(0x2c, "\5Black\0\0", 8, &header_check_ado, file_stat);
}
+#endif
diff --git a/src/file_afdesign.c b/src/file_afdesign.c
index af93b7c..c13d6b5 100644
--- a/src/file_afdesign.c
+++ b/src/file_afdesign.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_afdesign)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -76,3 +77,4 @@ static void register_header_check_afdesign(file_stat_t *file_stat)
static const unsigned char afdesign_header[4]= { 0x00, 0xff, 'K' , 'A' };
register_header_check(0, afdesign_header, sizeof(afdesign_header), &header_check_afdesign, file_stat);
}
+#endif
diff --git a/src/file_ahn.c b/src/file_ahn.c
index 8112322..f490ee5 100644
--- a/src/file_ahn.c
+++ b/src/file_ahn.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_ahn)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -56,3 +57,4 @@ static void register_header_check_ahn(file_stat_t *file_stat)
static const unsigned char ahn_magic[10] = {'A','H','N','E','N','B','L','A','T','T'};
register_header_check(8, ahn_magic, sizeof(ahn_magic), &header_check_ahn, file_stat);
}
+#endif
diff --git a/src/file_aif.c b/src/file_aif.c
index 5504f22..69a06d4 100644
--- a/src/file_aif.c
+++ b/src/file_aif.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_aif)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -79,3 +80,4 @@ static void register_header_check_aif(file_stat_t *file_stat)
{
register_header_check(0, "FORM", 4, &header_check_aif, file_stat);
}
+#endif
diff --git a/src/file_all.c b/src/file_all.c
index de7b0ac..9972f25 100644
--- a/src/file_all.c
+++ b/src/file_all.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_all)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -55,3 +56,4 @@ static void register_header_check_all(file_stat_t *file_stat)
static const unsigned char all_header[8]= { 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x06, 0x04};
register_header_check(0, all_header,sizeof(all_header), &header_check_all, file_stat);
}
+#endif
diff --git a/src/file_als.c b/src/file_als.c
index 5082331..c915341 100644
--- a/src/file_als.c
+++ b/src/file_als.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_als)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -76,3 +77,4 @@ static void register_header_check_als(file_stat_t *file_stat)
};
register_header_check(0, als_header,sizeof(als_header), &header_check_als, file_stat);
}
+#endif
diff --git a/src/file_amd.c b/src/file_amd.c
index 53f6885..cf7d203 100644
--- a/src/file_amd.c
+++ b/src/file_amd.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_amd)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -84,3 +85,4 @@ static void register_header_check_amd(file_stat_t *file_stat)
register_header_check(0, amd_header,sizeof(amd_header), &header_check_amd, file_stat);
register_header_check(0, amt_header,sizeof(amt_header), &header_check_amt, file_stat);
}
+#endif
diff --git a/src/file_amr.c b/src/file_amr.c
index a5ec01c..ac1c132 100644
--- a/src/file_amr.c
+++ b/src/file_amr.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_amr)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -43,8 +44,21 @@ const file_hint_t file_hint_amr= {
.register_header_check=&register_header_check_amr
};
+/*@
+ @ requires buffer_size > 0;
+ @ requires (buffer_size&1)==0;
+ @ requires \valid_read(buffer+(0..buffer_size-1));
+ @ requires \valid(file_recovery);
+ @ requires file_recovery->data_check==&data_check_amr;
+ @ requires \separated(buffer, file_recovery);
+ @ ensures \result == DC_CONTINUE || \result == DC_STOP;
+ @ assigns file_recovery->calculated_file_size;
+ @*/
static data_check_t data_check_amr(const unsigned char *buffer, const unsigned int buffer_size, file_recovery_t *file_recovery)
{
+ /*@
+ @ loop assigns file_recovery->calculated_file_size;
+ @*/
while(file_recovery->calculated_file_size + buffer_size/2 >= file_recovery->file_size &&
file_recovery->calculated_file_size + 4 < file_recovery->file_size + buffer_size/2)
{
@@ -94,3 +108,4 @@ static void register_header_check_amr(file_stat_t *file_stat)
static const unsigned char amr_header[6]= {'#','!','A','M','R','\n'};
register_header_check(0, amr_header,sizeof(amr_header), &header_check_amr, file_stat);
}
+#endif
diff --git a/src/file_apa.c b/src/file_apa.c
index fc47582..88648fb 100644
--- a/src/file_apa.c
+++ b/src/file_apa.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_apa)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -62,3 +63,4 @@ static int header_check_apa(const unsigned char *buffer, const unsigned int buff
}
return 0;
}
+#endif
diff --git a/src/file_ape.c b/src/file_ape.c
index c013880..b30c52a 100644
--- a/src/file_ape.c
+++ b/src/file_ape.c
@@ -19,6 +19,7 @@
Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_ape)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -139,3 +140,4 @@ static void register_header_check_ape(file_stat_t *file_stat)
static const unsigned char ape_header[4]= { 'M', 'A', 'C', ' '};
register_header_check(0, ape_header,sizeof(ape_header), &header_check_ape, file_stat);
}
+#endif
diff --git a/src/file_apple.c b/src/file_apple.c
index de63f33..1612ebc 100644
--- a/src/file_apple.c
+++ b/src/file_apple.c
@@ -19,6 +19,7 @@
Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_apple)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -54,3 +55,4 @@ static void register_header_check_apple(file_stat_t *file_stat)
};
register_header_check(0, apple_header,sizeof(apple_header), &header_check_apple, file_stat);
}
+#endif
diff --git a/src/file_ari.c b/src/file_ari.c
index fbe99b6..cc17ef1 100644
--- a/src/file_ari.c
+++ b/src/file_ari.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_ari)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -74,3 +75,4 @@ static void register_header_check_ari(file_stat_t *file_stat)
0x00, 0x10, 0x00, 0x00};
register_header_check(0, ari_header, sizeof(ari_header), &header_check_ari, file_stat);
}
+#endif
diff --git a/src/file_arj.c b/src/file_arj.c
index 9bf2c1e..62bf5d0 100644
--- a/src/file_arj.c
+++ b/src/file_arj.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_arj)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -162,3 +163,4 @@ static void register_header_check_arj(file_stat_t *file_stat)
static const unsigned char arj_header[2]={0x60, 0xEA};
register_header_check(0, arj_header,sizeof(arj_header), &header_check_arj, file_stat);
}
+#endif
diff --git a/src/file_asf.c b/src/file_asf.c
index a9a7650..0598f1e 100644
--- a/src/file_asf.c
+++ b/src/file_asf.c
@@ -32,6 +32,7 @@
#include "common.h"
#include "log.h"
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_asf)
static void register_header_check_asf(file_stat_t *file_stat);
static int header_check_asf(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);
@@ -156,3 +157,4 @@ static void register_header_check_asf(file_stat_t *file_stat)
};
register_header_check(0, asf_header,sizeof(asf_header), &header_check_asf, file_stat);
}
+#endif
diff --git a/src/file_asl.c b/src/file_asl.c
index 7c541c2..c70b26d 100644
--- a/src/file_asl.c
+++ b/src/file_asl.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_asl)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -56,3 +57,4 @@ static void register_header_check_asl(file_stat_t *file_stat)
};
register_header_check(0, asl_header, sizeof(asl_header), &header_check_asl, file_stat);
}
+#endif
diff --git a/src/file_asm.c b/src/file_asm.c
index 6026c74..71ef2f8 100644
--- a/src/file_asm.c
+++ b/src/file_asm.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_asm)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -31,10 +32,7 @@
#include "types.h"
#include "filegen.h"
-
static void register_header_check_asm(file_stat_t *file_stat);
-static int header_check_asm(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_asm(file_recovery_t *file_recovery);
const file_hint_t file_hint_asm= {
.extension="asm",
@@ -49,9 +47,12 @@ static const unsigned char asm_header[16]= {
'#', 'U', 'G', 'C', ':', '2', ' ', 'A',
'S', 'S', 'E', 'M', 'B', 'L', 'Y', ' '};
-static void register_header_check_asm(file_stat_t *file_stat)
+static void file_check_asm(file_recovery_t *file_recovery)
{
- register_header_check(0, asm_header,sizeof(asm_header), &header_check_asm, file_stat);
+ const unsigned char asm_footer[11]= {
+ '#', 'E', 'N', 'D', '_', 'O', 'F', '_',
+ 'U', 'G', 'C'};
+ file_search_footer(file_recovery, asm_footer, sizeof(asm_footer), 1);
}
static int header_check_asm(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)
@@ -64,10 +65,8 @@ static int header_check_asm(const unsigned char *buffer, const unsigned int buff
return 1;
}
-static void file_check_asm(file_recovery_t *file_recovery)
+static void register_header_check_asm(file_stat_t *file_stat)
{
- const unsigned char asm_footer[11]= {
- '#', 'E', 'N', 'D', '_', 'O', 'F', '_',
- 'U', 'G', 'C'};
- file_search_footer(file_recovery, asm_footer, sizeof(asm_footer), 1);
+ register_header_check(0, asm_header,sizeof(asm_header), &header_check_asm, file_stat);
}
+#endif
diff --git a/src/file_atd.c b/src/file_atd.c
index 5478354..409ecb3 100644
--- a/src/file_atd.c
+++ b/src/file_atd.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_atd)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -55,3 +56,4 @@ static void register_header_check_atd(file_stat_t *file_stat)
'D' ,'A' ,'T' ,'A' ,'B' ,'A' ,'S' ,'E' };
register_header_check(0, atd_header,sizeof(atd_header), &header_check_atd, file_stat);
}
+#endif
diff --git a/src/file_au.c b/src/file_au.c
index bab248b..9d51a78 100644
--- a/src/file_au.c
+++ b/src/file_au.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_au)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -85,3 +86,4 @@ static void register_header_check_au(file_stat_t *file_stat)
static const unsigned char au_header[4]= {'.','s','n','d'};
register_header_check(0, au_header,sizeof(au_header), &header_check_au, file_stat);
}
+#endif
diff --git a/src/file_axp.c b/src/file_axp.c
index 349dc5a..3a8d290 100644
--- a/src/file_axp.c
+++ b/src/file_axp.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_axp)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -41,6 +42,16 @@ const file_hint_t file_hint_axp= {
.register_header_check=&register_header_check_axp
};
+/*@
+ @ requires buffer_size > 0;
+ @ requires (buffer_size&1)==0;
+ @ requires \valid_read(buffer+(0..buffer_size-1));
+ @ requires \valid(file_recovery);
+ @ requires file_recovery->data_check==&data_check_axp;
+ @ requires \separated(buffer, file_recovery);
+ @ ensures \result == DC_CONTINUE || \result == DC_STOP;
+ @ assigns file_recovery->calculated_file_size;
+ @*/
static data_check_t data_check_axp(const unsigned char *buffer, const unsigned int buffer_size, file_recovery_t *file_recovery)
{
const unsigned char axp_footer[34]= {
@@ -51,6 +62,9 @@ static data_check_t data_check_axp(const unsigned char *buffer, const unsigned i
0x0a, 0
};
unsigned int j;
+ /*@
+ @ loop assigns j;
+ @*/
for(j=(buffer_size/2>sizeof(axp_footer)?buffer_size/2-sizeof(axp_footer):0);
j+sizeof(axp_footer) < buffer_size;
j++)
@@ -94,3 +108,4 @@ static void register_header_check_axp(file_stat_t *file_stat)
};
register_header_check(0, axp_header, sizeof(axp_header), &header_check_axp, file_stat);
}
+#endif
diff --git a/src/file_axx.c b/src/file_axx.c
index bc6bc4a..4c818d7 100644
--- a/src/file_axx.c
+++ b/src/file_axx.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_axx)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -104,3 +105,4 @@ static void register_header_check_axx(file_stat_t *file_stat)
};
register_header_check(0, axx_header, sizeof(axx_header), &header_check_axx, file_stat);
}
+#endif
diff --git a/src/file_bac.c b/src/file_bac.c
index e9aada3..c4514f2 100644
--- a/src/file_bac.c
+++ b/src/file_bac.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_bac)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -33,6 +34,9 @@
#include "log.h"
#include "memmem.h"
+/*@
+ @ requires \valid(file_stat);
+ @*/
static void register_header_check_bac(file_stat_t *file_stat);
const file_hint_t file_hint_bac= {
@@ -54,6 +58,16 @@ struct block_header
uint32_t VolSessionTime; /* Session Time for Job */
} __attribute__ ((gcc_struct, __packed__));
+/*@
+ @ requires buffer_size >= 2*0x18;
+ @ requires (buffer_size&1)==0;
+ @ requires \valid_read(buffer+(0..buffer_size-1));
+ @ requires \valid(file_recovery);
+ @ requires file_recovery->data_check==&data_check_bac;
+ @ requires \separated(buffer, file_recovery);
+ @ ensures \result == DC_CONTINUE || \result == DC_STOP;
+ @ assigns file_recovery->calculated_file_size;
+ @*/
static data_check_t data_check_bac(const unsigned char *buffer, const unsigned int buffer_size, file_recovery_t *file_recovery)
{
if(buffer_size < 2*0x18)
@@ -62,6 +76,9 @@ static data_check_t data_check_bac(const unsigned char *buffer, const unsigned i
file_recovery->file_check=NULL;
return DC_CONTINUE;
}
+ /*@
+ @ loop assigns file_recovery->calculated_file_size;
+ @*/
while(file_recovery->calculated_file_size + buffer_size/2 >= file_recovery->file_size &&
file_recovery->calculated_file_size + 0x18 < file_recovery->file_size + buffer_size/2)
{
@@ -76,8 +93,10 @@ static data_check_t data_check_bac(const unsigned char *buffer, const unsigned i
#endif
if(memcmp(hdr->ID, "BB02", 4)!=0 || block_size<0x18)
{
+#ifndef __FRAMAC__
log_error("file_bac.c: invalid block at %llu\n",
(long long unsigned)file_recovery->calculated_file_size);
+#endif
return DC_STOP;
}
file_recovery->calculated_file_size+=(uint64_t)block_size;
@@ -89,6 +108,24 @@ static data_check_t data_check_bac(const unsigned char *buffer, const unsigned i
return DC_CONTINUE;
}
+/*@
+ @ requires buffer_size >= sizeof(struct block_header);
+ @ requires \valid_read(buffer+(0..buffer_size-1));
+ @ requires \valid_read(file_recovery);
+ @ requires file_recovery->file_stat==\null || valid_read_string((char*)file_recovery->filename);
+ @ requires \valid(file_recovery_new);
+ @ requires file_recovery_new->blocksize > 0;
+ @ requires separation: \separated(&file_hint_bac, buffer, file_recovery, file_recovery_new);
+ @ ensures \result == 0 || \result == 1;
+ @ ensures (\result == 1) ==> (file_recovery_new->file_stat == \null);
+ @ ensures (\result == 1) ==> (file_recovery_new->handle == \null);
+ @ ensures (\result == 1) ==> (file_recovery_new->time == 0);
+ @ ensures (\result == 1) ==> (file_recovery_new->file_size == 0);
+ @ ensures (\result == 1) ==> (file_recovery_new->calculated_file_size == 0);
+ @ ensures (\result == 1) ==> (file_recovery_new->data_check == \null || file_recovery_new->data_check == &data_check_bac);
+ @ ensures (\result == 1) ==> (file_recovery_new->file_check == \null || file_recovery_new->file_check == &file_check_size);
+ @ ensures (\result == 1) ==> (file_recovery_new->extension == file_hint_bac.extension);
+ @*/
static int header_check_bac(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 struct block_header *hdr=(const struct block_header *)buffer;
@@ -111,3 +148,4 @@ static void register_header_check_bac(file_stat_t *file_stat)
static const unsigned char bac_header[8]={ 0, 0, 0, 0, 'B', 'B', '0', '2' };
register_header_check(8, bac_header, sizeof(bac_header), &header_check_bac, file_stat);
}
+#endif
diff --git a/src/file_bdm.c b/src/file_bdm.c
index 84512e8..cd5066d 100644
--- a/src/file_bdm.c
+++ b/src/file_bdm.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_bdm)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -53,3 +54,4 @@ static void register_header_check_bdm(file_stat_t *file_stat)
register_header_check(0, "INDX0100", 8, &header_check_bdm, file_stat);
register_header_check(0, "MOBJ0100", 8, &header_check_bdm, file_stat);
}
+#endif
diff --git a/src/file_berkeley.c b/src/file_berkeley.c
index 3f5452a..67dbd1f 100644
--- a/src/file_berkeley.c
+++ b/src/file_berkeley.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_berkeley)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -72,3 +73,4 @@ static void register_header_check_berkeley_le(file_stat_t *file_stat)
register_header_check(0xC, berkeley_db_btree_8, 8, &header_check_berkeley_le, file_stat);
register_header_check(0xC, berkeley_db_btree_9, 8, &header_check_berkeley_le, file_stat);
}
+#endif
diff --git a/src/file_bfa.c b/src/file_bfa.c
new file mode 100644
index 0000000..573b9ec
--- /dev/null
+++ b/src/file_bfa.c
@@ -0,0 +1,78 @@
+/*
+
+ File: file_bfa.c
+
+ Copyright (C) 2019 Christophe GRENIER <grenier@cgsecurity.org>
+
+ 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.
+
+ */
+
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_bfa)
+#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"
+#include "common.h"
+
+static void register_header_check_bfa(file_stat_t *file_stat);
+
+const file_hint_t file_hint_bfa= {
+ .extension="bfa",
+ .description="Blowfish Advanced CS",
+ .max_filesize=PHOTOREC_MAX_FILE_SIZE,
+ .recover=1,
+ .enable_by_default=1,
+ .register_header_check=&register_header_check_bfa
+};
+
+struct bfa_header
+{
+ uint32_t lMagic;
+ uint16_t wSizeOfHeader;
+ uint16_t wVersion;
+ uint64_t lLength;
+ uint16_t wCipherInitDataSize;
+ uint16_t wCipherBlockSize;
+ uint8_t salt[11];
+ uint32_t lKeyHash;
+} __attribute__ ((gcc_struct, __packed__));
+
+static int header_check_bfa(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 struct bfa_header *header=(const struct bfa_header*)buffer;
+ uint64_t size=le64(header->lLength);
+ if(size > PHOTOREC_MAX_FILE_SIZE)
+ return 0;
+ reset_file_recovery(file_recovery_new);
+ file_recovery_new->extension=file_hint_bfa.extension;
+ file_recovery_new->calculated_file_size=size + le16(header->wSizeOfHeader);
+ file_recovery_new->file_check=&file_check_size_min;
+ return 1;
+}
+
+static void register_header_check_bfa(file_stat_t *file_stat)
+{
+ static const unsigned char bfa_header[8]= {
+ 0x24, 0x08, 0x19, 0x92, 0x23, 0x00, 0x15, 0x01
+ };
+ register_header_check(0, bfa_header, sizeof(bfa_header), &header_check_bfa, file_stat);
+}
+#endif
diff --git a/src/file_bim.c b/src/file_bim.c
index 7fbc9b3..10ebb23 100644
--- a/src/file_bim.c
+++ b/src/file_bim.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_bim)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -58,3 +59,4 @@ static void register_header_check_bim(file_stat_t *file_stat)
};
register_header_check(0, bim_header, sizeof(bim_header), &header_check_bim, file_stat);
}
+#endif
diff --git a/src/file_bin.c b/src/file_bin.c
index 5dabdb2..7be6a4c 100644
--- a/src/file_bin.c
+++ b/src/file_bin.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_bin)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -72,3 +73,4 @@ static void register_header_check_bin(file_stat_t *file_stat)
'i' , 'c' , 'k' , 'e' , 't' , 's' };
register_header_check(6, bin_header, sizeof(bin_header), &header_check_bin, file_stat);
}
+#endif
diff --git a/src/file_binvox.c b/src/file_binvox.c
index b4ac7d8..4d6886c 100644
--- a/src/file_binvox.c
+++ b/src/file_binvox.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_binvox)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -52,3 +53,4 @@ static void register_header_check_binvox(file_stat_t *file_stat)
{
register_header_check(0, "#binvox 1\ndim ", 14, &header_check_binvox, file_stat);
}
+#endif
diff --git a/src/file_bkf.c b/src/file_bkf.c
index bebc131..b509dd2 100644
--- a/src/file_bkf.c
+++ b/src/file_bkf.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_bkf)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -94,3 +95,4 @@ static void register_header_check_bkf(file_stat_t *file_stat)
static const unsigned char bkf_header[4]= { 'T','A','P','E'};
register_header_check(0, bkf_header,sizeof(bkf_header), &header_check_bkf, file_stat);
}
+#endif
diff --git a/src/file_bld.c b/src/file_bld.c
index 3fc5b26..5653189 100644
--- a/src/file_bld.c
+++ b/src/file_bld.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_blend)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -31,6 +32,9 @@
#include "filegen.h"
#include "log.h"
+/*@
+ @ requires \valid(file_stat);
+ @*/
static void register_header_check_blend(file_stat_t *file_stat);
const file_hint_t file_hint_blend= {
@@ -44,8 +48,19 @@ const file_hint_t file_hint_blend= {
static const unsigned char blend_header_footer[4] = { 'E', 'N', 'D', 'B'};
+/*@
+ @ requires buffer_size > 0;
+ @ requires (buffer_size&1)==0;
+ @ requires \valid_read(buffer+(0..buffer_size-1));
+ @ requires \valid(file_recovery);
+ @ requires file_recovery->data_check==&data_check_blend4le;
+ @ requires \separated(buffer, file_recovery);
+ @ ensures \result == DC_CONTINUE || \result == DC_STOP;
+ @ assigns file_recovery->calculated_file_size;
+ @*/
static data_check_t data_check_blend4le(const unsigned char *buffer, const unsigned int buffer_size, file_recovery_t *file_recovery)
{
+ /*@ loop assigns file_recovery->calculated_file_size; */
while(file_recovery->calculated_file_size + buffer_size/2 >= file_recovery->file_size &&
file_recovery->calculated_file_size + 0x14 < file_recovery->file_size + buffer_size/2)
{
@@ -68,8 +83,19 @@ static data_check_t data_check_blend4le(const unsigned char *buffer, const unsig
return DC_CONTINUE;
}
+/*@
+ @ requires buffer_size > 0;
+ @ requires (buffer_size&1)==0;
+ @ requires \valid_read(buffer+(0..buffer_size-1));
+ @ requires \valid(file_recovery);
+ @ requires file_recovery->data_check==&data_check_blend8le;
+ @ requires \separated(buffer, file_recovery);
+ @ ensures \result == DC_CONTINUE || \result == DC_STOP;
+ @ assigns file_recovery->calculated_file_size;
+ @*/
static data_check_t data_check_blend8le(const unsigned char *buffer, const unsigned int buffer_size, file_recovery_t *file_recovery)
{
+ /*@ loop assigns file_recovery->calculated_file_size; */
while(file_recovery->calculated_file_size + 0x18 < file_recovery->file_size + buffer_size/2)
{
const unsigned int i=file_recovery->calculated_file_size - file_recovery->file_size + buffer_size/2;
@@ -91,8 +117,19 @@ static data_check_t data_check_blend8le(const unsigned char *buffer, const unsig
return DC_CONTINUE;
}
+/*@
+ @ requires buffer_size > 0;
+ @ requires (buffer_size&1)==0;
+ @ requires \valid_read(buffer+(0..buffer_size-1));
+ @ requires \valid(file_recovery);
+ @ requires file_recovery->data_check==&data_check_blend4be;
+ @ requires \separated(buffer, file_recovery);
+ @ ensures \result == DC_CONTINUE || \result == DC_STOP;
+ @ assigns file_recovery->calculated_file_size;
+ @*/
static data_check_t data_check_blend4be(const unsigned char *buffer, const unsigned int buffer_size, file_recovery_t *file_recovery)
{
+ /*@ loop assigns file_recovery->calculated_file_size; */
while(file_recovery->calculated_file_size + 0x14 < file_recovery->file_size + buffer_size/2)
{
const unsigned int i=file_recovery->calculated_file_size - file_recovery->file_size + buffer_size/2;
@@ -114,8 +151,19 @@ static data_check_t data_check_blend4be(const unsigned char *buffer, const unsig
return DC_CONTINUE;
}
+/*@
+ @ requires buffer_size > 0;
+ @ requires (buffer_size&1)==0;
+ @ requires \valid_read(buffer+(0..buffer_size-1));
+ @ requires \valid(file_recovery);
+ @ requires file_recovery->data_check==&data_check_blend8be;
+ @ requires \separated(buffer, file_recovery);
+ @ ensures \result == DC_CONTINUE || \result == DC_STOP;
+ @ assigns file_recovery->calculated_file_size;
+ @*/
static data_check_t data_check_blend8be(const unsigned char *buffer, const unsigned int buffer_size, file_recovery_t *file_recovery)
{
+ /*@ loop assigns file_recovery->calculated_file_size; */
while(file_recovery->calculated_file_size + 0x18 < file_recovery->file_size + buffer_size/2)
{
const unsigned int i=file_recovery->calculated_file_size - file_recovery->file_size + buffer_size/2;
@@ -137,6 +185,42 @@ static data_check_t data_check_blend8be(const unsigned char *buffer, const unsig
return DC_CONTINUE;
}
+/*@
+ @ requires buffer_size > 0;
+ @ requires \valid_read(buffer+(0..buffer_size-1));
+ @ requires \valid_read(file_recovery);
+ @ requires file_recovery->file_stat==\null || valid_read_string((char*)file_recovery->filename);
+ @ requires \valid(file_recovery_new);
+ @ requires file_recovery_new->blocksize > 0;
+ @
+ @ requires buffer_size >= 8;
+ @ requires separation: \separated(&file_hint_blend, buffer+(..), file_recovery, file_recovery_new);
+ @
+ @ ensures \result == 0 || \result == 1;
+ @ ensures (\result == 1) ==> (file_recovery_new->file_stat == \null);
+ @ ensures (\result == 1) ==> (file_recovery_new->handle == \null);
+ @ ensures (\result == 1) ==> \initialized(&file_recovery_new->time);
+ @ ensures (\result == 1) ==> \initialized(&file_recovery_new->calculated_file_size);
+ @ ensures (\result == 1) ==> file_recovery_new->file_size == 0;
+ @ ensures (\result == 1) ==> \initialized(&file_recovery_new->min_filesize);
+ @ ensures (\result == 1) ==> (file_recovery_new->data_check == \null || \valid_function(file_recovery_new->data_check));
+ @ ensures (\result == 1) ==> (file_recovery_new->file_check == \null || \valid_function(file_recovery_new->file_check));
+ @ ensures (\result == 1) ==> (file_recovery_new->file_rename == \null || \valid_function(file_recovery_new->file_rename));
+ @ ensures (\result != 0) ==> file_recovery_new->extension != \null;
+ @ ensures (\result == 1) ==> (valid_read_string(file_recovery_new->extension));
+ @ ensures (\result == 1) ==> \separated(file_recovery_new, file_recovery_new->extension);
+ @
+ @ ensures (\result == 1) ==> (file_recovery_new->time == 0);
+ @ ensures (\result == 1) ==> (file_recovery_new->calculated_file_size == 12);
+ @ ensures (\result == 1) ==> (file_recovery_new->extension == file_hint_blend.extension);
+ @ ensures (\result == 1) ==> (file_recovery_new->data_check == &data_check_blend4be ||
+ file_recovery_new->data_check == &data_check_blend4le ||
+ file_recovery_new->data_check == &data_check_blend8be ||
+ file_recovery_new->data_check == &data_check_blend8le
+ );
+ @ ensures (\result == 1) ==> (file_recovery_new->file_check == &file_check_size);
+ @ ensures (\result == 1) ==> (file_recovery_new->file_rename == \null);
+ @*/
static int header_check_blend(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(buffer[7]!='_' && buffer[7]!='-')
@@ -169,3 +253,4 @@ static void register_header_check_blend(file_stat_t *file_stat)
static const unsigned char blend_header[7] = { 'B', 'L', 'E', 'N', 'D', 'E', 'R'};
register_header_check(0, blend_header,sizeof(blend_header), &header_check_blend, file_stat);
}
+#endif
diff --git a/src/file_bmp.c b/src/file_bmp.c
index afef52b..b2d56b0 100644
--- a/src/file_bmp.c
+++ b/src/file_bmp.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_bmp)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -144,6 +145,7 @@ static void register_header_check_bmp(file_stat_t *file_stat)
{
register_header_check(0, bmp_header,sizeof(bmp_header), &header_check_bmp, file_stat);
}
+#endif
#if defined(MAIN_bmp)
#define BLOCKSIZE 65536u
diff --git a/src/file_bpg.c b/src/file_bpg.c
index bc16eb5..c049946 100644
--- a/src/file_bpg.c
+++ b/src/file_bpg.c
@@ -24,6 +24,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_bpg)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -94,3 +95,4 @@ static void register_header_check_bpg(file_stat_t *file_stat)
static const unsigned char bpg_header[4]= {'B','P','G',0xFB};
register_header_check(0, bpg_header,sizeof(bpg_header), &header_check_bpg, file_stat);
}
+#endif
diff --git a/src/file_bvr.c b/src/file_bvr.c
index 1b4a43d..ca02620 100644
--- a/src/file_bvr.c
+++ b/src/file_bvr.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_bvr)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -43,6 +44,9 @@ const file_hint_t file_hint_bvr= {
static data_check_t data_check_bvr(const unsigned char *buffer, const unsigned int buffer_size, file_recovery_t *file_recovery)
{
+ /*@
+ @ loop assigns file_recovery->calculated_file_size;
+ @*/
while(file_recovery->calculated_file_size + buffer_size/2 >= file_recovery->file_size &&
file_recovery->calculated_file_size + 16 < file_recovery->file_size + buffer_size/2)
{
@@ -77,3 +81,4 @@ static void register_header_check_bvr(file_stat_t *file_stat)
static const unsigned char bvrheader[8]= { 'B', 'L', 'U', 'E', 0x20, 0x00, 0x10, 0x00};
register_header_check(0, bvrheader, sizeof(bvrheader), &header_check_bvr, file_stat);
}
+#endif
diff --git a/src/file_bz2.c b/src/file_bz2.c
index 191bcd6..7aba0e9 100644
--- a/src/file_bz2.c
+++ b/src/file_bz2.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_bz2)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -59,3 +60,4 @@ static int header_check_bz2(const unsigned char *buffer, const unsigned int buff
}
return 0;
}
+#endif
diff --git a/src/file_c4d.c b/src/file_c4d.c
index aafaded..48681ca 100644
--- a/src/file_c4d.c
+++ b/src/file_c4d.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_c4d)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -52,3 +53,4 @@ static void register_header_check_c4d(file_stat_t *file_stat)
{
register_header_check(0, "QC4DC4D6", 8, &header_check_c4d, file_stat);
}
+#endif
diff --git a/src/file_cab.c b/src/file_cab.c
index 16db328..0e9bda4 100644
--- a/src/file_cab.c
+++ b/src/file_cab.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_cab)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -77,3 +78,4 @@ static void register_header_check_cab(file_stat_t *file_stat)
static const unsigned char cab_header[4] = { 'M','S','C','F'};
register_header_check(0, cab_header,sizeof(cab_header), &header_check_cab, file_stat);
}
+#endif
diff --git a/src/file_caf.c b/src/file_caf.c
index 521a0b9..fbde9e3 100644
--- a/src/file_caf.c
+++ b/src/file_caf.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_caf)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -46,7 +47,7 @@ const file_hint_t file_hint_caf= {
.register_header_check=&register_header_check_caf
};
-/* http://developer.apple.com/library/mac/documentation/MusicAudio/Reference/CAFSpec/CAF_spec/CAF_spec.html */
+/* https://developer.apple.com/library/archive/documentation/MusicAudio/Reference/CAFSpec/CAF_spec/CAF_spec.html */
struct chunk_struct
{
@@ -56,6 +57,9 @@ struct chunk_struct
static data_check_t data_check_caf(const unsigned char *buffer, const unsigned int buffer_size, file_recovery_t *file_recovery)
{
+ /*@
+ @ loop assigns file_recovery->calculated_file_size;
+ @*/
while(file_recovery->calculated_file_size + buffer_size/2 >= file_recovery->file_size &&
file_recovery->calculated_file_size + 12 < file_recovery->file_size + buffer_size/2)
{
@@ -97,7 +101,7 @@ static data_check_t data_check_caf(const unsigned char *buffer, const unsigned i
static int header_check_caf(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 struct chunk_struct *chunk=(const struct chunk_struct*)&buffer[8];
- const int64_t chunk_size=be64(chunk->size);
+ const int64_t chunk_size=(int64_t)be64(chunk->size);
if(chunk_size < 0)
return 0;
reset_file_recovery(file_recovery_new);
@@ -120,3 +124,4 @@ static void register_header_check_caf(file_stat_t *file_stat)
};
register_header_check(0, caf_header, sizeof(caf_header), &header_check_caf, file_stat);
}
+#endif
diff --git a/src/file_cam.c b/src/file_cam.c
index b62431d..ad6f804 100644
--- a/src/file_cam.c
+++ b/src/file_cam.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_cam)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -53,3 +54,4 @@ static void register_header_check_cam(file_stat_t *file_stat)
static const unsigned char cam_header[4]= {0x07, 0x20, 'M', 'M'};
register_header_check(0, cam_header,sizeof(cam_header), &header_check_cam, file_stat);
}
+#endif
diff --git a/src/file_catdrawing.c b/src/file_catdrawing.c
index a76b775..3748397 100644
--- a/src/file_catdrawing.c
+++ b/src/file_catdrawing.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_catdrawing)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -56,3 +57,4 @@ static void register_header_check_catdrawing(file_stat_t *file_stat)
};
register_header_check(0, catdrawing_header, sizeof(catdrawing_header), &header_check_catdrawing, file_stat);
}
+#endif
diff --git a/src/file_cdt.c b/src/file_cdt.c
index 3a90db5..1a2c7b8 100644
--- a/src/file_cdt.c
+++ b/src/file_cdt.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_cdt)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -62,3 +63,4 @@ static void register_header_check_cdt(file_stat_t *file_stat)
};
register_header_check(12, cdt_header, sizeof(cdt_header), &header_check_cdt, file_stat);
}
+#endif
diff --git a/src/file_che.c b/src/file_che.c
index 17a2641..b290e5d 100644
--- a/src/file_che.c
+++ b/src/file_che.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_che)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -97,3 +98,4 @@ static void register_header_check_che(file_stat_t *file_stat)
{
register_header_check(0, "Compucon EOS Design File", 24, &header_check_che, file_stat);
}
+#endif
diff --git a/src/file_chm.c b/src/file_chm.c
index cc4b65a..597ffe9 100644
--- a/src/file_chm.c
+++ b/src/file_chm.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_chm)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -60,3 +61,4 @@ static void register_header_check_chm(file_stat_t *file_stat)
0x60, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00};
register_header_check(0, chm_header,sizeof(chm_header), &header_check_chm, file_stat);
}
+#endif
diff --git a/src/file_class.c b/src/file_class.c
index 91f446e..38e23e4 100644
--- a/src/file_class.c
+++ b/src/file_class.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_class)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -71,3 +72,4 @@ static int header_check_class(const unsigned char *buffer, const unsigned int bu
}
return 0;
}
+#endif
diff --git a/src/file_cm.c b/src/file_cm.c
index 0f25a05..c8a6b26 100644
--- a/src/file_cm.c
+++ b/src/file_cm.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_cm)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -54,3 +55,4 @@ static void register_header_check_cm(file_stat_t *file_stat)
static const unsigned char cm_header[8] = { 'f','L','m','C','0','0','0','1'};
register_header_check(0x0, cm_header,sizeof(cm_header), &header_check_cm, file_stat);
}
+#endif
diff --git a/src/file_compress.c b/src/file_compress.c
index 7722128..fcdf338 100644
--- a/src/file_compress.c
+++ b/src/file_compress.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_compress)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -53,3 +54,4 @@ static void register_header_check_compress(file_stat_t *file_stat)
static const unsigned char compress_header[9] = {'S', 'Z', 'D', 'D', 0x88, 0xf0, 0x27, 0x33, 'A'};
register_header_check(0, compress_header, sizeof(compress_header), &header_check_compress, file_stat);
}
+#endif
diff --git a/src/file_cow.c b/src/file_cow.c
index b0de7cb..b1f5b72 100644
--- a/src/file_cow.c
+++ b/src/file_cow.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_cow)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -127,3 +128,4 @@ static void register_header_check_cow(file_stat_t *file_stat)
register_header_check(0, cow_header2,sizeof(cow_header2), &header_check_qcow2, file_stat);
register_header_check(0, cow_header3,sizeof(cow_header3), &header_check_qcow2, file_stat);
}
+#endif
diff --git a/src/file_cpi.c b/src/file_cpi.c
index 8d7ad5c..54f8a76 100644
--- a/src/file_cpi.c
+++ b/src/file_cpi.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_cpi)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -52,3 +53,4 @@ static void register_header_check_cpi(file_stat_t *file_stat)
{
register_header_check(0, "HDMV0100", 8, &header_check_cpi, file_stat);
}
+#endif
diff --git a/src/file_crw.c b/src/file_crw.c
index 6db052d..7fc5c97 100644
--- a/src/file_crw.c
+++ b/src/file_crw.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_crw)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -71,3 +72,4 @@ static void file_check_crw(file_recovery_t *file_recovery)
const unsigned char crw_footer[2]= { 0x0A, 0x30};
file_search_footer(file_recovery, crw_footer, sizeof(crw_footer), 12);
}
+#endif
diff --git a/src/file_csh.c b/src/file_csh.c
index 50c20a7..73fc76c 100644
--- a/src/file_csh.c
+++ b/src/file_csh.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_csh)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -56,3 +57,4 @@ static void register_header_check_csh(file_stat_t *file_stat)
};
register_header_check(0, csh_header, sizeof(csh_header), &header_check_csh, file_stat);
}
+#endif
diff --git a/src/file_ctg.c b/src/file_ctg.c
index 991c31b..d661aaf 100644
--- a/src/file_ctg.c
+++ b/src/file_ctg.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_ctg)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -53,3 +54,4 @@ static void register_header_check_ctg(file_stat_t *file_stat)
static const unsigned char ctg_header[7]= {':','\\','D','C','I','M','\\'};
register_header_check(1, ctg_header,sizeof(ctg_header), &header_check_ctg, file_stat);
}
+#endif
diff --git a/src/file_cwk.c b/src/file_cwk.c
index cba78e6..6b9f1b2 100644
--- a/src/file_cwk.c
+++ b/src/file_cwk.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_cwk)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -86,3 +87,4 @@ static void register_header_check_cwk(file_stat_t *file_stat)
static const unsigned char cwk_header[4]= {'B','O','B','O'};
register_header_check(4, cwk_header,sizeof(cwk_header), &header_check_cwk, file_stat);
}
+#endif
diff --git a/src/file_d2s.c b/src/file_d2s.c
index 9a3779a..3aa8954 100644
--- a/src/file_d2s.c
+++ b/src/file_d2s.c
@@ -19,6 +19,7 @@
Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_d2s)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -46,7 +47,7 @@ struct d2s_header {
uint32_t size;
uint32_t unk1;
uint32_t unk2;
- char name[0];
+// char name[0];
} __attribute__ ((gcc_struct, __packed__));
static void file_rename_d2s(file_recovery_t *file_recovery)
@@ -82,3 +83,4 @@ static void register_header_check_d2s(file_stat_t *file_stat)
};
register_header_check(0, d2s_header,sizeof(d2s_header), &header_check_d2s, file_stat);
}
+#endif
diff --git a/src/file_dad.c b/src/file_dad.c
index f4e5794..b99bf43 100644
--- a/src/file_dad.c
+++ b/src/file_dad.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_dad)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -53,6 +54,9 @@ struct dad_header
static data_check_t data_check_dad(const unsigned char *buffer, const unsigned int buffer_size, file_recovery_t *file_recovery)
{
+ /*@
+ @ loop assigns file_recovery->calculated_file_size;
+ @*/
while(file_recovery->calculated_file_size + buffer_size/2 >= file_recovery->file_size &&
file_recovery->calculated_file_size + 16 <= file_recovery->file_size + buffer_size/2)
{
@@ -98,3 +102,4 @@ static void register_header_check_dad(file_stat_t *file_stat)
{
register_header_check(0, "DHAV", 4, &header_check_dad, file_stat);
}
+#endif
diff --git a/src/file_dar.c b/src/file_dar.c
index f642493..52ce361 100644
--- a/src/file_dar.c
+++ b/src/file_dar.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_dar)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -61,3 +62,4 @@ static void register_header_check_dar(file_stat_t *file_stat)
};
register_header_check(0, dar_header, sizeof(dar_header), &header_check_dar, file_stat);
}
+#endif
diff --git a/src/file_dat.c b/src/file_dat.c
index 3618323..370fbed 100644
--- a/src/file_dat.c
+++ b/src/file_dat.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_dat)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -93,3 +94,4 @@ static void register_header_check_dat(file_stat_t *file_stat)
register_header_check(4, dat_history, sizeof(dat_history), &header_check_dat_history4, file_stat);
register_header_check(10, dat_history, sizeof(dat_history), &header_check_dat_history10, file_stat);
}
+#endif
diff --git a/src/file_dbf.c b/src/file_dbf.c
index 19b30b6..085dc20 100644
--- a/src/file_dbf.c
+++ b/src/file_dbf.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_dbf)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -66,3 +67,4 @@ static int header_check_dbf(const unsigned char *buffer, const unsigned int buff
}
return 0;
}
+#endif
diff --git a/src/file_dbn.c b/src/file_dbn.c
index 44a8575..e857051 100644
--- a/src/file_dbn.c
+++ b/src/file_dbn.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_dbn)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -59,3 +60,4 @@ static void register_header_check_dbn(file_stat_t *file_stat)
};
register_header_check(0, dbn_header, sizeof(dbn_header), &header_check_dbn, file_stat);
}
+#endif
diff --git a/src/file_dcm.c b/src/file_dcm.c
index 81a62a7..f0eb886 100644
--- a/src/file_dcm.c
+++ b/src/file_dcm.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_dcm)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -55,3 +56,4 @@ static void register_header_check_dcm(file_stat_t *file_stat)
'U' , 'L' };
register_header_check(0x80, dcm_header, sizeof(dcm_header), &header_check_dcm, file_stat);
}
+#endif
diff --git a/src/file_ddf.c b/src/file_ddf.c
index 805c95c..401d97d 100644
--- a/src/file_ddf.c
+++ b/src/file_ddf.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_ddf)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -138,3 +139,4 @@ static void register_header_check_ddf(file_stat_t *file_stat)
register_header_check(0, ddf4_header, sizeof(ddf4_header), &header_check_ddf4, file_stat);
register_header_check(0, ddf5_header, sizeof(ddf5_header), &header_check_ddf5, file_stat);
}
+#endif
diff --git a/src/file_dex.c b/src/file_dex.c
index a79e864..3c1b229 100644
--- a/src/file_dex.c
+++ b/src/file_dex.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_dex)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -93,3 +94,4 @@ static void register_header_check_dex(file_stat_t *file_stat)
static const unsigned char dex_header[4]= {'d','e','x','\n'};
register_header_check(0, dex_header,sizeof(dex_header), &header_check_dex, file_stat);
}
+#endif
diff --git a/src/file_dim.c b/src/file_dim.c
index 02a3731..dae7824 100644
--- a/src/file_dim.c
+++ b/src/file_dim.c
@@ -19,6 +19,7 @@
Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_dim)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -53,3 +54,4 @@ static void register_header_check_dim(file_stat_t *file_stat)
static const unsigned char dim_header[4]= { 'S', 'P','C','I'};
register_header_check(0x0c, dim_header,sizeof(dim_header), &header_check_dim, file_stat);
}
+#endif
diff --git a/src/file_djv.c b/src/file_djv.c
index 3e4300d..2d3731b 100644
--- a/src/file_djv.c
+++ b/src/file_djv.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_djv)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -68,3 +69,4 @@ static void register_header_check_djv(file_stat_t *file_stat)
static const unsigned char djv_header[8]= { 'A','T','&','T','F','O','R','M'};
register_header_check(0, djv_header,sizeof(djv_header), &header_check_djv, file_stat);
}
+#endif
diff --git a/src/file_dmp.c b/src/file_dmp.c
index 95aa021..f53e615 100644
--- a/src/file_dmp.c
+++ b/src/file_dmp.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_dmp)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -58,4 +59,4 @@ static void register_header_check_dmp(file_stat_t *file_stat)
};
register_header_check(0, dmp_header, sizeof(dmp_header), &header_check_dmp, file_stat);
}
-
+#endif
diff --git a/src/file_doc.c b/src/file_doc.c
index 88347b4..33c471a 100644
--- a/src/file_doc.c
+++ b/src/file_doc.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_doc)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -43,6 +44,9 @@
#include "__fc_builtin.h"
#endif
+/*@
+ @ requires \valid(file_stat);
+ @*/
static void register_header_check_doc(file_stat_t *file_stat);
const file_hint_t file_hint_doc= {
@@ -139,6 +143,7 @@ static int OLE_read_block(FILE *IN, char *buf, const unsigned int uSectorShift,
/*@
@ requires \valid_read(dir_entry);
@ requires \initialized(dir_entry);
+ @ assigns \nothing;
@ ensures \result == \null || valid_read_string(\result);
@*/
static const char *entry2ext(const struct OLE_DIR *dir_entry)
@@ -283,6 +288,10 @@ static const char *ole_get_file_extension(const struct OLE_HDR *header, const un
/*@ assert \valid_read(dir_entries + (0 .. 512/sizeof(struct OLE_DIR)-1)); */
const char *ext=NULL;
int is_db=0;
+ /*@
+ @ loop invariant ext == \null || ext == extension_xls || ext == extension_psmodel || ext == extension_snt;
+ @ loop assigns ext, is_db, sid;
+ @*/
for(sid=0;
sid<512/sizeof(struct OLE_DIR);
sid++)
@@ -445,6 +454,7 @@ static uint32_t *OLE_load_FAT(FILE *IN, const struct OLE_HDR *header, const uint
/*@
@ requires \valid(file_recovery);
@ requires \valid(file_recovery->handle);
+ @ requires \separated(file_recovery, file_recovery->handle);
@ ensures \valid(file_recovery->handle);
@*/
void file_check_doc_aux(file_recovery_t *file_recovery, const uint64_t offset)
@@ -602,6 +612,7 @@ void file_check_doc_aux(file_recovery_t *file_recovery, const uint64_t offset)
/*@
@ requires \valid(file_recovery);
@ requires \valid(file_recovery->handle);
+ @ requires \separated(file_recovery, file_recovery->handle);
@ requires file_recovery->file_check == &file_check_doc;
@ ensures \valid(file_recovery->handle);
@*/
@@ -615,6 +626,7 @@ static void file_check_doc(file_recovery_t *file_recovery)
@ requires \valid_read(fat + (0 .. fat_entries-1));
@ requires 9 == uSectorShift || 12 == uSectorShift;
@ requires 0 < len <= 1024*1024;
+ @ requires \separated(IN, fat + (..), &errno, &Frama_C_entropy_source);
@ ensures \result!=\null ==> \valid((char *)\result + (0 .. len - 1));
@*/
static void *OLE_read_stream(FILE *IN,
@@ -647,6 +659,7 @@ static void *OLE_read_stream(FILE *IN,
return NULL;
}
}
+ /*@ assert \valid(dataPt + (0 .. len - 1)); */
return dataPt;
}
@@ -1798,14 +1811,12 @@ static int header_check_doc(const unsigned char *buffer, const unsigned int buff
return 1;
}
-/*@
- @ requires \valid(file_stat);
- @*/
static void register_header_check_doc(file_stat_t *file_stat)
{
static const unsigned char doc_header[]= { 0xd0, 0xcf, 0x11, 0xe0, 0xa1, 0xb1, 0x1a, 0xe1};
register_header_check(0, doc_header,sizeof(doc_header), &header_check_doc, file_stat);
}
+#endif
#if defined(MAIN_doc)
#define BLOCKSIZE 65536u
diff --git a/src/file_dpx.c b/src/file_dpx.c
index b764efe..89368cc 100644
--- a/src/file_dpx.c
+++ b/src/file_dpx.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_dpx)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -89,3 +90,4 @@ static void register_header_check_dpx(file_stat_t *file_stat)
register_header_check(0, "SDPX", 4, &header_check_dpx, file_stat);
register_header_check(0, "XPDS", 4, &header_check_dpx, file_stat);
}
+#endif
diff --git a/src/file_drw.c b/src/file_drw.c
index 05c9924..2c7cb95 100644
--- a/src/file_drw.c
+++ b/src/file_drw.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_drw)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -67,3 +68,4 @@ static void register_header_check_drw(file_stat_t *file_stat)
'R', 'A', 'W', 'I', 'N', 'G'};
register_header_check(0, drw_header,sizeof(drw_header), &header_check_drw, file_stat);
}
+#endif
diff --git a/src/file_ds2.c b/src/file_ds2.c
index 73b1116..754d8e7 100644
--- a/src/file_ds2.c
+++ b/src/file_ds2.c
@@ -19,6 +19,7 @@
Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_ds2)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -74,3 +75,4 @@ static void register_header_check_ds2(file_stat_t *file_stat)
static const unsigned char ds2_header[4]= { 0x03, 'd','s','2'};
register_header_check(0, ds2_header,sizeof(ds2_header), &header_check_ds2, file_stat);
}
+#endif
diff --git a/src/file_ds_store.c b/src/file_ds_store.c
index ba23b46..c4d4431 100644
--- a/src/file_ds_store.c
+++ b/src/file_ds_store.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_ds_store)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -70,3 +71,4 @@ static void register_header_check_ds_store(file_stat_t *file_stat)
};
register_header_check(0, ds_store_header, sizeof(ds_store_header), &header_check_ds_store, file_stat);
}
+#endif
diff --git a/src/file_dsc.c b/src/file_dsc.c
index 398ae6e..002cd84 100644
--- a/src/file_dsc.c
+++ b/src/file_dsc.c
@@ -19,6 +19,7 @@
Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_dsc)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -54,3 +55,4 @@ static void register_header_check_dsc(file_stat_t *file_stat)
static const unsigned char dsc_header[3]= { 'M','L','T'};
register_header_check(588, dsc_header,sizeof(dsc_header), &header_check_dsc, file_stat);
}
+#endif
diff --git a/src/file_dss.c b/src/file_dss.c
index 8f6de2b..6e4db8e 100644
--- a/src/file_dss.c
+++ b/src/file_dss.c
@@ -19,6 +19,7 @@
Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_dss)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -78,3 +79,4 @@ static void register_header_check_dss(file_stat_t *file_stat)
static const unsigned char dss_header[4]= { 0x02, 'd','s','s'};
register_header_check(0, dss_header,sizeof(dss_header), &header_check_dss, file_stat);
}
+#endif
diff --git a/src/file_dst.c b/src/file_dst.c
index 38a2e5e..3267bae 100644
--- a/src/file_dst.c
+++ b/src/file_dst.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_dst)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -62,3 +63,4 @@ static void register_header_check_dst(file_stat_t *file_stat)
{
register_header_check(0x13, "\rST:", 4, &header_check_dst, file_stat);
}
+#endif
diff --git a/src/file_dta.c b/src/file_dta.c
index ce52423..8fe774a 100644
--- a/src/file_dta.c
+++ b/src/file_dta.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_dta)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -66,3 +67,4 @@ static void register_header_check_dta(file_stat_t *file_stat)
register_header_check(0, dta_header_71le,sizeof(dta_header_71le), &header_check_dta, file_stat);
register_header_check(0, dta_header_72le,sizeof(dta_header_72le), &header_check_dta, file_stat);
}
+#endif
diff --git a/src/file_dump.c b/src/file_dump.c
index 38c77f3..f21b9c6 100644
--- a/src/file_dump.c
+++ b/src/file_dump.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_dump)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -145,3 +146,4 @@ static void register_header_check_dump(file_stat_t *file_stat)
register_header_check(0x18, dump_header_le_old_fs,sizeof(dump_header_le_old_fs), &header_check_dump, file_stat);
register_header_check(0x18, dump_header_le_new_fs,sizeof(dump_header_le_new_fs), &header_check_dump, file_stat);
}
+#endif
diff --git a/src/file_dv.c b/src/file_dv.c
index 6aabd81..bc45ce3 100644
--- a/src/file_dv.c
+++ b/src/file_dv.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_dv)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -29,6 +30,9 @@
#include <stdio.h>
#include "types.h"
#include "filegen.h"
+#if defined(__FRAMAC__)
+#include "__fc_builtin.h"
+#endif
static void register_header_check_dv(file_stat_t *file_stat);
@@ -43,6 +47,9 @@ const file_hint_t file_hint_dv= {
static data_check_t data_check_NTSC(const unsigned char *buffer, const unsigned int buffer_size, file_recovery_t *file_recovery)
{
+ /*@
+ @ loop assigns file_recovery->calculated_file_size;
+ @*/
while(file_recovery->calculated_file_size + buffer_size/2 >= file_recovery->file_size &&
file_recovery->calculated_file_size + 8 < file_recovery->file_size + buffer_size/2)
{
@@ -64,6 +71,9 @@ static void file_check_dv_NTSC(file_recovery_t *fr)
if(my_fseek(fr->handle, 0, SEEK_SET) < 0 ||
fread(&buffer_header, sizeof(buffer_header), 1, fr->handle) != 1)
return ;
+#if defined(__FRAMAC__)
+ Frama_C_make_unknown((char *)&buffer_header, sizeof(buffer_header));
+#endif
if(fs > 0)
fs-=120000;
if(fs > 0)
@@ -73,6 +83,9 @@ static void file_check_dv_NTSC(file_recovery_t *fr)
fread(&buffer, sizeof(buffer), 1, fr->handle) == 1)
{
unsigned int i;
+#if defined(__FRAMAC__)
+ Frama_C_make_unknown((char *)&buffer, sizeof(buffer));
+#endif
for(i=1; i<sizeof(buffer); i+=0x50)
if((buffer[i]&0x0f)!=(buffer_header[1]&0x0f))
{
@@ -86,6 +99,9 @@ static void file_check_dv_NTSC(file_recovery_t *fr)
static data_check_t data_check_PAL(const unsigned char *buffer, const unsigned int buffer_size, file_recovery_t *file_recovery)
{
+ /*@
+ @ loop assigns file_recovery->calculated_file_size;
+ @*/
while(file_recovery->calculated_file_size + buffer_size/2 >= file_recovery->file_size &&
file_recovery->calculated_file_size + 8 < file_recovery->file_size + buffer_size/2)
{
@@ -107,6 +123,9 @@ static void file_check_dv_PAL(file_recovery_t *fr)
if(my_fseek(fr->handle, 0, SEEK_SET) < 0 ||
fread(&buffer_header, sizeof(buffer_header), 1, fr->handle) != 1)
return ;
+#if defined(__FRAMAC__)
+ Frama_C_make_unknown((char *)&buffer_header, sizeof(buffer_header));
+#endif
if(fs > 0)
fs-=144000;
if(fs > 0)
@@ -116,6 +135,9 @@ static void file_check_dv_PAL(file_recovery_t *fr)
fread(&buffer, sizeof(buffer), 1, fr->handle) == 1)
{
unsigned int i;
+#if defined(__FRAMAC__)
+ Frama_C_make_unknown((char *)&buffer, sizeof(buffer));
+#endif
for(i=1; i<sizeof(buffer); i+=0x50)
if((buffer[i]&0x0f)!=(buffer_header[1]&0x0f))
{
@@ -159,3 +181,4 @@ static void register_header_check_dv(file_stat_t *file_stat)
static const unsigned char dv_header[3]= {0x1f, 0x07, 0x00};
register_header_check(0, dv_header,sizeof(dv_header), &header_check_dv, file_stat);
}
+#endif
diff --git a/src/file_dvi.c b/src/file_dvi.c
index 0458f67..48570ae 100644
--- a/src/file_dvi.c
+++ b/src/file_dvi.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_dvi)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -65,3 +66,4 @@ static void register_header_check_dvi(file_stat_t *file_stat)
};
register_header_check(0, dvi_header, sizeof(dvi_header), &header_check_dvi, file_stat);
}
+#endif
diff --git a/src/file_dvr.c b/src/file_dvr.c
index 4adbbb7..3b9aa4b 100644
--- a/src/file_dvr.c
+++ b/src/file_dvr.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_dvr)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -60,3 +61,4 @@ static void register_header_check_dvr(file_stat_t *file_stat)
{
register_header_check(0, "RT60", 4, &header_check_dvr, file_stat);
}
+#endif
diff --git a/src/file_dwg.c b/src/file_dwg.c
index 9eb30e3..09abae4 100644
--- a/src/file_dwg.c
+++ b/src/file_dwg.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_dwg)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -69,3 +70,4 @@ static void register_header_check_dwg(file_stat_t *file_stat)
register_header_check(0, dwg_header_24,sizeof(dwg_header_24), &header_check_dwg, file_stat);
register_header_check(0, dwg_header_27,sizeof(dwg_header_27), &header_check_dwg, file_stat);
}
+#endif
diff --git a/src/file_dxf.c b/src/file_dxf.c
index fb0ed16..9308d3b 100644
--- a/src/file_dxf.c
+++ b/src/file_dxf.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_dxf)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -59,6 +60,9 @@ static int header_check_dxf(const unsigned char *buffer, const unsigned int buff
static data_check_t data_check_dxf(const unsigned char *buffer, const unsigned int buffer_size, file_recovery_t *file_recovery)
{
unsigned int i;
+ /*@
+ @ loop assigns i, file_recovery->calculated_file_size;
+ @*/
for(i=(buffer_size/2)-3;i+4<buffer_size;i++)
{
if(buffer[i]=='\n' && buffer[i+1]=='E' && buffer[i+2]=='O' && buffer[i+3]=='F')
@@ -94,3 +98,4 @@ static void register_header_check_dxf(file_stat_t *file_stat)
register_header_check(0, header_dxflib, sizeof(header_dxflib), &header_check_dxf, file_stat);
register_header_check(0, header_dxflib_dos, sizeof(header_dxflib_dos), &header_check_dxf, file_stat);
}
+#endif
diff --git a/src/file_e01.c b/src/file_e01.c
index ed219a3..b563b09 100644
--- a/src/file_e01.c
+++ b/src/file_e01.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_e01)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -105,3 +106,4 @@ static void register_header_check_e01(file_stat_t *file_stat)
};
register_header_check(0, e01_header, sizeof(e01_header), &header_check_e01, file_stat);
}
+#endif
diff --git a/src/file_ecryptfs.c b/src/file_ecryptfs.c
index a43b9a4..5f5741b 100644
--- a/src/file_ecryptfs.c
+++ b/src/file_ecryptfs.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_ecryptfs)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -87,3 +88,4 @@ static int header_check_ecryptfs(const unsigned char *buffer, const unsigned int
file_recovery_new->file_check=&file_check_ecryptfs;
return 1;
}
+#endif
diff --git a/src/file_edb.c b/src/file_edb.c
index e09d61b..ad07bda 100644
--- a/src/file_edb.c
+++ b/src/file_edb.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_edb)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -65,3 +66,4 @@ static void register_header_check_edb(file_stat_t *file_stat)
};
register_header_check(4, edb_magic, sizeof(edb_magic), &header_check_edb, file_stat);
}
+#endif
diff --git a/src/file_elf.c b/src/file_elf.c
index f9ff9a0..2bdbcb2 100644
--- a/src/file_elf.c
+++ b/src/file_elf.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_elf)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -152,3 +153,4 @@ static void register_header_check_elf(file_stat_t *file_stat)
register_header_check(0, elf_header16, sizeof(elf_header16), &header_check_elf, file_stat);
register_header_check(0, elf_header32, sizeof(elf_header32), &header_check_elf, file_stat);
}
+#endif
diff --git a/src/file_emf.c b/src/file_emf.c
index b4a10d0..39ff7ac 100644
--- a/src/file_emf.c
+++ b/src/file_emf.c
@@ -19,6 +19,7 @@
Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_emf)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -422,6 +423,7 @@ static void register_header_check_emf(file_stat_t *file_stat)
static const unsigned char emf_sign[4]= { ' ','E', 'M','F'};
register_header_check(0x28, emf_sign,sizeof(emf_sign), &header_check_emf, file_stat);
}
+#endif
#if defined(MAIN_emf)
#define BLOCKSIZE 65536u
diff --git a/src/file_ess.c b/src/file_ess.c
index 9ed99f2..dd316e8 100644
--- a/src/file_ess.c
+++ b/src/file_ess.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_ess)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -52,3 +53,4 @@ static void register_header_check_ess(file_stat_t *file_stat)
{
register_header_check(0, "TESV_SAVEGAME", 13, &header_check_ess, file_stat);
}
+#endif
diff --git a/src/file_evt.c b/src/file_evt.c
index 6eb621f..a06f356 100644
--- a/src/file_evt.c
+++ b/src/file_evt.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_evt)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -34,7 +35,6 @@
static void register_header_check_evt(file_stat_t *file_stat);
static int header_check_evt(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 data_check_t data_check_evt(const unsigned char *buffer, const unsigned int buffer_size, file_recovery_t *file_recovery);
const file_hint_t file_hint_evt= {
.extension="evt",
@@ -52,6 +52,9 @@ struct evt_chunk {
static data_check_t data_check_evt(const unsigned char *buffer, const unsigned int buffer_size, file_recovery_t *file_recovery)
{
+ /*@
+ @ loop assigns file_recovery->calculated_file_size;
+ @*/
while(file_recovery->calculated_file_size + buffer_size/2 >= file_recovery->file_size &&
file_recovery->calculated_file_size + 8 < file_recovery->file_size + buffer_size/2)
{
@@ -84,9 +87,10 @@ static data_check_t data_check_evt(const unsigned char *buffer, const unsigned i
static int header_check_evt(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 struct evt_chunk *chunk=(const struct evt_chunk *)buffer;
- const struct evt_chunk *chunk2=(const struct evt_chunk *)&buffer[le32(chunk->size)];
+ const struct evt_chunk *chunk2;
if(le32(chunk->size) != 0x30)
return 0;
+ chunk2=(const struct evt_chunk *)&buffer[le32(chunk->size)];
if(le32(chunk2->size) < 8)
return 0;
reset_file_recovery(file_recovery_new);
@@ -105,3 +109,4 @@ static void register_header_check_evt(file_stat_t *file_stat)
static const unsigned char evt_header[8]= {0x30, 0x00, 0x00, 0x00, 'L', 'f', 'L', 'e'};
register_header_check(0, evt_header,sizeof(evt_header), &header_check_evt, file_stat);
}
+#endif
diff --git a/src/file_evtx.c b/src/file_evtx.c
index 68f884f..6f19ad9 100644
--- a/src/file_evtx.c
+++ b/src/file_evtx.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_evtx)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -78,3 +79,4 @@ static void register_header_check_evtx(file_stat_t *file_stat)
{
register_header_check(0, "ElfFile", 8, &header_check_evtx, file_stat);
}
+#endif
diff --git a/src/file_exe.c b/src/file_exe.c
index 2050e21..8aa1a6f 100644
--- a/src/file_exe.c
+++ b/src/file_exe.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_exe)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -913,6 +914,7 @@ static void register_header_check_exe(file_stat_t *file_stat)
{
register_header_check(0, exe_header,sizeof(exe_header), &header_check_exe, file_stat);
}
+#endif
#if defined(MAIN_exe)
#define BLOCKSIZE 65536u
diff --git a/src/file_exr.c b/src/file_exr.c
index f0df6ba..886fa6e 100644
--- a/src/file_exr.c
+++ b/src/file_exr.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_exr)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -56,3 +57,4 @@ static void register_header_check_exr(file_stat_t *file_stat)
static const unsigned char exr_header[5]= { 'v' , 0x2f, '1' , 0x01, 0x02 };
register_header_check(0, exr_header, sizeof(exr_header), &header_check_exr, file_stat);
}
+#endif
diff --git a/src/file_exs.c b/src/file_exs.c
index 921d596..26913ec 100644
--- a/src/file_exs.c
+++ b/src/file_exs.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_exs)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -70,5 +71,4 @@ static void register_header_check_exs(file_stat_t *file_stat)
};
register_header_check(0, exs_header, sizeof(exs_header), &header_check_exs, file_stat);
}
-
-
+#endif
diff --git a/src/file_ext.c b/src/file_ext.c
index b131fc7..cf55797 100644
--- a/src/file_ext.c
+++ b/src/file_ext.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_ext2_sb)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -32,6 +33,7 @@
#include "ext2.h"
#include "ext2_common.h"
#include "filegen.h"
+#include "log.h"
static void register_header_check_ext2_sb(file_stat_t *file_stat);
@@ -121,3 +123,4 @@ static void register_header_check_ext2_sb(file_stat_t *file_stat)
register_header_check(0x38, ext2_sb_header, sizeof(ext2_sb_header), &header_check_ext2_sb, file_stat);
register_header_check(0x4, ext2_ll_dir1, sizeof(ext2_ll_dir1), &header_check_ext2_dir, file_stat);
}
+#endif
diff --git a/src/file_ext2.c b/src/file_ext2.c
index 7bc31a9..cc672fe 100644
--- a/src/file_ext2.c
+++ b/src/file_ext2.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_ext2_fs)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -37,7 +38,7 @@ static void register_header_check_ext2_fs(file_stat_t *file_stat);
static int header_check_ext2_fs(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_ext2_fs= {
- .extension="ext",
+ .extension="ext2",
.description="ext2/ext3/ext4 Filesystem",
.max_filesize=0,
.recover=1,
@@ -73,3 +74,4 @@ static int header_check_ext2_fs(const unsigned char *buffer, const unsigned int
file_recovery_new->file_check=&file_check_size;
return 1;
}
+#endif
diff --git a/src/file_fbf.c b/src/file_fbf.c
index 31c5747..addf7af 100644
--- a/src/file_fbf.c
+++ b/src/file_fbf.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_fbf)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -57,3 +58,4 @@ static void register_header_check_fbf(file_stat_t *file_stat)
};
register_header_check(0, fbf_header, sizeof(fbf_header), &header_check_fbf, file_stat);
}
+#endif
diff --git a/src/file_fbk.c b/src/file_fbk.c
index 6efd490..c88994b 100644
--- a/src/file_fbk.c
+++ b/src/file_fbk.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_fbk)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -53,3 +54,4 @@ static void register_header_check_fbk(file_stat_t *file_stat)
static const unsigned char fbk_header[10] = {'T','a','b','l','e','D','a','t','a',' '};
register_header_check(0, fbk_header, sizeof(fbk_header), &header_check_fbk, file_stat);
}
+#endif
diff --git a/src/file_fcp.c b/src/file_fcp.c
index 8d71e89..a5390a0 100644
--- a/src/file_fcp.c
+++ b/src/file_fcp.c
@@ -19,6 +19,7 @@
Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_fcp)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -58,3 +59,4 @@ static void register_header_check_fcp(file_stat_t *file_stat)
static const unsigned char fcp_header[5]= { 0xA2, 'K','e','y','G'};
register_header_check(0, fcp_header,sizeof(fcp_header), &header_check_fcp, file_stat);
}
+#endif
diff --git a/src/file_fcs.c b/src/file_fcs.c
index 05ce8ca..1ad1af9 100644
--- a/src/file_fcs.c
+++ b/src/file_fcs.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_fcs)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -148,3 +149,4 @@ static int header_check_fcs(const unsigned char *buffer, const unsigned int buff
file_recovery_new->file_check=&file_check_size;
return 1;
}
+#endif
diff --git a/src/file_fdb.c b/src/file_fdb.c
index a827049..90bebda 100644
--- a/src/file_fdb.c
+++ b/src/file_fdb.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_fdb)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -58,3 +59,4 @@ static void register_header_check_fdb(file_stat_t *file_stat)
static const unsigned char fdb_header[7] = { 0x00, 0x00, 0x00, 0x5c, 0xa0, 0x83, 0x02};
register_header_check(5, fdb_header, sizeof(fdb_header), &header_check_fdb, file_stat);
}
+#endif
diff --git a/src/file_fds.c b/src/file_fds.c
index 0217fb6..2ec3c4b 100644
--- a/src/file_fds.c
+++ b/src/file_fds.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_fds)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -67,3 +68,4 @@ static void register_header_check_fds(file_stat_t *file_stat)
static const unsigned char fds_header[4]= {'F','D','S',0x1A};
register_header_check(0, fds_header,sizeof(fds_header), &header_check_fds, file_stat);
}
+#endif
diff --git a/src/file_fh10.c b/src/file_fh10.c
index f742f68..d350d8e 100644
--- a/src/file_fh10.c
+++ b/src/file_fh10.c
@@ -22,6 +22,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_fh10)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -64,3 +65,4 @@ static void register_header_check_fh10(file_stat_t *file_stat)
};
register_header_check(0, fh10_header,sizeof(fh10_header), &header_check_fh10, file_stat);
}
+#endif
diff --git a/src/file_fh5.c b/src/file_fh5.c
index 63a39f0..1d29412 100644
--- a/src/file_fh5.c
+++ b/src/file_fh5.c
@@ -21,6 +21,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_fh5)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -77,3 +78,4 @@ static void register_header_check_fh5(file_stat_t *file_stat)
static const unsigned char fh5_header[8] = { 0x41, 0x47, 0x44, 0x31, 0xbe, 0xb8, 0xbb, 0xce };
register_header_check(0, fh5_header,sizeof(fh5_header), &header_check_fh5, file_stat);
}
+#endif
diff --git a/src/file_filevault.c b/src/file_filevault.c
index b4bb498..afe45ee 100644
--- a/src/file_filevault.c
+++ b/src/file_filevault.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_filevault)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -60,3 +61,4 @@ static void register_header_check_filevault(file_stat_t *file_stat)
};
register_header_check(0, filevault_header, sizeof(filevault_header), &header_check_filevault, file_stat);
}
+#endif
diff --git a/src/file_fit.c b/src/file_fit.c
index 323beb7..3a1d317 100644
--- a/src/file_fit.c
+++ b/src/file_fit.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_fit )
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -73,3 +74,4 @@ static void register_header_check_fit(file_stat_t *file_stat)
static const unsigned char fits_header[4]= { '.', 'F', 'I', 'T' };
register_header_check(8, fits_header, sizeof(fits_header), &header_check_fit, file_stat);
}
+#endif
diff --git a/src/file_fits.c b/src/file_fits.c
index 12065ec..b40be59 100644
--- a/src/file_fits.c
+++ b/src/file_fits.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_fits)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -52,25 +53,45 @@ const file_hint_t file_hint_fits= {
* Image metadata is store in an ASCII header
* Specification can be found at http://fits.gsfc.nasa.gov/ */
+/*@
+ @ requires \valid_read(str + (0 .. 80-1));
+ @ assigns \nothing;
+ @*/
static uint64_t fits_get_val(const unsigned char *str)
{
unsigned int i;
uint64_t val=0;
+ /*@ loop assigns i; */
for(i=0;i<80 && str[i]!='=';i++);
i++;
+ /*@ loop assigns i; */
for(;i<80 && str[i]==' ';i++);
if(i<80 && str[i]=='-')
i++;
+ /*@ loop assigns i,val; */
for(;i<80 && str[i]>='0' && str[i]<='9';i++)
val=val*10+str[i]-'0';
return val;
}
+/*@
+ @ requires buffer_size > 0;
+ @ requires \valid_read(buffer + (0 .. buffer_size-1));
+ @ requires \valid(file_recovery);
+ @ requires \valid(i_pointer);
+ @ requires \separated(buffer+(..), file_recovery, i_pointer);
+ @*/
static uint64_t fits_info(const unsigned char *buffer, const unsigned int buffer_size, file_recovery_t *file_recovery, unsigned int *i_pointer)
{
uint64_t naxis_size=1;
unsigned int i=*i_pointer;
+ if( i+80 >= buffer_size)
+ return 1;
/* Header is composed of 80 character fixed-length strings */
+ /*@
+ @ loop invariant i < buffer_size + 80;
+ @ loop assigns i, naxis_size, file_recovery->time;
+ @*/
for(; i+80 < buffer_size &&
memcmp(&buffer[i], "END ", 4)!=0;
i+=80)
@@ -95,13 +116,14 @@ static uint64_t fits_info(const unsigned char *buffer, const unsigned int buffer
{
/* CREA_DAT= '2007-08-29T16:22:09' */
/* 0123456789012345678 */
- const char *date_asc;
unsigned int j;
- for(j=0,date_asc=(const char *)&buffer[i];j<80 && *date_asc!='\'';j++,date_asc++);
- if(j<60 && *date_asc=='\'')
+ /*@
+ @ loop assigns j;
+ @*/
+ for(j=0;j<80 && buffer[i+j]!='\'';j++);
+ if(j<60 && buffer[i+j]=='\'')
{
- date_asc++;
- file_recovery->time=get_time_from_YYYY_MM_DD_HH_MM_SS(date_asc);
+ file_recovery->time=get_time_from_YYYY_MM_DD_HH_MM_SS(&buffer[i+j+1]);
}
}
}
@@ -111,6 +133,9 @@ static uint64_t fits_info(const unsigned char *buffer, const unsigned int buffer
static data_check_t data_check_fits(const unsigned char *buffer, const unsigned int buffer_size, file_recovery_t *file_recovery)
{
+ /*@
+ @ loop assigns file_recovery->calculated_file_size;
+ @*/
while(file_recovery->calculated_file_size + buffer_size/2 >= file_recovery->file_size &&
file_recovery->calculated_file_size + 8 < file_recovery->file_size + buffer_size/2)
{
@@ -171,3 +196,4 @@ static void register_header_check_fits(file_stat_t *file_stat)
{
register_header_check(0, "SIMPLE =", 9, &header_check_fits, file_stat);
}
+#endif
diff --git a/src/file_flac.c b/src/file_flac.c
index 2a3a863..f46bb6d 100644
--- a/src/file_flac.c
+++ b/src/file_flac.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_flac)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -90,8 +91,11 @@ static int header_check_flac(const unsigned char *buffer, const unsigned int buf
#endif
file_recovery_new->min_filesize=4+size;
#if 0
- file_recovery_new->calculated_file_size=4;
- file_recovery_new->data_check=&data_check_flac_metadata;
+ if(file_recovery_new->blocksize >= 4)
+ {
+ file_recovery_new->calculated_file_size=4;
+ file_recovery_new->data_check=&data_check_flac_metadata;
+ }
#endif
return 1;
}
@@ -104,3 +108,4 @@ static void register_header_check_flac(file_stat_t *file_stat)
register_header_check(0, flac_header,sizeof(flac_header), &header_check_flac, file_stat);
register_header_check(0, flac_header2,sizeof(flac_header2), &header_check_flac, file_stat);
}
+#endif
diff --git a/src/file_flp.c b/src/file_flp.c
index affebe4..a6d23dd 100644
--- a/src/file_flp.c
+++ b/src/file_flp.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_flp)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -76,3 +77,4 @@ static void register_header_check_flp(file_stat_t *file_stat)
static const unsigned char flp_header[8]= {'F', 'L', 'h', 'd', 0x06, 0x00, 0x00, 0x00};
register_header_check(0, flp_header,sizeof(flp_header), &header_check_flp, file_stat);
}
+#endif
diff --git a/src/file_flv.c b/src/file_flv.c
index 1adf12a..dd89350 100644
--- a/src/file_flv.c
+++ b/src/file_flv.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_flv)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -64,6 +65,9 @@ struct flv_tag
static data_check_t data_check_flv(const unsigned char *buffer, const unsigned int buffer_size, file_recovery_t *file_recovery)
{
static uint32_t datasize=0;
+ /*@
+ @ loop assigns file_recovery->calculated_file_size, datasize;
+ @*/
while(file_recovery->calculated_file_size + buffer_size/2 >= file_recovery->file_size &&
file_recovery->calculated_file_size + 15 < file_recovery->file_size + buffer_size/2)
{
@@ -113,3 +117,4 @@ static void register_header_check_flv(file_stat_t *file_stat)
static const unsigned char flv_header[4]= {'F', 'L', 'V', 0x01};
register_header_check(0, flv_header,sizeof(flv_header), &header_check_flv, file_stat);
}
+#endif
diff --git a/src/file_fm.c b/src/file_fm.c
index 240e15d..12479d2 100644
--- a/src/file_fm.c
+++ b/src/file_fm.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_fm)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -67,3 +68,4 @@ static void register_header_check_fm(file_stat_t *file_stat)
};
register_header_check(0, fm_header, sizeof(fm_header), &header_check_fm, file_stat);
}
+#endif
diff --git a/src/file_fob.c b/src/file_fob.c
index c96f1bc..35b8362 100644
--- a/src/file_fob.c
+++ b/src/file_fob.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_fob)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -72,3 +73,4 @@ static void register_header_check_fob(file_stat_t *file_stat)
register_header_check(0, "Table ", 6, &header_check_fob, file_stat);
register_header_check(0, "XMLport ", 8, &header_check_fob, file_stat);
}
+#endif
diff --git a/src/file_fos.c b/src/file_fos.c
index c2254a3..31be28f 100644
--- a/src/file_fos.c
+++ b/src/file_fos.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_fos)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -53,3 +54,4 @@ static void register_header_check_fos(file_stat_t *file_stat)
{
register_header_check(0, "FO4_SAVEGAME", 11, &header_check_fos, file_stat);
}
+#endif
diff --git a/src/file_fp5.c b/src/file_fp5.c
index 5c762bc..a861201 100644
--- a/src/file_fp5.c
+++ b/src/file_fp5.c
@@ -19,6 +19,7 @@
Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_fp5)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -55,3 +56,4 @@ static void register_header_check_fp5(file_stat_t *file_stat)
};
register_header_check(0, fp5_header,sizeof(fp5_header), &header_check_fp5, file_stat);
}
+#endif
diff --git a/src/file_fp7.c b/src/file_fp7.c
index 8e54e54..0749ede 100644
--- a/src/file_fp7.c
+++ b/src/file_fp7.c
@@ -19,6 +19,7 @@
Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_fp7)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -69,3 +70,4 @@ static void register_header_check_fp7(file_stat_t *file_stat)
};
register_header_check(0, fp7_header,sizeof(fp7_header), &header_check_fp7, file_stat);
}
+#endif
diff --git a/src/file_freeway.c b/src/file_freeway.c
index bdbb419..8e07f46 100644
--- a/src/file_freeway.c
+++ b/src/file_freeway.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_freeway)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -56,3 +57,4 @@ static void register_header_check_freeway(file_stat_t *file_stat)
};
register_header_check(0x10, freeway_header, sizeof(freeway_header), &header_check_freeway, file_stat);
}
+#endif
diff --git a/src/file_frm.c b/src/file_frm.c
index 4b3f126..480c158 100644
--- a/src/file_frm.c
+++ b/src/file_frm.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_frm)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -70,3 +71,4 @@ static void register_header_check_frm(file_stat_t *file_stat)
'W', 'G', 'F', 'O', 'R', 'M'};
register_header_check(0, frm_header,sizeof(frm_header), &header_check_frm, file_stat);
}
+#endif
diff --git a/src/file_fs.c b/src/file_fs.c
index c8aa99f..dbd7e05 100644
--- a/src/file_fs.c
+++ b/src/file_fs.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_fs)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -58,6 +59,9 @@ struct transaction_header
static data_check_t data_check_fs(const unsigned char *buffer, const unsigned int buffer_size, file_recovery_t *file_recovery)
{
+ /*@
+ @ loop assigns file_recovery->calculated_file_size;
+ @*/
while(file_recovery->calculated_file_size + buffer_size/2 >= file_recovery->file_size &&
file_recovery->calculated_file_size + 0x11 < file_recovery->file_size + buffer_size/2)
{
@@ -102,3 +106,4 @@ static void register_header_check_fs(file_stat_t *file_stat)
static const unsigned char fs_header[4]={ 'F', 'S','2','1' };
register_header_check(0, fs_header,sizeof(fs_header), &header_check_fs, file_stat);
}
+#endif
diff --git a/src/file_fwd.c b/src/file_fwd.c
index 86c0ad8..195e2e7 100644
--- a/src/file_fwd.c
+++ b/src/file_fwd.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_fwd)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -52,3 +53,4 @@ static void register_header_check_fwd(file_stat_t *file_stat)
{
register_header_check(0, "FRWD0120", 8, &header_check_fwd, file_stat);
}
+#endif
diff --git a/src/file_gam.c b/src/file_gam.c
index 95b9491..28c0d39 100644
--- a/src/file_gam.c
+++ b/src/file_gam.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_gam)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -55,3 +56,4 @@ static void register_header_check_gam(file_stat_t *file_stat)
};
register_header_check(0, gam_header, sizeof(gam_header), &header_check_gam, file_stat);
}
+#endif
diff --git a/src/file_gct.c b/src/file_gct.c
index fd76bb9..727fbd5 100644
--- a/src/file_gct.c
+++ b/src/file_gct.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_gct)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -59,3 +60,4 @@ static void register_header_check_gct(file_stat_t *file_stat)
};
register_header_check(0, gct_header, sizeof(gct_header), &header_check_gct, file_stat);
}
+#endif
diff --git a/src/file_gho.c b/src/file_gho.c
index cdd0de3..8e405df 100644
--- a/src/file_gho.c
+++ b/src/file_gho.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_gho)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -56,3 +57,4 @@ static void register_header_check_gho(file_stat_t *file_stat)
static const unsigned char gho_header[3]= { 0xfe, 0xef, 0x01 };
register_header_check(0, gho_header,sizeof(gho_header), &header_check_db, file_stat);
}
+#endif
diff --git a/src/file_gi.c b/src/file_gi.c
index bd36fc7..0fc12f8 100644
--- a/src/file_gi.c
+++ b/src/file_gi.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_gi)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -67,3 +68,4 @@ static void register_header_check_gi(file_stat_t *file_stat)
};
register_header_check(0, gi_header, sizeof(gi_header), &header_check_gi, file_stat);
}
+#endif
diff --git a/src/file_gif.c b/src/file_gif.c
index 6f093c5..4ae2f69 100644
--- a/src/file_gif.c
+++ b/src/file_gif.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_gif)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -160,3 +161,4 @@ static void register_header_check_gif(file_stat_t *file_stat)
register_header_check(0, gif_header,sizeof(gif_header), &header_check_gif, file_stat);
register_header_check(0, gif_header2,sizeof(gif_header2), &header_check_gif, file_stat);
}
+#endif
diff --git a/src/file_gm6.c b/src/file_gm6.c
index 536eeca..4445a6c 100644
--- a/src/file_gm6.c
+++ b/src/file_gm6.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_gm6)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -140,3 +141,4 @@ static void register_header_check_gm6(file_stat_t *file_stat)
register_header_check(0, gm50_header, sizeof(gm50_header), &header_check_gmd, file_stat);
register_header_check(0, gm43_header, sizeof(gm43_header), &header_check_gmd, file_stat);
}
+#endif
diff --git a/src/file_gp2.c b/src/file_gp2.c
index a96e80d..407a4c5 100644
--- a/src/file_gp2.c
+++ b/src/file_gp2.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_gp2)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -66,3 +67,4 @@ static void register_header_check_gp2(file_stat_t *file_stat)
};
register_header_check(0, gp2_header, sizeof(gp2_header), &header_check_gp2, file_stat);
}
+#endif
diff --git a/src/file_gp5.c b/src/file_gp5.c
index 4d9d156..fcd66d0 100644
--- a/src/file_gp5.c
+++ b/src/file_gp5.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_gp5)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -77,3 +78,4 @@ static void register_header_check_gp5(file_stat_t *file_stat)
};
register_header_check(0, gp5_header, sizeof(gp5_header), &header_check_gp5, file_stat);
}
+#endif
diff --git a/src/file_gpg.c b/src/file_gpg.c
index 6492aed..225eaf0 100644
--- a/src/file_gpg.c
+++ b/src/file_gpg.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_gpg)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -281,20 +282,23 @@ static int is_valid_S2K(const unsigned int algo)
/*@
@ requires \valid(handle);
@ requires offset + tmp2 < 0x8000000000000000;
+ @ assigns *handle, errno;
+ @ assigns Frama_C_entropy_source;
@*/
static unsigned int file_check_gpg_pubkey(FILE *handle, const uint64_t offset, const uint64_t tmp2)
{
int len2;
- uint16_t mpi2;
+ char buffer[2];
+ const uint16_t *mpi2_ptr=(uint16_t *)&buffer;
if(my_fseek(handle, offset+tmp2, SEEK_SET) < 0 ||
- fread(&mpi2, sizeof(mpi2), 1, handle) != 1)
+ fread(buffer, sizeof(buffer), 1, handle) != 1)
return 0;
#ifdef __FRAMAC__
- Frama_C_make_unknown((char *)&mpi2, sizeof(mpi2));
+ Frama_C_make_unknown(&buffer, sizeof(buffer));
#endif
- len2=is_valid_mpi(mpi2);
+ len2=is_valid_mpi(*mpi2_ptr);
#ifdef DEBUG_GPG
- log_info(" data: [ %u bits]\n", be16(mpi2));
+ log_info(" data: [ %u bits]\n", be16(*mpi2_ptr));
#endif
if(len2 < 0)
return 0;
@@ -304,6 +308,7 @@ static unsigned int file_check_gpg_pubkey(FILE *handle, const uint64_t offset, c
/*@
@ requires \valid(file_recovery);
@ requires \valid(file_recovery->handle);
+ @ requires \separated(file_recovery, file_recovery->handle);
@ requires file_recovery->file_check == &file_check_gpg;
@*/
static void file_check_gpg(file_recovery_t *file_recovery)
@@ -778,6 +783,7 @@ static void register_header_check_gpg(file_stat_t *file_stat)
register_header_check(0, pgp_header, sizeof(pgp_header), &header_check_gpg, file_stat);
register_header_check(0, gpg_header_pkey, sizeof(gpg_header_pkey), &header_check_gpg, file_stat);
}
+#endif
#if defined(MAIN_gpg)
#define BLOCKSIZE 65536u
diff --git a/src/file_gpx.c b/src/file_gpx.c
index a1b91e7..7d7c5c9 100644
--- a/src/file_gpx.c
+++ b/src/file_gpx.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_gpx)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -55,3 +56,4 @@ static void register_header_check_gpx(file_stat_t *file_stat)
{
register_header_check(0, "BCFZ", 4, &header_check_gpx, file_stat);
}
+#endif
diff --git a/src/file_gsm.c b/src/file_gsm.c
index 7955344..affa471 100644
--- a/src/file_gsm.c
+++ b/src/file_gsm.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_gsm)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -52,6 +53,9 @@ struct block_header
static data_check_t data_check_gsm(const unsigned char *buffer, const unsigned int buffer_size, file_recovery_t *file_recovery)
{
+ /*@
+ @ loop assigns file_recovery->calculated_file_size;
+ @*/
while(file_recovery->calculated_file_size + buffer_size/2 >= file_recovery->file_size &&
file_recovery->calculated_file_size + sizeof(struct block_header) < file_recovery->file_size + buffer_size/2)
{
@@ -64,14 +68,26 @@ static data_check_t data_check_gsm(const unsigned char *buffer, const unsigned i
return DC_CONTINUE;
}
+/*@
+ @ requires buffer_size > 0;
+ @ requires \valid_read(buffer+(0..buffer_size-1));
+ @ requires \valid_read(file_recovery);
+ @ requires file_recovery->file_stat==\null || valid_read_string((char*)file_recovery->filename);
+ @ requires \valid(file_recovery_new);
+ @ requires file_recovery_new->blocksize > 0;
+ @
+ @ requires file_recovery_new->blocksize <= buffer_size;
+ @ requires separation: \separated(&file_hint_gsm, buffer+(..), file_recovery, file_recovery_new);
+ @*/
static int header_check_gsm(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 struct block_header *hdr;
unsigned int i=0;
- for(i=0, hdr=(const struct block_header *)buffer;
- i * sizeof(struct block_header) < file_recovery_new->blocksize;
- i++, hdr++)
+ /*@ loop assigns i; */
+ for(i=0;
+ (i+1) * sizeof(struct block_header) <= file_recovery_new->blocksize;
+ i++)
{
+ const struct block_header *hdr=(const struct block_header *)&buffer[i*sizeof(struct block_header)];
if(hdr->marker < 0xd0 || hdr->marker > 0xdf)
return 0;
}
@@ -128,3 +144,4 @@ static void register_header_check_gsm(file_stat_t *file_stat)
register_header_check(0, gsm_header15, sizeof(gsm_header15), &header_check_gsm, file_stat);
register_header_check(0, gsm_header16, sizeof(gsm_header16), &header_check_gsm, file_stat);
}
+#endif
diff --git a/src/file_gz.c b/src/file_gz.c
index da7a9f6..d75cfa9 100644
--- a/src/file_gz.c
+++ b/src/file_gz.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_gz)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -27,7 +28,6 @@
#if defined(MAIN_fidentify) || defined(MAIN_photorec) || defined(__FRAMAC__)
#undef HAVE_LIBZ
#undef HAVE_ZLIB_H
-#define SINGLE_FORMAT
#endif
#ifdef HAVE_STRING_H
@@ -372,6 +372,13 @@ static void file_rename_gz(file_recovery_t *file_recovery)
}
}
+static void register_header_check_gz(file_stat_t *file_stat)
+{
+ static const unsigned char gz_header_magic[3]= {0x1F, 0x8B, 0x08};
+ register_header_check(0, gz_header_magic,sizeof(gz_header_magic), &header_check_gz, file_stat);
+}
+#endif
+
const char*td_zlib_version(void)
{
#if defined(HAVE_ZLIB_H) && defined(HAVE_LIBZ)
@@ -380,9 +387,3 @@ const char*td_zlib_version(void)
return "none";
#endif
}
-
-static void register_header_check_gz(file_stat_t *file_stat)
-{
- static const unsigned char gz_header_magic[3]= {0x1F, 0x8B, 0x08};
- register_header_check(0, gz_header_magic,sizeof(gz_header_magic), &header_check_gz, file_stat);
-}
diff --git a/src/file_hdf.c b/src/file_hdf.c
index 378855c..cb5818d 100644
--- a/src/file_hdf.c
+++ b/src/file_hdf.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_hdf)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -129,3 +130,4 @@ static void register_header_check_hdf(file_stat_t *file_stat)
static const unsigned char hdf_header[4]= { 0x0e, 0x03, 0x13, 0x01};
register_header_check(0, hdf_header, sizeof(hdf_header), &header_check_hdf, file_stat);
}
+#endif
diff --git a/src/file_hdr.c b/src/file_hdr.c
index 0e6e9e6..596d3bc 100644
--- a/src/file_hdr.c
+++ b/src/file_hdr.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_hdr)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -79,3 +80,4 @@ static void register_header_check_hdr(file_stat_t *file_stat)
{
register_header_check(0, "ISc(", 4, &header_check_hdr, file_stat);
}
+#endif
diff --git a/src/file_hds.c b/src/file_hds.c
index 92664d2..4ada2f6 100644
--- a/src/file_hds.c
+++ b/src/file_hds.c
@@ -19,6 +19,7 @@
Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_hds)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -74,3 +75,4 @@ static void register_header_check_hds(file_stat_t *file_stat)
};
register_header_check(0, hds_header,sizeof(hds_header), &header_check_hds, file_stat);
}
+#endif
diff --git a/src/file_hfsp.c b/src/file_hfsp.c
index 8ed2504..0f7fc40 100644
--- a/src/file_hfsp.c
+++ b/src/file_hfsp.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_hfsp)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -59,3 +60,4 @@ static void register_header_check_hfsp(file_stat_t *file_stat)
register_header_check(0, "HX\0\5", 4, &header_check_hfsp, file_stat);
}
+#endif
diff --git a/src/file_hm.c b/src/file_hm.c
index 2eaa559..ea2f07c 100644
--- a/src/file_hm.c
+++ b/src/file_hm.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_hm)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -57,3 +58,4 @@ static void register_header_check_hm(file_stat_t *file_stat)
};
register_header_check(0, hm_header, sizeof(hm_header), &header_check_hm, file_stat);
}
+#endif
diff --git a/src/file_hr9.c b/src/file_hr9.c
index 3f5045f..ace2b02 100644
--- a/src/file_hr9.c
+++ b/src/file_hr9.c
@@ -19,6 +19,7 @@
Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_hr9)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -63,3 +64,4 @@ static void register_header_check_hr9(file_stat_t *file_stat)
};
register_header_check(0, hr9_header,sizeof(hr9_header), &header_check_hr9, file_stat);
}
+#endif
diff --git a/src/file_http.c b/src/file_http.c
index 33e63fa..5baa99e 100644
--- a/src/file_http.c
+++ b/src/file_http.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_http)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -52,3 +53,4 @@ static void register_header_check_http(file_stat_t *file_stat)
{
register_header_check(0, "HTTP/1.1 200 OK\r\nDate:", 22, &header_check_http, file_stat);
}
+#endif
diff --git a/src/file_ibd.c b/src/file_ibd.c
index b26eb2b..6c67df2 100644
--- a/src/file_ibd.c
+++ b/src/file_ibd.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_ibd)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -104,3 +105,4 @@ static void register_header_check_ibd(file_stat_t *file_stat)
{
register_header_check(0xc063, "infimum", 7, &header_check_ibd, file_stat);
}
+#endif
diff --git a/src/file_icc.c b/src/file_icc.c
index 9d22646..f540091 100644
--- a/src/file_icc.c
+++ b/src/file_icc.c
@@ -19,6 +19,7 @@
Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_icc)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -65,3 +66,4 @@ static void register_header_check_icc(file_stat_t *file_stat)
static const unsigned char icc_header[4]= { 'a', 'c', 's', 'p' };
register_header_check(36, icc_header,sizeof(icc_header), &header_check_icc, file_stat);
}
+#endif
diff --git a/src/file_icns.c b/src/file_icns.c
index 20d5d12..d7f6063 100644
--- a/src/file_icns.c
+++ b/src/file_icns.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_icns)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -52,7 +53,7 @@ struct icon_data
{
char type[4];
uint32_t size;
- uint8_t data[0];
+// uint8_t data[0];
};
static int check_icon_type(const char *type)
@@ -120,3 +121,4 @@ static void register_header_check_icns(file_stat_t *file_stat)
{
register_header_check(0, "icns", 4, &header_check_icns, file_stat);
}
+#endif
diff --git a/src/file_ico.c b/src/file_ico.c
index af2ae41..4d63a7a 100644
--- a/src/file_ico.c
+++ b/src/file_ico.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_ico)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -155,3 +156,4 @@ static void register_header_check_ico(file_stat_t *file_stat)
register_header_check(0, header_ico8, sizeof(header_ico8), &header_check_ico, file_stat);
register_header_check(0, header_ico9, sizeof(header_ico9), &header_check_ico, file_stat);
}
+#endif
diff --git a/src/file_idx.c b/src/file_idx.c
index 66f9cee..83934f6 100644
--- a/src/file_idx.c
+++ b/src/file_idx.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_idx)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -71,3 +72,4 @@ static void register_header_check_idx(file_stat_t *file_stat)
{
register_header_check(0, "RT60", 4, &header_check_idx, file_stat);
}
+#endif
diff --git a/src/file_ifo.c b/src/file_ifo.c
index a55ec66..1577ec4 100644
--- a/src/file_ifo.c
+++ b/src/file_ifo.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_ifo)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -67,3 +68,4 @@ static void register_header_check_ifo(file_stat_t *file_stat)
register_header_check(0, ifo_header_vmg, sizeof(ifo_header_vmg), &header_check_ifo, file_stat);
register_header_check(0, ifo_header_vts, sizeof(ifo_header_vts), &header_check_ifo, file_stat);
}
+#endif
diff --git a/src/file_imb.c b/src/file_imb.c
index d21be56..3d35bf6 100644
--- a/src/file_imb.c
+++ b/src/file_imb.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_imb)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -54,3 +55,4 @@ static void register_header_check_imb(file_stat_t *file_stat)
static const unsigned char imb_header[15]= { 0x00, 0x00, 0x00, 'I','n','c','r','e','d','i','m','a','i','l',' '};
register_header_check(1, imb_header,sizeof(imb_header), &header_check_imb, file_stat);
}
+#endif
diff --git a/src/file_indd.c b/src/file_indd.c
index 5d16702..a5ea927 100644
--- a/src/file_indd.c
+++ b/src/file_indd.c
@@ -21,6 +21,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_indd)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -150,3 +151,4 @@ static void register_header_check_indd(file_stat_t *file_stat)
0x44, 0x4f, 0x43, 0x55, 0x4d, 0x45, 0x4e, 0x54 };
register_header_check(0, indd_header,sizeof(indd_header), &header_check_indd, file_stat);
}
+#endif
diff --git a/src/file_info.c b/src/file_info.c
index 1b4d3e9..360394b 100644
--- a/src/file_info.c
+++ b/src/file_info.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_info)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -57,3 +58,4 @@ static void register_header_check_info(file_stat_t *file_stat)
};
register_header_check(0, info_header, sizeof(info_header), &header_check_info, file_stat);
}
+#endif
diff --git a/src/file_iso.c b/src/file_iso.c
index 0483809..a45b184 100644
--- a/src/file_iso.c
+++ b/src/file_iso.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_iso)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -79,3 +80,4 @@ static void register_header_check_iso(file_stat_t *file_stat)
register_header_check(0x8000, iso_header,sizeof(iso_header), &header_check_db, file_stat);
}
+#endif
diff --git a/src/file_it.c b/src/file_it.c
index 3f8925f..4aa14ed 100644
--- a/src/file_it.c
+++ b/src/file_it.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_it)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -82,3 +83,4 @@ static void register_header_check_it(file_stat_t *file_stat)
{
register_header_check(0, "IMPM", 4, &header_check_it, file_stat);
}
+#endif
diff --git a/src/file_itu.c b/src/file_itu.c
index 6033e6a..1c00342 100644
--- a/src/file_itu.c
+++ b/src/file_itu.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_itunes)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -63,3 +64,4 @@ static void register_header_check_itunes(file_stat_t *file_stat)
static const unsigned char itunes_header[8]= {'m', 'h', 'b', 'd', 0x68, 0x00, 0x00, 0x00};
register_header_check(0, itunes_header,sizeof(itunes_header), &header_check_itunes, file_stat);
}
+#endif
diff --git a/src/file_jks.c b/src/file_jks.c
index 9539db1..3ca16b7 100644
--- a/src/file_jks.c
+++ b/src/file_jks.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_jks)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -68,3 +69,4 @@ static void register_header_check_jks(file_stat_t *file_stat)
};
register_header_check(0, jks_header, sizeof(jks_header), &header_check_jks, file_stat);
}
+#endif
diff --git a/src/file_jpg.c b/src/file_jpg.c
index 45fb1a0..a807a48 100644
--- a/src/file_jpg.c
+++ b/src/file_jpg.c
@@ -20,13 +20,15 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_jpg)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
-#ifdef __FRAMAC__
+#if defined(__FRAMAC__) || defined(SINGLE_FORMAT)
#undef HAVE_LIBJPEG
#undef DEBUG_JPEG
+#undef HAVE_JPEGLIB_H
#endif
#ifdef HAVE_STRING_H
@@ -506,26 +508,37 @@ static time_t jpg_get_date(const unsigned char *buffer, const unsigned int buffe
/*@
- @ requires buffer_size >= 10;
+ @ requires buffer_size > 0;
@ requires \valid_read(buffer+(0..buffer_size-1));
@ requires \valid_read(file_recovery);
@ requires file_recovery->file_stat==\null || valid_read_string((char*)&file_recovery->filename);
@ requires \valid(file_recovery_new);
@ requires file_recovery_new->blocksize > 0;
+ @
+ @ requires buffer_size >= 10;
@ requires separation: \separated(&file_hint_jpg, buffer+(..), file_recovery, file_recovery_new);
+ @
@ ensures \result == 0 || \result == 1;
@ ensures (\result == 1) ==> (file_recovery_new->file_stat == \null);
@ ensures (\result == 1) ==> (file_recovery_new->handle == \null);
- @ ensures \result == 1 ==> file_recovery_new->extension == file_hint_jpg.extension;
@ ensures \result == 1 ==> \initialized(&file_recovery_new->time);
- @ ensures \result == 1 ==> file_recovery_new->calculated_file_size == 0;
+ @ ensures (\result == 1) ==> \initialized(&file_recovery_new->calculated_file_size);
@ ensures \result == 1 ==> file_recovery_new->file_size == 0;
- @ ensures \result == 1 ==> file_recovery_new->min_filesize > 0;
- @ ensures \result == 1 ==> file_recovery_new->offset_ok == 0;
+ @ ensures (\result == 1) ==> \initialized(&file_recovery_new->min_filesize);
+ @ ensures (\result == 1) ==> (file_recovery_new->data_check == \null || \valid_function(file_recovery_new->data_check));
+ @ ensures (\result == 1) ==> (file_recovery_new->file_check == \null || \valid_function(file_recovery_new->file_check));
+ @ ensures (\result == 1) ==> (file_recovery_new->file_rename == \null || \valid_function(file_recovery_new->file_rename));
+ @ ensures (\result == 1) ==> (file_recovery_new->extension != \null);
+ @ ensures (\result == 1) ==> valid_read_string(file_recovery_new->extension);
+ @ ensures (\result == 1) ==> \separated(file_recovery_new, file_recovery_new->extension);
+ @
+ @ ensures \result == 1 ==> file_recovery_new->calculated_file_size == 0;
@ ensures \result == 1 && buffer_size >= 4 ==> file_recovery_new->data_check == data_check_jpg;
@ ensures \result == 1 ==> file_recovery_new->file_check == file_check_jpg;
@ ensures \result == 1 ==> file_recovery_new->file_rename == \null;
- @ ensures \result == 1 ==> valid_read_string(file_recovery_new->extension);
+ @ ensures \result == 1 ==> file_recovery_new->extension == file_hint_jpg.extension;
+ @ ensures \result == 1 ==> file_recovery_new->min_filesize > 0;
+ @ ensures \result == 1 ==> file_recovery_new->offset_ok == 0;
@*/
static int header_check_jpg(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)
{
@@ -1733,6 +1746,7 @@ static void jpg_save_thumbnail(const file_recovery_t *file_recovery, const char
@ requires \valid(thumb_offset_ptr);
@ requires valid_read_string((char *)&file_recovery->filename);
@ requires file_recovery->blocksize > 0;
+ @ requires nbytes > 4;
@ requires \valid_read(buffer + (0 .. nbytes-1));
@ requires \initialized(&file_recovery->time);
@ requires separation: \separated(file_recovery, file_recovery->handle, buffer+(..), thumb_offset_ptr, &errno);
@@ -1796,9 +1810,10 @@ static int jpg_check_app1(file_recovery_t *file_recovery, const unsigned int ext
*thumb_offset_ptr=thumb_offset;
if(file_recovery->offset_ok<i)
file_recovery->offset_ok=i;
- if(thumb_offset >= nbytes - 1)
+ if(thumb_offset + 6 >= nbytes)
return 1;
- /*@ assert 0 < thumb_offset < nbytes - 1; */
+ /*@ assert 0 < thumb_offset < nbytes - 6; */
+ /*@ assert thumb_offset < nbytes; */
{
unsigned int j=thumb_offset+2;
unsigned int thumb_sos_found=0;
@@ -1816,14 +1831,22 @@ static int jpg_check_app1(file_recovery_t *file_recovery, const unsigned int ext
file_recovery->offset_error=thumb_offset+1;
return 0;
}
+ /*@ assert j == thumb_offset + 2; */
+ /*@ assert j < nbytes - 4; */
/*@
- @ loop invariant j <= nbytes + 2 + 65535;
@ loop invariant 0 < thumb_size;
@ loop invariant 0 < thumb_offset < nbytes - 1;
@*/
+ /*X
+ X loop assigns j, thumb_sos_found;
+ X loop assigns errno, *file_recovery->handle,Frama_C_entropy_source;
+ X loop assigns file_recovery->offset_ok;
+ X loop assigns file_recovery->offset_error;
+ X loop assigns file_recovery->extra;
+ X*/
while(j+4<nbytes && thumb_sos_found==0)
{
- /*@ assert j < nbytes; */
+ /*@ assert j + 4 < nbytes; */
if(buffer[j]!=0xff)
{
file_recovery->offset_error=j;
@@ -1844,7 +1867,9 @@ static int jpg_check_app1(file_recovery_t *file_recovery, const unsigned int ext
log_info("%s thumb marker 0x%02x at 0x%x\n", file_recovery->filename, buffer[j+1], j);
#endif
if(buffer[j+1]==0xda) /* Thumb SOS: Start Of Scan */
+ {
thumb_sos_found=1;
+ }
else if(buffer[j+1]==0xc4) /* DHT */
{
if(jpg_check_dht(buffer, nbytes, j, 2+(buffer[j+2]<<8)+buffer[j+3])!=0)
@@ -1893,9 +1918,9 @@ static int jpg_check_app1(file_recovery_t *file_recovery, const unsigned int ext
return 1;
if(thumb_offset+thumb_size > nbytes)
return 1;
- /*@ assert thumb_offset < nbytes; */
/*@ assert thumb_offset + thumb_size <= nbytes; */
/*@ assert 0 < thumb_size; */
+ /*@ assert thumb_offset < nbytes; */
jpg_save_thumbnail(file_recovery, (const char *)buffer, nbytes, thumb_offset, thumb_size);
return 1;
}
@@ -1938,6 +1963,8 @@ static uint64_t jpg_check_structure(file_recovery_t *file_recovery, const unsign
while(offset + 4 < nbytes && buffer[offset]==0xff && is_marker_valid(buffer[offset+1]) && (file_recovery->offset_error==0 || offset < file_recovery->offset_error))
{
const unsigned int i=offset;
+ /*@ assert i + 4 < nbytes; */
+ /*@ assert i < nbytes; */
const unsigned int size=(buffer[i+2]<<8)+buffer[i+3];
if(buffer[i+1]==0xff)
{
@@ -2072,6 +2099,7 @@ static void file_check_jpg(file_recovery_t *file_recovery)
@ requires file_recovery->calculated_file_size >= 2;
@ requires \valid_read(buffer + ( 0 .. buffer_size-1));
@ requires file_recovery->data_check == &data_check_jpg2;
+ @ requires separation: \separated(buffer+(..), file_recovery);
@ ensures \result == DC_CONTINUE || \result == DC_STOP;
@ ensures file_recovery->data_check == &data_check_jpg2 || file_recovery->data_check == \null;
@ ensures file_recovery->data_check == &data_check_jpg2 ==> file_recovery->calculated_file_size >= 2;
@@ -2083,6 +2111,7 @@ static void file_check_jpg(file_recovery_t *file_recovery)
static data_check_t data_check_jpg2(const unsigned char *buffer, const unsigned int buffer_size, file_recovery_t *file_recovery)
{
/*@
+ @ loop invariant file_recovery->data_check == \null ==> file_recovery->calculated_file_size == 0;
@ loop assigns file_recovery->calculated_file_size;
@ loop assigns file_recovery->data_check;
@ loop assigns file_recovery->offset_error;
@@ -2099,6 +2128,8 @@ static data_check_t data_check_jpg2(const unsigned char *buffer, const unsigned
/* JPEG_EOI */
file_recovery->calculated_file_size++;
/*@ assert file_recovery->data_check == &data_check_jpg2; */
+ /*@ assert file_recovery->calculated_file_size >= 2; */
+ /*@ assert file_recovery->data_check == \null ==> file_recovery->calculated_file_size == 0; */
return DC_STOP;
}
else if(buffer[i] >= 0xd0 && buffer[i] <= 0xd7)
@@ -2118,12 +2149,16 @@ static data_check_t data_check_jpg2(const unsigned char *buffer, const unsigned
old_marker=buffer[i];
#endif
/*@ assert file_recovery->data_check == &data_check_jpg2; */
+ /*@ assert file_recovery->calculated_file_size >= 2; */
}
else if(buffer[i] == 0xda || buffer[i] == 0xc4)
{
/* SOS and DHT may be embedded by progressive jpg */
file_recovery->data_check=NULL;
file_recovery->calculated_file_size=0;
+ /*@ assert file_recovery->data_check == \null; */
+ /*@ assert file_recovery->calculated_file_size == 0; */
+ /*@ assert file_recovery->data_check == \null ==> file_recovery->calculated_file_size == 0; */
return DC_CONTINUE;
}
else if(buffer[i]!=0x00)
@@ -2134,12 +2169,17 @@ static data_check_t data_check_jpg2(const unsigned char *buffer, const unsigned
#endif
file_recovery->offset_error=file_recovery->calculated_file_size;
/*@ assert file_recovery->data_check == &data_check_jpg2; */
+ /*@ assert file_recovery->calculated_file_size >= 2; */
+ /*@ assert file_recovery->data_check == \null ==> file_recovery->calculated_file_size == 0; */
return DC_STOP;
}
}
/*@ assert file_recovery->data_check == &data_check_jpg2; */
file_recovery->calculated_file_size++;
}
+ /*@ assert file_recovery->data_check == &data_check_jpg2; */
+ /*@ assert file_recovery->calculated_file_size >= 2; */
+ /*@ assert file_recovery->data_check == \null ==> file_recovery->calculated_file_size == 0; */
return DC_CONTINUE;
}
@@ -2150,6 +2190,7 @@ static data_check_t data_check_jpg2(const unsigned char *buffer, const unsigned
@ requires buffer_size >= 4;
@ requires \valid_read(buffer + ( 0 .. buffer_size-1));
@ requires file_recovery->data_check == &data_check_jpg;
+ @ requires separation: \separated(buffer+(..), file_recovery);
@ ensures \result == DC_CONTINUE || \result == DC_STOP;
@ ensures file_recovery->data_check == &data_check_jpg2 || file_recovery->data_check == &data_check_jpg || file_recovery->data_check == &data_check_size || file_recovery->data_check == \null;
@ ensures file_recovery->data_check == &data_check_jpg2 ==> file_recovery->calculated_file_size >= 2;
@@ -2327,6 +2368,7 @@ static void register_header_check_jpg(file_stat_t *file_stat)
static const unsigned char jpg_header[3]= { 0xff,0xd8,0xff};
register_header_check(0, jpg_header, sizeof(jpg_header), &header_check_jpg, file_stat);
}
+#endif
#if defined(MAIN_jpg)
#define BLOCKSIZE 65536u
diff --git a/src/file_jsonlz4.c b/src/file_jsonlz4.c
index 8d3390e..0035816 100644
--- a/src/file_jsonlz4.c
+++ b/src/file_jsonlz4.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_jsonlz4)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -59,3 +60,4 @@ static void register_header_check_jsonlz4(file_stat_t *file_stat)
{
register_header_check(0, "mozLz40", 8, &header_check_jsonlz4, file_stat);
}
+#endif
diff --git a/src/file_kdb.c b/src/file_kdb.c
index 5f07b82..3b37bab 100644
--- a/src/file_kdb.c
+++ b/src/file_kdb.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_kdb)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -54,3 +55,4 @@ static void register_header_check_kdb(file_stat_t *file_stat)
static const unsigned char kdb_header[8]= {0x03, 0xd9, 0xa2, 0x9a, 0x65, 0xfb, 0x4b, 0xb5};
register_header_check(0, kdb_header,sizeof(kdb_header), &header_check_kdb, file_stat);
}
+#endif
diff --git a/src/file_kdbx.c b/src/file_kdbx.c
index c47e3ca..f388137 100644
--- a/src/file_kdbx.c
+++ b/src/file_kdbx.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_kdbx)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -54,3 +55,4 @@ static void register_header_check_kdbx(file_stat_t *file_stat)
static const unsigned char kdbx_header[8]= {0x03, 0xd9, 0xa2, 0x9a, 0x67, 0xfb, 0x4b, 0xb5};
register_header_check(0, kdbx_header,sizeof(kdbx_header), &header_check_kdbx, file_stat);
}
+#endif
diff --git a/src/file_key.c b/src/file_key.c
index 8a396a9..534685f 100644
--- a/src/file_key.c
+++ b/src/file_key.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_key)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -55,3 +56,4 @@ static void register_header_check_key(file_stat_t *file_stat)
{
register_header_check(0, "323382b3c4f1c6d2", 16, &header_check_key, file_stat);
}
+#endif
diff --git a/src/file_ldf.c b/src/file_ldf.c
index e3acfe5..937120b 100644
--- a/src/file_ldf.c
+++ b/src/file_ldf.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_ldf)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -65,3 +66,4 @@ static int header_check_ldf(const unsigned char *buffer, const unsigned int buff
}
return 0;
}
+#endif
diff --git a/src/file_list.c b/src/file_list.c
index 6e3685a..36dc8b6 100644
--- a/src/file_list.c
+++ b/src/file_list.c
@@ -24,11 +24,13 @@
#endif
#include <stdio.h>
+#include <assert.h>
#include "types.h"
#include "filegen.h"
extern const file_hint_t file_hint_1cd;
extern const file_hint_t file_hint_3dm;
+extern const file_hint_t file_hint_3ds;
extern const file_hint_t file_hint_7z;
extern const file_hint_t file_hint_DB;
extern const file_hint_t file_hint_a;
@@ -60,6 +62,7 @@ extern const file_hint_t file_hint_axx;
extern const file_hint_t file_hint_bac;
extern const file_hint_t file_hint_bdm;
extern const file_hint_t file_hint_berkeley;
+extern const file_hint_t file_hint_bfa;
extern const file_hint_t file_hint_bim;
extern const file_hint_t file_hint_bin;
extern const file_hint_t file_hint_binvox;
@@ -205,6 +208,7 @@ extern const file_hint_t file_hint_mb;
extern const file_hint_t file_hint_mcd;
extern const file_hint_t file_hint_mdb;
extern const file_hint_t file_hint_mdf;
+extern const file_hint_t file_hint_mdp;
extern const file_hint_t file_hint_mfa;
extern const file_hint_t file_hint_mfg;
extern const file_hint_t file_hint_mft;
@@ -366,346 +370,1047 @@ extern const file_hint_t file_hint_zpr;
file_enable_t array_file_enable[]=
{
-#ifndef MAIN_fidentify
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_sig)
{ .enable=0, .file_hint=&file_hint_sig },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_1cd)
{ .enable=0, .file_hint=&file_hint_1cd },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_3dm)
{ .enable=0, .file_hint=&file_hint_3dm },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_3ds)
+ { .enable=0, .file_hint=&file_hint_3ds },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_7z)
{ .enable=0, .file_hint=&file_hint_7z },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_DB)
{ .enable=0, .file_hint=&file_hint_DB },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_a)
{ .enable=0, .file_hint=&file_hint_a },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_abr)
{ .enable=0, .file_hint=&file_hint_abr },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_acb)
{ .enable=0, .file_hint=&file_hint_acb },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_accdb)
{ .enable=0, .file_hint=&file_hint_accdb},
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_ace)
{ .enable=0, .file_hint=&file_hint_ace },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_addressbook)
{ .enable=0, .file_hint=&file_hint_addressbook},
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_ado)
{ .enable=0, .file_hint=&file_hint_ado },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_afdesign)
{ .enable=0, .file_hint=&file_hint_afdesign },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_ahn)
{ .enable=0, .file_hint=&file_hint_ahn },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_aif)
{ .enable=0, .file_hint=&file_hint_aif },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_all)
{ .enable=0, .file_hint=&file_hint_all },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_als)
{ .enable=0, .file_hint=&file_hint_als },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_amd)
{ .enable=0, .file_hint=&file_hint_amd },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_amr)
{ .enable=0, .file_hint=&file_hint_amr },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_apa)
{ .enable=0, .file_hint=&file_hint_apa },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_ape)
{ .enable=0, .file_hint=&file_hint_ape },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_apple)
{ .enable=0, .file_hint=&file_hint_apple },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_ari)
{ .enable=0, .file_hint=&file_hint_ari },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_arj)
{ .enable=0, .file_hint=&file_hint_arj },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_asf)
{ .enable=0, .file_hint=&file_hint_asf },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_asl)
{ .enable=0, .file_hint=&file_hint_asl },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_asm)
{ .enable=0, .file_hint=&file_hint_asm },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_atd)
{ .enable=0, .file_hint=&file_hint_atd },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_au)
{ .enable=0, .file_hint=&file_hint_au },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_axp)
{ .enable=0, .file_hint=&file_hint_axp },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_axx)
{ .enable=0, .file_hint=&file_hint_axx },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_bac)
{ .enable=0, .file_hint=&file_hint_bac },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_bdm)
{ .enable=0, .file_hint=&file_hint_bdm },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_berkeley)
{ .enable=0, .file_hint=&file_hint_berkeley },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_bfa)
+ { .enable=0, .file_hint=&file_hint_bfa },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_bim)
{ .enable=0, .file_hint=&file_hint_bim },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_bin)
{ .enable=0, .file_hint=&file_hint_bin },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_binvox)
{ .enable=0, .file_hint=&file_hint_binvox },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_bkf)
{ .enable=0, .file_hint=&file_hint_bkf },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_blend)
{ .enable=0, .file_hint=&file_hint_blend },
#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_bmp)
{ .enable=0, .file_hint=&file_hint_bmp },
-#ifndef MAIN_fidentify
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_bpg)
{ .enable=0, .file_hint=&file_hint_bpg },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_bvr)
{ .enable=0, .file_hint=&file_hint_bvr },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_bz2)
{ .enable=0, .file_hint=&file_hint_bz2 },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_c4d)
{ .enable=0, .file_hint=&file_hint_c4d },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_cab)
{ .enable=0, .file_hint=&file_hint_cab },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_caf)
{ .enable=0, .file_hint=&file_hint_caf },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_cam)
{ .enable=0, .file_hint=&file_hint_cam },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_catdrawing)
{ .enable=0, .file_hint=&file_hint_catdrawing },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_cdt)
{ .enable=0, .file_hint=&file_hint_cdt },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_che)
{ .enable=0, .file_hint=&file_hint_che },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_chm)
{ .enable=0, .file_hint=&file_hint_chm },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_class)
{ .enable=0, .file_hint=&file_hint_class },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_cm)
{ .enable=0, .file_hint=&file_hint_cm },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_compress)
{ .enable=0, .file_hint=&file_hint_compress },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_cow)
{ .enable=0, .file_hint=&file_hint_cow },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_cpi)
{ .enable=0, .file_hint=&file_hint_cpi },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_crw)
{ .enable=0, .file_hint=&file_hint_crw },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_csh)
{ .enable=0, .file_hint=&file_hint_csh },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_ctg)
{ .enable=0, .file_hint=&file_hint_ctg },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_cwk)
{ .enable=0, .file_hint=&file_hint_cwk },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_d2s)
{ .enable=0, .file_hint=&file_hint_d2s },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_dad)
{ .enable=0, .file_hint=&file_hint_dad },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_dar)
{ .enable=0, .file_hint=&file_hint_dar },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_dat)
{ .enable=0, .file_hint=&file_hint_dat },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_dbf)
{ .enable=0, .file_hint=&file_hint_dbf },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_dbn)
{ .enable=0, .file_hint=&file_hint_dbn },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_dcm)
{ .enable=0, .file_hint=&file_hint_dcm },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_ddf)
{ .enable=0, .file_hint=&file_hint_ddf },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_dex)
{ .enable=0, .file_hint=&file_hint_dex },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_dim)
{ .enable=0, .file_hint=&file_hint_dim },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_dir)
{ .enable=0, .file_hint=&file_hint_dir },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_djv)
{ .enable=0, .file_hint=&file_hint_djv },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_dmp)
{ .enable=0, .file_hint=&file_hint_dmp },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_drw)
{ .enable=0, .file_hint=&file_hint_drw },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_doc)
{ .enable=0, .file_hint=&file_hint_doc },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_dpx)
{ .enable=0, .file_hint=&file_hint_dpx },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_ds2)
{ .enable=0, .file_hint=&file_hint_ds2 },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_ds_store)
{ .enable=0, .file_hint=&file_hint_ds_store },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_dsc)
{ .enable=0, .file_hint=&file_hint_dsc },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_dss)
{ .enable=0, .file_hint=&file_hint_dss },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_dst)
{ .enable=0, .file_hint=&file_hint_dst },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_dta)
{ .enable=0, .file_hint=&file_hint_dta },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_dump)
{ .enable=0, .file_hint=&file_hint_dump },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_dv)
{ .enable=0, .file_hint=&file_hint_dv },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_dvi)
{ .enable=0, .file_hint=&file_hint_dvi },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_dvr)
{ .enable=0, .file_hint=&file_hint_dvr },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_dwg)
{ .enable=0, .file_hint=&file_hint_dwg },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_dxf)
{ .enable=0, .file_hint=&file_hint_dxf },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_e01)
{ .enable=0, .file_hint=&file_hint_e01 },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_ecryptfs)
{ .enable=0, .file_hint=&file_hint_ecryptfs },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_edb)
{ .enable=0, .file_hint=&file_hint_edb },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_elf)
{ .enable=0, .file_hint=&file_hint_elf },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_emf)
{ .enable=0, .file_hint=&file_hint_emf },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_ess)
{ .enable=0, .file_hint=&file_hint_ess },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_evt)
{ .enable=0, .file_hint=&file_hint_evt },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_evtx)
{ .enable=0, .file_hint=&file_hint_evtx },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_exe)
{ .enable=0, .file_hint=&file_hint_exe },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_exr)
{ .enable=0, .file_hint=&file_hint_exr },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_exs)
{ .enable=0, .file_hint=&file_hint_exs },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_ext2_sb)
{ .enable=0, .file_hint=&file_hint_ext2_sb },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_ext2_fs)
{ .enable=0, .file_hint=&file_hint_ext2_fs },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_fat)
{ .enable=0, .file_hint=&file_hint_fat },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_fbf)
{ .enable=0, .file_hint=&file_hint_fbf },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_fbk)
{ .enable=0, .file_hint=&file_hint_fbk },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_fcp)
{ .enable=0, .file_hint=&file_hint_fcp },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_fcs)
{ .enable=0, .file_hint=&file_hint_fcs },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_fdb)
{ .enable=0, .file_hint=&file_hint_fdb },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_fds)
{ .enable=0, .file_hint=&file_hint_fds },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_fh10)
{ .enable=0, .file_hint=&file_hint_fh10 },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_fh5)
{ .enable=0, .file_hint=&file_hint_fh5 },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_filevault)
{ .enable=0, .file_hint=&file_hint_filevault },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_fits)
{ .enable=0, .file_hint=&file_hint_fits },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_fit)
{ .enable=0, .file_hint=&file_hint_fit },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_flac)
{ .enable=0, .file_hint=&file_hint_flac },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_flp)
{ .enable=0, .file_hint=&file_hint_flp },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_flv)
{ .enable=0, .file_hint=&file_hint_flv },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_fm)
{ .enable=0, .file_hint=&file_hint_fm },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_fob)
{ .enable=0, .file_hint=&file_hint_fob },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_fos)
{ .enable=0, .file_hint=&file_hint_fos },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_fp5)
{ .enable=0, .file_hint=&file_hint_fp5 },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_fp7)
{ .enable=0, .file_hint=&file_hint_fp7 },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_freeway)
{ .enable=0, .file_hint=&file_hint_freeway },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_frm)
{ .enable=0, .file_hint=&file_hint_frm },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_fs)
{ .enable=0, .file_hint=&file_hint_fs },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_fwd)
{ .enable=0, .file_hint=&file_hint_fwd },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_gam)
{ .enable=0, .file_hint=&file_hint_gam },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_gct)
{ .enable=0, .file_hint=&file_hint_gct },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_gho)
{ .enable=0, .file_hint=&file_hint_gho },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_gi)
{ .enable=0, .file_hint=&file_hint_gi },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_gif)
{ .enable=0, .file_hint=&file_hint_gif },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_gm6)
{ .enable=0, .file_hint=&file_hint_gm6 },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_gp2)
{ .enable=0, .file_hint=&file_hint_gp2 },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_gp5)
{ .enable=0, .file_hint=&file_hint_gp5 },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_gpg)
{ .enable=0, .file_hint=&file_hint_gpg },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_gpx)
{ .enable=0, .file_hint=&file_hint_gpx },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_gsm)
{ .enable=0, .file_hint=&file_hint_gsm },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_gz)
{ .enable=0, .file_hint=&file_hint_gz },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_hdf)
{ .enable=0, .file_hint=&file_hint_hdf },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_hdr)
{ .enable=0, .file_hint=&file_hint_hdr },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_hds)
{ .enable=0, .file_hint=&file_hint_hds },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_hfsp)
{ .enable=0, .file_hint=&file_hint_hfsp },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_hm)
{ .enable=0, .file_hint=&file_hint_hm },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_hr9)
{ .enable=0, .file_hint=&file_hint_hr9 },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_http)
{ .enable=0, .file_hint=&file_hint_http },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_ibd)
{ .enable=0, .file_hint=&file_hint_ibd },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_icc)
{ .enable=0, .file_hint=&file_hint_icc },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_icns)
{ .enable=0, .file_hint=&file_hint_icns },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_ico)
{ .enable=0, .file_hint=&file_hint_ico },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_idx)
{ .enable=0, .file_hint=&file_hint_idx },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_ifo)
{ .enable=0, .file_hint=&file_hint_ifo },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_imb)
{ .enable=0, .file_hint=&file_hint_imb },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_indd)
{ .enable=0, .file_hint=&file_hint_indd },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_info)
{ .enable=0, .file_hint=&file_hint_info },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_iso)
{ .enable=0, .file_hint=&file_hint_iso },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_it)
{ .enable=0, .file_hint=&file_hint_it },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_itunes)
{ .enable=0, .file_hint=&file_hint_itunes },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_jks)
{ .enable=0, .file_hint=&file_hint_jks },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_jpg)
{ .enable=0, .file_hint=&file_hint_jpg },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_jsonlz4)
{ .enable=0, .file_hint=&file_hint_jsonlz4 },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_kdb)
{ .enable=0, .file_hint=&file_hint_kdb },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_kdbx)
{ .enable=0, .file_hint=&file_hint_kdbx },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_key)
{ .enable=0, .file_hint=&file_hint_key },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_ldf)
{ .enable=0, .file_hint=&file_hint_ldf },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_lit)
{ .enable=0, .file_hint=&file_hint_lit },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_logic)
{ .enable=0, .file_hint=&file_hint_logic},
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_lnk)
{ .enable=0, .file_hint=&file_hint_lnk },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_lso)
{ .enable=0, .file_hint=&file_hint_lso },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_luks)
{ .enable=0, .file_hint=&file_hint_luks },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_lxo)
{ .enable=0, .file_hint=&file_hint_lxo },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_lzh)
{ .enable=0, .file_hint=&file_hint_lzh },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_lzo)
{ .enable=0, .file_hint=&file_hint_lzo },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_m2ts)
{ .enable=0, .file_hint=&file_hint_m2ts },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_mat)
{ .enable=0, .file_hint=&file_hint_mat },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_max)
{ .enable=0, .file_hint=&file_hint_max },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_mb)
{ .enable=0, .file_hint=&file_hint_mb },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_mcd)
{ .enable=0, .file_hint=&file_hint_mcd },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_mdb)
{ .enable=0, .file_hint=&file_hint_mdb },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_mdf)
{ .enable=0, .file_hint=&file_hint_mdf },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_mdp)
+ { .enable=0, .file_hint=&file_hint_mdp },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_mfa)
{ .enable=0, .file_hint=&file_hint_mfa },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_mfg)
{ .enable=0, .file_hint=&file_hint_mfg },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_mft)
{ .enable=0, .file_hint=&file_hint_mft },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_mid)
{ .enable=0, .file_hint=&file_hint_mid },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_mig)
{ .enable=0, .file_hint=&file_hint_mig },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_mk5)
{ .enable=0, .file_hint=&file_hint_mk5 },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_mkv)
{ .enable=0, .file_hint=&file_hint_mkv },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_mlv)
{ .enable=0, .file_hint=&file_hint_mlv },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_mobi)
{ .enable=0, .file_hint=&file_hint_mobi },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_mov_mdat)
{ .enable=0, .file_hint=&file_hint_mov_mdat },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_mov)
{ .enable=0, .file_hint=&file_hint_mov },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_mp3)
{ .enable=0, .file_hint=&file_hint_mp3 },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_mpg)
{ .enable=0, .file_hint=&file_hint_mpg },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_mpl)
{ .enable=0, .file_hint=&file_hint_mpl },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_mrw)
{ .enable=0, .file_hint=&file_hint_mrw },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_msa)
{ .enable=0, .file_hint=&file_hint_msa },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_mus)
{ .enable=0, .file_hint=&file_hint_mus },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_myo)
{ .enable=0, .file_hint=&file_hint_myo },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_mysql)
{ .enable=0, .file_hint=&file_hint_mysql },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_mxf)
{ .enable=0, .file_hint=&file_hint_mxf },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_nd2)
{ .enable=0, .file_hint=&file_hint_nd2 },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_nds)
{ .enable=0, .file_hint=&file_hint_nds },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_nes)
{ .enable=0, .file_hint=&file_hint_nes },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_njx)
{ .enable=0, .file_hint=&file_hint_njx },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_nk2)
{ .enable=0, .file_hint=&file_hint_nk2 },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_nsf)
{ .enable=0, .file_hint=&file_hint_nsf },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_oci)
{ .enable=0, .file_hint=&file_hint_oci },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_ogg)
{ .enable=0, .file_hint=&file_hint_ogg },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_one)
{ .enable=0, .file_hint=&file_hint_one },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_orf)
{ .enable=0, .file_hint=&file_hint_orf },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_paf)
{ .enable=0, .file_hint=&file_hint_paf },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_pap)
{ .enable=0, .file_hint=&file_hint_pap },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_par2)
{ .enable=0, .file_hint=&file_hint_par2 },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_pcap)
{ .enable=0, .file_hint=&file_hint_pcap },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_pcb)
{ .enable=0, .file_hint=&file_hint_pcb },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_pct)
{ .enable=0, .file_hint=&file_hint_pct },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_pcx)
{ .enable=0, .file_hint=&file_hint_pcx },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_pdb)
{ .enable=0, .file_hint=&file_hint_pdb },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_pdf)
{ .enable=0, .file_hint=&file_hint_pdf },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_pds)
{ .enable=0, .file_hint=&file_hint_pds },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_pf)
{ .enable=0, .file_hint=&file_hint_pf },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_pfx)
{ .enable=0, .file_hint=&file_hint_pfx },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_pgdump)
{ .enable=0, .file_hint=&file_hint_pgdump },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_plist)
{ .enable=0, .file_hint=&file_hint_plist },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_plr)
{ .enable=0, .file_hint=&file_hint_plr },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_plt)
{ .enable=0, .file_hint=&file_hint_plt },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_png)
{ .enable=0, .file_hint=&file_hint_png },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_pnm)
{ .enable=0, .file_hint=&file_hint_pnm },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_prc)
{ .enable=0, .file_hint=&file_hint_prc },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_prd)
{ .enable=0, .file_hint=&file_hint_prd },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_prt)
{ .enable=0, .file_hint=&file_hint_prt },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_ps)
{ .enable=0, .file_hint=&file_hint_ps },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_psb)
{ .enable=0, .file_hint=&file_hint_psb },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_psd)
{ .enable=0, .file_hint=&file_hint_psd },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_psf)
{ .enable=0, .file_hint=&file_hint_psf },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_psp)
{ .enable=0, .file_hint=&file_hint_psp },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_pst)
{ .enable=0, .file_hint=&file_hint_pst },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_ptb)
{ .enable=0, .file_hint=&file_hint_ptb },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_ptf)
{ .enable=0, .file_hint=&file_hint_ptf },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_pyc)
{ .enable=0, .file_hint=&file_hint_pyc },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_pzf)
{ .enable=0, .file_hint=&file_hint_pzf },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_pzh)
{ .enable=0, .file_hint=&file_hint_pzh },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_qbb)
{ .enable=0, .file_hint=&file_hint_qbb },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_qdf)
{ .enable=0, .file_hint=&file_hint_qdf },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_qkt)
{ .enable=0, .file_hint=&file_hint_qkt },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_qxd)
{ .enable=0, .file_hint=&file_hint_qxd },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_r3d)
{ .enable=0, .file_hint=&file_hint_r3d },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_ra)
{ .enable=0, .file_hint=&file_hint_ra },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_raf)
{ .enable=0, .file_hint=&file_hint_raf },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_rar)
{ .enable=0, .file_hint=&file_hint_rar },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_raw)
{ .enable=0, .file_hint=&file_hint_raw },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_rdc)
{ .enable=0, .file_hint=&file_hint_rdc },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_reg)
{ .enable=0, .file_hint=&file_hint_reg },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_res)
{ .enable=0, .file_hint=&file_hint_res },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_rfp)
{ .enable=0, .file_hint=&file_hint_rfp },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_riff)
{ .enable=0, .file_hint=&file_hint_riff },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_rlv)
{ .enable=0, .file_hint=&file_hint_rlv },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_rm)
{ .enable=0, .file_hint=&file_hint_rm },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_rns)
{ .enable=0, .file_hint=&file_hint_rns },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_rpm)
{ .enable=0, .file_hint=&file_hint_rpm },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_rw2)
{ .enable=0, .file_hint=&file_hint_rw2 },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_rx2)
{ .enable=0, .file_hint=&file_hint_rx2 },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_save)
{ .enable=0, .file_hint=&file_hint_save },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_sdsk)
{ .enable=0, .file_hint=&file_hint_sdsk },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_ses)
{ .enable=0, .file_hint=&file_hint_ses },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_sgcta)
{ .enable=0, .file_hint=&file_hint_sgcta },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_shn)
{ .enable=0, .file_hint=&file_hint_shn },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_sib)
{ .enable=0, .file_hint=&file_hint_sib },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_sit)
{ .enable=0, .file_hint=&file_hint_sit },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_skd)
{ .enable=0, .file_hint=&file_hint_skd },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_skp)
{ .enable=0, .file_hint=&file_hint_skp },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_snag)
{ .enable=0, .file_hint=&file_hint_snag },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_snz)
{ .enable=0, .file_hint=&file_hint_snz },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_sp3)
{ .enable=0, .file_hint=&file_hint_sp3 },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_spe)
{ .enable=0, .file_hint=&file_hint_spe },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_spf)
{ .enable=0, .file_hint=&file_hint_spf },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_spss)
{ .enable=0, .file_hint=&file_hint_spss },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_sqlite)
{ .enable=0, .file_hint=&file_hint_sqlite },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_sqm)
{ .enable=0, .file_hint=&file_hint_sqm },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_steuer2014)
{ .enable=0, .file_hint=&file_hint_steuer2014 },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_stl)
{ .enable=0, .file_hint=&file_hint_stl },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_studio)
{ .enable=0, .file_hint=&file_hint_studio },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_stuffit)
{ .enable=0, .file_hint=&file_hint_stuffit },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_swf)
{ .enable=0, .file_hint=&file_hint_swf },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_tar)
{ .enable=0, .file_hint=&file_hint_tar },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_tax)
{ .enable=0, .file_hint=&file_hint_tax },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_tg)
{ .enable=0, .file_hint=&file_hint_tg },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_tib)
{ .enable=0, .file_hint=&file_hint_tib },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_tiff)
{ .enable=0, .file_hint=&file_hint_tiff },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_tivo)
{ .enable=0, .file_hint=&file_hint_tivo },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_torrent)
{ .enable=0, .file_hint=&file_hint_torrent },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_tph)
{ .enable=0, .file_hint=&file_hint_tph },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_tpl)
{ .enable=0, .file_hint=&file_hint_tpl },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_ts)
{ .enable=0, .file_hint=&file_hint_ts },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_ttf)
{ .enable=0, .file_hint=&file_hint_ttf },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_fasttxt)
{ .enable=0, .file_hint=&file_hint_fasttxt },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_txt)
{ .enable=0, .file_hint=&file_hint_txt },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_tz)
{ .enable=0, .file_hint=&file_hint_tz },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_v2i)
{ .enable=0, .file_hint=&file_hint_v2i },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_vault)
{ .enable=0, .file_hint=&file_hint_vault },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_vdj)
{ .enable=0, .file_hint=&file_hint_vdj },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_vfb)
{ .enable=0, .file_hint=&file_hint_vfb },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_vdi)
{ .enable=0, .file_hint=&file_hint_vdi },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_veg)
{ .enable=0, .file_hint=&file_hint_veg },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_vib)
{ .enable=0, .file_hint=&file_hint_vib },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_vmdk)
{ .enable=0, .file_hint=&file_hint_vmdk },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_vmg)
{ .enable=0, .file_hint=&file_hint_vmg },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_wallet)
{ .enable=0, .file_hint=&file_hint_wallet },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_wdp)
{ .enable=0, .file_hint=&file_hint_wdp },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_wee)
{ .enable=0, .file_hint=&file_hint_wee },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_wim)
{ .enable=0, .file_hint=&file_hint_wim },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_win)
{ .enable=0, .file_hint=&file_hint_win },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_wks)
{ .enable=0, .file_hint=&file_hint_wks },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_wld)
{ .enable=0, .file_hint=&file_hint_wld },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_wmf)
{ .enable=0, .file_hint=&file_hint_wmf },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_wnk)
{ .enable=0, .file_hint=&file_hint_wnk },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_woff)
{ .enable=0, .file_hint=&file_hint_woff },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_wpb)
{ .enable=0, .file_hint=&file_hint_wpb },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_wpd)
{ .enable=0, .file_hint=&file_hint_wpd },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_wtv)
{ .enable=0, .file_hint=&file_hint_wtv },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_wv)
{ .enable=0, .file_hint=&file_hint_wv },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_x3f)
{ .enable=0, .file_hint=&file_hint_x3f },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_x3i)
{ .enable=0, .file_hint=&file_hint_x3i },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_x4a)
{ .enable=0, .file_hint=&file_hint_x4a },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_xar)
{ .enable=0, .file_hint=&file_hint_xar },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_xcf)
{ .enable=0, .file_hint=&file_hint_xcf },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_xfi)
{ .enable=0, .file_hint=&file_hint_xfi },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_xfs)
{ .enable=0, .file_hint=&file_hint_xfs },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_xm)
{ .enable=0, .file_hint=&file_hint_xm },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_xml)
{ .enable=0, .file_hint=&file_hint_xml },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_xsv)
{ .enable=0, .file_hint=&file_hint_xsv },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_xpt)
{ .enable=0, .file_hint=&file_hint_xpt },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_xv)
{ .enable=0, .file_hint=&file_hint_xv },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_xz)
{ .enable=0, .file_hint=&file_hint_xz },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_z2d)
{ .enable=0, .file_hint=&file_hint_z2d },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_zcode)
{ .enable=0, .file_hint=&file_hint_zcode },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_zip)
{ .enable=0, .file_hint=&file_hint_zip },
+#endif
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_zpr)
{ .enable=0, .file_hint=&file_hint_zpr },
#endif
{ .enable=0, .file_hint=NULL }
};
+#ifdef SINGLE_FORMAT
+#ifdef __OPTIMIZE__
+#define __compiletime_error(message) __attribute__((__error__(message)))
+# define __compiletime_assert(condition, msg, prefix, suffix) \
+ do { \
+ extern void prefix ## suffix(void) __compiletime_error(msg); \
+ if (!(condition)) \
+ prefix ## suffix(); \
+ } while (0)
+#else
+# define __compiletime_assert(condition, msg, prefix, suffix) do { } while (0)
+#endif
+
+#define _compiletime_assert(condition, msg, prefix, suffix) \
+ __compiletime_assert(condition, msg, prefix, suffix)
+
+#define compiletime_assert(condition, msg) \
+ _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
+
+static void check_array_file_enable()
+{
+ compiletime_assert(sizeof(file_enable_t) != sizeof(array_file_enable), "No file format has been enabled");
+}
+#endif
diff --git a/src/file_lit.c b/src/file_lit.c
index e0db1ab..8b2095d 100644
--- a/src/file_lit.c
+++ b/src/file_lit.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_lit)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -57,3 +58,4 @@ static void register_header_check_lit(file_stat_t *file_stat)
};
register_header_check(0, lit_header, sizeof(lit_header), &header_check_lit, file_stat);
}
+#endif
diff --git a/src/file_lnk.c b/src/file_lnk.c
index 3624623..40ddb52 100644
--- a/src/file_lnk.c
+++ b/src/file_lnk.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_lnk)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -246,3 +247,4 @@ static void register_header_check_lnk(file_stat_t *file_stat)
};
register_header_check(0, lnk_header,sizeof(lnk_header), &header_check_lnk, file_stat);
}
+#endif
diff --git a/src/file_logic.c b/src/file_logic.c
index ab0c663..fc597e0 100644
--- a/src/file_logic.c
+++ b/src/file_logic.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_logic)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -55,3 +56,4 @@ static void register_header_check_logic(file_stat_t *file_stat)
};
register_header_check(0, logic_header,sizeof(logic_header), &header_check_logic, file_stat);
}
+#endif
diff --git a/src/file_lso.c b/src/file_lso.c
index 2aac251..2fd3e80 100644
--- a/src/file_lso.c
+++ b/src/file_lso.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_lso)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -63,3 +64,4 @@ static void register_header_check_lso(file_stat_t *file_stat)
};
register_header_check(0, lso_header, sizeof(lso_header), &header_check_lso, file_stat);
}
+#endif
diff --git a/src/file_luks.c b/src/file_luks.c
index 01db685..e29d838 100644
--- a/src/file_luks.c
+++ b/src/file_luks.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_luks)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -65,3 +66,4 @@ static void register_header_check_luks(file_stat_t *file_stat)
{
register_header_check(0, luks_header, sizeof(luks_header), &header_check_luks, file_stat);
}
+#endif
diff --git a/src/file_lxo.c b/src/file_lxo.c
index 2360e5d..2ab8a99 100644
--- a/src/file_lxo.c
+++ b/src/file_lxo.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_lxo)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -83,3 +84,4 @@ static void register_header_check_lxo(file_stat_t *file_stat)
};
register_header_check(0, lxo_header, sizeof(lxo_header), &header_check_lxo, file_stat);
}
+#endif
diff --git a/src/file_lzh.c b/src/file_lzh.c
index 80a75cc..38a3d4b 100644
--- a/src/file_lzh.c
+++ b/src/file_lzh.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_lzh)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -54,7 +55,8 @@ struct lzh_level0
uint8_t attrib;
uint8_t level;
uint8_t filename_len;
- uint8_t filename[0];
+ /* Size should be 0, be carefull when using sizeof to decrement */
+ uint8_t filename[1];
} __attribute__ ((gcc_struct, __packed__));
struct lzh_level1
@@ -68,7 +70,9 @@ struct lzh_level1
uint8_t reserved_20;
uint8_t level;
uint8_t filename_len;
+#ifndef __FRAMAC__
uint8_t filename[0];
+#endif
} __attribute__ ((gcc_struct, __packed__));
struct lzh_level2
@@ -96,9 +100,9 @@ static void file_rename_level0(file_recovery_t *file_recovery)
return;
buffer_size=fread(buffer, 1, sizeof(buffer), file);
fclose(file);
- if(buffer_size < sizeof(struct lzh_level0))
+ if(buffer_size < sizeof(struct lzh_level0) - 1)
return;
- if(buffer_size < sizeof(struct lzh_level0) + hdr->filename_len)
+ if(buffer_size < sizeof(struct lzh_level0) - 1 + hdr->filename_len)
return;
for(i=0; i< hdr->filename_len && hdr->filename[i]!=0 && hdr->filename[i]!='.'; i++);
file_rename(file_recovery, hdr->filename, i, 0, NULL, 1);
@@ -155,3 +159,4 @@ static void register_header_check_lzh(file_stat_t *file_stat)
register_header_check(2, "-lzs-", 5, &header_check_lzh, file_stat);
register_header_check(2, "-lz4-", 5, &header_check_lzh, file_stat);
}
+#endif
diff --git a/src/file_lzo.c b/src/file_lzo.c
index 7b17f56..40299bf 100644
--- a/src/file_lzo.c
+++ b/src/file_lzo.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_lzo)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -56,3 +57,4 @@ static void register_header_check_lzo(file_stat_t *file_stat)
};
register_header_check(0, lzo_header, sizeof(lzo_header), &header_check_lzo, file_stat);
}
+#endif
diff --git a/src/file_m2ts.c b/src/file_m2ts.c
index 3a8a456..505d308 100644
--- a/src/file_m2ts.c
+++ b/src/file_m2ts.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_m2ts)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -203,3 +204,4 @@ static void register_header_check_ts(file_stat_t *file_stat)
register_header_check(0, "G", 1, &header_check_m2t, file_stat);
register_header_check(4, "G", 1, &header_check_m2ts, file_stat);
}
+#endif
diff --git a/src/file_mat.c b/src/file_mat.c
index 4e27306..a5e6f2d 100644
--- a/src/file_mat.c
+++ b/src/file_mat.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_mat)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -60,3 +61,4 @@ static void register_header_check_mat(file_stat_t *file_stat)
static const unsigned char mat_header[7]= {'M', 'A', 'T', 'L', 'A', 'B', ' '};
register_header_check(0, mat_header,sizeof(mat_header), &header_check_mat, file_stat);
}
+#endif
diff --git a/src/file_max.c b/src/file_max.c
index 5d2dd3b..4a03e63 100644
--- a/src/file_max.c
+++ b/src/file_max.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_max)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -54,3 +55,4 @@ static void register_header_check_max(file_stat_t *file_stat)
{
register_header_check(0, "ViGFk", 5, &header_check_max, file_stat);
}
+#endif
diff --git a/src/file_mb.c b/src/file_mb.c
index b730062..860bc05 100644
--- a/src/file_mb.c
+++ b/src/file_mb.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_mb)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -79,3 +80,4 @@ static void register_header_check_mb(file_stat_t *file_stat)
register_header_check(8, "MAYAFOR4", 8, &header_check_mb, file_stat);
register_header_check(8, "MPLEFOR4", 8, &header_check_mp, file_stat);
}
+#endif
diff --git a/src/file_mcd.c b/src/file_mcd.c
index 1d8ce77..bcbf46d 100644
--- a/src/file_mcd.c
+++ b/src/file_mcd.c
@@ -19,6 +19,7 @@
Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_mcd)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -54,3 +55,4 @@ static void register_header_check_mcd(file_stat_t *file_stat)
static const unsigned char mcd_header[11]= { 'V', 'e','c','t','o','r','W','o','r','k','s'};
register_header_check(0x0e, mcd_header,sizeof(mcd_header), &header_check_mcd, file_stat);
}
+#endif
diff --git a/src/file_mdb.c b/src/file_mdb.c
index f7aad9e..a77c27f 100644
--- a/src/file_mdb.c
+++ b/src/file_mdb.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_mdb)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -76,3 +77,4 @@ static void register_header_check_accdb(file_stat_t *file_stat)
static const unsigned char accdb_header[]= { 0x00, 0x01, 0x00, 0x00, 'S', 't', 'a', 'n', 'd','a','r','d',' ','A','C','E',' ', 'D','B', 0x00};
register_header_check(0, accdb_header,sizeof(accdb_header), &header_check_accdb, file_stat);
}
+#endif
diff --git a/src/file_mdf.c b/src/file_mdf.c
index a1020eb..188944c 100644
--- a/src/file_mdf.c
+++ b/src/file_mdf.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_mdf)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -65,3 +66,4 @@ static int header_check_mdf(const unsigned char *buffer, const unsigned int buff
}
return 0;
}
+#endif
diff --git a/src/file_mdp.c b/src/file_mdp.c
new file mode 100644
index 0000000..f15c955
--- /dev/null
+++ b/src/file_mdp.c
@@ -0,0 +1,69 @@
+/*
+
+ File: file_mdp.c
+
+ Copyright (C) 2020 Christophe GRENIER <grenier@cgsecurity.org>
+
+ 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.
+
+ */
+
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_mdp)
+#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"
+#include "common.h"
+
+static void register_header_check_mdp(file_stat_t *file_stat);
+
+const file_hint_t file_hint_mdp= {
+ .extension="mdp",
+ .description="MediBang Paint Pro",
+ .max_filesize=PHOTOREC_MAX_FILE_SIZE,
+ .recover=1,
+ .enable_by_default=1,
+ .register_header_check=&register_header_check_mdp
+};
+
+struct mdp_header
+{
+ char magic[8];
+ uint32_t val0; /* 0 in the sample files I have */
+ uint32_t val1;
+ uint32_t val2;
+} __attribute__ ((gcc_struct, __packed__));
+
+static int header_check_mdp(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 struct mdp_header *header=(const struct mdp_header *)buffer;
+ reset_file_recovery(file_recovery_new);
+ file_recovery_new->extension=file_hint_mdp.extension;
+ file_recovery_new->calculated_file_size=(uint64_t)le32(header->val1) + le32(header->val2) + 20;
+ file_recovery_new->data_check=&data_check_size;
+ file_recovery_new->file_check=&file_check_size;
+ return 1;
+}
+
+static void register_header_check_mdp(file_stat_t *file_stat)
+{
+ register_header_check(0, "mdipack", 8, &header_check_mdp, file_stat);
+}
+#endif
diff --git a/src/file_mfa.c b/src/file_mfa.c
index 0d9d1a4..c63d999 100644
--- a/src/file_mfa.c
+++ b/src/file_mfa.c
@@ -19,6 +19,7 @@
Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_mfa)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -59,3 +60,4 @@ static void register_header_check_mfa(file_stat_t *file_stat)
static const unsigned char mfa_header[8]= { 'M', 'M', 'F', '2', 0x04, 0x00, 0x00, 0x00};
register_header_check(0, mfa_header,sizeof(mfa_header), &header_check_mfa, file_stat);
}
+#endif
diff --git a/src/file_mfg.c b/src/file_mfg.c
index 6c2aca2..f3c9f2f 100644
--- a/src/file_mfg.c
+++ b/src/file_mfg.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_mfg)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -65,3 +66,4 @@ static void register_header_check_mfg(file_stat_t *file_stat)
register_header_check(0, mfg_header,sizeof(mfg_header), &header_check_mfg, file_stat);
}
+#endif
diff --git a/src/file_mft.c b/src/file_mft.c
index 8802672..99e8735 100644
--- a/src/file_mft.c
+++ b/src/file_mft.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_mft)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -78,7 +79,7 @@ static int header_check_mft(const unsigned char *buffer, const unsigned int buff
return 0;
reset_file_recovery(file_recovery_new);
file_recovery_new->extension=file_hint_mft.extension;
- file_recovery_new->calculated_file_size=bytes_allocated;
+ file_recovery_new->calculated_file_size=td_max(file_recovery_new->blocksize, bytes_allocated);
file_recovery_new->data_check=&data_check_size;
file_recovery_new->file_check=&file_check_size;
file_recovery_new->file_rename=&file_rename_mft;
@@ -89,3 +90,4 @@ static void register_header_check_mft(file_stat_t *file_stat)
{
register_header_check(0, "FILE", 4, &header_check_mft, file_stat);
}
+#endif
diff --git a/src/file_mid.c b/src/file_mid.c
index c7f8255..c013e03 100644
--- a/src/file_mid.c
+++ b/src/file_mid.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_mid)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -121,3 +122,4 @@ static void register_header_check_mid(file_stat_t *file_stat)
static const unsigned char mid_header[8] = { 'M','T','h','d', 0, 0, 0, 0x6};
register_header_check(0, mid_header,sizeof(mid_header), &header_check_mid, file_stat);
}
+#endif
diff --git a/src/file_mig.c b/src/file_mig.c
index b60a8b9..ca45ac5 100644
--- a/src/file_mig.c
+++ b/src/file_mig.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_mig)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -111,3 +112,4 @@ static void register_header_check_mig(file_stat_t *file_stat)
};
register_header_check(0, mig_header, sizeof(mig_header), &header_check_mig, file_stat);
}
+#endif
diff --git a/src/file_mk5.c b/src/file_mk5.c
index a23636d..ea6952d 100644
--- a/src/file_mk5.c
+++ b/src/file_mk5.c
@@ -19,6 +19,7 @@
Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_mk5)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -55,3 +56,4 @@ static void register_header_check_mk5(file_stat_t *file_stat)
static const unsigned char mk5_header[4]= { 0x36, 0xff, 0xff, 0xff };
register_header_check(0, mk5_header,sizeof(mk5_header), &header_check_mk5, file_stat);
}
+#endif
diff --git a/src/file_mkv.c b/src/file_mkv.c
index be34cda..91701a2 100644
--- a/src/file_mkv.c
+++ b/src/file_mkv.c
@@ -21,6 +21,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_mkv)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -183,3 +184,4 @@ static int header_check_mkv(const unsigned char *buffer, const unsigned int buff
}
return 1;
}
+#endif
diff --git a/src/file_mlv.c b/src/file_mlv.c
index 5d53760..f9436fb 100644
--- a/src/file_mlv.c
+++ b/src/file_mlv.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_mlv)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -31,6 +32,9 @@
#include "filegen.h"
#include "common.h"
#include "log.h"
+#if defined(__FRAMAC__)
+#include "__fc_builtin.h"
+#endif
static void register_header_check_mlv(file_stat_t *file_stat);
@@ -66,9 +70,15 @@ typedef struct {
uint64_t timestamp;
} __attribute__ ((gcc_struct, __packed__)) mlv_hdr_t;
+/*@
+ @ requires \valid_read(hdr);
+ @ requires \initialized(hdr);
+ @ assigns \nothing;
+ @*/
static int is_valid_type(const mlv_hdr_t *hdr)
{
unsigned int i;
+ /*@ loop assigns i; */
for(i=0; i<4; i++)
{
const uint8_t c=hdr->blockType[i];
@@ -80,6 +90,9 @@ static int is_valid_type(const mlv_hdr_t *hdr)
static data_check_t data_check_mlv(const unsigned char *buffer, const unsigned int buffer_size, file_recovery_t *fr)
{
+ /*@
+ @ loop assigns fr->calculated_file_size;
+ @*/
while(fr->calculated_file_size + buffer_size/2 >= fr->file_size &&
fr->calculated_file_size + 8 < fr->file_size + buffer_size/2)
{
@@ -94,13 +107,20 @@ static data_check_t data_check_mlv(const unsigned char *buffer, const unsigned i
static void file_check_mlv(file_recovery_t *file_recovery)
{
- mlv_hdr_t hdr;
uint64_t fs=0;
- do
+ while(fs < 0x8000000000000000)
{
+ mlv_hdr_t hdr;
if(my_fseek(file_recovery->handle, fs, SEEK_SET)<0 ||
- fread(&hdr, sizeof(hdr), 1, file_recovery->handle)!=1 ||
- le32(hdr.blockSize)<0x10 ||
+ fread(&hdr, sizeof(hdr), 1, file_recovery->handle)!=1)
+ {
+ file_recovery->file_size=(fs <= file_recovery->blocksize ? 0 : fs);
+ return;
+ }
+#if defined(__FRAMAC__)
+ Frama_C_make_unknown(&hdr, sizeof(mlv_hdr_t));
+#endif
+ if(le32(hdr.blockSize)<0x10 ||
!is_valid_type(&hdr) ||
fs + le32(hdr.blockSize) > file_recovery->file_size)
{
@@ -108,7 +128,8 @@ static void file_check_mlv(file_recovery_t *file_recovery)
return;
}
fs+=le32(hdr.blockSize);
- } while(1);
+ }
+ file_recovery->file_size=0;
}
static void file_rename_mlv(file_recovery_t *file_recovery)
@@ -129,6 +150,17 @@ static void file_rename_mlv(file_recovery_t *file_recovery)
file_rename(file_recovery, NULL, 0, 0, ext, 1);
}
+/*@
+ @ requires buffer_size > 0;
+ @ requires \valid_read(buffer+(0..buffer_size-1));
+ @ requires \valid_read(file_recovery);
+ @ requires file_recovery->file_stat==\null || valid_read_string((char*)file_recovery->filename);
+ @ requires \valid(file_recovery_new);
+ @ requires file_recovery_new->blocksize > 0;
+ @
+ @ requires buffer_size >= sizeof(mlv_file_hdr_t);
+ @ requires separation: \separated(&file_hint_mlv, buffer+(..), file_recovery, file_recovery_new);
+ @*/
static int header_check_mlv(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 mlv_file_hdr_t *hdr=(const mlv_file_hdr_t *)buffer;
@@ -163,3 +195,4 @@ static void register_header_check_mlv(file_stat_t *file_stat)
{
register_header_check(0, "MLVI", 4, &header_check_mlv, file_stat);
}
+#endif
diff --git a/src/file_mobi.c b/src/file_mobi.c
index 3d9e59a..ef48467 100644
--- a/src/file_mobi.c
+++ b/src/file_mobi.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_mobi)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -68,3 +69,4 @@ static void register_header_check_mobi(file_stat_t *file_stat)
{
register_header_check(0x3c, "BOOKMOBI", 8, &header_check_mobi, file_stat);
}
+#endif
diff --git a/src/file_mov.c b/src/file_mov.c
index a403eb9..52574a6 100644
--- a/src/file_mov.c
+++ b/src/file_mov.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_mov) || defined(SINGLE_FORMAT_mov_mdat)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -58,7 +59,7 @@ const file_hint_t file_hint_mov_mdat= {
};
static const char *extension_mp4="mp4";
-static const char *extension_m4p="m4p";
+static const char *extension_m4a="m4a";
static const char *extension_3gp="3gp";
static const char *extension_3g2="3g2";
static const char *extension_heic="heic";
@@ -214,7 +215,7 @@ static data_check_t data_check_mov(const unsigned char *buffer, const unsigned i
file_recovery_new->extension == extension_cr3 ||
file_recovery_new->extension == extension_heic ||
file_recovery_new->extension == extension_jp2 ||
- file_recovery_new->extension == extension_m4p ||
+ file_recovery_new->extension == extension_m4a ||
file_recovery_new->extension == extension_mp4);
@ ensures (\result == 1) ==> (file_recovery_new->time == 0);
@ ensures (\result == 1) ==> (valid_read_string(file_recovery_new->extension));
@@ -339,8 +340,7 @@ static int header_check_mov_aux(const unsigned char *buffer, const unsigned int
else if(memcmp(&buffer[i+8], "M4A ", 4)==0)
{
reset_file_recovery(file_recovery_new);
- /* acc ? */
- file_recovery_new->extension=extension_m4p;
+ file_recovery_new->extension=extension_m4a;
if(file_recovery->blocksize < 16)
{
file_recovery_new->min_filesize=calculated_file_size;
@@ -477,7 +477,7 @@ static int header_check_mov_aux(const unsigned char *buffer, const unsigned int
file_recovery_new->extension == extension_cr3 ||
file_recovery_new->extension == extension_heic ||
file_recovery_new->extension == extension_jp2 ||
- file_recovery_new->extension == extension_m4p ||
+ file_recovery_new->extension == extension_m4a ||
file_recovery_new->extension == extension_mp4);
@ ensures (\result == 1) ==> (valid_read_string(file_recovery_new->extension));
@ ensures (\result == 1) ==> (file_recovery_new->file_rename == &file_rename_mov || file_recovery_new->file_rename == \null);
@@ -529,6 +529,7 @@ static void register_header_check_mov(file_stat_t *file_stat)
register_header_check(4, (const unsigned char*)"wide",4, &header_check_mov, file_stat);
register_header_check(4, (const unsigned char*)"jP ",4, &header_check_mov, file_stat);
}
+#endif
#if defined(MAIN_mov)
#define BLOCKSIZE 65536u
diff --git a/src/file_mp3.c b/src/file_mp3.c
index 11431da..7760545 100644
--- a/src/file_mp3.c
+++ b/src/file_mp3.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_mp3)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -35,7 +36,7 @@
#include "__fc_builtin.h"
#endif
-#if !defined(MAIN_mp3)
+#if !defined(SINGLE_FORMAT)
extern const file_hint_t file_hint_mkv;
extern const file_hint_t file_hint_tiff;
#endif
@@ -536,12 +537,12 @@ static int header_check_mp3(const unsigned char *buffer, const unsigned int buff
return 0;
/*@ assert nbr == 0; */
/*@
- @ loop invariant 0 <= nbr <= potential_frame_offset <= 2048 + 8065;
+ @ loop invariant 0 <= nbr <= potential_frame_offset <= 8192 + 8065;
@ loop assigns potential_frame_offset,nbr;
- @ loop variant 2048 - potential_frame_offset;
+ @ loop variant 8192 - potential_frame_offset;
@*/
while(potential_frame_offset+1 < buffer_size &&
- potential_frame_offset+1 < 2048)
+ potential_frame_offset+1 < 8192)
{
if(buffer[potential_frame_offset+0]!=0xFF)
return 0;
@@ -587,7 +588,7 @@ static int header_check_mp3(const unsigned char *buffer, const unsigned int buff
if(file_recovery->file_stat!=NULL)
{
if(file_recovery->file_stat->file_hint==&file_hint_mp3
-#if !defined(MAIN_mp3)
+#if !defined(SINGLE_FORMAT)
|| file_recovery->file_stat->file_hint==&file_hint_mkv
#endif
)
@@ -595,7 +596,7 @@ static int header_check_mp3(const unsigned char *buffer, const unsigned int buff
header_ignored(file_recovery_new);
return 0;
}
-#if !defined(MAIN_mp3)
+#if !defined(SINGLE_FORMAT)
/* RGV values from TIFF may be similar to the beginning of an mp3 */
if(file_recovery->file_stat->file_hint==&file_hint_tiff &&
buffer[0]==buffer[3] && buffer[1]==buffer[4] && buffer[2]==buffer[5])
@@ -644,6 +645,7 @@ static void register_header_check_mp3(file_stat_t *file_stat)
register_header_check(0, mpeg25_L3_header1, sizeof(mpeg25_L3_header1), &header_check_mp3, file_stat);
register_header_check(0, mpeg25_L3_header2, sizeof(mpeg25_L3_header2), &header_check_mp3, file_stat);
}
+#endif
#if defined(MAIN_mp3)
#define BLOCKSIZE 65536u
diff --git a/src/file_mpg.c b/src/file_mpg.c
index 03b61d3..7a3fb68 100644
--- a/src/file_mpg.c
+++ b/src/file_mpg.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_mpg)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -341,3 +342,4 @@ static void register_header_check_mpg(file_stat_t *file_stat)
register_header_check(0, mpg_header_BA,sizeof(mpg_header_BA), &header_check_mpg_Pack, file_stat);
register_header_check(0, mpg_header_BB,sizeof(mpg_header_BB), &header_check_mpg_System, file_stat);
}
+#endif
diff --git a/src/file_mpl.c b/src/file_mpl.c
index 011a315..c28235c 100644
--- a/src/file_mpl.c
+++ b/src/file_mpl.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_mpl)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -52,3 +53,4 @@ static void register_header_check_mpl(file_stat_t *file_stat)
{
register_header_check(0, "MPLS0100", 8, &header_check_mpl, file_stat);
}
+#endif
diff --git a/src/file_mrw.c b/src/file_mrw.c
index 498c216..5c30f8d 100644
--- a/src/file_mrw.c
+++ b/src/file_mrw.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_mrw)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -96,3 +97,4 @@ static void register_header_check_mrw(file_stat_t *file_stat)
static const unsigned char mrw_header[4]= { 0x00,'M','R','M'}; /* Minolta Raw */
register_header_check(0, mrw_header,sizeof(mrw_header), &header_check_mrw, file_stat);
}
+#endif
diff --git a/src/file_msa.c b/src/file_msa.c
index 7d9f558..07e6d23 100644
--- a/src/file_msa.c
+++ b/src/file_msa.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_msa)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -72,3 +73,4 @@ static void register_header_check_msa(file_stat_t *file_stat)
register_header_check(0, msa_header_fb, sizeof(msa_header_fb), &header_check_msa, file_stat);
register_header_check(0, msa_header_fc, sizeof(msa_header_fc), &header_check_msa, file_stat);
}
+#endif
diff --git a/src/file_mus.c b/src/file_mus.c
index 1e46612..7d004b4 100644
--- a/src/file_mus.c
+++ b/src/file_mus.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_mus)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -61,3 +62,4 @@ static void register_header_check_mus(file_stat_t *file_stat)
static const unsigned char mus_header[18] = { 'E','N','I','G','M','A',' ','B','I','N','A','R','Y',' ','F','I','L','E' };
register_header_check(0, mus_header,sizeof(mus_header), &header_check_mus, file_stat);
}
+#endif
diff --git a/src/file_mxf.c b/src/file_mxf.c
index d6715bb..c73af64 100644
--- a/src/file_mxf.c
+++ b/src/file_mxf.c
@@ -19,6 +19,7 @@
Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_mxf)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -155,3 +156,4 @@ static void register_header_check_mxf(file_stat_t *file_stat)
};
register_header_check(0, mxf_header,sizeof(mxf_header), &header_check_mxf, file_stat);
}
+#endif
diff --git a/src/file_myo.c b/src/file_myo.c
index 25af8e0..839ddc7 100644
--- a/src/file_myo.c
+++ b/src/file_myo.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_myo)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -67,3 +68,4 @@ static void register_header_check_myo(file_stat_t *file_stat)
{
register_header_check(0x9ce, "FC!DEF", 6, &header_check_myo, file_stat);
}
+#endif
diff --git a/src/file_mysql.c b/src/file_mysql.c
index 2052b7a..8d9dfd0 100644
--- a/src/file_mysql.c
+++ b/src/file_mysql.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_mysql)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -70,3 +71,4 @@ static int header_check_mysql(const unsigned char *buffer, const unsigned int bu
}
return 0;
}
+#endif
diff --git a/src/file_nd2.c b/src/file_nd2.c
index 3dd9f84..feeaca0 100644
--- a/src/file_nd2.c
+++ b/src/file_nd2.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_nd2)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -55,3 +56,4 @@ static void register_header_check_nd2(file_stat_t *file_stat)
{
register_header_check(0x10, "ND2 FILE SIGNATURE CHUNK NAME01!Ver", 0x23, &header_check_nd2, file_stat);
}
+#endif
diff --git a/src/file_nds.c b/src/file_nds.c
index 7bc302e..3786452 100644
--- a/src/file_nds.c
+++ b/src/file_nds.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_nds)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -74,3 +75,4 @@ static void register_header_check_nds(file_stat_t *file_stat)
};
register_header_check(0xc0, nds_header, sizeof(nds_header), &header_check_nds, file_stat);
}
+#endif
diff --git a/src/file_nes.c b/src/file_nes.c
index 5e6601f..0c7e156 100644
--- a/src/file_nes.c
+++ b/src/file_nes.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_nes)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -67,3 +68,4 @@ static void register_header_check_nes(file_stat_t *file_stat)
static const unsigned char nes_header[4]= {'N','E','S',0x1A};
register_header_check(0, nes_header,sizeof(nes_header), &header_check_nes, file_stat);
}
+#endif
diff --git a/src/file_njx.c b/src/file_njx.c
index 57be6b8..f4c8158 100644
--- a/src/file_njx.c
+++ b/src/file_njx.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_njx)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -69,3 +70,4 @@ static void file_check_njx(file_recovery_t *file_recovery)
const unsigned char njx_footer[4]= {'N', 'J', '*', 0x04};
file_search_footer(file_recovery, njx_footer, sizeof(njx_footer), 0);
}
+#endif
diff --git a/src/file_nk2.c b/src/file_nk2.c
index 4e2a44a..f97a279 100644
--- a/src/file_nk2.c
+++ b/src/file_nk2.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_nk2)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -190,3 +191,4 @@ static void register_header_check_nk2(file_stat_t *file_stat)
static const unsigned char nk2_header[8]= { 0x0d, 0xf0, 0xad, 0xba, 0x0a, 0x00, 0x00, 0x00 };
register_header_check(0, nk2_header, sizeof(nk2_header), &header_check_nk2, file_stat);
}
+#endif
diff --git a/src/file_nsf.c b/src/file_nsf.c
index af3269b..65ccd43 100644
--- a/src/file_nsf.c
+++ b/src/file_nsf.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_nsf)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -59,3 +60,4 @@ static void register_header_check_nsf(file_stat_t *file_stat)
register_header_check(0, nsf_header, sizeof(nsf_header), &header_check_nsf, file_stat);
}
+#endif
diff --git a/src/file_oci.c b/src/file_oci.c
index 94145aa..2d2048b 100644
--- a/src/file_oci.c
+++ b/src/file_oci.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_oci)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -111,3 +112,4 @@ static void register_header_check_oci(file_stat_t *file_stat)
};
register_header_check(0, oci_header, sizeof(oci_header), &header_check_oci, file_stat);
}
+#endif
diff --git a/src/file_ogg.c b/src/file_ogg.c
index fb9d43d..1184f6b 100644
--- a/src/file_ogg.c
+++ b/src/file_ogg.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_ogg)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -113,3 +114,4 @@ static void register_header_check_ogg(file_stat_t *file_stat)
{
register_header_check(0, ogg_header,sizeof(ogg_header), &header_check_ogg, file_stat);
}
+#endif
diff --git a/src/file_one.c b/src/file_one.c
index 31664c0..9fe0343 100644
--- a/src/file_one.c
+++ b/src/file_one.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_one)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -62,3 +63,4 @@ static void register_header_check_one(file_stat_t *file_stat)
0xae, 0xb1, 0x53, 0x78, 0xd0, 0x29, 0x96, 0xd3 };
register_header_check(0, one_header,sizeof(one_header), &header_check_one, file_stat);
}
+#endif
diff --git a/src/file_orf.c b/src/file_orf.c
index 15531a5..1637893 100644
--- a/src/file_orf.c
+++ b/src/file_orf.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_orf)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -65,3 +66,4 @@ static void register_header_check_orf(file_stat_t *file_stat)
register_header_check(0, orf_header_IIRS, sizeof(orf_header_IIRS), &header_check_orf_IIRS, file_stat);
register_header_check(0, orf_header_IIRO, sizeof(orf_header_IIRO), &header_check_orf_IIRO, file_stat);
}
+#endif
diff --git a/src/file_paf.c b/src/file_paf.c
index 6e956d9..00ada90 100644
--- a/src/file_paf.c
+++ b/src/file_paf.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_paf)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -56,3 +57,4 @@ static void register_header_check_paf(file_stat_t *file_stat)
static const unsigned char paf_header[11]= {'5', '0', '0', '\0', '5', '0', '0', '\0', 'P','A','F'};
register_header_check(0, paf_header,sizeof(paf_header), &header_check_paf, file_stat);
}
+#endif
diff --git a/src/file_pap.c b/src/file_pap.c
index 9f51490..7834c69 100644
--- a/src/file_pap.c
+++ b/src/file_pap.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_pap)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -54,3 +55,4 @@ static void register_header_check_pap(file_stat_t *file_stat)
static const unsigned char pap_header[] = {'P','A','P','1'};
register_header_check(0, pap_header,sizeof(pap_header), &header_check_pap, file_stat);
}
+#endif
diff --git a/src/file_par2.c b/src/file_par2.c
index 2cb5fa0..ddfb5f6 100644
--- a/src/file_par2.c
+++ b/src/file_par2.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_par2)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -131,3 +132,4 @@ static void register_header_check_par2(file_stat_t *file_stat)
{
register_header_check(0, par2_header, sizeof(par2_header), &header_check_par2, file_stat);
}
+#endif
diff --git a/src/file_pcap.c b/src/file_pcap.c
index 337a4da..174d571 100644
--- a/src/file_pcap.c
+++ b/src/file_pcap.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_pcap)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -59,3 +60,4 @@ static void register_header_check_pcap(file_stat_t *file_stat)
register_header_check(0, pcap_le_header1, sizeof(pcap_le_header1), &header_check_pcap, file_stat);
register_header_check(0, pcap_le_header2, sizeof(pcap_le_header2), &header_check_pcap, file_stat);
}
+#endif
diff --git a/src/file_pcb.c b/src/file_pcb.c
index 9d788db..9b2c571 100644
--- a/src/file_pcb.c
+++ b/src/file_pcb.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_pcb)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -56,3 +57,4 @@ static void register_header_check_pcb(file_stat_t *file_stat)
};
register_header_check(0, pcb_header, sizeof(pcb_header), &header_check_pcb, file_stat);
}
+#endif
diff --git a/src/file_pct.c b/src/file_pct.c
index 4983705..ae5589f 100644
--- a/src/file_pct.c
+++ b/src/file_pct.c
@@ -19,6 +19,7 @@
Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_pct)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -134,3 +135,4 @@ static void register_header_check_pct(file_stat_t *file_stat)
static const unsigned char pct_header[6]= { 0x00, 0x11, 0x02, 0xff, 0x0c, 0x00};
register_header_check(0x20a, pct_header,sizeof(pct_header), &header_check_pct, file_stat);
}
+#endif
diff --git a/src/file_pcx.c b/src/file_pcx.c
index 4f351e8..c51c1d9 100644
--- a/src/file_pcx.c
+++ b/src/file_pcx.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_pcx)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -110,4 +111,4 @@ static int header_check_pcx(const unsigned char *buffer, const unsigned int buff
}
return 0;
}
-
+#endif
diff --git a/src/file_pdb.c b/src/file_pdb.c
index 4a9ec33..d104fac 100644
--- a/src/file_pdb.c
+++ b/src/file_pdb.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_pdb)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -96,3 +97,4 @@ static void register_header_check_pdb(file_stat_t *file_stat)
{
register_header_check(0, "HEADER ", 10, &header_check_pdb, file_stat);
}
+#endif
diff --git a/src/file_pdf.c b/src/file_pdf.c
index 1311539..1644697 100644
--- a/src/file_pdf.c
+++ b/src/file_pdf.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_pdf)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -316,3 +317,4 @@ static void register_header_check_pdf(file_stat_t *file_stat)
static const unsigned char pdf_header[] = { '%','P','D','F','-','1'};
register_header_check(0, pdf_header,sizeof(pdf_header), &header_check_pdf, file_stat);
}
+#endif
diff --git a/src/file_pds.c b/src/file_pds.c
index f16641e..866fb41 100644
--- a/src/file_pds.c
+++ b/src/file_pds.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_pds)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -58,3 +59,4 @@ static void register_header_check_pds(file_stat_t *file_stat)
};
register_header_check(0, pds_header, sizeof(pds_header), &header_check_pds, file_stat);
}
+#endif
diff --git a/src/file_pf.c b/src/file_pf.c
index d01b99d..fef0cdd 100644
--- a/src/file_pf.c
+++ b/src/file_pf.c
@@ -21,6 +21,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_pf)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -128,6 +129,7 @@ static void register_header_check_pf(file_stat_t *file_stat)
static const unsigned char pf_header[7] = {0x00, 0x00, 0x00, 'S', 'C', 'C', 'A'};
register_header_check(1, pf_header,sizeof(pf_header), &header_check_pf, file_stat);
}
+#endif
#if defined(MAIN_pf)
#define BLOCKSIZE 65536u
diff --git a/src/file_pfx.c b/src/file_pfx.c
index 2151bd6..b338c09 100644
--- a/src/file_pfx.c
+++ b/src/file_pfx.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_pfx)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -90,3 +91,4 @@ static void register_header_check_pfx(file_stat_t *file_stat)
};
register_header_check(11, pfx_header,sizeof(pfx_header), &header_check_pfx, file_stat);
}
+#endif
diff --git a/src/file_pgdump.c b/src/file_pgdump.c
index 3acaffe..4d53804 100644
--- a/src/file_pgdump.c
+++ b/src/file_pgdump.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_pgdump)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -107,3 +108,4 @@ static void register_header_check_pgdump(file_stat_t *file_stat)
{
register_header_check(0, "PGDMP", 5, &header_check_pgdump, file_stat);
}
+#endif
diff --git a/src/file_plist.c b/src/file_plist.c
index 63e5767..a738a2c 100644
--- a/src/file_plist.c
+++ b/src/file_plist.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_plist)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -64,3 +65,4 @@ static void register_header_check_plist(file_stat_t *file_stat)
{
register_header_check(0, "bplist00", 8, &header_check_plist, file_stat);
}
+#endif
diff --git a/src/file_plr.c b/src/file_plr.c
index 50b9866..e851f53 100644
--- a/src/file_plr.c
+++ b/src/file_plr.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_plr)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -59,3 +60,4 @@ static void register_header_check_plr(file_stat_t *file_stat)
};
register_header_check(0, plr_header, sizeof(plr_header), &header_check_plr, file_stat);
}
+#endif
diff --git a/src/file_plt.c b/src/file_plt.c
index 7ad9334..5d09a41 100644
--- a/src/file_plt.c
+++ b/src/file_plt.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_plt)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -60,3 +61,4 @@ static void register_header_check_plt(file_stat_t *file_stat)
};
register_header_check(2, plt_header, sizeof(plt_header), &header_check_plt, file_stat);
}
+#endif
diff --git a/src/file_png.c b/src/file_png.c
index 3d3b31f..00be0be 100644
--- a/src/file_png.c
+++ b/src/file_png.c
@@ -26,6 +26,7 @@
http://www.libpng.org/pub/mng/spec/
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_png)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -262,3 +263,4 @@ static void register_header_check_png(file_stat_t *file_stat)
register_header_check(0, mng_header, sizeof(mng_header), &header_check_mng, file_stat);
register_header_check(0, jng_header, sizeof(jng_header), &header_check_jng, file_stat);
}
+#endif
diff --git a/src/file_pnm.c b/src/file_pnm.c
index 569defb..7790919 100644
--- a/src/file_pnm.c
+++ b/src/file_pnm.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_pnm)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -79,3 +80,4 @@ static void register_header_check_pnm(file_stat_t *file_stat)
register_header_check(0, "P5\n# ", 5, &header_check_pgm, file_stat);
register_header_check(0, "P6\n# ", 5, &header_check_ppm, file_stat);
}
+#endif
diff --git a/src/file_prc.c b/src/file_prc.c
index 5679ff5..26639c5 100644
--- a/src/file_prc.c
+++ b/src/file_prc.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_prc)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -76,3 +77,4 @@ static void register_header_check_prc(file_stat_t *file_stat)
static const unsigned char prc_header[16]= {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,'a','p','p','l'};
register_header_check(0x30, prc_header,sizeof(prc_header), &header_check_prc, file_stat);
}
+#endif
diff --git a/src/file_prd.c b/src/file_prd.c
index a355162..124306a 100644
--- a/src/file_prd.c
+++ b/src/file_prd.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_prd)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -58,3 +59,4 @@ static void register_header_check_prd(file_stat_t *file_stat)
};
register_header_check(0, prd_header, sizeof(prd_header), &header_check_prd, file_stat);
}
+#endif
diff --git a/src/file_prt.c b/src/file_prt.c
index 18b45f4..71067a6 100644
--- a/src/file_prt.c
+++ b/src/file_prt.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_prt)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -64,3 +65,4 @@ static void register_header_check_prt(file_stat_t *file_stat)
'A', 'R', 'T', ' '};
register_header_check(0, prt_header,sizeof(prt_header), &header_check_prt, file_stat);
}
+#endif
diff --git a/src/file_ps.c b/src/file_ps.c
index f9cfb6c..934cb77 100644
--- a/src/file_ps.c
+++ b/src/file_ps.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_ps)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -100,3 +101,4 @@ static data_check_t data_check_ps(const unsigned char *buffer, const unsigned in
file_recovery->calculated_file_size=file_recovery->file_size+(buffer_size/2);
return DC_CONTINUE;
}
+#endif
diff --git a/src/file_psb.c b/src/file_psb.c
index 4a27ac4..82e3934 100644
--- a/src/file_psb.c
+++ b/src/file_psb.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_psb)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -176,3 +177,4 @@ static void register_header_check_psb(file_stat_t *file_stat)
static const unsigned char psb_header[6]={'8', 'B', 'P', 'S', 0x00, 0x02};
register_header_check(0, psb_header,sizeof(psb_header), &header_check_psb, file_stat);
}
+#endif
diff --git a/src/file_psd.c b/src/file_psd.c
index ab275d1..b1f6a89 100644
--- a/src/file_psd.c
+++ b/src/file_psd.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_psd)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -176,3 +177,4 @@ static void register_header_check_psd(file_stat_t *file_stat)
static const unsigned char psd_header[6]={'8', 'B', 'P', 'S', 0x00, 0x01};
register_header_check(0, psd_header,sizeof(psd_header), &header_check_psd, file_stat);
}
+#endif
diff --git a/src/file_psf.c b/src/file_psf.c
index e30308f..28c817d 100644
--- a/src/file_psf.c
+++ b/src/file_psf.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_psf)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -61,3 +62,4 @@ static void register_header_check_psf(file_stat_t *file_stat)
{
register_header_check(12, "PSD5RDOC", 8, &header_check_psf, file_stat);
}
+#endif
diff --git a/src/file_psp.c b/src/file_psp.c
index a219467..effe5aa 100644
--- a/src/file_psp.c
+++ b/src/file_psp.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_psp)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -85,3 +86,4 @@ static int header_check_psp(const unsigned char *buffer, const unsigned int buff
}
return 1;
}
+#endif
diff --git a/src/file_pst.c b/src/file_pst.c
index 464f329..3152a4a 100644
--- a/src/file_pst.c
+++ b/src/file_pst.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_pst)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -146,3 +147,4 @@ static void register_header_check_pst(file_stat_t *file_stat)
register_header_check(0, dbx_header,sizeof(dbx_header), &header_check_dbx, file_stat);
register_header_check(0, wab_header,sizeof(wab_header), &header_check_wab, file_stat);
}
+#endif
diff --git a/src/file_ptb.c b/src/file_ptb.c
index 13837d1..284af10 100644
--- a/src/file_ptb.c
+++ b/src/file_ptb.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_ptb)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -58,3 +59,4 @@ static void register_header_check_ptb(file_stat_t *file_stat)
static const unsigned char ptb_header[4]= {'p', 't', 'a', 'b'};
register_header_check(0, ptb_header,sizeof(ptb_header), &header_check_ptb, file_stat);
}
+#endif
diff --git a/src/file_ptf.c b/src/file_ptf.c
index 358fc48..b12c3f3 100644
--- a/src/file_ptf.c
+++ b/src/file_ptf.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_ptf)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -69,3 +70,4 @@ static void register_header_check_ptf(file_stat_t *file_stat)
};
register_header_check(0, ptf_header, sizeof(ptf_header), &header_check_ptf, file_stat);
}
+#endif
diff --git a/src/file_pyc.c b/src/file_pyc.c
index ed70e83..faff089 100644
--- a/src/file_pyc.c
+++ b/src/file_pyc.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_pyc)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -94,3 +95,4 @@ static void register_header_check_pyc(file_stat_t *file_stat)
register_header_check(0, pyc_33_magic, sizeof(pyc_33_magic), &header_check_pyc, file_stat);
register_header_check(0, pyc_34_magic, sizeof(pyc_34_magic), &header_check_pyc, file_stat);
}
+#endif
diff --git a/src/file_pzf.c b/src/file_pzf.c
index a7e5a9f..649131b 100644
--- a/src/file_pzf.c
+++ b/src/file_pzf.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_pzf)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -66,3 +67,4 @@ static void register_header_check_pzf(file_stat_t *file_stat)
};
register_header_check(0, pzf_header, sizeof(pzf_header), &header_check_pzf, file_stat);
}
+#endif
diff --git a/src/file_pzh.c b/src/file_pzh.c
index 03bcbab..3fcedc5 100644
--- a/src/file_pzh.c
+++ b/src/file_pzh.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_pzh)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -79,3 +80,4 @@ static void register_header_check_pzh(file_stat_t *file_stat)
{
register_header_check(0x9c4, pzh_header, sizeof(pzh_header), &header_check_pzh, file_stat);
}
+#endif
diff --git a/src/file_qbb.c b/src/file_qbb.c
index 076b6ae..c6d5971 100644
--- a/src/file_qbb.c
+++ b/src/file_qbb.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_qbb)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -51,7 +52,9 @@ struct qbb_header
uint16_t type;
uint16_t data_len;
uint16_t unk1;
+#if 0
unsigned char data[0];
+#endif
} __attribute__ ((gcc_struct, __packed__));
struct qbb_header02
@@ -64,7 +67,9 @@ struct qbb_header02
uint32_t size;
uint8_t unk3[10];
uint16_t title_len;
+#if 0
uint8_t title[0];
+#endif
} __attribute__ ((gcc_struct, __packed__));
static void file_rename_qbb(file_recovery_t *file_recovery)
@@ -85,9 +90,10 @@ static void file_rename_qbb(file_recovery_t *file_recovery)
if(le16(hdr->type)==2)
{
const struct qbb_header02 *hdr2=(const struct qbb_header02 *)hdr;
+ /* FIXME */
if(sizeof(struct qbb_header02)+le16(hdr2->title_len) <= sizeof(struct qbb_header)+le16(hdr2->data_len) &&
i+sizeof(struct qbb_header)+le16(hdr->data_len) < lu)
- file_rename(file_recovery, hdr2->title, le16(hdr2->title_len), 0, NULL, 1);
+ file_rename(file_recovery, (const char *)hdr2 + sizeof(struct qbb_header02), le16(hdr2->title_len), 0, NULL, 1);
return ;
}
i+=sizeof(struct qbb_header)+le16(hdr->data_len);
@@ -171,3 +177,4 @@ static void register_header_check_qbb(file_stat_t *file_stat)
register_header_check(4, qbw_header,sizeof(qbw_header), &header_check_qbw, file_stat);
register_header_check(0x14, qbw2_header,sizeof(qbw2_header), &header_check_qbw2, file_stat);
}
+#endif
diff --git a/src/file_qdf.c b/src/file_qdf.c
index 5f5e80d..983e243 100644
--- a/src/file_qdf.c
+++ b/src/file_qdf.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_qdf)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -45,8 +46,8 @@ const file_hint_t file_hint_qdf= {
static int header_check_qdf(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(file_recovery->file_stat != NULL &&
- file_recovery->file_stat->file_hint==&file_hint_doc &&
- strstr(file_recovery->filename, ".qdf-backup")!=NULL)
+ file_recovery->file_stat->file_hint==&file_hint_doc)
+// && strstr(file_recovery->filename, ".qdf-backup")!=NULL)
{
if(header_ignored_adv(file_recovery, file_recovery_new)==0)
return 0;
@@ -61,3 +62,4 @@ static void register_header_check_qdf(file_stat_t *file_stat)
static const unsigned char qdf_header[6] = { 0xAC, 0x9E, 0xBD, 0x8F, 0x00, 0x00};
register_header_check(0, qdf_header, sizeof(qdf_header), &header_check_qdf, file_stat);
}
+#endif
diff --git a/src/file_qkt.c b/src/file_qkt.c
index 37475e1..4a34223 100644
--- a/src/file_qkt.c
+++ b/src/file_qkt.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_qkt)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -55,3 +56,4 @@ static void register_header_check_qkt(file_stat_t *file_stat)
};
register_header_check(0, qkt_header, sizeof(qkt_header), &header_check_qkt, file_stat);
}
+#endif
diff --git a/src/file_qxd.c b/src/file_qxd.c
index 7d8fc7c..8d9f3b4 100644
--- a/src/file_qxd.c
+++ b/src/file_qxd.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_qxd)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -69,3 +70,4 @@ static void register_header_check_qxd(file_stat_t *file_stat)
register_header_check(2, qxp_header_be,sizeof(qxp_header_be), &header_check_qxp, file_stat);
register_header_check(2, qxp_header_le,sizeof(qxp_header_le), &header_check_qxp, file_stat);
}
+#endif
diff --git a/src/file_r3d.c b/src/file_r3d.c
index d465e31..cfd0ceb 100644
--- a/src/file_r3d.c
+++ b/src/file_r3d.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_r3d)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -149,3 +150,4 @@ static void register_header_check_r3d(file_stat_t *file_stat)
register_header_check(4, r3d_header1, sizeof(r3d_header1), &header_check_r3d, file_stat);
register_header_check(4, r3d_header2, sizeof(r3d_header2), &header_check_r3d_v2, file_stat);
}
+#endif
diff --git a/src/file_ra.c b/src/file_ra.c
index b1b6e90..a027b4e 100644
--- a/src/file_ra.c
+++ b/src/file_ra.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_ra)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -111,3 +112,4 @@ static void register_header_check_ra(file_stat_t *file_stat)
static const unsigned char ra_header[4] = { '.', 'r', 'a', 0xfd};
register_header_check(0, ra_header,sizeof(ra_header), &header_check_ra, file_stat);
}
+#endif
diff --git a/src/file_raf.c b/src/file_raf.c
index e171c9e..6927922 100644
--- a/src/file_raf.c
+++ b/src/file_raf.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_raf)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -92,3 +93,4 @@ static void register_header_check_raf(file_stat_t *file_stat)
{
register_header_check(0, "FUJIFILMCCD-RAW ", 16, &header_check_raf, file_stat);
}
+#endif
diff --git a/src/file_rar.c b/src/file_rar.c
index e51ce88..9f0dd49 100644
--- a/src/file_rar.c
+++ b/src/file_rar.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_rar)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -83,3 +84,4 @@ static void register_header_check_rar(file_stat_t *file_stat)
register_header_check(0, rar15fmt_header,sizeof(rar15fmt_header), &header_check_rar15fmt, file_stat);
register_header_check(0, rar50fmt_header,sizeof(rar50fmt_header), &header_check_rar50fmt, file_stat);
}
+#endif
diff --git a/src/file_raw.c b/src/file_raw.c
index 8368f93..c99a181 100644
--- a/src/file_raw.c
+++ b/src/file_raw.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_raw)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -54,3 +55,4 @@ static void register_header_check_raw(file_stat_t *file_stat)
static const unsigned char raw_header_contax[7]= {'A','R','E','C','O','Y','K'};
register_header_check(25, raw_header_contax,sizeof(raw_header_contax), &header_check_raw, file_stat);
}
+#endif
diff --git a/src/file_rdc.c b/src/file_rdc.c
index 3414097..3f79ac1 100644
--- a/src/file_rdc.c
+++ b/src/file_rdc.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_rdc)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -54,3 +55,4 @@ static void register_header_check_rdc(file_stat_t *file_stat)
static const unsigned char rdc_header[9]= {'D','S','C','-','I','m','a','g','e'};
register_header_check(0, rdc_header,sizeof(rdc_header), &header_check_rdc, file_stat);
}
+#endif
diff --git a/src/file_reg.c b/src/file_reg.c
index 73bf7b4..98afdf4 100644
--- a/src/file_reg.c
+++ b/src/file_reg.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_reg)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -125,3 +126,4 @@ static void register_header_check_reg(file_stat_t *file_stat)
register_header_check(0, reg_header_nt,sizeof(reg_header_nt), &header_check_reg_nt, file_stat);
register_header_check(0, reg_header_9x,sizeof(reg_header_9x), &header_check_reg_9x, file_stat);
}
+#endif
diff --git a/src/file_res.c b/src/file_res.c
index 2b536bd..204ea6a 100644
--- a/src/file_res.c
+++ b/src/file_res.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_res)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -54,3 +55,4 @@ static void register_header_check_res(file_stat_t *file_stat)
0xFF, 0xFF, 0, 0, 0xFF, 0xFF};
register_header_check(0, MS_res_header,sizeof(MS_res_header), &header_check_res, file_stat);
}
+#endif
diff --git a/src/file_rfp.c b/src/file_rfp.c
index 1778b2a..9a0c4bb 100644
--- a/src/file_rfp.c
+++ b/src/file_rfp.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_rfp)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -56,3 +57,4 @@ static void register_header_check_rfp(file_stat_t *file_stat)
};
register_header_check(0, rfp_header, sizeof(rfp_header), &header_check_rfp, file_stat);
}
+#endif
diff --git a/src/file_riff.c b/src/file_riff.c
index dedc297..40b6d07 100644
--- a/src/file_riff.c
+++ b/src/file_riff.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_riff)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -333,3 +334,4 @@ static void register_header_check_riff(file_stat_t *file_stat)
register_header_check(0, "RIFF", 4, &header_check_riff, file_stat);
register_header_check(0, "RIFX", 4, &header_check_rifx, file_stat);
}
+#endif
diff --git a/src/file_rlv.c b/src/file_rlv.c
index 9adba92..367eae3 100644
--- a/src/file_rlv.c
+++ b/src/file_rlv.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_rlv)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -59,3 +60,4 @@ static void register_header_check_rlv(file_stat_t *file_stat)
static const unsigned char rlv_header[4]= { 'r' , 'v' , 'l' , 0x00 };
register_header_check(0, rlv_header, sizeof(rlv_header), &header_check_rlv, file_stat);
}
+#endif
diff --git a/src/file_rm.c b/src/file_rm.c
index 3ac1e47..e8e3b50 100644
--- a/src/file_rm.c
+++ b/src/file_rm.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_rm)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -67,3 +68,4 @@ static void register_header_check_rm(file_stat_t *file_stat)
static const unsigned char rm_header[9] = { '.', 'R', 'M', 'F', 0x00, 0x00, 0x00, 0x12, 0x00};
register_header_check(0, rm_header,sizeof(rm_header), &header_check_rm, file_stat);
}
+#endif
diff --git a/src/file_rns.c b/src/file_rns.c
index b1455b4..a567365 100644
--- a/src/file_rns.c
+++ b/src/file_rns.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_rns)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -53,3 +54,4 @@ static void register_header_check_rns(file_stat_t *file_stat)
static const unsigned char rns_header[] = "Propellerheads Reason Song File";
register_header_check(0, rns_header,sizeof(rns_header)-1, &header_check_rns, file_stat);
}
+#endif
diff --git a/src/file_rpm.c b/src/file_rpm.c
index 4ec95b5..5fc0883 100644
--- a/src/file_rpm.c
+++ b/src/file_rpm.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_rpm)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -99,3 +100,4 @@ static void register_header_check_rpm(file_stat_t *file_stat)
static const unsigned char rpm_header[5]= {0xed, 0xab, 0xee, 0xdb, 0x3};
register_header_check(0, rpm_header,sizeof(rpm_header), &header_check_rpm, file_stat);
}
+#endif
diff --git a/src/file_rw2.c b/src/file_rw2.c
index 639a036..587fe24 100644
--- a/src/file_rw2.c
+++ b/src/file_rw2.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_rw2)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -62,3 +63,4 @@ static void register_header_check_rw2(file_stat_t *file_stat)
static const unsigned char rw2_header_panasonic[4]= {'I','I','U','\0'};
register_header_check(0, rw2_header_panasonic, sizeof(rw2_header_panasonic), &header_check_rw2, file_stat);
}
+#endif
diff --git a/src/file_rx2.c b/src/file_rx2.c
index ab184aa..eed9c4e 100644
--- a/src/file_rx2.c
+++ b/src/file_rx2.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_rx2)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -67,3 +68,4 @@ static void register_header_check_rx2(file_stat_t *file_stat)
{
register_header_check(0, rx2_header, sizeof(rx2_header), &header_check_rx2, file_stat);
}
+#endif
diff --git a/src/file_save.c b/src/file_save.c
index 205bf4c..1645e07 100644
--- a/src/file_save.c
+++ b/src/file_save.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_save)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -55,3 +56,4 @@ static void register_header_check_save(file_stat_t *file_stat)
};
register_header_check(8, save_header, sizeof(save_header), &header_check_save, file_stat);
}
+#endif
diff --git a/src/file_sdsk.c b/src/file_sdsk.c
index 0d0ec6a..fd35de1 100644
--- a/src/file_sdsk.c
+++ b/src/file_sdsk.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_sdsk)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -64,3 +65,4 @@ static void register_header_check_sdsk(file_stat_t *file_stat)
};
register_header_check(0, sdsk_header, sizeof(sdsk_header), &header_check_sdsk, file_stat);
}
+#endif
diff --git a/src/file_ses.c b/src/file_ses.c
index 5739eee..c24dae8 100644
--- a/src/file_ses.c
+++ b/src/file_ses.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_ses)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -53,3 +54,4 @@ static void register_header_check_ses(file_stat_t *file_stat)
{
register_header_check(0, "COOLNESS", 8, &header_check_ses, file_stat);
}
+#endif
diff --git a/src/file_sgcta.c b/src/file_sgcta.c
index 3bc866e..bc39d5e 100644
--- a/src/file_sgcta.c
+++ b/src/file_sgcta.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_sgcta)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -56,3 +57,4 @@ static void register_header_check_sgcta(file_stat_t *file_stat)
};
register_header_check(0, sgcta_header, sizeof(sgcta_header), &header_check_sgcta, file_stat);
}
+#endif
diff --git a/src/file_shn.c b/src/file_shn.c
index c0fd732..8fc9d00 100644
--- a/src/file_shn.c
+++ b/src/file_shn.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_shn)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -53,3 +54,4 @@ static void register_header_check_shn(file_stat_t *file_stat)
static const unsigned char shn_header[5]= { 'a' , 'j' , 'k' , 'g' , 0x02 };
register_header_check(0, shn_header, sizeof(shn_header), &header_check_shn, file_stat);
}
+#endif
diff --git a/src/file_sib.c b/src/file_sib.c
index bd29dc3..2e54efc 100644
--- a/src/file_sib.c
+++ b/src/file_sib.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_sib)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -53,3 +54,4 @@ static void register_header_check_sib(file_stat_t *file_stat)
static const unsigned char sib_header[9]= {0x0F, 'S', 'I', 'B', 'E', 'L', 'I', 'U', 'S'};
register_header_check(0, sib_header,sizeof(sib_header), &header_check_sib, file_stat);
}
+#endif
diff --git a/src/file_sig.c b/src/file_sig.c
index 41207e4..3c8ae48 100644
--- a/src/file_sig.c
+++ b/src/file_sig.c
@@ -19,6 +19,7 @@
Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_sig)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -73,7 +74,10 @@ static signature_t signatures={
.list = TD_LIST_HEAD_INIT(signatures.list)
};
-static int signature_cmp(const struct td_list_head *a, const struct td_list_head *b)
+#ifndef __FRAMAC__
+static
+#endif
+int signature_cmp(const struct td_list_head *a, const struct td_list_head *b)
{
const signature_t *sig_a=td_list_entry_const(a, const signature_t, list);
const signature_t *sig_b=td_list_entry_const(b, const signature_t, list);
@@ -457,3 +461,4 @@ static void register_header_check_sig(file_stat_t *file_stat)
}
free(buffer);
}
+#endif
diff --git a/src/file_sit.c b/src/file_sit.c
index ec64e6f..f1e79d8 100644
--- a/src/file_sit.c
+++ b/src/file_sit.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_sit)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -56,3 +57,4 @@ static void register_header_check_sit(file_stat_t *file_stat)
static const unsigned char sit_header[14] = { '7','1','0','0',' ','3','.','3','D',' ','7','1','0','0'};
register_header_check(0, sit_header,sizeof(sit_header), &header_check_sit, file_stat);
}
+#endif
diff --git a/src/file_skd.c b/src/file_skd.c
index c01e5c1..383932e 100644
--- a/src/file_skd.c
+++ b/src/file_skd.c
@@ -19,6 +19,7 @@
Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_skd)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -57,3 +58,4 @@ static void register_header_check_skd(file_stat_t *file_stat)
};
register_header_check(0, skd_header,sizeof(skd_header), &header_check_skd, file_stat);
}
+#endif
diff --git a/src/file_skp.c b/src/file_skp.c
index 0ffc00b..612db4d 100644
--- a/src/file_skp.c
+++ b/src/file_skp.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_skp)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -55,3 +56,4 @@ static void register_header_check_skp(file_stat_t *file_stat)
'U', 0x00, 'p', 0x00, ' ', 0x00, 'M', 0x00, 'o', 0x00, 'd', 0x00, 'e', 0x00, 'l', 0x00 };
register_header_check(0, skp_header,sizeof(skp_header), &header_check_skp, file_stat);
}
+#endif
diff --git a/src/file_snag.c b/src/file_snag.c
index a867077..b6d143b 100644
--- a/src/file_snag.c
+++ b/src/file_snag.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_snag)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -63,3 +64,4 @@ static void register_header_check_snag(file_stat_t *file_stat)
};
register_header_check(0, snag_header, sizeof(snag_header), &header_check_snag, file_stat);
}
+#endif
diff --git a/src/file_sp3.c b/src/file_sp3.c
index 4d3336d..30df9d1 100644
--- a/src/file_sp3.c
+++ b/src/file_sp3.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_sp3)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -118,3 +119,4 @@ static void register_header_check_sp3(file_stat_t *file_stat)
register_header_check(0, sp31_header, sizeof(sp31_header), &header_check_sp3, file_stat);
register_header_check(0, sp32_header, sizeof(sp32_header), &header_check_sp3, file_stat);
}
+#endif
diff --git a/src/file_spe.c b/src/file_spe.c
index 0e79aab..c1bd112 100644
--- a/src/file_spe.c
+++ b/src/file_spe.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_spe)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -319,6 +320,7 @@ static void register_header_check_spe(file_stat_t *file_stat)
static const unsigned char spe_header[4]= {0x67, 0x45, 0x23, 0x01};
register_header_check(0xbb4, spe_header,sizeof(spe_header), &header_check_spe, file_stat);
}
+#endif
#if defined(MAIN_spe)
#define BLOCKSIZE 65536u
diff --git a/src/file_spf.c b/src/file_spf.c
index c235082..f0df65c 100644
--- a/src/file_spf.c
+++ b/src/file_spf.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_spf)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -98,3 +99,4 @@ static void register_header_check_spf(file_stat_t *file_stat)
};
register_header_check(0, spf_header,sizeof(spf_header), &header_check_spf, file_stat);
}
+#endif
diff --git a/src/file_spss.c b/src/file_spss.c
index a837adb..9838bc9 100644
--- a/src/file_spss.c
+++ b/src/file_spss.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_spss)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -53,3 +54,4 @@ static void register_header_check_spss(file_stat_t *file_stat)
/* Check record type + beginning of product name*/
register_header_check(0, "$FL2@(#) SPSS DATA FILE", 23, &header_check_spss, file_stat);
}
+#endif
diff --git a/src/file_sql.c b/src/file_sql.c
index d139463..ddc8569 100644
--- a/src/file_sql.c
+++ b/src/file_sql.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_sqlite)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -100,3 +101,4 @@ static void register_header_check_sqlite(file_stat_t *file_stat)
{
register_header_check(0, "SQLite format 3", 16, &header_check_sqlite, file_stat);
}
+#endif
diff --git a/src/file_sqm.c b/src/file_sqm.c
index f72dee2..ce0bf3c 100644
--- a/src/file_sqm.c
+++ b/src/file_sqm.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_sqm)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -53,3 +54,4 @@ static void register_header_check_sqm(file_stat_t *file_stat)
static const unsigned char sqm_header[6]= { 'M', 'S', 'Q', 'M', 'x', 0x00};
register_header_check(0, sqm_header, sizeof(sqm_header), &header_check_sqm, file_stat);
}
+#endif
diff --git a/src/file_steuer2014.c b/src/file_steuer2014.c
index eba0702..e8857ed 100644
--- a/src/file_steuer2014.c
+++ b/src/file_steuer2014.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_steuer2014)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -104,3 +105,4 @@ static void register_header_check_steuer(file_stat_t *file_stat)
};
register_header_check(0, steuer_header, sizeof(steuer_header), &header_check_steuer, file_stat);
}
+#endif
diff --git a/src/file_stl.c b/src/file_stl.c
index d05c4a8..cc1200b 100644
--- a/src/file_stl.c
+++ b/src/file_stl.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_stl)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -68,3 +69,4 @@ static void register_header_check_stl(file_stat_t *file_stat)
/* Note: STL Ascii format is recovered in file_txt.c */
register_header_check(0, "solid ", 6, &header_check_stl, file_stat);
}
+#endif
diff --git a/src/file_stu.c b/src/file_stu.c
index fe914df..f3d8829 100644
--- a/src/file_stu.c
+++ b/src/file_stu.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_stuffit)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -54,3 +55,4 @@ static void register_header_check_stuffit(file_stat_t *file_stat)
static const unsigned char stuffit_header[7] = { 'S', 't', 'u', 'f', 'f', 'I', 't'};
register_header_check(0, stuffit_header,sizeof(stuffit_header), &header_check_stuffit, file_stat);
}
+#endif
diff --git a/src/file_studio.c b/src/file_studio.c
index d6b84da..15ddf63 100644
--- a/src/file_studio.c
+++ b/src/file_studio.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_studio)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -65,3 +66,4 @@ static void register_header_check_studio(file_stat_t *file_stat)
{
register_header_check(0, "silhouette04;", 13, &header_check_studio, file_stat);
}
+#endif
diff --git a/src/file_swf.c b/src/file_swf.c
index 17d743a..c85160b 100644
--- a/src/file_swf.c
+++ b/src/file_swf.c
@@ -19,6 +19,7 @@
Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_swf)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -296,6 +297,7 @@ static void register_header_check_swf(file_stat_t *file_stat)
register_header_check(0, "FWS", 3, &header_check_swf, file_stat);
register_header_check(0, "ZWS", 3, &header_check_swfz, file_stat);
}
+#endif
#if defined(MAIN_swf)
#define BLOCKSIZE 65536u
diff --git a/src/file_tar.c b/src/file_tar.c
index c777a6e..1056584 100644
--- a/src/file_tar.c
+++ b/src/file_tar.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_tar)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -99,3 +100,4 @@ static void register_header_check_tar(file_stat_t *file_stat)
register_header_check(0x101, tar_header_gnu,sizeof(tar_header_gnu), &header_check_tar, file_stat);
register_header_check(0x101, tar_header_posix,sizeof(tar_header_posix), &header_check_tar, file_stat);
}
+#endif
diff --git a/src/file_tax.c b/src/file_tax.c
index 66515b9..48b6b82 100644
--- a/src/file_tax.c
+++ b/src/file_tax.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_tax)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -54,3 +55,4 @@ static void register_header_check_tax(file_stat_t *file_stat)
static const unsigned char tax_header[6]= { 'T', 'T', 'F', 'N', 0x01, 0x01};
register_header_check(0, tax_header, sizeof(tax_header), &header_check_tax, file_stat);
}
+#endif
diff --git a/src/file_template.c b/src/file_template.c
index 190207e..eb1f052 100644
--- a/src/file_template.c
+++ b/src/file_template.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_EXTENSION)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -64,3 +65,4 @@ static void register_header_check_EXTENSION(file_stat_t *file_stat)
};
register_header_check(HEADER_LOC, EXTENSION_header, sizeof(EXTENSION_header), &header_check_EXTENSION, file_stat);
}
+#endif
diff --git a/src/file_tg.c b/src/file_tg.c
index fb93a9b..0091231 100644
--- a/src/file_tg.c
+++ b/src/file_tg.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_tg)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -61,3 +62,4 @@ static void register_header_check_tg(file_stat_t *file_stat)
};
register_header_check(0, tg_header, sizeof(tg_header), &header_check_tg, file_stat);
}
+#endif
diff --git a/src/file_tib.c b/src/file_tib.c
index 0fc9ab5..bdbe08e 100644
--- a/src/file_tib.c
+++ b/src/file_tib.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_tib)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -125,3 +126,4 @@ static void register_header_check_tib(file_stat_t *file_stat)
register_header_check(0, tib_header,sizeof(tib_header), &header_check_tib, file_stat);
register_header_check(0, tib2_header,sizeof(tib2_header), &header_check_tib2, file_stat);
}
+#endif
diff --git a/src/file_tivo.c b/src/file_tivo.c
index dad23d8..7cd6f36 100644
--- a/src/file_tivo.c
+++ b/src/file_tivo.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_tivo)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -66,3 +67,4 @@ static void register_header_check_tivo(file_stat_t *file_stat)
};
register_header_check(0, tivo_header, sizeof(tivo_header), &header_check_tivo, file_stat);
}
+#endif
diff --git a/src/file_torrent.c b/src/file_torrent.c
index 6f116ce..d7e03ed 100644
--- a/src/file_torrent.c
+++ b/src/file_torrent.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_torrent)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -54,3 +55,4 @@ static void register_header_check_torrent(file_stat_t *file_stat)
{
register_header_check(0, "d8:announce", 11, &header_check_torrent, file_stat);
}
+#endif
diff --git a/src/file_tph.c b/src/file_tph.c
index d8ad62b..cdb2f94 100644
--- a/src/file_tph.c
+++ b/src/file_tph.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_tph)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -71,3 +72,4 @@ static void register_header_check_tph(file_stat_t *file_stat)
'P', 'A', 'T', 'H'};
register_header_check(0, tph_header,sizeof(tph_header), &header_check_tph, file_stat);
}
+#endif
diff --git a/src/file_tpl.c b/src/file_tpl.c
index 5e4d1f0..4cd08c8 100644
--- a/src/file_tpl.c
+++ b/src/file_tpl.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_tpl)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -55,3 +56,4 @@ static void register_header_check_tpl(file_stat_t *file_stat)
};
register_header_check(0, tpl_header, sizeof(tpl_header), &header_check_tpl, file_stat);
}
+#endif
diff --git a/src/file_ttf.c b/src/file_ttf.c
index 7ed7ffa..be30c9e 100644
--- a/src/file_ttf.c
+++ b/src/file_ttf.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_ttf)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -113,3 +114,4 @@ static void register_header_check_ttf(file_stat_t *file_stat)
static const unsigned char header_ttf[5]= {0x00 , 0x01, 0x00, 0x00, 0x00};
register_header_check(0, header_ttf, sizeof(header_ttf), &header_check_ttf, file_stat);
}
+#endif
diff --git a/src/file_txt.c b/src/file_txt.c
index 83efab3..dc258f0 100644
--- a/src/file_txt.c
+++ b/src/file_txt.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_txt)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -1800,6 +1801,34 @@ static int header_check_txt(const unsigned char *buffer, const unsigned int buff
if(strstr(file_recovery->filename,".html")==NULL)
return 0;
}
+ /* DFRWS 2006 Forensics Challenge: recover recup_dir.1/f0034288.doc
+ */
+#if 0
+ if(file_recovery->file_stat->file_hint == &file_hint_doc)
+ {
+ if(strstr(file_recovery->filename,".doc")==NULL)
+ return 0;
+ }
+#endif
+ /* Useful for DFRWS 2006 Forensics Challenge */
+#if 0
+ else if(file_recovery->file_stat->file_hint == &file_hint_jpg)
+ {
+ /* Don't search text at the beginning of JPG */
+ if(file_recovery->file_size < file_recovery->min_filesize)
+ return 0;
+ /* Text should not be found in JPEG */
+ if(td_memmem(buffer, buffer_size_test, "8BIM", 4)!=NULL ||
+ td_memmem(buffer, buffer_size_test, "adobe", 5)!=NULL ||
+ td_memmem(buffer, buffer_size_test, "exif:", 5)!=NULL ||
+ td_memmem(buffer, buffer_size_test, "<rdf:", 5)!=NULL ||
+ td_memmem(buffer, buffer_size_test, "<?xpacket", 9)!=NULL ||
+ td_memmem(buffer, buffer_size_test, "<dict>", 6)!=NULL ||
+ td_memmem(buffer, buffer_size_test, "xmp:CreatorTool>", 16)!=NULL ||
+ td_memmem(buffer, buffer_size_test, "[camera info]", 13)!=NULL)
+ return 0;
+ }
+#endif
else
return 0;
}
@@ -2284,7 +2313,9 @@ static void register_header_check_fasttxt(file_stat_t *file_stat)
}
register_header_check(4, "SC V10", 6, &header_check_dc, file_stat);
register_header_check(0, "DatasetHeader Begin", 19, &header_check_ers, file_stat);
-// register_header_check(0, "\n<!DOCTYPE html", 15, &header_check_html, file_stat);
+ /* DFRWS 2006 Forensics Challenge */
+ register_header_check(0, "\n<!DOCTYPE html", 15, &header_check_html, file_stat);
+//
register_header_check(0, "<!DOCTYPE html", 14, &header_check_html, file_stat);
register_header_check(0, "<!DOCTYPE HTML", 14, &header_check_html, file_stat);
// register_header_check(0, "<html", 5, &header_check_html, file_stat);
@@ -2339,6 +2370,7 @@ static void register_header_check_txt(file_stat_t *file_stat)
register_header_check(1, &ascii_char[0], 1, &header_check_le16_txt, file_stat);
#endif
}
+#endif
#if defined(MAIN_txt)
#define BLOCKSIZE 65536u
diff --git a/src/file_tz.c b/src/file_tz.c
index c7ff41f..1a27ec2 100644
--- a/src/file_tz.c
+++ b/src/file_tz.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_tz)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -75,3 +76,4 @@ static void register_header_check_tz(file_stat_t *file_stat)
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);
}
+#endif
diff --git a/src/file_v2i.c b/src/file_v2i.c
index cb655fe..63a87fb 100644
--- a/src/file_v2i.c
+++ b/src/file_v2i.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_v2i)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -57,3 +58,4 @@ static void register_header_check_v2i(file_stat_t *file_stat)
{
register_header_check(0, "$CAN", 4, &header_check_v2i, file_stat);
}
+#endif
diff --git a/src/file_vault.c b/src/file_vault.c
index 7943e6b..d8a9fc1 100644
--- a/src/file_vault.c
+++ b/src/file_vault.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_vault)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -82,3 +83,4 @@ static void register_header_check_vault(file_stat_t *file_stat)
};
register_header_check(0, vault_header, sizeof(vault_header), &header_check_vault, file_stat);
}
+#endif
diff --git a/src/file_vdi.c b/src/file_vdi.c
index 7c7b2be..0d4d88e 100644
--- a/src/file_vdi.c
+++ b/src/file_vdi.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_vdi)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -103,3 +104,4 @@ static void register_header_check_vdi(file_stat_t *file_stat)
static const unsigned char vdi_header[4]= {0x7f, 0x10, 0xda, 0xbe};
register_header_check(0x40, vdi_header,sizeof(vdi_header), &header_check_vdi, file_stat);
}
+#endif
diff --git a/src/file_vdj.c b/src/file_vdj.c
index 4ae5cbb..b579be3 100644
--- a/src/file_vdj.c
+++ b/src/file_vdj.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_vdj)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -56,3 +57,4 @@ static void register_header_check_vdj(file_stat_t *file_stat)
};
register_header_check(0, vdj_header, sizeof(vdj_header), &header_check_vdj, file_stat);
}
+#endif
diff --git a/src/file_veg.c b/src/file_veg.c
index 8000754..a854ba6 100644
--- a/src/file_veg.c
+++ b/src/file_veg.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_veg)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -60,3 +61,4 @@ static void register_header_check_veg(file_stat_t *file_stat)
static const unsigned char veg_header[5]= {'r','i','f','f', '.'};
register_header_check(0, veg_header,sizeof(veg_header), &header_check_veg, file_stat);
}
+#endif
diff --git a/src/file_vfb.c b/src/file_vfb.c
index bad108e..676f3fb 100644
--- a/src/file_vfb.c
+++ b/src/file_vfb.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_vfb)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -66,3 +67,4 @@ static void register_header_check_vfb(file_stat_t *file_stat)
register_header_check(0, vfb_header, sizeof(vfb_header), &header_check_vfb, file_stat);
}
+#endif
diff --git a/src/file_vib.c b/src/file_vib.c
index 575add6..27a9810 100644
--- a/src/file_vib.c
+++ b/src/file_vib.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_vib)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -56,3 +57,4 @@ static void register_header_check_vib(file_stat_t *file_stat)
};
register_header_check(4, vib_header, sizeof(vib_header), &header_check_vib, file_stat);
}
+#endif
diff --git a/src/file_vmdk.c b/src/file_vmdk.c
index 0071a06..a7dcf42 100644
--- a/src/file_vmdk.c
+++ b/src/file_vmdk.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_vmdk)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -118,3 +119,4 @@ static void register_header_check_vmdk(file_stat_t *file_stat)
register_header_check(0, vmdk_header4_2,sizeof(vmdk_header4_2), &header_check_vmdk4, file_stat);
register_header_check(0, vmdk_header4_3,sizeof(vmdk_header4_3), &header_check_vmdk4, file_stat);
}
+#endif
diff --git a/src/file_vmg.c b/src/file_vmg.c
index 46e42b8..4d17693 100644
--- a/src/file_vmg.c
+++ b/src/file_vmg.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_vmg)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -70,3 +71,4 @@ static void register_header_check_vmg(file_stat_t *file_stat)
};
register_header_check(0, vmg_header, sizeof(vmg_header), &header_check_vmg, file_stat);
}
+#endif
diff --git a/src/file_wallet.c b/src/file_wallet.c
index 55f5f90..39578fc 100644
--- a/src/file_wallet.c
+++ b/src/file_wallet.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_wallet)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -55,3 +56,4 @@ static void register_header_check_wallet(file_stat_t *file_stat)
};
register_header_check(0, wallet_header, sizeof(wallet_header), &header_check_wallet, file_stat);
}
+#endif
diff --git a/src/file_wdp.c b/src/file_wdp.c
index 0be5694..a965ece 100644
--- a/src/file_wdp.c
+++ b/src/file_wdp.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_wdp)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -61,3 +62,4 @@ static void register_header_check_wdp(file_stat_t *file_stat)
static const unsigned char wdp_header[4]= {'I', 'I', 0xbc, 0x01};
register_header_check(0, wdp_header, sizeof(wdp_header), &header_check_wdp, file_stat);
}
+#endif
diff --git a/src/file_wee.c b/src/file_wee.c
index 5f4059c..3bb653d 100644
--- a/src/file_wee.c
+++ b/src/file_wee.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_wee)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -66,3 +67,4 @@ static void register_header_check_wee(file_stat_t *file_stat)
};
register_header_check(0, wee_header, sizeof(wee_header), &header_check_wee, file_stat);
}
+#endif
diff --git a/src/file_wim.c b/src/file_wim.c
index c0d4748..be2c702 100644
--- a/src/file_wim.c
+++ b/src/file_wim.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_wim)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -109,3 +110,4 @@ static void register_header_check_wim(file_stat_t *file_stat)
{
register_header_check(0, "MSWIM\0\0\0", 8, &header_check_wim, file_stat);
}
+#endif
diff --git a/src/file_win.c b/src/file_win.c
index 9e8b726..3d7cfe9 100644
--- a/src/file_win.c
+++ b/src/file_win.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_win)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -82,3 +83,4 @@ static void register_header_check_win(file_stat_t *file_stat)
};
register_header_check(0, win_header, sizeof(win_header), &header_check_win, file_stat);
}
+#endif
diff --git a/src/file_wks.c b/src/file_wks.c
index c613239..82e3a2a 100644
--- a/src/file_wks.c
+++ b/src/file_wks.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_wks)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -74,3 +75,4 @@ static void register_header_check_wks(file_stat_t *file_stat)
register_header_check(0, wks_header,sizeof(wks_header), &header_check_wks, file_stat);
register_header_check(0, wk4_header,sizeof(wk4_header), &header_check_wk4, file_stat);
}
+#endif
diff --git a/src/file_wld.c b/src/file_wld.c
index 5f4c366..7d503d3 100644
--- a/src/file_wld.c
+++ b/src/file_wld.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_wld)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -91,3 +92,4 @@ static void register_header_check_wld(file_stat_t *file_stat)
'r' , 'e' , 'l' , 'o' , 'g' , 'i' , 'c' };
register_header_check(1, wld_header, sizeof(wld_header), &header_check_wld, file_stat);
}
+#endif
diff --git a/src/file_wmf.c b/src/file_wmf.c
index 554fdca..23bbb1f 100644
--- a/src/file_wmf.c
+++ b/src/file_wmf.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_wmf)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -119,3 +120,4 @@ static void register_header_check_wmf(file_stat_t *file_stat)
register_header_check(0, apm_header,sizeof(apm_header), &header_check_wmf_placeable, file_stat);
register_header_check(0, wmf_header,sizeof(wmf_header), &header_check_wmf, file_stat);
}
+#endif
diff --git a/src/file_wnk.c b/src/file_wnk.c
index 0605ee1..dcc01db 100644
--- a/src/file_wnk.c
+++ b/src/file_wnk.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_wnk)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -53,3 +54,4 @@ static void register_header_check_wnk(file_stat_t *file_stat)
static const unsigned char wnk_header[6]= {'R','P','K','W','I',0x02};
register_header_check(0, wnk_header,sizeof(wnk_header), &header_check_wnk, file_stat);
}
+#endif
diff --git a/src/file_woff.c b/src/file_woff.c
index de3bb7f..b21d82a 100644
--- a/src/file_woff.c
+++ b/src/file_woff.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_woff)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -86,3 +87,4 @@ static void register_header_check_woff(file_stat_t *file_stat)
{
register_header_check(0, "wOFF", 4, &header_check_woff, file_stat);
}
+#endif
diff --git a/src/file_wpb.c b/src/file_wpb.c
index 42caa6d..c3a735d 100644
--- a/src/file_wpb.c
+++ b/src/file_wpb.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_wpb)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -55,3 +56,4 @@ static void register_header_check_wpb(file_stat_t *file_stat)
};
register_header_check(0, wpb_header, sizeof(wpb_header), &header_check_wpb, file_stat);
}
+#endif
diff --git a/src/file_wpd.c b/src/file_wpd.c
index 3d46653..a6e3995 100644
--- a/src/file_wpd.c
+++ b/src/file_wpd.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_wpd)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -103,3 +104,4 @@ static void register_header_check_wpd(file_stat_t *file_stat)
static const unsigned char wpd_header[4]= {0xff, 'W','P','C'};
register_header_check(0, wpd_header,sizeof(wpd_header), &header_check_wpd, file_stat);
}
+#endif
diff --git a/src/file_wtv.c b/src/file_wtv.c
index 5b8e9bb..fd61343 100644
--- a/src/file_wtv.c
+++ b/src/file_wtv.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_wtv)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -72,3 +73,4 @@ static void register_header_check_wtv(file_stat_t *file_stat)
};
register_header_check(0, wtv_header, sizeof(wtv_header), &header_check_wtv, file_stat);
}
+#endif
diff --git a/src/file_wv.c b/src/file_wv.c
index a061cff..652c816 100644
--- a/src/file_wv.c
+++ b/src/file_wv.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_wv)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -116,3 +117,4 @@ static void register_header_check_wv(file_stat_t *file_stat)
{
register_header_check(0, wv_header, sizeof(wv_header), &header_check_wv, file_stat);
}
+#endif
diff --git a/src/file_x3f.c b/src/file_x3f.c
index 0cba13f..e92a2c4 100644
--- a/src/file_x3f.c
+++ b/src/file_x3f.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_x3f)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -81,3 +82,4 @@ static void register_header_check_x3f(file_stat_t *file_stat)
static const unsigned char x3f_header[4]= {'F','O','V','b'};
register_header_check(0, x3f_header,sizeof(x3f_header), &header_check_x3f, file_stat);
}
+#endif
diff --git a/src/file_x3i.c b/src/file_x3i.c
index c1a001f..6571f53 100644
--- a/src/file_x3i.c
+++ b/src/file_x3i.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_x3i)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -56,3 +57,4 @@ static void register_header_check_x3i(file_stat_t *file_stat)
};
register_header_check(0, x3i_header, sizeof(x3i_header), &header_check_x3i, file_stat);
}
+#endif
diff --git a/src/file_x4a.c b/src/file_x4a.c
index 9122044..e0d5eba 100644
--- a/src/file_x4a.c
+++ b/src/file_x4a.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_x4a)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -102,3 +103,4 @@ static void register_header_check_ysfc100(file_stat_t *file_stat)
};
register_header_check(0x30, ysfc100_header, sizeof(ysfc100_header), &header_check_ysfc100, file_stat);
}
+#endif
diff --git a/src/file_xar.c b/src/file_xar.c
index 54ed675..29aabf7 100644
--- a/src/file_xar.c
+++ b/src/file_xar.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_xar)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -76,3 +77,4 @@ static void register_header_check_xar(file_stat_t *file_stat)
{
register_header_check(0, "xar!", 4, &header_check_xar, file_stat);
}
+#endif
diff --git a/src/file_xcf.c b/src/file_xcf.c
index 584a2a7..c8092fa 100644
--- a/src/file_xcf.c
+++ b/src/file_xcf.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_xcf)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -74,3 +75,4 @@ static void register_header_check_xcf(file_stat_t *file_stat)
register_header_check(0, "gimp xcf v001", 13, &header_check_xcf, file_stat);
register_header_check(0, "gimp xcf v002", 13, &header_check_xcf, file_stat);
}
+#endif
diff --git a/src/file_xfi.c b/src/file_xfi.c
index 3c85490..69a0fc3 100644
--- a/src/file_xfi.c
+++ b/src/file_xfi.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_xfi)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -58,3 +59,4 @@ static void register_header_check_xfi(file_stat_t *file_stat)
};
register_header_check(0x10, xfi_header, sizeof(xfi_header), &header_check_xfi, file_stat);
}
+#endif
diff --git a/src/file_xfs.c b/src/file_xfs.c
index e607e09..9de879d 100644
--- a/src/file_xfs.c
+++ b/src/file_xfs.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_xfs)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -148,3 +149,4 @@ static void register_header_check_xfs(file_stat_t *file_stat)
register_header_check(0, iabt, 8, &header_save_xfs, file_stat);
register_header_check(0, "IN", 2, &header_check_xfs_inode, file_stat);
}
+#endif
diff --git a/src/file_xm.c b/src/file_xm.c
index 8a32d96..caf48c6 100644
--- a/src/file_xm.c
+++ b/src/file_xm.c
@@ -21,6 +21,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_xm)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -192,3 +193,4 @@ static void register_header_check_xm(file_stat_t *file_stat)
static const unsigned char xm_header[17] = { 'E','x','t','e','n','d','e','d',' ','M','o','d','u','l','e',':',' '};
register_header_check(0, xm_header,sizeof(xm_header), &header_check_xm, file_stat);
}
+#endif
diff --git a/src/file_xml.c b/src/file_xml.c
index 62fd28f..bf19026 100644
--- a/src/file_xml.c
+++ b/src/file_xml.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_xml)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -111,3 +112,4 @@ static void register_header_check_xml(file_stat_t *file_stat)
};
register_header_check(0, xml_header, sizeof(xml_header), &header_check_xml, file_stat);
}
+#endif
diff --git a/src/file_xpt.c b/src/file_xpt.c
index 0f45c25..6b06401 100644
--- a/src/file_xpt.c
+++ b/src/file_xpt.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_xpt)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -75,3 +76,4 @@ static void register_header_check_xpt(file_stat_t *file_stat)
};
register_header_check(0, xpt_header,sizeof(xpt_header), &header_check_xpt, file_stat);
}
+#endif
diff --git a/src/file_xsv.c b/src/file_xsv.c
index 67f8735..01add82 100644
--- a/src/file_xsv.c
+++ b/src/file_xsv.c
@@ -21,6 +21,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_xsv)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -58,3 +59,4 @@ static void register_header_check_xsv(file_stat_t *file_stat)
static const unsigned char xsv_header[9]= {'B','L','O','C', 'K', 'L', 0xDC, 0x1D, 'd'};
register_header_check(20, xsv_header,sizeof(xsv_header), &header_check_xsv, file_stat);
}
+#endif
diff --git a/src/file_xv.c b/src/file_xv.c
index be8a257..fc54905 100644
--- a/src/file_xv.c
+++ b/src/file_xv.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_xv)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -59,3 +60,4 @@ static void register_header_check_xv(file_stat_t *file_stat)
register_header_check(0, xv_header, sizeof(xv_header), &header_check_xv, file_stat);
}
+#endif
diff --git a/src/file_xz.c b/src/file_xz.c
index d4e936e..3729e80 100644
--- a/src/file_xz.c
+++ b/src/file_xz.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_xz)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -65,3 +66,4 @@ static void register_header_check_xz(file_stat_t *file_stat)
};
register_header_check(0, xz_header, sizeof(xz_header), &header_check_xz, file_stat);
}
+#endif
diff --git a/src/file_z2d.c b/src/file_z2d.c
index 2e8b585..5d5557f 100644
--- a/src/file_z2d.c
+++ b/src/file_z2d.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_z2d)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -62,3 +63,4 @@ static void register_header_check_z2d(file_stat_t *file_stat)
{
register_header_check(0x28, z2d_header, sizeof(z2d_header), &header_check_z2d, file_stat);
}
+#endif
diff --git a/src/file_zcode.c b/src/file_zcode.c
index 8d5ff0f..4c24c8f 100644
--- a/src/file_zcode.c
+++ b/src/file_zcode.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_zcode)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -55,3 +56,4 @@ static void register_header_check_zcode(file_stat_t *file_stat)
};
register_header_check(0, zcode_header, sizeof(zcode_header), &header_check_zcode, file_stat);
}
+#endif
diff --git a/src/file_zip.c b/src/file_zip.c
index 6b806eb..c4486a6 100644
--- a/src/file_zip.c
+++ b/src/file_zip.c
@@ -22,6 +22,7 @@
Information about ZIP file format: http://www.info-zip.org/doc/appnote-iz-latest.zip
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_zip)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -1340,6 +1341,7 @@ static void register_header_check_zip(file_stat_t *file_stat)
register_header_check(0, zip_header,sizeof(zip_header), &header_check_zip, file_stat);
register_header_check(0, zip_header2,sizeof(zip_header2), &header_check_winzip, file_stat);
}
+#endif
#if defined(MAIN_zip)
#define BLOCKSIZE 65536u
diff --git a/src/file_zpr.c b/src/file_zpr.c
index 040bf79..723e8ef 100644
--- a/src/file_zpr.c
+++ b/src/file_zpr.c
@@ -20,6 +20,7 @@
*/
+#if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_zpr)
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -54,3 +55,4 @@ static void register_header_check_zpr(file_stat_t *file_stat)
{
register_header_check(0, "ZBrush File.", 12, &header_check_zpr, file_stat);
}
+#endif
diff --git a/src/filegen.c b/src/filegen.c
index 67d4edb..16b6a25 100644
--- a/src/filegen.c
+++ b/src/filegen.c
@@ -59,12 +59,15 @@ file_check_list_t file_check_list={
uint64_t gpls_nbr=0;
+// X requires \valid_read(b);
/*@
@ requires \valid_read(a);
- @ requires \valid_read(b);
@ assigns \nothing;
@*/
-static int file_check_cmp(const struct td_list_head *a, const struct td_list_head *b)
+#ifndef __FRAMAC__
+static
+#endif
+int file_check_cmp(const struct td_list_head *a, const struct td_list_head *b)
{
const file_check_t *fc_a=td_list_entry_const(a, const file_check_t, list);
const file_check_t *fc_b=td_list_entry_const(b, const file_check_t, list);
@@ -111,7 +114,7 @@ static void file_check_add_tail(file_check_t *file_check_new, file_check_list_t
/*@
@ loop unroll 256;
@ loop invariant 0 <= i <= 256;
- @ loop assigns i, newe->file_checks[0 .. 255].list.prev, newe->file_checks[0 .. 255].list.next;
+ @ loop assigns i, newe->file_checks[0 .. i-1].list.prev, newe->file_checks[0 .. i-1].list.next;
@ loop variant 255-i;
@*/
for(i=0;i<256;i++)
@@ -249,6 +252,8 @@ void file_allow_nl(file_recovery_t *file_recovery, const unsigned int nl_mode)
{
unsigned char buffer[4096];
int taille;
+ if(file_recovery->file_size >= 0x8000000000000000-2)
+ return ;
/*@ assert \valid(file_recovery->handle); */
if(my_fseek(file_recovery->handle, file_recovery->file_size,SEEK_SET)<0)
{
diff --git a/src/filegen.h b/src/filegen.h
index ce70f86..cfd9a72 100644
--- a/src/filegen.h
+++ b/src/filegen.h
@@ -320,6 +320,7 @@ time_t get_time_from_YYYYMMDD_HHMMSS(const char *date_asc);
@ requires \valid(offset);
@*/
void get_prev_location_smart(const alloc_data_t *list_search_space, alloc_data_t **current_search_space, uint64_t *offset, const uint64_t prev_location);
+
#ifdef __cplusplus
} /* closing brace for extern "C" */
#endif