changeset 996:09b8b2327838

tiffs in vitro reader: implemented support for old 16-bit location field (-O)
author Mychaela Falconia <falcon@ivan.Harhan.ORG>
date Sun, 03 Jan 2016 04:23:29 +0000
parents c22afeecbf34
children c7ca69bf84f3
files ffstools/tiffs-rd/globals.c ffstools/tiffs-rd/globals.h ffstools/tiffs-rd/inode.c ffstools/tiffs-rd/main.c
diffstat 4 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ffstools/tiffs-rd/globals.c	Sat Jan 02 04:05:51 2016 +0000
+++ b/ffstools/tiffs-rd/globals.c	Sun Jan 03 04:23:29 2016 +0000
@@ -14,6 +14,7 @@
 int index_blk_num = -1, root_inode;
 int inode_limit;
 int verbose, verbose2;
+int old_16bit_location;
 
 u8 *image, *inode_block;
 struct inode_info **inode_info;
--- a/ffstools/tiffs-rd/globals.h	Sat Jan 02 04:05:51 2016 +0000
+++ b/ffstools/tiffs-rd/globals.h	Sun Jan 03 04:23:29 2016 +0000
@@ -10,6 +10,7 @@
 extern int index_blk_num, root_inode;
 extern int inode_limit;
 extern int verbose, verbose2;
+extern int old_16bit_location;
 
 extern u8 *image, *inode_block;
 extern struct inode_info **inode_info;
--- a/ffstools/tiffs-rd/inode.c	Sat Jan 02 04:05:51 2016 +0000
+++ b/ffstools/tiffs-rd/inode.c	Sun Jan 03 04:23:29 2016 +0000
@@ -106,6 +106,8 @@
 	}
 	if (inf->len) {
 		inf->rawloc = le32toh(fl->dataptr);
+		if (old_16bit_location)
+			inf->rawloc >>= 16;
 		if (inf->rawloc > 0x0FFFFFFF) {
 invdptr:		fprintf(stderr,
 			"warning: inode #%x: invalid data pointer, skipping\n",
--- a/ffstools/tiffs-rd/main.c	Sat Jan 02 04:05:51 2016 +0000
+++ b/ffstools/tiffs-rd/main.c	Sun Jan 03 04:23:29 2016 +0000
@@ -85,7 +85,7 @@
 	char *cmd;
 	struct cmdtab *tp;
 
-	while ((c = getopt(argc, argv, "+a:o:r:v")) != EOF)
+	while ((c = getopt(argc, argv, "+a:o:Or:v")) != EOF)
 		switch (c) {
 		case 'a':
 			index_blk_num = atoi(optarg);
@@ -93,6 +93,9 @@
 		case 'o':
 			imgfile_offset = strtoul(optarg, 0, 0);
 			continue;
+		case 'O':
+			old_16bit_location = 1;
+			continue;
 		case 'r':
 			root_inode = strtoul(optarg, 0, 16);
 			continue;