[Libreoffice] [PATCH] produce smaller .res files with the resource compiler

Norbert Thiebaud nthiebaud at gmail.com
Sun Jul 24 06:48:49 PDT 2011


On Fri, Jul 22, 2011 at 8:15 AM, Andras Timar <timar74 at gmail.com> wrote:
> 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.

Are you sure you actually saved that 'much' ? presumably this 2158
bytes repeated 71 times should compress well enough when packaged

>
> 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. :)

Looks pretty ugly to me. That code seems neglected enough without
adding another layer of WTF-factor for the poor soul that one day will
want/have to maintain it.

Norbert


More information about the LibreOffice mailing list