Alexandre Julliard : winebuild: Dump resource data as dwords to reduce the output file size.

Alexandre Julliard julliard at winehq.org
Thu Jul 9 10:57:01 CDT 2009


Module: wine
Branch: master
Commit: f0ea22ba87ac15374c254b9d6195fd4aecda3b35
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=f0ea22ba87ac15374c254b9d6195fd4aecda3b35

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Thu Jul  9 12:54:16 2009 +0200

winebuild: Dump resource data as dwords to reduce the output file size.

---

 tools/winebuild/res32.c |   24 +++++++++++++++++++++++-
 1 files changed, 23 insertions(+), 1 deletions(-)

diff --git a/tools/winebuild/res32.c b/tools/winebuild/res32.c
index 946523d..d03d16f 100644
--- a/tools/winebuild/res32.c
+++ b/tools/winebuild/res32.c
@@ -218,6 +218,28 @@ static void put_string( const struct string_id *str )
     }
 }
 
+static void dump_res_data( const struct resource *res )
+{
+    unsigned int i = 0;
+    unsigned int size = (res->data_size + 3) & ~3;
+
+    if (!size) return;
+
+    file_pos = res->data;
+    file_end = (const unsigned char *)res->data + size;
+
+    output( "\t.long " );
+    while (size > 4)
+    {
+        if ((i++ % 16) == 15) output( "0x%08x\n\t.long ", get_dword() );
+        else output( "0x%08x,", get_dword() );
+        size -= 4;
+    }
+    output( "0x%08x\n", get_dword() );
+    size -= 4;
+    assert( file_pos == file_end );
+}
+
 /* check the file header */
 /* all values must be zero except header size */
 static int check_header(void)
@@ -515,7 +537,7 @@ void output_resources( DLLSPEC *spec )
     {
         output( "\n\t.align %d\n", get_alignment(get_ptr_size()) );
         output( ".L__wine_spec_res_%d:\n", i );
-        dump_bytes( res->data, (res->data_size + 3) & ~3 );
+        dump_res_data( res );
     }
     output( ".L__wine_spec_resources_end:\n" );
     output( "\t.byte 0\n" );




More information about the wine-cvs mailing list