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;
17 // http://www.zlib.net/manual.html
18 err = inflateInit2 (&stream, 16+MAX_WBITS);
23 stream.next_out = uncompr;
24 stream.avail_out = (uInt) uncompr_len;
25 err = inflate (&stream, Z_NO_FLUSH);
26 if (err == Z_STREAM_END) break;
33 err = inflateEnd (&stream);
37 if (stream.total_out != uncompr_len)
43 void mono_mkbundle_init ()
45 CompressedAssembly **ptr;
46 MonoBundledAssembly **bundled_ptr;
50 install_dll_config_files ();
52 ptr = (CompressedAssembly **) compressed;
54 while (*ptr++ != NULL)
57 bundled = (MonoBundledAssembly **) malloc (sizeof (MonoBundledAssembly *) * (nbundles + 1));
58 bundled_ptr = bundled;
59 ptr = (CompressedAssembly **) compressed;
60 while (*ptr != NULL) {
64 MonoBundledAssembly *current;
66 real_size = (*ptr)->assembly.size;
67 zsize = (*ptr)->compressed_size;
68 buffer = (Bytef *) malloc (real_size);
69 result = my_inflate ((*ptr)->assembly.data, zsize, buffer, real_size);
71 fprintf (stderr, "mkbundle: Error %d decompressing data for %s\n", result, (*ptr)->assembly.name);
74 (*ptr)->assembly.data = buffer;
75 current = (MonoBundledAssembly *) malloc (sizeof (MonoBundledAssembly));
76 memcpy (current, *ptr, sizeof (MonoBundledAssembly));
77 current->name = (*ptr)->assembly.name;
78 *bundled_ptr = current;
83 mono_register_bundled_assemblies((const MonoBundledAssembly **) bundled);