Skip to content

Commit

Permalink
Use NoFill hunk allocs when loading images
Browse files Browse the repository at this point in the history
  • Loading branch information
andrei-drexler committed Oct 19, 2024
1 parent 40ae636 commit 386dd49
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Quake/image.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ byte *Image_LoadImage (const char *name, int *width, int *height, enum srcformat
if (data)
{
int numbytes = (*width) * (*height) * 4;
byte *hunkdata = (byte *) Hunk_AllocName (numbytes, ext);
byte *hunkdata = (byte *) Hunk_AllocNameNoFill (numbytes, ext);
memcpy (hunkdata, data, numbytes);
free (data);
data = hunkdata;
Expand Down Expand Up @@ -272,7 +272,7 @@ static byte *Image_LoadPCX (FILE *f, int *width, int *height)
w = pcx.xmax - pcx.xmin + 1;
h = pcx.ymax - pcx.ymin + 1;

data = (byte *) Hunk_Alloc((w*h+1)*4); //+1 to allow reading padding byte on last line
data = (byte *) Hunk_AllocNoFill ((w*h+1)*4); //+1 to allow reading padding byte on last line

//load palette
fseek (f, start + com_filesize - 768, SEEK_SET);
Expand Down Expand Up @@ -360,7 +360,7 @@ static byte *Image_LoadLMP (FILE *f, int *width, int *height)
}

mark = Hunk_LowMark ();
data = (byte *) Hunk_Alloc (pix);
data = (byte *) Hunk_AllocNoFill (pix);
if (fread (data, 1, pix, f) != pix)
{
Hunk_FreeToLowMark (mark);
Expand Down

0 comments on commit 386dd49

Please sign in to comment.