[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: GTK Progress bar: assistance pls.
- From: vijayasarathy setsindia net
- To: "Dan H" <dunno stoptrick com>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: GTK Progress bar: assistance pls.
- Date: Mon, 7 Jan 2008 14:51:11 +0530 (IST)
IN REPLY TO DANS COMMENTS:
1. I am using the g++ compiler and g++ doesnt let a gpointer[return type
of g_malloc0()] or a void pointer point a gchar or a ProgressData pointer.
That is why the typecast.
2. I need more explanation here:
txt_start_count = (gchar
>> *)gtk_entry_get_text(GTK_ENTRY(wdgt_start_count));
>>
>
> Useless (possibly dangerous) cast, and you're leaking the memory
> g_malloced() above.
Why do you think memory is leaked ? I have already done a lookup_widget on
wdgt_start_count. gtk_entry_get_text() returns a const gchar * value while
mine is a gchar *, and that is why the typecast.
On Mon, January 7, 2008 2:03 pm, Dan H wrote:
>
> ------=neXtPaRt_1199694274
> Content-Type: text/plain; charset="us-ascii"
> Content-Transfer-Encoding: 7bit
>
>
> On Mon, 7 Jan 2008 13:18:07 +0530 (IST)
> vijayasarathy setsindia net wrote:
>
> [Stuff snipped]
>
>
> Some comments on your code, aside from the basic conceptual problems:
>
>
>
>> pdata = (ProgressData *)g_malloc0(sizeof(ProgressData));
>
> Useless cast, and useless parentheses around sizeof's operand.
>
>
>> txt_start_count = (gchar *) g_malloc0(50*sizeof(gchar));
>
> Same here.
>
>
>> txt_start_count = (gchar
>> *)gtk_entry_get_text(GTK_ENTRY(wdgt_start_count));
>>
>
> Useless (possibly dangerous) cast, and you're leaking the memory
> g_malloced() above.
>
> txt_end_count =
>> (gchar *)gtk_entry_get_text(GTK_ENTRY(wdgt_end_count));
>>
>
> Same here.
>
>
>>
>> start_count = atoi(txt_start_count); end_count = atoi(txt_end_count);
>
> Don't use atoi(). Use strtol() and do error checking.
>
>
> --D.
> _______________________________________________
> gtk-app-devel-list mailing list gtk-app-devel-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>
>
> ------=neXtPaRt_1199694274
> Content-Type: text/plain;
>
>
> *************************************************************************
> ************
> DISCLAIMER
> This e-mail and any files transmitted with it are for the sole use of the
> intended recipient(s) and may contain confidential and privileged
> information. Any use,distribution,copying or disclosure by any other
> person is strictly prohibited. If you have received this transmission in
> error please notify SETS immediately either by replying to this e-mail or
> by telephone +91-44-28205655 and then delete this e-mail. The sender does
> not accept any responsibility for any damage which you sustain as a
> result of software viruses or malicious programs. You should therefore
> scan attachments (if any) prior to opening them.
> *************************************************************************
> ***********
>
>
>
>
>
>
>
> ------=neXtPaRt_1199694274--
>
>
Vijayasarathy
Senior Research Associate
SETS
***************************************************************************
DISCLAIMER
This e-mail and any files transmitted with it are for the sole use of
the intended recipient(s) and may contain confidential and privileged
information. Any use, distribution, copying or disclosure by any other
person is strictly prohibited. If you have received this transmission
in error please notify SETS immediately either by replying to this e-mail
or
by telephone on +91-44-28205655 and then delete this e-mail.
The sender does not accept any responsibility for any damage which
you sustain as a result of software viruses or malicious programs.
You should therefore scan attachments (if any) prior to opening them.
**************************************************************************
*************************************************************************************
DISCLAIMER
This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information.
Any use,distribution,copying or disclosure by any other person is strictly prohibited. If you have received this transmission in error please notify SETS immediately either by replying to this e-mail or by telephone +91-44-28205655 and then delete this e-mail. The sender does not accept any responsibility for any damage which you sustain as a result of software viruses or malicious programs. You should therefore scan attachments (if any) prior to opening them.
************************************************************************************
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]