[PD-cvs] pd/src d_soundfile.c, 1.4.4.11.2.10.2.27, 1.4.4.11.2.10.2.28

Mathieu Bouchard matju at users.sourceforge.net
Fri Jul 20 07:46:07 CEST 2007


Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18044

Modified Files:
      Tag: desiredata
	d_soundfile.c 
Log Message:
removed some MAXPDSTRING


Index: d_soundfile.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/d_soundfile.c,v
retrieving revision 1.4.4.11.2.10.2.27
retrieving revision 1.4.4.11.2.10.2.28
diff -C2 -d -r1.4.4.11.2.10.2.27 -r1.4.4.11.2.10.2.28
*** d_soundfile.c	20 Jul 2007 05:34:13 -0000	1.4.4.11.2.10.2.27
--- d_soundfile.c	20 Jul 2007 05:46:05 -0000	1.4.4.11.2.10.2.28
***************
*** 202,216 ****
      q.bytelimit = 0x7fffffff;
      if (headersize >= 0) { /* header detection overridden */
!         q.bigendian      = p->bigendian;
!         q.nchannels      = p->nchannels;
!         q.bytespersample = p->bytespersample;
!         q.bytelimit      = p->bytelimit;
      } else {
          char buf[MAXPDSTRING];
          int bytesread = read(fd, buf, READHDRSIZE);
          int format;
!         if (bytesread < 4)
!             goto badheader;
!         if (!strncmp(buf, ".snd", 4))      {format = FORMAT_NEXT; q.bigendian = 1;}
          else if (!strncmp(buf, "dns.", 4)) {format = FORMAT_NEXT; q.bigendian = 0;}
          else if (!strncmp(buf, "RIFF", 4)) {
--- 202,212 ----
      q.bytelimit = 0x7fffffff;
      if (headersize >= 0) { /* header detection overridden */
!         q = *p;
      } else {
          char buf[MAXPDSTRING];
          int bytesread = read(fd, buf, READHDRSIZE);
          int format;
!         if (bytesread < 4) goto badheader;
!         if      (!strncmp(buf, ".snd", 4)) {format = FORMAT_NEXT; q.bigendian = 1;}
          else if (!strncmp(buf, "dns.", 4)) {format = FORMAT_NEXT; q.bigendian = 0;}
          else if (!strncmp(buf, "RIFF", 4)) {
***************
*** 226,231 ****
              if (bytesread < (int)sizeof(t_nextstep)) goto badheader;
              q.nchannels = swap4(((t_nextstep *)buf)->nchans, swap);
!             format = swap4(((t_nextstep *)buf)->format, swap);
!             headersize = swap4(((t_nextstep *)buf)->onset, swap);
              if      (format == NS_FORMAT_LINEAR_16) q.bytespersample = 2;
              else if (format == NS_FORMAT_LINEAR_24) q.bytespersample = 3;
--- 222,227 ----
              if (bytesread < (int)sizeof(t_nextstep)) goto badheader;
              q.nchannels = swap4(((t_nextstep *)buf)->nchans, swap);
!             format      = swap4(((t_nextstep *)buf)->format, swap);
!             headersize  = swap4(((t_nextstep *)buf)->onset,  swap);
              if      (format == NS_FORMAT_LINEAR_16) q.bytespersample = 2;
              else if (format == NS_FORMAT_LINEAR_24) q.bytespersample = 3;
***************
*** 305,313 ****
      q.bytelimit -= q.bytesperchannel() * skipframes;
      if (q.bytelimit < 0) q.bytelimit = 0;
!     /* copy sample format back to caller */
!     p->bigendian      = q.bigendian;
!     p->nchannels      = q.nchannels;
!     p->bytespersample = q.bytespersample;
!     p->bytelimit      = q.bytelimit;
      return fd;
  badheader:
--- 301,305 ----
      q.bytelimit -= q.bytesperchannel() * skipframes;
      if (q.bytelimit < 0) q.bytelimit = 0;
!     *p = q;
      return fd;
  badheader:
***************
*** 452,460 ****
  static int create_soundfile(t_canvas *canvas, const char *filename, int filetype, int nframes, int bytespersample,
  int bigendian, int nchannels, int swap, float samplerate) {
!     char filenamebuf[MAXPDSTRING];
      char headerbuf[WRITEHDRSIZE];
      int fd, headersize = 0;
!     strncpy(filenamebuf, filename, MAXPDSTRING-10);
!     filenamebuf[MAXPDSTRING-10] = 0;
      if (filetype == FORMAT_NEXT) {
          t_nextstep *nexthdr = (t_nextstep *)headerbuf;
--- 444,451 ----
  static int create_soundfile(t_canvas *canvas, const char *filename, int filetype, int nframes, int bytespersample,
  int bigendian, int nchannels, int swap, float samplerate) {
!     char filenamebuf[strlen(filename)+10];
      char headerbuf[WRITEHDRSIZE];
      int fd, headersize = 0;
!     strcpy(filenamebuf, filename);
      if (filetype == FORMAT_NEXT) {
          t_nextstep *nexthdr = (t_nextstep *)headerbuf;





More information about the Pd-cvs mailing list