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

Re: GTK Progress bar: assistance pls.



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.


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