MCPcopy Create free account
hub / github.com/assaultcube/AC / writecfggz

Function writecfggz

source/src/worldio.cpp:64–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

62}
63
64void 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

Callers 1

receivefileFunction · 0.85

Calls 4

setnamesFunction · 0.85
openfileFunction · 0.85
conoutfFunction · 0.70
writeMethod · 0.45

Tested by

no test coverage detected