mirror of
https://github.com/nzp-team/dquakeplus.git
synced 2024-11-22 11:51:21 +00:00
Actually use Q_malloc in a lot of places
This commit is contained in:
parent
8ca8175096
commit
9f58c947fc
9 changed files with 27 additions and 29 deletions
|
@ -42,7 +42,7 @@ char decrypt(char c, int key)
|
|||
char *strencrypt(char *s, int key, int len)
|
||||
{
|
||||
int i;
|
||||
char *result = malloc(len);
|
||||
char *result = Q_malloc(len);
|
||||
for(i = 0; i < len; i++)
|
||||
{
|
||||
result[i] = encrypt(s[i], key);
|
||||
|
@ -55,7 +55,7 @@ char *strencrypt(char *s, int key, int len)
|
|||
char *strdecrypt(char *s, int key, int len)
|
||||
{
|
||||
int i;
|
||||
char *result = malloc(len);
|
||||
char *result = Q_malloc(len);
|
||||
for(i = 0; i < len; i++)
|
||||
{
|
||||
result[i] = decrypt(s[i], -key);
|
||||
|
|
|
@ -1445,7 +1445,7 @@ void M_Achievement_Draw (void)
|
|||
int maxLenght = floor((vid.width - 155)/8);
|
||||
int stringLenght;
|
||||
char *description;
|
||||
char *string_line = (char*) malloc(maxLenght);
|
||||
char *string_line = (char*) Q_malloc(maxLenght);
|
||||
int lines;
|
||||
|
||||
y = 0;
|
||||
|
@ -4925,15 +4925,15 @@ void Map_Finder(void)
|
|||
|
||||
COM_StripExtension(dirent.d_name, ntype);
|
||||
custom_maps[user_maps_num].occupied = true;
|
||||
custom_maps[user_maps_num].map_name = malloc(sizeof(char)*32);
|
||||
custom_maps[user_maps_num].map_name = Q_malloc(sizeof(char)*32);
|
||||
sprintf(custom_maps[user_maps_num].map_name, "%s", ntype);
|
||||
|
||||
char* setting_path;
|
||||
int setting_file;
|
||||
SceIoStat setting_info;
|
||||
|
||||
setting_path = malloc(sizeof(char)*64);
|
||||
custom_maps[user_maps_num].map_thumbnail_path = malloc(sizeof(char)*64);
|
||||
setting_path = Q_malloc(sizeof(char)*64);
|
||||
custom_maps[user_maps_num].map_thumbnail_path = Q_malloc(sizeof(char)*64);
|
||||
#ifdef KERNEL_MODE
|
||||
strcpy(setting_path, va("%s/maps/", com_gamedir));
|
||||
#else
|
||||
|
@ -4953,16 +4953,16 @@ void Map_Finder(void)
|
|||
state = 0;
|
||||
int value;
|
||||
|
||||
custom_maps[user_maps_num].map_name_pretty = malloc(sizeof(char)*32);
|
||||
custom_maps[user_maps_num].map_desc_1 = malloc(sizeof(char)*40);
|
||||
custom_maps[user_maps_num].map_desc_2 = malloc(sizeof(char)*40);
|
||||
custom_maps[user_maps_num].map_desc_3 = malloc(sizeof(char)*40);
|
||||
custom_maps[user_maps_num].map_desc_4 = malloc(sizeof(char)*40);
|
||||
custom_maps[user_maps_num].map_desc_5 = malloc(sizeof(char)*40);
|
||||
custom_maps[user_maps_num].map_desc_6 = malloc(sizeof(char)*40);
|
||||
custom_maps[user_maps_num].map_desc_7 = malloc(sizeof(char)*40);
|
||||
custom_maps[user_maps_num].map_desc_8 = malloc(sizeof(char)*40);
|
||||
custom_maps[user_maps_num].map_author = malloc(sizeof(char)*40);
|
||||
custom_maps[user_maps_num].map_name_pretty = Q_malloc(sizeof(char)*32);
|
||||
custom_maps[user_maps_num].map_desc_1 = Q_malloc(sizeof(char)*40);
|
||||
custom_maps[user_maps_num].map_desc_2 = Q_malloc(sizeof(char)*40);
|
||||
custom_maps[user_maps_num].map_desc_3 = Q_malloc(sizeof(char)*40);
|
||||
custom_maps[user_maps_num].map_desc_4 = Q_malloc(sizeof(char)*40);
|
||||
custom_maps[user_maps_num].map_desc_5 = Q_malloc(sizeof(char)*40);
|
||||
custom_maps[user_maps_num].map_desc_6 = Q_malloc(sizeof(char)*40);
|
||||
custom_maps[user_maps_num].map_desc_7 = Q_malloc(sizeof(char)*40);
|
||||
custom_maps[user_maps_num].map_desc_8 = Q_malloc(sizeof(char)*40);
|
||||
custom_maps[user_maps_num].map_author = Q_malloc(sizeof(char)*40);
|
||||
|
||||
char* buffer = (char*)calloc(setting_info.st_size+1, sizeof(char));
|
||||
sceIoRead(setting_file, buffer, setting_info.st_size);
|
||||
|
|
|
@ -474,13 +474,13 @@ char *Sys_FindFirstFile (char *path, char *pattern)
|
|||
return NULL;
|
||||
|
||||
tmp_len = strlen (pattern);
|
||||
findpattern = (char*) malloc (tmp_len + 1);
|
||||
findpattern = (char*) Q_malloc (tmp_len + 1);
|
||||
if (!findpattern)
|
||||
return NULL;
|
||||
strcpy (findpattern, pattern);
|
||||
findpattern[tmp_len] = '\0';
|
||||
tmp_len = strlen (path);
|
||||
findpath = (char*) malloc (tmp_len + 1);
|
||||
findpath = (char*) Q_malloc (tmp_len + 1);
|
||||
if (!findpath)
|
||||
return NULL;
|
||||
strcpy (findpath, path);
|
||||
|
|
|
@ -420,7 +420,8 @@ void QMB_AllocParticles (void)
|
|||
Con_Printf("QMB_AllocParticles: internal error >num particles<\n");
|
||||
|
||||
// can't alloc on Hunk, using native memory
|
||||
particles = (particle_t *) malloc (r_numparticles * sizeof(particle_t));
|
||||
// why??????? why not?????? where's the context :$
|
||||
particles = (particle_t *) Q_malloc (r_numparticles * sizeof(particle_t));
|
||||
}
|
||||
|
||||
void QMB_InitParticles (void)
|
||||
|
|
|
@ -25,7 +25,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#include <valarray>
|
||||
#include <vector>
|
||||
#include <malloc.h>
|
||||
#include <pspgu.h>
|
||||
#include <pspkernel.h>
|
||||
#include <pspctrl.h>
|
||||
|
|
|
@ -192,7 +192,7 @@ void R_Envmap_f (void)
|
|||
{
|
||||
byte *buffer;
|
||||
|
||||
buffer = static_cast<byte*>(malloc(ENVMAP_SIZE));
|
||||
buffer = static_cast<byte*>(Q_malloc(ENVMAP_SIZE));
|
||||
if(!buffer)
|
||||
{
|
||||
Con_Printf("ENV MAP FAILED, buffer not created\n");
|
||||
|
|
|
@ -28,7 +28,6 @@ extern "C"
|
|||
{
|
||||
#include "../quakedef.h"
|
||||
}
|
||||
#include <malloc.h>
|
||||
#include <pspgu.h>
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#include <malloc.h>
|
||||
#include <pspgu.h>
|
||||
|
||||
extern "C"
|
||||
|
@ -57,7 +56,7 @@ static void Image_Resample32 (void *indata, int inwidth, int inheight,void *outd
|
|||
out = static_cast<byte*>(outdata);
|
||||
fstep = (int) (inheight * 65536.0f / outheight);
|
||||
|
||||
memalloc = static_cast<byte*>(malloc(2 * outwidth4));
|
||||
memalloc = static_cast<byte*>(Q_malloc(2 * outwidth4));
|
||||
row1 = memalloc;
|
||||
row2 = memalloc + outwidth4;
|
||||
inrow = (byte *) indata;
|
||||
|
@ -207,7 +206,7 @@ static void Image_Resample24 (void *indata, int inwidth, int inheight,
|
|||
out = static_cast<byte*>(outdata);
|
||||
fstep = (int) (inheight * 65536.0f / outheight);
|
||||
|
||||
memalloc = static_cast<byte*>(malloc(2 * outwidth3));
|
||||
memalloc = static_cast<byte*>(Q_malloc(2 * outwidth3));
|
||||
row1 = memalloc;
|
||||
row2 = memalloc + outwidth3;
|
||||
inrow = (byte *) indata;
|
||||
|
|
|
@ -168,7 +168,7 @@ int ConvertWad3ToRGBA(miptex_t *tex)
|
|||
pal = in + ((image_size * 85) >> 6) + 2;
|
||||
|
||||
|
||||
data = (byte*)malloc(image_size);
|
||||
data = (byte*)Q_malloc(image_size);
|
||||
for (i = 0; i < image_size; i++)
|
||||
{
|
||||
p = *in++;
|
||||
|
@ -369,7 +369,7 @@ void W_LoadTextureWadFileHL (char *filename, int complain)
|
|||
return;
|
||||
}
|
||||
|
||||
if (!(lumps = static_cast<lumpinfo_t*>(malloc(sizeof(lumpinfo_t)*numlumps))))
|
||||
if (!(lumps = static_cast<lumpinfo_t*>(Q_malloc(sizeof(lumpinfo_t)*numlumps))))
|
||||
{
|
||||
fclose(file);
|
||||
Con_Printf ("W_LoadTextureWadFile: unable to allocate temporary memory for lump table");
|
||||
|
@ -415,7 +415,7 @@ byte *W_ConvertWAD3TextureHL(miptex_t *tex)
|
|||
int d, p, image_size;
|
||||
|
||||
in = (byte *)((int) tex + tex->offsets[0]);
|
||||
data = out = static_cast<byte*>(malloc(tex->width * tex->height * 4));
|
||||
data = out = static_cast<byte*>(Q_malloc(tex->width * tex->height * 4));
|
||||
|
||||
if (!data)
|
||||
return NULL;
|
||||
|
@ -468,7 +468,7 @@ byte *W_GetTextureHL(char *name)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
tex = static_cast<miptex_t*>(malloc(texwadlump[i].size));
|
||||
tex = static_cast<miptex_t*>(Q_malloc(texwadlump[i].size));
|
||||
|
||||
if (!tex)
|
||||
return NULL;
|
||||
|
|
Loading…
Reference in a new issue