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

This commit is contained in:
Daniel Marmier 2003-10-15 03:35:54 +00:00 committed by Alexandre Julliard
parent 3156df8539
commit f95be92d24
8 changed files with 17 additions and 15 deletions

View File

@ -2398,7 +2398,7 @@ void MSVCRT_setbuf(MSVCRT_FILE* file, char *buf)
char *MSVCRT_tmpnam(char *s) char *MSVCRT_tmpnam(char *s)
{ {
char tmpbuf[MAX_PATH]; char tmpbuf[MAX_PATH];
char* prefix = "TMP"; const char* prefix = "TMP";
if (!GetTempPathA(MAX_PATH,tmpbuf) || if (!GetTempPathA(MAX_PATH,tmpbuf) ||
!GetTempFileNameA(tmpbuf,prefix,0,MSVCRT_tmpname)) !GetTempFileNameA(tmpbuf,prefix,0,MSVCRT_tmpname))
{ {

View File

@ -335,12 +335,13 @@ static void test_exception(void)
if (pe) if (pe)
{ {
/* vector dtor, multiple elements */ /* vector dtor, multiple elements */
char name[] = "a constant";
*((int*)pe) = 3; *((int*)pe) = 3;
pe = (exception*)((int*)pe + 1); pe = (exception*)((int*)pe + 1);
call_func2(pexception_ctor, &pe[0], &e_name); call_func2(pexception_ctor, &pe[0], &e_name);
call_func2(pexception_ctor, &pe[1], &e_name); call_func2(pexception_ctor, &pe[1], &e_name);
call_func2(pexception_ctor, &pe[2], &e_name); call_func2(pexception_ctor, &pe[2], &e_name);
pe[3].name = "a constant"; pe[3].name = name;
pe[3].do_free = 1; /* Crash if we try to free this */ pe[3].do_free = 1; /* Crash if we try to free this */
call_func2(pexception_vector_dtor, pe, 3); /* Should delete all 3 and then pe block */ call_func2(pexception_vector_dtor, pe, 3); /* Should delete all 3 and then pe block */
} }

View File

@ -280,7 +280,7 @@ extern int mkstemps(char *template, int suffix_len);
# define _P_DETACH 4 # define _P_DETACH 4
#endif #endif
#ifndef HAVE_SPAWNVP #ifndef HAVE_SPAWNVP
extern int spawnvp(int mode, const char *cmdname, char *const argv[]); extern int spawnvp(int mode, const char *cmdname, const char * const argv[]);
#endif #endif
/* Interlocked functions */ /* Interlocked functions */

View File

@ -32,7 +32,7 @@
#endif #endif
#ifndef HAVE_SPAWNVP #ifndef HAVE_SPAWNVP
int spawnvp(int mode, const char *cmdname, char *const argv[]) int spawnvp(int mode, const char *cmdname, const char *const argv[])
{ {
#ifndef HAVE__SPAWNVP #ifndef HAVE__SPAWNVP
int pid = 0, status, wret; int pid = 0, status, wret;
@ -40,7 +40,7 @@ int spawnvp(int mode, const char *cmdname, char *const argv[])
if (mode == _P_OVERLAY) if (mode == _P_OVERLAY)
{ {
execvp(cmdname, argv); execvp(cmdname, (char **)argv);
return -1; /* if we get here it failed */ return -1; /* if we get here it failed */
} }
@ -54,7 +54,7 @@ int spawnvp(int mode, const char *cmdname, char *const argv[])
if (pid == 0) if (pid == 0)
{ {
sigaction( SIGPIPE, &dfl_act, NULL ); sigaction( SIGPIPE, &dfl_act, NULL );
execvp(cmdname, argv); execvp(cmdname, (char **)argv);
_exit(1); _exit(1);
} }

View File

@ -578,7 +578,7 @@ static int fork_and_wait( char *linker, char *link_name, char *path,
char *workdir, char *description ) char *workdir, char *description )
{ {
int pos = 0; int pos = 0;
char *argv[20]; const char *argv[20];
WINE_TRACE( "linker app='%s' link='%s' mode=%s " WINE_TRACE( "linker app='%s' link='%s' mode=%s "
"path='%s' args='%s' icon='%s' workdir='%s' descr='%s'\n", "path='%s' args='%s' icon='%s' workdir='%s' descr='%s'\n",

View File

@ -99,7 +99,7 @@ void strarray_free(strarray* arr)
free(arr); free(arr);
} }
void strarray_add(strarray* arr, char* str) void strarray_add(strarray* arr, const char* str)
{ {
if (arr->size == arr->maximum) if (arr->size == arr->maximum)
{ {
@ -109,10 +109,10 @@ void strarray_add(strarray* arr, char* str)
arr->base[arr->size++] = str; arr->base[arr->size++] = str;
} }
void spawn(strarray* arr) void spawn(const strarray* arr)
{ {
int i, status; int i, status;
char **argv = arr->base; const char **argv = arr->base;
if (verbose) if (verbose)
{ {

View File

@ -30,13 +30,13 @@ char *strmake(const char *fmt, ...);
typedef struct { typedef struct {
size_t maximum; size_t maximum;
size_t size; size_t size;
char** base; const char** base;
} strarray; } strarray;
strarray *strarray_alloc(void); strarray *strarray_alloc(void);
void strarray_free(strarray* arr); void strarray_free(strarray* arr);
void strarray_add(strarray* arr, char* str); void strarray_add(strarray* arr, const char* str);
void spawn(strarray* arr); void spawn(const strarray* arr);
extern int verbose; extern int verbose;

View File

@ -215,7 +215,7 @@ static const char *wrapper_code =
"}\n" "}\n"
; ;
static char *output_name = "a.out"; static const char *output_name = "a.out";
static strarray *arh_files, *dll_files, *lib_files, *llib_paths, *lib_paths, *obj_files; static strarray *arh_files, *dll_files, *lib_files, *llib_paths, *lib_paths, *obj_files;
static int keep_generated = 0; static int keep_generated = 0;
@ -345,7 +345,8 @@ static void add_lib_file(const char* library)
static void create_the_wrapper(char* base_file, char* base_name, char* app_name, int gui_mode) static void create_the_wrapper(char* base_file, char* base_name, char* app_name, int gui_mode)
{ {
char *wrp_temp_name, *wspec_name, *wspec_c_name, *wspec_o_name; char *wrp_temp_name, *wspec_name, *wspec_c_name, *wspec_o_name;
char *wrap_c_name, *wrap_o_name, *dlls = ""; char *wrap_c_name, *wrap_o_name;
const char *dlls = "";
strarray *wwrap_args, *wspec_args, *wcomp_args, *wlink_args; strarray *wwrap_args, *wspec_args, *wcomp_args, *wlink_args;
int i; int i;