summaryrefslogtreecommitdiff
path: root/external/libwps/libwps-lotus-version-tdf127887.patch.1
blob: 3427ef1f0813ac486374cd5e54a464a40fec0d3a (plain)
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
diff -ur libwps.org/src/lib/WKS4.cpp libwps/src/lib/WKS4.cpp
--- libwps.org/src/lib/WKS4.cpp	2018-08-06 10:51:12.000000000 +0200
+++ libwps/src/lib/WKS4.cpp	2019-10-01 17:28:59.497500545 +0200
@@ -477,7 +477,7 @@
 			}
 			else if (val==0x406)
 			{
-				m_state->m_version=1;
+				m_state->m_version=2;
 				f << "lotus,";
 				creatorId=libwps::WPS_LOTUS;
 			}
@@ -830,14 +830,15 @@
 			isParsed = true;
 			break;
 		case 0x2f: // iteration count: only in dos file Wk1, Wks(dos), Wq[12] ?
+			// Maybe, but that does not mean it would not be used
+			// in Lotus version 2 files (that are also .WK1), so do
+			// not reset an already detected version here.
 			if (sz!=1) break;
 			input->seek(pos+4, librevenge::RVNG_SEEK_SET);
 			f.str("");
 			val=int(libwps::readU8(input));
 			f << "Entries(ItCount):dos";
 			if (val!=1) f << "=" << val << ",";
-			if (m_state->m_version==2)
-				m_state->m_version=1;
 			isParsed = needWriteInAscii = true;
 			break;
 		case 0x41: // graph record name
diff -ur libwps.org/src/lib/WPSDocument.cpp libwps/src/lib/WPSDocument.cpp
--- libwps.org/src/lib/WPSDocument.cpp	2018-08-02 12:12:26.000000000 +0200
+++ libwps/src/lib/WPSDocument.cpp	2019-10-01 16:00:41.172596186 +0200
@@ -155,6 +155,10 @@
 			WKS4Parser parser(header->getInput(), header);
 			if (!parser.checkHeader(header.get(), true))
 				return WPS_CONFIDENCE_NONE;
+			// checkHeader() may set new kind and creator values,
+			// pass them up to caller.
+			kind = header->getKind();
+			creator = header->getCreator();
 			needEncoding=header->getNeedEncoding();
 			return header->getIsEncrypted() ? WPS_CONFIDENCE_SUPPORTED_ENCRYPTION : WPS_CONFIDENCE_EXCELLENT;
 		}