File: laolareplace.c

package info (click to toggle)
abiword 0.7.7-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 20,604 kB
  • ctags: 18,358
  • sloc: cpp: 88,791; ansic: 66,296; sh: 7,777; makefile: 3,397; xml: 687; perl: 361; awk: 273; sed: 36; csh: 28
file content (71 lines) | stat: -rw-r--r-- 1,753 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*
The interface to wvOLEDecode now has
  int OLEdecode(char *filename, FILE **mainfd, FILE **tablefd0, FILE 
**tablefd1,FILE **data,FILE **summary)	
*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "config.h"
#include "wv.h"
#include "oledecod.h"

extern FILE*erroroutput;

pps_entry *stream_tree;

void wvOLEFree(void)
	{
	/* need to free all the allocated memory */
	freeOLEtree (stream_tree);
	}


int wvOLEDecode(char *filename, FILE **mainfd, FILE **tablefd0, FILE **tablefd1,FILE **data)
	{
	int result;
	U32 root_stream;
	U32 stream;

	result = OLEdecode (filename, &stream_tree, &root_stream, 1);
	if (result == 0)
		{
		for (stream = stream_tree[root_stream].dir; stream != 0xffffffff; stream = stream_tree[stream].next)
			{
			if (stream_tree[stream].type != 1 && stream_tree[stream].level == 1)
				{
				if (!(strcmp(stream_tree[stream].name,"WordDocument")))
					{
					*mainfd = fopen(stream_tree[stream].filename,"rb");
					}
				else if (!(strcmp(stream_tree[stream].name,"1Table")))
					{
					*tablefd1 = fopen(stream_tree[stream].filename,"rb");
					}
				else if (!(strcmp(stream_tree[stream].name,"0Table")))
					{
					*tablefd0 = fopen(stream_tree[stream].filename,"rb");
					}
				else if (!(strcmp(stream_tree[stream].name,"Data")))
					{
					*data = fopen(stream_tree[stream].filename,"rb");
					}
				else if (!(strcmp(stream_tree[stream].name,"\005SummaryInformation")))
					{
					*summary = fopen(stream_tree[stream].filename,"rb");
					}
				else
					fprintf(stderr,"streamname is %s\n",stream_tree[stream].filename);
				}
			}
		}
	switch(result)
		{
		case 5:
			fprintf(erroroutput,"OLE file appears to be corrupt, unable to extract streams\n");
			break;
		}

	return(result);
	}