1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
Index: sv_main.c
===================================================================
--- sv_main.c
+++ sv_main.c
@@ -800,7 +800,7 @@
sb.data = (unsigned char *) buf;
sb.maxsize = sizeof(buf);
i = 0;
- while(MakeDownloadPacket(sv.csqc_progname, sv.csqc_progdata, sv.csqc_progsize, sv.csqc_progcrc, i++, &sb, sv.protocol))
+ while(MakeDownloadPacket(sv.csqc_progname, svs.csqc_progdata, sv.csqc_progsize, sv.csqc_progcrc, i++, &sb, sv.protocol))
SV_WriteDemoMessage(client, &sb, false);
}
@@ -2234,9 +2234,9 @@
Con_DPrintf("Downloading %s to %s\n", host_client->download_name, host_client->name);
if(host_client->download_deflate)
- host_client->download_file = FS_FileFromData(sv.csqc_progdata_deflated, sv.csqc_progsize_deflated, true);
+ host_client->download_file = FS_FileFromData(svs.csqc_progdata_deflated, svs.csqc_progsize_deflated, true);
else
- host_client->download_file = FS_FileFromData(sv.csqc_progdata, sv.csqc_progsize, true);
+ host_client->download_file = FS_FileFromData(svs.csqc_progdata, sv.csqc_progsize, true);
// no, no space is needed between %s and %s :P
Host_ClientCommands("\ncl_downloadbegin %i %s%s\n", (int)FS_FileSize(host_client->download_file), host_client->download_name, extensions);
@@ -2638,37 +2638,37 @@
{
fs_offset_t progsize;
- if(sv.csqc_progdata)
+ if(svs.csqc_progdata)
{
Con_DPrintf("Unloading old CSQC data.\n");
- Mem_Free(sv.csqc_progdata);
- if(sv.csqc_progdata_deflated)
- Mem_Free(sv.csqc_progdata_deflated);
+ Mem_Free(svs.csqc_progdata);
+ if(svs.csqc_progdata_deflated)
+ Mem_Free(svs.csqc_progdata_deflated);
}
- sv.csqc_progdata = NULL;
- sv.csqc_progdata_deflated = NULL;
+ svs.csqc_progdata = NULL;
+ svs.csqc_progdata_deflated = NULL;
Con_Print("Loading csprogs.dat\n");
sv.csqc_progname[0] = 0;
- sv.csqc_progdata = FS_LoadFile(csqc_progname.string, sv_mempool, false, &progsize);
+ svs.csqc_progdata = FS_LoadFile(csqc_progname.string, sv_mempool, false, &progsize);
if(progsize > 0)
{
size_t deflated_size;
sv.csqc_progsize = (int)progsize;
- sv.csqc_progcrc = CRC_Block(sv.csqc_progdata, progsize);
+ sv.csqc_progcrc = CRC_Block(svs.csqc_progdata, progsize);
strlcpy(sv.csqc_progname, csqc_progname.string, sizeof(sv.csqc_progname));
Con_Printf("server detected csqc progs file \"%s\" with size %i and crc %i\n", sv.csqc_progname, sv.csqc_progsize, sv.csqc_progcrc);
Con_Print("Compressing csprogs.dat\n");
//unsigned char *FS_Deflate(const unsigned char *data, size_t size, size_t *deflated_size, int level, mempool_t *mempool);
- sv.csqc_progdata_deflated = FS_Deflate(sv.csqc_progdata, progsize, &deflated_size, -1, sv_mempool);
- sv.csqc_progsize_deflated = (int)deflated_size;
+ svs.csqc_progdata_deflated = FS_Deflate(svs.csqc_progdata, progsize, &deflated_size, -1, sv_mempool);
+ svs.csqc_progsize_deflated = (int)deflated_size;
Con_Printf("Deflated: %g%%\n", 100.0 - 100.0 * (deflated_size / (float)progsize));
- Con_DPrintf("Uncompressed: %u\nCompressed: %u\n", (unsigned)sv.csqc_progsize, (unsigned)sv.csqc_progsize_deflated);
+ Con_DPrintf("Uncompressed: %u\nCompressed: %u\n", (unsigned)sv.csqc_progsize, (unsigned)svs.csqc_progsize_deflated);
}
}
Index: jpeg.c
===================================================================
--- jpeg.c (revision 8850)
+++ jpeg.c (revision 8853)
@@ -1047,6 +1047,8 @@
// try to compress it to JPEG
*buf = Z_Malloc(maxsize);
*size = JPEG_SaveImage_to_Buffer((char *) *buf, maxsize, image_width, image_height, newimagedata);
+ Mem_Free(newimagedata);
+
if(!*size)
{
Z_Free(*buf);
Index: server.h
===================================================================
--- server.h (revision 8850)
+++ server.h (revision 8853)
@@ -48,6 +48,12 @@
float perf_acc_offset_squared;
float perf_acc_offset_max;
int perf_acc_offset_samples;
+
+ // csqc stuff
+ unsigned char *csqc_progdata;
+ size_t csqc_progsize_deflated;
+ unsigned char *csqc_progdata_deflated;
+
} server_static_t;
//=============================================================================
@@ -87,9 +93,6 @@
int csqc_progcrc; // -1 = no progs
int csqc_progsize; // -1 = no progs
char csqc_progname[MAX_QPATH]; // copied from csqc_progname at level start
- unsigned char *csqc_progdata;
- size_t csqc_progsize_deflated;
- unsigned char *csqc_progdata_deflated;
// collision culling data
world_t world;
|