Dnia 2005-09-29 13:56, Christian Neumair napisał:
Am Donnerstag, den 29.09.2005, 13:39 +0200 schrieb Przemysław Sitek:
Dnia 2005-09-29 21:41, Colossus napisał:
Ok,
the correct way is to cast g_strerror to (char *):
response = ShowGtkMessageDialog (GTK_WINDOW
(MainWindow),GTK_DIALOG_MODAL,G
Am Donnerstag, den 29.09.2005, 13:39 +0200 schrieb Przemysław Sitek:
> Dnia 2005-09-29 21:41, Colossus napisał:
> > Ok,
> >
> > the correct way is to cast g_strerror to (char *):
> >
> > response = ShowGtkMessageDialog (GTK_WINDOW
> > (MainWindow),GTK_DIALOG_MODAL,GTK_MESSAGE_ERROR,GTK_BUTTONS_O
Dnia 2005-09-29 21:41, Colossus napisał:
Ok,
the correct way is to cast g_strerror to (char *):
response = ShowGtkMessageDialog (GTK_WINDOW
(MainWindow),GTK_DIALOG_MODAL,GTK_MESSAGE_ERROR,GTK_BUTTONS_OK,(char *)
g_strerror(errno));
This way i don't get any warning.
But it's still incorrec
Am Donnerstag, den 29.09.2005, 12:42 +0200 schrieb Christian Neumair:
> 1 foo (const void *bar);
and
> 2 foo (void **bar);
Should have a void retval. Sorry for the confusion.
--
Christian Neumair <[EMAIL PROTECTED]>
___
gtk-app-devel-list mailing lis
Am Mittwoch, den 28.09.2005, 21:44 -0400 schrieb Allin Cottrell:
> On Wed, 28 Sep 2005, David Rosal wrote:
>
> > Allin Cottrell wrote:
> >
> >> gchar *text = g_strdup_printf("banana %d", i);
> >> gtk_entry_set_text(GTK_ENTRY(entry), text);
> >> g_free(text);
> >
> > Is the above code really safe?
Ok,
the correct way is to cast g_strerror to (char *):
response = ShowGtkMessageDialog (GTK_WINDOW
(MainWindow),GTK_DIALOG_MODAL,GTK_MESSAGE_ERROR,GTK_BUTTONS_OK,(char
*) g_strerror(errno));
This way i don't get any warning.
Colossus wrote:
Hi,
I did as you suggested me but gcc 3.4.3 give
Hi,
I did as you suggested me but gcc 3.4.3 gives me this warning:
callbacks.c:605: warning: passing arg 5 of `ShowGtkMessageDialog'
discards qualifiers from pointer target type
and the line 605 is:
response = ShowGtkMessageDialog (GTK_WINDOW
(MainWindow),GTK_DIALOG_MODAL,GTK_MESSAGE_ERROR,G
Am Mittwoch, den 28.09.2005, 10:58 +0200 schrieb David Rosal:
> Colossus wrote:
> > Am I doing the same ( memory leaking ) with g_strdup_printf ?
Yes, of course. It also allocated new memory for you, but additionally
merges the ith (where ith > 1) argument of the g_strdup_printf into the
string as
Am Dienstag, den 27.09.2005, 17:53 +0200 schrieb David Rosal:
> gtk_entry_set_text(GTK_ENTRY(entry), g_strdup("banana");
>
> Am I leaking memory? (...)
> My question is: Is that memory chunk free'd before the program exits?
If I'm taken correctly, your OS is meant to free *all* memory you
allocat
On Wed, 28 Sep 2005, David Rosal wrote:
Allin Cottrell wrote:
gchar *text = g_strdup_printf("banana %d", i);
gtk_entry_set_text(GTK_ENTRY(entry), text);
g_free(text);
Is the above code really safe?
Yes! A function such as gtk_entry_set_text() is bound to make a
copy of the string offered
Colossus wrote:
Hi,
Am I doing the same ( memory leaking ) with g_strdup_printf ?
If so what is the better way to write the following code: ?
response = ShowGtkMessageDialog (GTK_WINDOW
(MainWindow),GTK_DIALOG_MODAL,GTK_MESSAGE_ERROR,GTK_BUTTONS_OK,
g_strdup_printf ("%s",g_strerror(er
David Rosal <[EMAIL PROTECTED]> writes:
> Allin Cottrell wrote:
>
>> gchar *text = g_strdup_printf("banana %d", i);
>> gtk_entry_set_text(GTK_ENTRY(entry), text);
>> g_free(text);
>
> Is the above code really safe?
>
> You're passing the address of "text" to the function
> gtk_entry_set_text(). N
Hi,
Am I doing the same ( memory leaking ) with g_strdup_printf ?
If so what is the better way to write the following code: ?
response = ShowGtkMessageDialog (GTK_WINDOW
(MainWindow),GTK_DIALOG_MODAL,GTK_MESSAGE_ERROR,GTK_BUTTONS_OK,
g_strdup_printf ("%s",g_strerror(errno)) );
David Rosal wrote:
Allin Cottrell wrote:
gchar *text = g_strdup_printf("banana %d", i);
gtk_entry_set_text(GTK_ENTRY(entry), text);
g_free(text);
Is the above code really safe?
You're passing the address of "text" to the function
gtk_entry_set_text(). Next you g_free() that address, so
Allin Cottrell wrote:
gchar *text = g_strdup_printf("banana %d", i);
gtk_entry_set_text(GTK_ENTRY(entry), text);
g_free(text);
Is the above code really safe?
You're passing the address of "text" to the function
gtk_entry_set_text(). Next you g_free() that address, so AFAIK the
memory manag
On Tue, 27 Sep 2005, David Rosal wrote:
I know this is a general C programming issue, but...
It is a memory leak to call g_strdup() as argument to other function?
For example, if I do this:
gtk_entry_set_text(GTK_ENTRY(entry), g_strdup("banana");
Am I leaking memory?
Yes, since the allocat
David Rosal wrote:
Hello.
I know this is a general C programming issue, but...
It is a memory leak to call g_strdup() as argument to other function?
For example, if I do this:
gtk_entry_set_text(GTK_ENTRY(entry), g_strdup("banana");
Am I leaking memory?
AFAIK, the above code makes glib (via
On Tue, 27 Sep 2005 17:53:17 +0200
David Rosal <[EMAIL PROTECTED]> wrote:
> Hello.
>
> I know this is a general C programming issue, but...
>
> It is a memory leak to call g_strdup() as argument to other function?
>
> For example, if I do this:
>
> gtk_entry_set_text(GTK_ENTRY(entry), g_strdup
18 matches
Mail list logo