mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-04-04 16:31:30 +00:00
[image] Ensure tex fields are all initialized
Designated initializers for the win.
This commit is contained in:
parent
346ed29f49
commit
baa11cd710
3 changed files with 20 additions and 16 deletions
|
@ -94,17 +94,18 @@ LoadPCX (QFile *f, bool convert, const byte *pal, int load)
|
|||
count = load ? (pcx->xmax + 1) * (pcx->ymax + 1) : 0;
|
||||
if (convert) {
|
||||
tex = Hunk_TempAlloc (0, sizeof (tex_t) + count * 3);
|
||||
tex->data = (byte *) (tex + 1);
|
||||
tex->format = tex_rgb;
|
||||
tex->palette = 0;
|
||||
*tex = (tex_t) {
|
||||
.data = (byte *) (tex + 1),
|
||||
.format = tex_rgb,
|
||||
.palette = 0,
|
||||
};
|
||||
} else {
|
||||
tex = Hunk_TempAlloc (0, sizeof (tex_t) + count);
|
||||
tex->data = (byte *) (tex + 1);
|
||||
tex->format = tex_palette;
|
||||
if (pal)
|
||||
tex->palette = pal;
|
||||
else
|
||||
tex->palette = palette;
|
||||
*tex = (tex_t) {
|
||||
.data = (byte *) (tex + 1),
|
||||
.format = tex_palette,
|
||||
.palette = pal ? pal : palette,
|
||||
};
|
||||
}
|
||||
tex->width = pcx->xmax + 1;
|
||||
tex->height = pcx->ymax + 1;
|
||||
|
|
|
@ -164,10 +164,12 @@ LoadPNG (QFile *infile, int load)
|
|||
/* Allocate tex_t structure */
|
||||
rowbytes = png_get_rowbytes(png_ptr, info_ptr);
|
||||
tex = Hunk_TempAlloc (0, sizeof (tex_t) + height * rowbytes);
|
||||
tex->data = (byte *) (tex + 1);
|
||||
*tex = (tex_t) {
|
||||
.data = (byte *) (tex + 1),
|
||||
};
|
||||
} else {
|
||||
tex = Hunk_TempAlloc (0, sizeof (tex_t));
|
||||
tex->data = 0;
|
||||
*tex = (tex_t) { };
|
||||
}
|
||||
|
||||
tex->width = width;
|
||||
|
|
|
@ -663,11 +663,12 @@ LoadTGA (QFile *fin, int load)
|
|||
numPixels = 0;
|
||||
}
|
||||
tex = Hunk_TempAlloc (0, sizeof (tex_t) + numPixels * 4);
|
||||
tex->data = (byte *) (tex + 1);
|
||||
tex->width = targa->width;
|
||||
tex->height = targa->height;
|
||||
tex->palette = 0;
|
||||
tex->loaded = load;
|
||||
*tex = (tex_t) {
|
||||
.width = targa->width,
|
||||
.height = targa->height,
|
||||
.loaded = load,
|
||||
.data = (byte *) (tex + 1),
|
||||
};
|
||||
|
||||
if (load) {
|
||||
// skip TARGA image comment
|
||||
|
|
Loading…
Reference in a new issue