Re: compiler prob



On Thu, 18 Jul 2002, Martin Muellenberg wrote:

gcc -DHAVE_CONFIG_H -I. -I. -I..     -g -Wall -I/usr/lib/ViaVoice/include
`pkg-config --cflags gtk+-2.0` -c gtkdateiname.c
gtkdateiname.c: In function `dateiname_ok':
gtkdateiname.c:57: warning: assignment discards qualifiers from pointer
target
type

static
void dateiname_ok(GtkWidget *widget, FILEDATEN *fdaten)
{
    gchar *ausgewaehlt;

    ausgewaehlt = gtk_file_selection_get_filename(
 GTK_FILE_SELECTION(fdaten->gewaehlt));    /* THIS IS LINE 57 */

    if (strlen (ausgewaehlt) < fdaten->laenge)
        strcpy (fdaten->dateiname, ausgewaehlt);

    gtk_widget_destroy(fdaten->gewaehlt);
    gtk_main_quit();
}

The return from gtk_file_selection_get_filename is a const *gchar.
So you should replace the declaration

gchar *ausgewaehlt;

with

const gchar *ausgewaehlt;

(You are implicitly discarding the "const" qualifier by assigning the
filename returned by the file selection dialog to a plain *gchar
variable.  You're not allowed to modify ausgewaehlt.)

Allin Cottrell.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]