diff options
author | IOhannes m zmölnig <zmoelnig@users.sourceforge.net> | 2007-03-06 17:33:12 +0000 |
---|---|---|
committer | IOhannes m zmölnig <zmoelnig@users.sourceforge.net> | 2007-03-06 17:33:12 +0000 |
commit | e93f7c8c547ea2ce4c72db9c7bafbc5ccfa68527 (patch) | |
tree | 58deb7035007899c77025a1f0891599cb767025c /src | |
parent | 1cc1b9c0e2740157195abf4424194808c9a2a6c6 (diff) |
increased the headroom for converting the buffer from the text-format to a binbuf-readable one;
LATER see how this is done in [textfile]
svn path=/trunk/externals/zexy/; revision=7472
Diffstat (limited to 'src')
-rw-r--r-- | src/msgfile.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/msgfile.c b/src/msgfile.c index c2ee54c..28077f8 100644 --- a/src/msgfile.c +++ b/src/msgfile.c @@ -531,6 +531,7 @@ static void msgfile_read2(t_msgfile *x, t_symbol *filename, t_symbol *format) char filnam[MAXPDSTRING], namebuf[MAXPDSTRING]; char buf[MAXPDSTRING], *bufptr, *readbuf; char *charbinbuf=NULL, *cbb; + int charbinbuflength=0; char*dirname=canvas_getdir(x->x_canvas)->s_name; int mode = x->mode; @@ -538,7 +539,6 @@ static void msgfile_read2(t_msgfile *x, t_symbol *filename, t_symbol *format) t_binbuf *bbuf = binbuf_new(); - #ifdef __WIN32__ rmode |= O_BINARY; #endif @@ -598,15 +598,17 @@ static void msgfile_read2(t_msgfile *x, t_symbol *filename, t_symbol *format) bufptr=readbuf; # define MSGFILE_HEADROOM 1024 + charbinbuflength=2*length+MSGFILE_HEADROOM; - charbinbuf=(char*)getbytes(length+MSGFILE_HEADROOM); + charbinbuf=(char*)getbytes(charbinbuflength); + cbb=charbinbuf; - for(pos=0; pos<length+MSGFILE_HEADROOM; pos++)charbinbuf[pos]=0; + for(pos=0; pos<charbinbuflength; pos++)charbinbuf[pos]=0; *cbb++=';'; pos=1; while (readlength--) { - if(pos>=length+MSGFILE_HEADROOM){ + if(pos>=charbinbuflength){ pd_error(x, "msgfile: read error (headroom %d too small!)", MSGFILE_HEADROOM); goto read_error; break; @@ -626,13 +628,13 @@ static void msgfile_read2(t_msgfile *x, t_symbol *filename, t_symbol *format) } /* convert to binbuf */ - binbuf_text(bbuf, charbinbuf, length+MSGFILE_HEADROOM); + binbuf_text(bbuf, charbinbuf, charbinbuflength); msgfile_binbuf2listbuf(x, bbuf); read_error: binbuf_free(bbuf); t_freebytes(readbuf, length); - t_freebytes(charbinbuf, length+MSGFILE_HEADROOM); + t_freebytes(charbinbuf, charbinbuflength); } static void msgfile_read(t_msgfile *x, t_symbol *filename, t_symbol *format) { |