Kaydet (Commit) 1ad700f5 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Minor improvements to UNOIDL binary format

Change-Id: Ia215b34842ce85bfbd1ad90a286abcbae0884bd5
üst 79774d96
......@@ -16,10 +16,10 @@ Version settings
#undef LIBO_THIS_YEAR
#define LIBO_VERSION_DOTTED \
(LIBO_VERSION_STRINGIFY(LIBO_VERSION_MAJOR) "." \
LIBO_VERSION_STRINGIFY(LIBO_VERSION_MINOR) "." \
LIBO_VERSION_STRINGIFY(LIBO_VERSION_MICRO) "." \
LIBO_VERSION_STRINGIFY(LIBO_VERSION_PATCH))
LIBO_VERSION_STRINGIFY(LIBO_VERSION_MAJOR) "." \
LIBO_VERSION_STRINGIFY(LIBO_VERSION_MINOR) "." \
LIBO_VERSION_STRINGIFY(LIBO_VERSION_MICRO) "." \
LIBO_VERSION_STRINGIFY(LIBO_VERSION_PATCH)
#define LIBO_VERSION_ENCODED_IN_32BITS \
((LIBO_VERSION_MAJOR << 24) | (LIBO_VERSION_MINOR << 16) | (LIBO_VERSION_MICRO << 8) | LIBO_VERSION_PATCH)
......
......@@ -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:
......
......@@ -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 {
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment