aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryan Jurish <mukau@users.sourceforge.net>2007-07-24 22:58:49 +0000
committerBryan Jurish <mukau@users.sourceforge.net>2007-07-24 22:58:49 +0000
commit193d0dc9ee102b6f8b29c05cb713e61fe8527983 (patch)
tree64e8b42352a9899200dd09a333fd8e892f120c93
parentcf40e844031c1035230e62fd88a0c42f7f617365 (diff)
+ v0.0.4: paranoia fixes in any2string.c
svn path=/trunk/externals/moocow/pdstring/; revision=8237
-rw-r--r--configure.in5
-rw-r--r--src/any2string.c16
2 files changed, 12 insertions, 9 deletions
diff --git a/configure.in b/configure.in
index 337a501..703fa8f 100644
--- a/configure.in
+++ b/configure.in
@@ -4,7 +4,7 @@ AC_PREREQ(2.5)
dnl Some handy macros
define([THE_PACKAGE_NAME], [pdstring])
-define([THE_PACKAGE_VERSION], [0.03])
+define([THE_PACKAGE_VERSION], [0.04])
define([THE_PACKAGE_AUTHOR], [moocow@ling.uni-potsdam.de])
AC_INIT(THE_PACKAGE_NAME, THE_PACKAGE_VERSION, THE_PACKAGE_AUTHOR)
@@ -146,7 +146,8 @@ then
LFLAGS="-export_dynamic -shared"
if test "$DEBUG" == "no"; then
#OFLAGS="-O6 -funroll-loops -fomit-frame-pointer -finline-limit-10000000"
- OFLAGS="-O6 -funroll-loops -fomit-frame-pointer"
+ #OFLAGS="-O2 -funroll-loops -fomit-frame-pointer"
+ OFLAGS="-O2"
else
OFLAGS="-g"
fi
diff --git a/src/any2string.c b/src/any2string.c
index 3bcaa3a..2f68667 100644
--- a/src/any2string.c
+++ b/src/any2string.c
@@ -4,7 +4,7 @@
* Author: Bryan Jurish <moocow@ling.uni-potsdam.de>
* Description: convert pd messages to strings
*
- * Copyright (c) 2004 Bryan Jurish.
+ * Copyright (c) 2004 - 2007 Bryan Jurish.
*
* For information on usage and redistribution, and for a DISCLAIMER OF ALL
* WARRANTIES, see the file "COPYING", in this distribution.
@@ -37,7 +37,7 @@
/*--------------------------------------------------------------------
* DEBUG
*--------------------------------------------------------------------*/
-//#define ANY2STRING_DEBUG 1
+#define ANY2STRING_DEBUG 1
#ifdef ANY2STRING_DEBUG
# define A2SDEBUG(x) x
@@ -78,7 +78,7 @@ typedef struct _any2string
static void any2string_anything(t_any2string *x, t_symbol *sel, int argc, t_atom *argv)
{
t_atom *a;
- char *text, *s;
+ char *text=NULL, *s, *s_max;
int len;
A2SDEBUG(post("-------any2string_anything()---------"));
@@ -88,12 +88,13 @@ static void any2string_anything(t_any2string *x, t_symbol *sel, int argc, t_atom
binbuf_clear(x->x_binbuf);
A2SDEBUG(post("any2string: binbuf_add()"));
binbuf_add(x->x_binbuf, argc, argv);
+ A2SDEBUG(startpost("any2string: binbuf_print: "));
A2SDEBUG(binbuf_print(x->x_binbuf));
A2SDEBUG(post("any2string: binbuf_gettext()"));
binbuf_gettext(x->x_binbuf, &text, &len);
A2SDEBUG(post("any2string: binbuf_gettext() = \"%s\" ; len=%d", text, len));
- text[len] = 0;
+ /*text[len] = 0;*/ /*-- ? avoid errors: free(): invalid next size(fast): [HEX_ADDRESS] */
/*-- get string length --*/
x->x_argc = len+1;
@@ -111,7 +112,7 @@ static void any2string_anything(t_any2string *x, t_symbol *sel, int argc, t_atom
x->x_alloc = x->x_argc;
}
- /*-- add selector --*/
+ /*-- add selector (maybe) --*/
a=x->x_argv;
if (sel != &s_float && sel != &s_list && sel != &s_) {
A2SDEBUG(post("any2string: for {...} //sel"));
@@ -129,7 +130,8 @@ static void any2string_anything(t_any2string *x, t_symbol *sel, int argc, t_atom
/*-- add binbuf text --*/
A2SDEBUG(post("any2string: for {...}"));
- for (s=text; *s; s++, a++) {
+ s_max = text+len;
+ for (s=text; s < s_max; s++, a++) {
A2SDEBUG(post("any2string: for: //SETFLOAT(a,'%c'=%d)", *s, *s));
SETFLOAT(a,*s);
}
@@ -139,7 +141,7 @@ static void any2string_anything(t_any2string *x, t_symbol *sel, int argc, t_atom
SETFLOAT(a,0);
A2SDEBUG(post("any2string: freebytes()"));
- freebytes(text, strlen(text));
+ freebytes(text, len);
/*
A2SDEBUG(post("any2string: binbuf_free()"));