|
|
04-14-2012
, 10:29 AM
|
|
|
Posts: 2,394 |
Thanked: 2,862 times |
Joined on Dec 2007
|
#3
|
counter<= (sizeof(xxx)-0
counter< (sizeof(xxx)-1
|
|
04-14-2012
, 12:10 PM
|
|
|
Posts: 331 |
Thanked: 259 times |
Joined on Jan 2011
@ Stockholm, Sweden
|
#4
|
xxx must be NULL terminated for the line after the pink code to not randomly crash. The pink code doesn't guarantee that. So, you might actually want to change:
toCode:counter<= (sizeof(xxx)-0
Code:counter< (sizeof(xxx)-1

|
|
04-14-2012
, 02:28 PM
|
|
|
Posts: 2,394 |
Thanked: 2,862 times |
Joined on Dec 2007
|
#5
|
char *mime_icon_name=NULL;
char mime_icon_name[50];
|
|
04-14-2012
, 03:21 PM
|
|
|
Posts: 331 |
Thanked: 259 times |
Joined on Jan 2011
@ Stockholm, Sweden
|
#6
|
mime_icon_name=NULL;
if ((mime_icon_name=strrchr(fullpath, '.'))==0)
mime_icon_name=g_strconcat (".noext-exe","\0",NULL);
mime_icon_name=g_strconcat (".noext","\0",NULL);
.. && (mime_icon_name[counter]!=0) mychar=mime_icon_name[counter]; xxx[counter]=(tolower(mychar));
|
|
04-14-2012
, 07:53 PM
|
|
|
Posts: 331 |
Thanked: 259 times |
Joined on Jan 2011
@ Stockholm, Sweden
|
#7
|
if (mime_icon_name!=NULL){ ...}

| The Following User Says Thank You to electroaudio For This Useful Post: | ||
![]() |
| Thread Tools | Search this Thread |
|
When the code in pink is commented out, then the routine seem to work very well, but when the part in pink is part of the compilation, then the program will crash (sort of..) randomly with error sigsegv-11
GdkPixbuf *get_pixbuf_file (gchar *fullpath) { GdkPixbuf *pixbuf=NULL; struct stat statbuf; int counter=0; char mychar; char xxx[50]; char *mime_icon_name=NULL; gchar *mime_icon_file=NULL; gchar *test; gchar *file_open; GtkIconTheme *icon_theme; char *ext = strrchr(fullpath, '.'); if (ext==NULL) ... if (strstr(ext,".desktop") && strstr(".desktop",ext)) ... if (strstr(fullpath, "/folder.png") && (fast_mode==0)) ... mime_icon_name=NULL; if ((mime_icon_name=strrchr(fullpath, '.'))==0) .. if ((statbuf.st_mode &S_IXUSR)) ... memset (xxx,0,sizeof(xxx)); for ( counter = 0 ; (counter<= (sizeof(xxx)-0)) && (mime_icon_name[counter]!=0) ; counter++ ){ mychar=mime_icon_name[counter]; xxx[counter]=(tolower(mychar)); } mime_icon_file=g_strconcat ("/home/user/.deskypplet/icons/",xxx+1,".png",NULL); if ((pixbuf=gdk_pixbuf_new_from_file_at_size(mime_icon_file,app->icon_x_size,app->icon_y_size,NULL))!=0) { return pixbuf; } else { pixbuf= gdk_pixbuf_new_from_file_at_size("/home/user/.deskypplet/icons/dummy.png",app->icon_x_size,app->icon_y_size,NULL); return pixbuf; } }Deskypplet , a desktop for N900 *RIP*
Last edited by electroaudio; 04-14-2012 at 07:56 PM.