summaryrefslogtreecommitdiff
path: root/unoidl
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2013-05-08 17:29:37 +0200
committerStephan Bergmann <sbergman@redhat.com>2013-05-08 17:30:53 +0200
commit1ad700f5a449aeee1dfbbb5ae37b3bf43638d394 (patch)
tree0aaeeb1d9b73a08fc8b184d85aebcf7ce6b63b02 /unoidl
parent79774d961644ea81b4e790114c9b785d38bcd8a4 (diff)
Minor improvements to UNOIDL binary format
Change-Id: Ia215b34842ce85bfbd1ad90a286abcbae0884bd5
Diffstat (limited to 'unoidl')
-rw-r--r--unoidl/README9
-rw-r--r--unoidl/source/reg2unoidl.cxx9
-rw-r--r--unoidl/source/unoidlprovider.cxx5
3 files changed, 19 insertions, 4 deletions
diff --git a/unoidl/README b/unoidl/README
index 2e159c6eea2f..5daff7a618c2 100644
--- a/unoidl/README
+++ b/unoidl/README
@@ -45,11 +45,18 @@ The file starts with an 8 byte header, followed by information about the root
map (reg2unoidl generates files in a single depth-first pass, so the root map
itself is at the end of the file):
-* 8 byte header "UNOIDL\0\xFF"
+* 7 byte magic header "UNOIDL\xFF"
+* version byte 0
* Offset of root Map
* UInt32 number of entries of root Map
...
+Files generated by reg2unoidl follow that by a
+
+ "\0** Created by LibreOffice " LIBO_VERSION_DOTTED " reg2unoidl **\0"
+
+banner (cf. config_host/config_version.h.in), as a debugging aid.
+
Layout of per-entry payload in the root or a module Map:
* kind byte:
diff --git a/unoidl/source/reg2unoidl.cxx b/unoidl/source/reg2unoidl.cxx
index a311147261d9..2bd9e56b6582 100644
--- a/unoidl/source/reg2unoidl.cxx
+++ b/unoidl/source/reg2unoidl.cxx
@@ -17,11 +17,13 @@
#include <utility>
#include <vector>
+#include "config_version.h"
#include "osl/endian.h"
#include "osl/file.h"
#include "osl/file.hxx"
#include "osl/process.h"
#include "rtl/process.h"
+#include "rtl/string.h"
#include "rtl/string.hxx"
#include "rtl/textenc.h"
#include "rtl/textcvt.h"
@@ -746,9 +748,14 @@ SAL_IMPLEMENT_MAIN() {
<< +e << std::endl;
std::exit(EXIT_FAILURE);
}
- write(f, "UNOIDL\0\xFF", 8);
+ write(f, "UNOIDL\xFF\0", 8);
write32(f, 0); // root map offset
write32(f, 0); // root map size
+ write(
+ f,
+ RTL_CONSTASCII_STRINGPARAM(
+ "\0** Created by LibreOffice " LIBO_VERSION_DOTTED
+ " reg2unoidl **\0"));
sal_uInt64 off;
std::size_t size;
try {
diff --git a/unoidl/source/unoidlprovider.cxx b/unoidl/source/unoidlprovider.cxx
index 6ead9cfd64d2..33848a1c632e 100644
--- a/unoidl/source/unoidlprovider.cxx
+++ b/unoidl/source/unoidlprovider.cxx
@@ -1058,11 +1058,12 @@ rtl::Reference< Entity > readEntity(
UnoidlProvider::UnoidlProvider(OUString const & uri):
file_(new detail::MappedFile(uri))
{
- if (file_->size < 8 || std::memcmp(file_->address, "UNOIDL\0\xFF", 8) != 0)
+ if (file_->size < 8 || std::memcmp(file_->address, "UNOIDL\xFF\0", 8) != 0)
{
throw FileFormatException(
file_->uri,
- "UNOIDL format: does not begin with magic UNOIDL\\0\\xFF");
+ "UNOIDL format: does not begin with magic UNOIDL\\xFF and version"
+ " 0");
}
sal_uInt32 off = file_->read32(8);
mapSize_ = file_->read32(12);