(svn r159) -Fix: w->custom[] was too small for 64bit pointers

pull/155/head
truelight 20 years ago
parent 0fe07eac63
commit 1846563cf8

@ -338,11 +338,11 @@ restart:;
w->hscroll.count = 0;
w->widget = widget;
((uint32*)w->custom)[0] = 0;
((uint32*)w->custom)[1] = 0;
((uint32*)w->custom)[2] = 0;
((uint32*)w->custom)[3] = 0;
{
int i;
for (i=0;i<lengthof(w->custom);i++)
w->custom[i] = 0;
}
_last_window++;

@ -161,7 +161,22 @@ enum {
WDP_CENTER = -2,
};
typedef struct {
StringID caption;
bool caret;
WindowClass wnd_class;
WindowNumber wnd_num;
uint16 maxlen, maxwidth;
byte *buf;
} querystr_d;
#define WP(ptr,str) (*(str*)(ptr)->custom)
// querystr_d is the bigest struct that comes in w->custom
// because 64-bit systems use 64-bit pointers, it is bigger on a 64-bit system
// then on a 32-bit system. Therefor the size is calculated from querystr_d
// instead of a hardcoded number.
// if any struct becomes bigger the querystr_d, it should be replaced.
#define WINDOW_CUSTOM_SIZE sizeof(querystr_d)
typedef struct {
uint16 count, cap, pos;
@ -186,7 +201,7 @@ struct Window {
//const WindowDesc *desc;
uint32 desc_flags;
byte custom[16];
byte custom[WINDOW_CUSTOM_SIZE];
};
typedef struct {
@ -250,15 +265,6 @@ typedef struct {
byte gender;
} facesel_d;
typedef struct {
StringID caption;
bool caret;
WindowClass wnd_class;
WindowNumber wnd_num;
uint16 maxlen, maxwidth;
byte *buf;
} querystr_d;
typedef struct {
int sel;
byte cargo;

Loading…
Cancel
Save