Hi,
I'm studying the binary .res format and I noticed that every .res file
contains a 2168 bytes long data block. This data block contains the
enumeration of VCL resource types, however, it is never read and seems
to be unnecessary. I thought that it would be a small size win, I
removed this block. 2158 bytes x 71 .res files x 105 languages =
15MB.
I tried to find out why resource compiler writes this block to .res
files but unfortunately I could not understand the code. When I
removed these structures from memory, the resource compiler did not
work. So I had to do the hack which is attached here. I detected the
magic bytes at the beginning of the block and I moved the pointer 2168
bytes further at fwrite().
LibreOffice master builds and runs fine with this patch.
Please review it, I'm not sure if such low level hacks are acceptable. :)
Best regards,
Andras
From d70605d2cd9dd8040253345f7294eca6787d9b48 Mon Sep 17 00:00:00 2001
From: Andras Timar <atimar@suse.com>
Date: Fri, 22 Jul 2011 11:30:37 +0200
Subject: [PATCH] do not write out unused data block to .res files
---
rsc/source/parser/rscdb.cxx | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/rsc/source/parser/rscdb.cxx b/rsc/source/parser/rscdb.cxx
index 967de81..c711873 100644
--- a/rsc/source/parser/rscdb.cxx
+++ b/rsc/source/parser/rscdb.cxx
@@ -571,7 +571,10 @@ void RscEnumerateObj :: WriteRcFile( RscWriteRc & rMem, FILE * fOut ){
//Position wurde vorher in Tabelle geschrieben
- fwrite( rMem.GetBuffer(), rMem.Size(), 1, fOut );
+ sal_uInt32 nOffset = 0;
+ if ( ( nId == 0xC8 ) && ( nRT == 0x102 ) )
+ nOffset = 2168; // size of the unused data block
+ fwrite( rMem.GetBuffer() + nOffset, rMem.Size() - nOffset, 1, fOut );
};
--
1.7.0.4
Context
- [Libreoffice] [PATCH] produce smaller .res files with the resource compiler · Andras Timar
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.