1 static MonoBundledAssembly **bundled;
8 my_inflate (const Byte *compr, uLong compr_len, Byte *uncompr, uLong uncompr_len)
13 memset (&stream, 0, sizeof (z_stream));
14 stream.next_in = (Byte *) compr;
15 stream.avail_in = (uInt) compr_len;
16 /* To decompress gzip format: http://stackoverflow.com/a/1838702/83444 */
17 err = inflateInit2 (&stream, 16+MAX_WBITS);
22 stream.next_out = uncompr;
23 stream.avail_out = (uInt) uncompr_len;
24 err = inflate (&stream, Z_NO_FLUSH);
25 if (err == Z_STREAM_END) break;
32 err = inflateEnd (&stream);
36 if (stream.total_out != uncompr_len)
42 void mono_mkbundle_init ()
44 CompressedAssembly **ptr;
45 MonoBundledAssembly **bundled_ptr;
49 install_dll_config_files ();
51 ptr = (CompressedAssembly **) compressed;
53 while (*ptr++ != NULL)
56 bundled = (MonoBundledAssembly **) malloc (sizeof (MonoBundledAssembly *) * (nbundles + 1));
57 bundled_ptr = bundled;
58 ptr = (CompressedAssembly **) compressed;
59 while (*ptr != NULL) {
63 MonoBundledAssembly *current;
65 real_size = (*ptr)->assembly.size;
66 zsize = (*ptr)->compressed_size;
67 buffer = (Bytef *) malloc (real_size);
68 result = my_inflate ((*ptr)->assembly.data, zsize, buffer, real_size);
70 fprintf (stderr, "Error %d decompresing data for %s\n", result, (*ptr)->assembly.name);
73 (*ptr)->assembly.data = buffer;
74 current = (MonoBundledAssembly *) malloc (sizeof (MonoBundledAssembly));
75 memcpy (current, *ptr, sizeof (MonoBundledAssembly));
76 current->name = (*ptr)->assembly.name;
77 *bundled_ptr = current;
82 mono_register_bundled_assemblies((const MonoBundledAssembly **) bundled);