1 static MonoBundledAssembly **bundled;
9 my_inflate (const Byte *compr, uLong compr_len, Byte *uncompr, uLong uncompr_len)
14 memset (&stream, 0, sizeof (z_stream));
15 stream.next_in = (Byte *) compr;
16 stream.avail_in = (uInt) compr_len;
18 // http://www.zlib.net/manual.html
19 err = inflateInit2 (&stream, 16+MAX_WBITS);
24 stream.next_out = uncompr;
25 stream.avail_out = (uInt) uncompr_len;
26 err = inflate (&stream, Z_NO_FLUSH);
27 if (err == Z_STREAM_END) break;
34 err = inflateEnd (&stream);
38 if (stream.total_out != uncompr_len)
44 void mono_mkbundle_init ()
46 CompressedAssembly **ptr;
47 MonoBundledAssembly **bundled_ptr;
51 install_dll_config_files ();
53 ptr = (CompressedAssembly **) compressed;
55 while (*ptr++ != NULL)
58 bundled = (MonoBundledAssembly **) malloc (sizeof (MonoBundledAssembly *) * (nbundles + 1));
59 bundled_ptr = bundled;
60 ptr = (CompressedAssembly **) compressed;
61 while (*ptr != NULL) {
65 MonoBundledAssembly *current;
67 real_size = (*ptr)->assembly.size;
68 zsize = (*ptr)->compressed_size;
69 buffer = (Bytef *) malloc (real_size);
70 result = my_inflate ((*ptr)->assembly.data, zsize, buffer, real_size);
72 fprintf (stderr, "mkbundle: Error %d decompressing data for %s\n", result, (*ptr)->assembly.name);
75 (*ptr)->assembly.data = buffer;
76 current = (MonoBundledAssembly *) malloc (sizeof (MonoBundledAssembly));
77 memcpy (current, *ptr, sizeof (MonoBundledAssembly));
78 current->name = (*ptr)->assembly.name;
79 *bundled_ptr = current;
84 mono_register_bundled_assemblies((const MonoBundledAssembly **) bundled);