Commit fce74f74 authored by Alexandre Julliard's avatar Alexandre Julliard

wrc: Get rid of xmalloc casts.

parent fba0897e
......@@ -48,18 +48,18 @@
res_t *new_res(void)
{
res_t *r;
r = (res_t *)xmalloc(sizeof(res_t));
r = xmalloc(sizeof(res_t));
r->allocsize = RES_BLOCKSIZE;
r->size = 0;
r->dataidx = 0;
r->data = (char *)xmalloc(RES_BLOCKSIZE);
r->data = xmalloc(RES_BLOCKSIZE);
return r;
}
res_t *grow_res(res_t *r, unsigned int add)
{
r->allocsize += add;
r->data = (char *)xrealloc(r->data, r->allocsize);
r->data = xrealloc(r->data, r->allocsize);
return r;
}
......@@ -1847,7 +1847,7 @@ char *make_c_name(const char *base, const name_id_t *nid, const language_t *lan)
buf = prep_nid_for_label(nid);
nlen = strlen(buf) + strlen(lanbuf);
nlen += strlen(base) + 4; /* three time '_' and '\0' */
ret = (char *)xmalloc(nlen);
ret = xmalloc(nlen);
strcpy(ret, "_");
strcat(ret, base);
strcat(ret, "_");
......
......@@ -75,7 +75,7 @@ __NEW_STRUCT_FUNC(ani_any)
*/
resource_t *new_resource(enum res_e t, void *res, int memopt, language_t *lan)
{
resource_t *r = (resource_t *)xmalloc(sizeof(resource_t));
resource_t *r = xmalloc(sizeof(resource_t));
memset( r, 0, sizeof(*r) );
r->type = t;
r->res.overlay = res;
......@@ -86,21 +86,21 @@ resource_t *new_resource(enum res_e t, void *res, int memopt, language_t *lan)
version_t *new_version(DWORD v)
{
version_t *vp = (version_t *)xmalloc(sizeof(version_t));
version_t *vp = xmalloc(sizeof(version_t));
*vp = v;
return vp;
}
characts_t *new_characts(DWORD c)
{
characts_t *cp = (characts_t *)xmalloc(sizeof(characts_t));
characts_t *cp = xmalloc(sizeof(characts_t));
*cp = c;
return cp;
}
language_t *new_language(int id, int sub)
{
language_t *lan = (language_t *)xmalloc(sizeof(language_t));
language_t *lan = xmalloc(sizeof(language_t));
lan->id = id;
lan->sub = sub;
return lan;
......@@ -140,7 +140,7 @@ html_t *new_html(raw_data_t *rd, int *memopt)
rcdata_t *new_rcdata(raw_data_t *rd, int *memopt)
{
rcdata_t *rc = (rcdata_t *)xmalloc(sizeof(rcdata_t));
rcdata_t *rc = xmalloc(sizeof(rcdata_t));
rc->data = rd;
if(memopt)
{
......@@ -154,7 +154,7 @@ rcdata_t *new_rcdata(raw_data_t *rd, int *memopt)
font_id_t *new_font_id(int size, string_t *face, int weight, int italic)
{
font_id_t *fid = (font_id_t *)xmalloc(sizeof(font_id_t));
font_id_t *fid = xmalloc(sizeof(font_id_t));
fid->name = face;
fid->size = size;
fid->weight = weight;
......@@ -164,7 +164,7 @@ font_id_t *new_font_id(int size, string_t *face, int weight, int italic)
user_t *new_user(name_id_t *type, raw_data_t *rd, int *memopt)
{
user_t *usr = (user_t *)xmalloc(sizeof(user_t));
user_t *usr = xmalloc(sizeof(user_t));
usr->data = rd;
if(memopt)
{
......@@ -179,7 +179,7 @@ user_t *new_user(name_id_t *type, raw_data_t *rd, int *memopt)
font_t *new_font(raw_data_t *rd, int *memopt)
{
font_t *fnt = (font_t *)xmalloc(sizeof(font_t));
font_t *fnt = xmalloc(sizeof(font_t));
fnt->data = rd;
if(memopt)
{
......@@ -193,7 +193,7 @@ font_t *new_font(raw_data_t *rd, int *memopt)
fontdir_t *new_fontdir(raw_data_t *rd, int *memopt)
{
fontdir_t *fnd = (fontdir_t *)xmalloc(sizeof(fontdir_t));
fontdir_t *fnd = xmalloc(sizeof(fontdir_t));
fnd->data = rd;
if(memopt)
{
......@@ -411,7 +411,7 @@ static int get_new_id(id_alloc_t **list, int *n, language_t *lan)
if(!*list)
{
*list = (id_alloc_t *)xmalloc(sizeof(id_alloc_t));
*list = xmalloc(sizeof(id_alloc_t));
*n = 1;
(*list)[0].lan = *lan;
(*list)[0].id = 1;
......@@ -424,7 +424,7 @@ static int get_new_id(id_alloc_t **list, int *n, language_t *lan)
return ++((*list)[i].id);
}
*list = (id_alloc_t *)xrealloc(*list, sizeof(id_alloc_t) * (*n+1));
*list = xrealloc(*list, sizeof(id_alloc_t) * (*n+1));
(*list)[*n].lan = *lan;
(*list)[*n].id = 1;
*n += 1;
......@@ -621,7 +621,7 @@ static void split_cursors(raw_data_t *rd, cursor_group_t *curg, int *ncur)
icon_group_t *new_icon_group(raw_data_t *rd, int *memopt)
{
icon_group_t *icog = (icon_group_t *)xmalloc(sizeof(icon_group_t));
icon_group_t *icog = xmalloc(sizeof(icon_group_t));
if(memopt)
{
icog->memopt = *memopt;
......@@ -638,7 +638,7 @@ icon_group_t *new_icon_group(raw_data_t *rd, int *memopt)
cursor_group_t *new_cursor_group(raw_data_t *rd, int *memopt)
{
cursor_group_t *curg = (cursor_group_t *)xmalloc(sizeof(cursor_group_t));
cursor_group_t *curg = xmalloc(sizeof(cursor_group_t));
if(memopt)
{
curg->memopt = *memopt;
......@@ -824,7 +824,7 @@ static void handle_ani_list(riff_tag_t *lst, enum res_e type, int isswapped)
ani_curico_t *new_ani_curico(enum res_e type, raw_data_t *rd, int *memopt)
{
ani_curico_t *ani = (ani_curico_t *)xmalloc(sizeof(ani_curico_t));
ani_curico_t *ani = xmalloc(sizeof(ani_curico_t));
riff_tag_t *rtp;
int isswapped = 0;
int doswap;
......@@ -951,7 +951,7 @@ ani_curico_t *new_ani_curico(enum res_e type, raw_data_t *rd, int *memopt)
/* Bitmaps */
bitmap_t *new_bitmap(raw_data_t *rd, int *memopt)
{
bitmap_t *bmp = (bitmap_t *)xmalloc(sizeof(bitmap_t));
bitmap_t *bmp = xmalloc(sizeof(bitmap_t));
bmp->data = rd;
if(memopt)
......@@ -967,8 +967,8 @@ bitmap_t *new_bitmap(raw_data_t *rd, int *memopt)
ver_words_t *new_ver_words(int i)
{
ver_words_t *w = (ver_words_t *)xmalloc(sizeof(ver_words_t));
w->words = (WORD *)xmalloc(sizeof(WORD));
ver_words_t *w = xmalloc(sizeof(ver_words_t));
w->words = xmalloc(sizeof(WORD));
w->words[0] = (WORD)i;
w->nwords = 1;
return w;
......@@ -976,7 +976,7 @@ ver_words_t *new_ver_words(int i)
ver_words_t *add_ver_words(ver_words_t *w, int i)
{
w->words = (WORD *)xrealloc(w->words, (w->nwords+1) * sizeof(WORD));
w->words = xrealloc(w->words, (w->nwords+1) * sizeof(WORD));
w->words[w->nwords] = (WORD)i;
w->nwords++;
return w;
......@@ -985,7 +985,7 @@ ver_words_t *add_ver_words(ver_words_t *w, int i)
#define MSGTAB_BAD_PTR(p, b, l, r) (((l) - ((char *)(p) - (char *)(b))) > (r))
messagetable_t *new_messagetable(raw_data_t *rd, int *memopt)
{
messagetable_t *msg = (messagetable_t *)xmalloc(sizeof(messagetable_t));
messagetable_t *msg = xmalloc(sizeof(messagetable_t));
msgtab_block_t *mbp;
DWORD nblk;
DWORD i;
......@@ -1125,11 +1125,11 @@ void copy_raw_data(raw_data_t *dst, raw_data_t *src, unsigned int offs, int len)
assert(offs + len <= src->size);
if(!dst->data)
{
dst->data = (char *)xmalloc(len);
dst->data = xmalloc(len);
dst->size = 0;
}
else
dst->data = (char *)xrealloc(dst->data, dst->size + len);
dst->data = xrealloc(dst->data, dst->size + len);
/* dst->size holds the offset to copy to */
memcpy(dst->data + dst->size, src->data + offs, len);
dst->size += len;
......@@ -1137,14 +1137,14 @@ void copy_raw_data(raw_data_t *dst, raw_data_t *src, unsigned int offs, int len)
int *new_int(int i)
{
int *ip = (int *)xmalloc(sizeof(int));
int *ip = xmalloc(sizeof(int));
*ip = i;
return ip;
}
stringtable_t *new_stringtable(lvc_t *lvc)
{
stringtable_t *stt = (stringtable_t *)xmalloc(sizeof(stringtable_t));
stringtable_t *stt = xmalloc(sizeof(stringtable_t));
memset( stt, 0, sizeof(*stt) );
if(lvc)
......@@ -1155,7 +1155,7 @@ stringtable_t *new_stringtable(lvc_t *lvc)
toolbar_t *new_toolbar(int button_width, int button_height, toolbar_item_t *items, int nitems)
{
toolbar_t *tb = (toolbar_t *)xmalloc(sizeof(toolbar_t));
toolbar_t *tb = xmalloc(sizeof(toolbar_t));
memset( tb, 0, sizeof(*tb) );
tb->button_width = button_width;
tb->button_height = button_height;
......@@ -1166,7 +1166,7 @@ toolbar_t *new_toolbar(int button_width, int button_height, toolbar_item_t *item
dlginit_t *new_dlginit(raw_data_t *rd, int *memopt)
{
dlginit_t *di = (dlginit_t *)xmalloc(sizeof(dlginit_t));
dlginit_t *di = xmalloc(sizeof(dlginit_t));
di->data = rd;
if(memopt)
{
......@@ -1181,7 +1181,7 @@ dlginit_t *new_dlginit(raw_data_t *rd, int *memopt)
style_pair_t *new_style_pair(style_t *style, style_t *exstyle)
{
style_pair_t *sp = (style_pair_t *)xmalloc(sizeof(style_pair_t));
style_pair_t *sp = xmalloc(sizeof(style_pair_t));
sp->style = style;
sp->exstyle = exstyle;
return sp;
......@@ -1189,7 +1189,7 @@ style_pair_t *new_style_pair(style_t *style, style_t *exstyle)
style_t *new_style(DWORD or_mask, DWORD and_mask)
{
style_t *st = (style_t *)xmalloc(sizeof(style_t));
style_t *st = xmalloc(sizeof(style_t));
st->or_mask = or_mask;
st->and_mask = and_mask;
return st;
......
......@@ -638,7 +638,7 @@ static string_t *get_buffered_cstring(void)
str->size = cbufidx;
str->type = str_char;
str->str.cstr = (char *)xmalloc(cbufidx+1);
str->str.cstr = xmalloc(cbufidx+1);
memcpy(str->str.cstr, cbuffer, cbufidx);
str->str.cstr[cbufidx] = '\0';
......@@ -674,7 +674,7 @@ static string_t *make_string(char *s)
string_t *str = new_string();
str->size = strlen(s);
str->type = str_char;
str->str.cstr = (char *)xmalloc(str->size+1);
str->str.cstr = xmalloc(str->size+1);
memcpy(str->str.cstr, s, str->size+1);
return str;
}
......@@ -2285,7 +2285,7 @@ static event_t *add_string_event(string_t *key, int id, int flags, event_t *prev
/* MenuEx specific functions */
static itemex_opt_t *new_itemex_opt(int id, int type, int state, int helpid)
{
itemex_opt_t *opt = (itemex_opt_t *)xmalloc(sizeof(itemex_opt_t));
itemex_opt_t *opt = xmalloc(sizeof(itemex_opt_t));
memset( opt, 0, sizeof(*opt) );
opt->id = id;
opt->type = type;
......@@ -2318,7 +2318,7 @@ static raw_data_t *load_file(string_t *filename, language_t *lang)
fseek(fp, 0, SEEK_SET);
if (rd->size)
{
rd->data = (char *)xmalloc(rd->size);
rd->data = xmalloc(rd->size);
fread(rd->data, rd->size, 1, fp);
}
else rd->data = NULL;
......@@ -2338,7 +2338,7 @@ static raw_data_t *int2raw_data(int i)
rd = new_raw_data();
rd->size = sizeof(short);
rd->data = (char *)xmalloc(rd->size);
rd->data = xmalloc(rd->size);
switch(byteorder)
{
#ifdef WORDS_BIGENDIAN
......@@ -2365,7 +2365,7 @@ static raw_data_t *long2raw_data(int i)
raw_data_t *rd;
rd = new_raw_data();
rd->size = sizeof(int);
rd->data = (char *)xmalloc(rd->size);
rd->data = xmalloc(rd->size);
switch(byteorder)
{
#ifdef WORDS_BIGENDIAN
......@@ -2396,7 +2396,7 @@ static raw_data_t *str2raw_data(string_t *str)
raw_data_t *rd;
rd = new_raw_data();
rd->size = str->size * (str->type == str_char ? 1 : 2);
rd->data = (char *)xmalloc(rd->size);
rd->data = xmalloc(rd->size);
if(str->type == str_char)
memcpy(rd->data, str->str.cstr, rd->size);
else if(str->type == str_unicode)
......@@ -2602,7 +2602,7 @@ static resource_t *build_stt_resources(stringtable_t *stthead)
for(i = 0; i < stt->nentries; )
{
newstt = new_stringtable(&stt->lvc);
newstt->entries = (stt_entry_t *)xmalloc(16 * sizeof(stt_entry_t));
newstt->entries = xmalloc(16 * sizeof(stt_entry_t));
memset( newstt->entries, 0, 16 * sizeof(stt_entry_t) );
newstt->nentries = 16;
newstt->idbase = stt->entries[i].id & ~0xf;
......
......@@ -149,7 +149,7 @@ char *dup_basename(const char *name, const char *ext)
namelen = strlen(name);
/* +4 for later extension and +1 for '\0' */
base = (char *)xmalloc(namelen +4 +1);
base = xmalloc(namelen +4 +1);
strcpy(base, name);
if(!strcasecmp(name + namelen-extlen, ext))
{
......@@ -191,7 +191,7 @@ char *xstrdup(const char *str)
char *s;
assert(str != NULL);
s = (char *)xmalloc(strlen(str)+1);
s = xmalloc(strlen(str)+1);
return strcpy(s, str);
}
......
......@@ -266,7 +266,7 @@ int main(int argc,char *argv[])
cmdlen = 4; /* for "wrc " */
for(i = 1; i < argc; i++)
cmdlen += strlen(argv[i]) + 1;
cmdline = (char *)xmalloc(cmdlen);
cmdline = xmalloc(cmdlen);
strcpy(cmdline, "wrc ");
for(i = 1; i < argc; i++)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment