Commit 4034ff36 authored by Daniel Marmier's avatar Daniel Marmier Committed by Alexandre Julliard

Fixed warnings with gcc option "-Wwrite-strings".

parent 9bd1dbd0
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
#define YYLEX_PARAM info #define YYLEX_PARAM info
#define YYPARSE_PARAM info #define YYPARSE_PARAM info
extern int yyerror(char *str); extern int yyerror(const char *str);
WINE_DEFAULT_DEBUG_CHANNEL(msi); WINE_DEFAULT_DEBUG_CHANNEL(msi);
...@@ -392,7 +392,7 @@ INT yygetint( yyinput *sql ) ...@@ -392,7 +392,7 @@ INT yygetint( yyinput *sql )
return atoiW( p ); return atoiW( p );
} }
int yyerror(char *str) int yyerror(const char *str)
{ {
return 0; return 0;
} }
......
...@@ -23,8 +23,8 @@ ...@@ -23,8 +23,8 @@
#include "wrctypes.h" #include "wrctypes.h"
char *get_typename(resource_t* r); const char *get_typename(const resource_t* r);
void dump_resources(resource_t *top); void dump_resources(const resource_t *top);
char *get_nameid_str(name_id_t *n); const char *get_nameid_str(const name_id_t *n);
#endif #endif
...@@ -1620,7 +1620,7 @@ static res_t *versioninfo2res(name_id_t *name, versioninfo_t *ver) ...@@ -1620,7 +1620,7 @@ static res_t *versioninfo2res(name_id_t *name, versioninfo_t *ver)
assert(ver != NULL); assert(ver != NULL);
vsvi.type = str_char; vsvi.type = str_char;
vsvi.str.cstr = "VS_VERSION_INFO"; vsvi.str.cstr = xstrdup("VS_VERSION_INFO");
vsvi.size = 15; /* Excl. termination */ vsvi.size = 15; /* Excl. termination */
res = new_res(); res = new_res();
...@@ -1661,6 +1661,7 @@ static res_t *versioninfo2res(name_id_t *name, versioninfo_t *ver) ...@@ -1661,6 +1661,7 @@ static res_t *versioninfo2res(name_id_t *name, versioninfo_t *ver)
if(win32) if(win32)
put_pad(res); put_pad(res);
free(vsvi.str.cstr);
return res; return res;
} }
...@@ -1762,7 +1763,7 @@ static res_t *dlginit2res(name_id_t *name, dlginit_t *dit) ...@@ -1762,7 +1763,7 @@ static res_t *dlginit2res(name_id_t *name, dlginit_t *dit)
/* /*
***************************************************************************** *****************************************************************************
* Function : prep_nid_for_label * Function : prep_nid_for_label
* Syntax : char *prep_nid_for_label(name_id_t *nid) * Syntax : char *prep_nid_for_label(const name_id_t *nid)
* Input : * Input :
* Output : * Output :
* Description : Converts a resource name into the first 32 (or less) * Description : Converts a resource name into the first 32 (or less)
...@@ -1771,7 +1772,7 @@ static res_t *dlginit2res(name_id_t *name, dlginit_t *dit) ...@@ -1771,7 +1772,7 @@ static res_t *dlginit2res(name_id_t *name, dlginit_t *dit)
***************************************************************************** *****************************************************************************
*/ */
#define MAXNAMELEN 32 #define MAXNAMELEN 32
char *prep_nid_for_label(name_id_t *nid) char *prep_nid_for_label(const name_id_t *nid)
{ {
static char buf[MAXNAMELEN+1]; static char buf[MAXNAMELEN+1];
...@@ -1822,7 +1823,7 @@ char *prep_nid_for_label(name_id_t *nid) ...@@ -1822,7 +1823,7 @@ char *prep_nid_for_label(name_id_t *nid)
/* /*
***************************************************************************** *****************************************************************************
* Function : make_c_name * Function : make_c_name
* Syntax : char *make_c_name(char *base, name_id_t *nid, language_t *lan) * Syntax : char *make_c_name(const char *base, const name_id_t *nid, const language_t *lan)
* Input : * Input :
* Output : * Output :
* Description : Converts a resource name into a valid c-identifier in the * Description : Converts a resource name into a valid c-identifier in the
...@@ -1830,7 +1831,7 @@ char *prep_nid_for_label(name_id_t *nid) ...@@ -1830,7 +1831,7 @@ char *prep_nid_for_label(name_id_t *nid)
* Remarks : * Remarks :
***************************************************************************** *****************************************************************************
*/ */
char *make_c_name(char *base, name_id_t *nid, language_t *lan) char *make_c_name(const char *base, const name_id_t *nid, const language_t *lan)
{ {
int nlen; int nlen;
char *buf; char *buf;
...@@ -1854,7 +1855,7 @@ char *make_c_name(char *base, name_id_t *nid, language_t *lan) ...@@ -1854,7 +1855,7 @@ char *make_c_name(char *base, name_id_t *nid, language_t *lan)
/* /*
***************************************************************************** *****************************************************************************
* Function : get_c_typename * Function : get_c_typename
* Syntax : char *get_c_typename(enum res_e type) * Syntax : const char *get_c_typename(enum res_e type)
* Input : * Input :
* Output : * Output :
* Description : Convert resource enum to char string to be used in c-name * Description : Convert resource enum to char string to be used in c-name
...@@ -1862,7 +1863,7 @@ char *make_c_name(char *base, name_id_t *nid, language_t *lan) ...@@ -1862,7 +1863,7 @@ char *make_c_name(char *base, name_id_t *nid, language_t *lan)
* Remarks : * Remarks :
***************************************************************************** *****************************************************************************
*/ */
char *get_c_typename(enum res_e type) const char *get_c_typename(enum res_e type)
{ {
switch(type) switch(type)
{ {
......
...@@ -29,8 +29,8 @@ void put_byte(res_t *res, unsigned c); ...@@ -29,8 +29,8 @@ void put_byte(res_t *res, unsigned c);
void put_word(res_t *res, unsigned w); void put_word(res_t *res, unsigned w);
void put_dword(res_t *res, unsigned d); void put_dword(res_t *res, unsigned d);
void resources2res(resource_t *top); void resources2res(resource_t *top);
char *get_c_typename(enum res_e type); const char *get_c_typename(enum res_e type);
char *make_c_name(char *base, name_id_t *nid, language_t *lan); char *make_c_name(const char *base, const name_id_t *nid, const language_t *lan);
char *prep_nid_for_label(name_id_t *nid); char *prep_nid_for_label(const name_id_t *nid);
#endif #endif
...@@ -157,11 +157,11 @@ static int wanted_id = 0; ...@@ -157,11 +157,11 @@ static int wanted_id = 0;
static int save_wanted_id; /* To save across comment reductions */ static int save_wanted_id; /* To save across comment reductions */
struct keyword { struct keyword {
char *keyword; const char *keyword;
int token; int token;
int isextension; int isextension;
int needcase; int needcase;
int alwayskw; int alwayskw;
}; };
static struct keyword keywords[] = { static struct keyword keywords[] = {
...@@ -243,7 +243,7 @@ static struct keyword keywords[] = { ...@@ -243,7 +243,7 @@ static struct keyword keywords[] = {
}; };
#define NKEYWORDS (sizeof(keywords)/sizeof(keywords[0])) #define NKEYWORDS (sizeof(keywords)/sizeof(keywords[0]))
#define KWP(p) ((struct keyword *)(p)) #define KWP(p) ((const struct keyword *)(p))
static int kw_cmp_func(const void *s1, const void *s2) static int kw_cmp_func(const void *s1, const void *s2)
{ {
int ret; int ret;
......
...@@ -2763,7 +2763,7 @@ static resource_t *build_fontdirs(resource_t *tail) ...@@ -2763,7 +2763,7 @@ static resource_t *build_fontdirs(resource_t *tail)
nid.type = name_str; nid.type = name_str;
nid.name.s_name = &str; nid.name.s_name = &str;
str.type = str_char; str.type = str_char;
str.str.cstr = "FONTDIR"; str.str.cstr = xstrdup("FONTDIR");
str.size = 7; str.size = 7;
/* Extract all fonts and fontdirs */ /* Extract all fonts and fontdirs */
...@@ -2888,6 +2888,7 @@ clean: ...@@ -2888,6 +2888,7 @@ clean:
free(fnt); free(fnt);
if(fnd) if(fnd)
free(fnd); free(fnd);
free(str.str.cstr);
return lst; return lst;
} }
...@@ -2919,7 +2920,7 @@ clean: ...@@ -2919,7 +2920,7 @@ clean:
static int rsrcid_to_token(int lookahead) static int rsrcid_to_token(int lookahead)
{ {
int token; int token;
char *type = "?"; const char *type = "?";
/* Get a token if we don't have one yet */ /* Get a token if we don't have one yet */
if(lookahead == YYEMPTY) if(lookahead == YYEMPTY)
......
...@@ -100,7 +100,7 @@ int read_data(FILE *fp, size_t size, void *buf) ...@@ -100,7 +100,7 @@ int read_data(FILE *fp, size_t size, void *buf)
* Remarks : * Remarks :
***************************************************************************** *****************************************************************************
*/ */
enum res_e res_type_from_id(name_id_t *nid) enum res_e res_type_from_id(const name_id_t *nid)
{ {
if(nid->type == name_str) if(nid->type == name_str)
return res_usr; return res_usr;
......
...@@ -204,14 +204,14 @@ char *xstrdup(const char *str) ...@@ -204,14 +204,14 @@ char *xstrdup(const char *str)
/* /*
***************************************************************************** *****************************************************************************
* Function : compare_name_id * Function : compare_name_id
* Syntax : int compare_name_id(name_id_t *n1, name_id_t *n2) * Syntax : int compare_name_id(const name_id_t *n1, const name_id_t *n2)
* Input : * Input :
* Output : * Output :
* Description : * Description :
* Remarks : * Remarks :
***************************************************************************** *****************************************************************************
*/ */
int compare_name_id(name_id_t *n1, name_id_t *n2) int compare_name_id(const name_id_t *n1, const name_id_t *n2)
{ {
if(n1->type == name_ord && n2->type == name_ord) if(n1->type == name_ord && n2->type == name_ord)
{ {
......
...@@ -41,7 +41,7 @@ void warning(const char *s, ...) __attribute__((format (printf, 1, 2))); ...@@ -41,7 +41,7 @@ void warning(const char *s, ...) __attribute__((format (printf, 1, 2)));
void chat(const char *s, ...) __attribute__((format (printf, 1, 2))); void chat(const char *s, ...) __attribute__((format (printf, 1, 2)));
char *dup_basename(const char *name, const char *ext); char *dup_basename(const char *name, const char *ext);
int compare_name_id(name_id_t *n1, name_id_t *n2); int compare_name_id(const name_id_t *n1, const name_id_t *n2);
string_t *convert_string(const string_t *str, enum str_e type, int codepage); string_t *convert_string(const string_t *str, enum str_e type, int codepage);
void free_string( string_t *str ); void free_string( string_t *str );
int check_unicode_conversion( const string_t *str_a, const string_t *str_w, int codepage ); int check_unicode_conversion( const string_t *str_a, const string_t *str_w, int codepage );
......
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