[Gridflow-cvs] [svn] commit: r5678 - /trunk/src/gridflow.cxx

svn-gridflow at artengine.ca svn-gridflow at artengine.ca
Thu May 13 13:31:55 EDT 2010


Author: matju
Date: Thu May 13 13:31:50 2010
New Revision: 5678

Log:
remove useless space before comma when printing binbuf. fix crash in short_backtrace

Modified:
    trunk/src/gridflow.cxx

Modified: trunk/src/gridflow.cxx
==============================================================================
--- trunk/src/gridflow.cxx (original)
+++ trunk/src/gridflow.cxx Thu May 13 13:31:50 2010
@@ -737,8 +737,8 @@
 	if (!b) return "[???]";
 	std::ostringstream s;
 	int n = binbuf_getnatom(b);
-	t_atom *at = binbuf_getvec(b);
-	for (int i=0; i<n; i++) s << (i ? " " : "[") << at[i];
+	t_atom2 *at = (t_atom2 *)binbuf_getvec(b);
+	for (int i=0; i<n; i++) s << (i ? at[i].a_type==A_COMMA ? "" : " " : "[") << at[i];
 	s << "]";
 	return s.str();
 }
@@ -932,20 +932,20 @@
 	void *array[end];
 	int nSize = backtrace(array,end);
 	char **symbols = backtrace_symbols(array, nSize);
+	char *demangled = (char *)malloc(1024); size_t length=1024; int status;
 	for (int i=start,j=0; i<nSize; i++) {
 		char *a = strchr(symbols[i],'(');
 		char *b = strchr(symbols[i],'+');
 		if (a&&b) {
 			char mangled[1024]; sprintf(mangled,"%.*s",b-a-1,a+1);
-			char *demangled = (char *)malloc(1024);
-			size_t length;
-			int status;
-			/* char *result = */ abi::__cxa_demangle(mangled,demangled,&length,&status);
-			j+=sprintf(buf+j,"%s%.*s",i>start?", \n  ":"[",length,demangled);
-			free(demangled);
+			if (abi::__cxa_demangle(mangled,demangled,&length,&status))
+				j+=sprintf(buf+j,"%s%.*s",i>start?", \n  ":"[",length,demangled);
+			else
+			j+=sprintf(buf+j,"%s%s",  i>start?", \n  ":"[",symbols[i]);
 		}
 		else    j+=sprintf(buf+j,"%s%s",  i>start?", \n  ":"[",symbols[i]);
 	}
+	free(demangled);
 	sprintf(buf+strlen(buf),"]");
 	return buf;
 }



More information about the Gridflow-cvs mailing list