wrc: Store version and characteristics as simple integers.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2022-04-01 12:58:15 +02:00
parent 49bea92bdc
commit d0b7fa9da7
6 changed files with 28 additions and 58 deletions

View File

@ -247,17 +247,17 @@ static void put_name_id(name_id_t *nid, int upcase, language_t lang)
static void put_lvc(lvc_t *lvc)
{
if(lvc)
{
put_word(lvc->language);
put_dword(lvc->version);
put_dword(lvc->characts);
}
else
{
put_word(0); /* Neutral */
if(lvc && lvc->version)
put_dword(*lvc->version);
else
put_dword(0);
if(lvc && lvc->characts)
put_dword(*lvc->characts);
else
put_dword(0);
}
}
/*

View File

@ -196,32 +196,6 @@ resource_t *new_resource(enum res_e t, void *res, int memopt, language_t lan)
return r;
}
version_t *new_version(unsigned int v)
{
version_t *vp = xmalloc(sizeof(version_t));
*vp = v;
return vp;
}
characts_t *new_characts(unsigned int c)
{
characts_t *cp = xmalloc(sizeof(characts_t));
*cp = c;
return cp;
}
version_t *dup_version(version_t *v)
{
if(!v) return NULL;
return new_version(*v);
}
characts_t *dup_characts(characts_t *c)
{
if(!c) return NULL;
return new_characts(*c);
}
html_t *new_html(raw_data_t *rd, int *memopt)
{
html_t *html = xmalloc(sizeof(html_t));

View File

@ -43,10 +43,6 @@ string_t *new_string(void);
toolbar_item_t *new_toolbar_item(void);
ani_any_t *new_ani_any(void);
resource_t *new_resource(enum res_e t, void *res, int memopt, language_t lan);
version_t *new_version(unsigned int v);
characts_t *new_characts(unsigned int c);
version_t *dup_version(version_t *v);
characts_t *dup_characts(characts_t *c);
html_t *new_html(raw_data_t *rd, int *memopt);
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);

View File

@ -155,8 +155,8 @@ static int dont_want_id = 0; /* See language parsing for details */
/* Set to the current options of the currently scanning stringtable */
static int *tagstt_memopt;
static characts_t *tagstt_characts;
static version_t *tagstt_version;
static characts_t tagstt_characts;
static version_t tagstt_version;
static const char riff[4] = "RIFF"; /* RIFF file magic for animated cursor/icon */
@ -180,8 +180,8 @@ static event_t *add_string_event(string_t *key, int id, int flags, event_t *prev
static event_t *add_event(int key, int id, int flags, event_t *prev);
static name_id_t *convert_ctlclass(name_id_t *cls);
static control_t *ins_ctrl(int type, int special_style, control_t *ctrl, control_t *prev);
static dialog_t *dialog_version(version_t *v, dialog_t *dlg);
static dialog_t *dialog_characteristics(characts_t *c, dialog_t *dlg);
static dialog_t *dialog_version(version_t v, dialog_t *dlg);
static dialog_t *dialog_characteristics(characts_t c, dialog_t *dlg);
static dialog_t *dialog_language(language_t l, dialog_t *dlg);
static dialog_t *dialog_menu(name_id_t *m, dialog_t *dlg);
static dialog_t *dialog_class(name_id_t *n, dialog_t *dlg);
@ -228,8 +228,8 @@ static int rsrcid_to_token(int lookahead);
name_id_t *nid;
font_id_t *fntid;
language_t lan;
version_t *ver;
characts_t *chars;
version_t ver;
characts_t chars;
event_t *event;
menu_item_t *menitm;
itemex_opt_t *exopt;
@ -1727,11 +1727,11 @@ opt_language
;
opt_characts
: tCHARACTERISTICS expr { $$ = new_characts($2); }
: tCHARACTERISTICS expr { $$ = $2; }
;
opt_version
: tVERSION expr { $$ = new_version($2); }
: tVERSION expr { $$ = $2; }
;
/* ------------------------------ Raw data handling ------------------------------ */
@ -1895,7 +1895,7 @@ static dialog_t *dialog_language(language_t l, dialog_t *dlg)
return dlg;
}
static dialog_t *dialog_characteristics(characts_t *c, dialog_t *dlg)
static dialog_t *dialog_characteristics(characts_t c, dialog_t *dlg)
{
assert(dlg != NULL);
if(dlg->lvc.characts)
@ -1904,7 +1904,7 @@ static dialog_t *dialog_characteristics(characts_t *c, dialog_t *dlg)
return dlg;
}
static dialog_t *dialog_version(version_t *v, dialog_t *dlg)
static dialog_t *dialog_version(version_t v, dialog_t *dlg)
{
assert(dlg != NULL);
if(dlg->lvc.version)
@ -2369,8 +2369,8 @@ static resource_t *build_stt_resources(stringtable_t *stthead)
int j;
unsigned int andsum;
unsigned int orsum;
characts_t *characts;
version_t *version;
characts_t characts;
version_t version;
if(!stthead)
return NULL;
@ -2401,8 +2401,8 @@ static resource_t *build_stt_resources(stringtable_t *stthead)
}
andsum = ~0;
orsum = 0;
characts = NULL;
version = NULL;
characts = 0;
version = 0;
/* Check individual memory options and get
* the first characteristics/version
*/
@ -2426,11 +2426,11 @@ static resource_t *build_stt_resources(stringtable_t *stthead)
{
if(characts
&& newstt->entries[j].characts
&& *newstt->entries[j].characts != *characts)
&& newstt->entries[j].characts != characts)
warning("Stringtable's characteristics are not the same (idbase: %d)\n", newstt->idbase);
if(version
&& newstt->entries[j].version
&& *newstt->entries[j].version != *version)
&& newstt->entries[j].version != version)
warning("Stringtable's versions are not the same (idbase: %d)\n", newstt->idbase);
}
rsc = new_resource(res_stt, newstt, newstt->memopt, newstt->lvc.language);

View File

@ -86,10 +86,10 @@ static language_t get_default_sublang( language_t lan )
}
}
static version_t *get_dup_version( language_t lang )
static version_t get_dup_version( language_t lang )
{
/* English "translations" take precedence over the original rc contents */
return new_version( is_english( lang ) ? 1 : -1 );
return is_english( lang ) ? 1 : -1;
}
static name_id_t *dup_name_id( name_id_t *id )

View File

@ -108,8 +108,8 @@ typedef unsigned int version_t;
typedef struct lvc {
language_t language;
version_t *version;
characts_t *characts;
version_t version;
characts_t characts;
} lvc_t;
typedef struct font_id {
@ -428,8 +428,8 @@ typedef struct stt_entry {
string_t *str;
int id;
unsigned int memopt;
characts_t *characts;
version_t *version;
characts_t characts;
version_t version;
} stt_entry_t;
typedef struct stringtable {