| 62 | } |
| 63 | |
| 64 | void writecfggz(const char *name, int size, int sizegz, uchar *data) |
| 65 | { |
| 66 | if(size < 1 || !sizegz || size > MAXCFGFILESIZE) return; |
| 67 | setnames(name); |
| 68 | |
| 69 | uchar *rawcfg = new uchar[size]; |
| 70 | uLongf rawsize = size; |
| 71 | if(rawcfg && uncompress(rawcfg, &rawsize, data, sizegz) == Z_OK && rawsize - size == 0) |
| 72 | { |
| 73 | stream *f = openfile(mcfname, "w"); |
| 74 | if(f) |
| 75 | { |
| 76 | f->write(rawcfg, size); |
| 77 | delete f; |
| 78 | conoutf("wrote map config to %s", mcfname); |
| 79 | } |
| 80 | else |
| 81 | { |
| 82 | conoutf("\f3could not write config to %s", mcfname); |
| 83 | } |
| 84 | } |
| 85 | DELETEA(rawcfg); |
| 86 | } |
| 87 | |
| 88 | #define GZBUFSIZE ((MAXCFGFILESIZE * 11) / 10) |
| 89 |
no test coverage detected