[PD-cvs] externals/iemlib/src/iemlib2 mergefilename.c,1.6,1.7

musil tmusil at users.sourceforge.net
Thu Nov 9 19:35:50 CET 2006


Update of /cvsroot/pure-data/externals/iemlib/src/iemlib2
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25225/iemlib/src/iemlib2

Modified Files:
	mergefilename.c 
Log Message:
changed maxsize of symbol strings

Index: mergefilename.c
===================================================================
RCS file: /cvsroot/pure-data/externals/iemlib/src/iemlib2/mergefilename.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** mergefilename.c	7 Nov 2006 17:11:40 -0000	1.6
--- mergefilename.c	9 Nov 2006 18:35:48 -0000	1.7
***************
*** 22,27 ****
    t_object x_obj;
    char     x_sep[2];
!   char     *x_mem;
!   t_int    x_size;
  } t_mergefilename;
  
--- 22,26 ----
    t_object x_obj;
    char     x_sep[2];
!   char     x_mem[MAXPDSTRING];  /* miller WHY ???? */
  } t_mergefilename;
  
***************
*** 90,146 ****
    if(ac > 0)
    {
!     if(IS_A_SYMBOL(av, 0))
!     {
!       length = strlen(av->a_w.w_symbol->s_name);
!       if((length + accu_size) >= (x->x_size-2))
!       {
!         x->x_mem = (char *)resizebytes(x->x_mem, x->x_size*sizeof(char), 2*(length + accu_size)*sizeof(char));
!         x->x_size = 2*(length + accu_size);
!       }
!       strcat(x->x_mem, av->a_w.w_symbol->s_name);
!       accu_size += length;
!     }
!     else if(IS_A_FLOAT(av, 0))
      {
!       sprintf(flt_buf, "%g", av->a_w.w_float);
!       length = strlen(flt_buf);
!       if((length + accu_size) >= (x->x_size-2))
        {
!         x->x_mem = (char *)resizebytes(x->x_mem, x->x_size*sizeof(char), 2*(length + accu_size)*sizeof(char));
!         x->x_size = 2*(length + accu_size);
        }
!       strcat(x->x_mem, flt_buf);
!       accu_size += length;
!     }
!   }
!   
!   if(ac > 1)
!   {
!     for(i=1; i<ac; i++)
!     {
!       av++;
!       strcat(x->x_mem, x->x_sep);
!       if(IS_A_SYMBOL(av, 0))
        {
          length = strlen(av->a_w.w_symbol->s_name);
!         if((length + accu_size) >= (x->x_size-2))
          {
!           x->x_mem = (char *)resizebytes(x->x_mem, x->x_size*sizeof(char), 2*(length + accu_size)*sizeof(char));
!           x->x_size = 2*(length + accu_size);
          }
-         strcat(x->x_mem, av->a_w.w_symbol->s_name);
-         accu_size += length;
        }
!       else if(IS_A_FLOAT(av, 0))
        {
          sprintf(flt_buf, "%g", av->a_w.w_float);
          length = strlen(flt_buf);
!         if((length + accu_size) >= (x->x_size-2))
          {
!           x->x_mem = (char *)resizebytes(x->x_mem, x->x_size*sizeof(char), 2*(length + accu_size)*sizeof(char));
!           x->x_size = 2*(length + accu_size);
          }
-         strcat(x->x_mem, flt_buf);
-         accu_size += length;
        }
      }
--- 89,129 ----
    if(ac > 0)
    {
!     for(i=0; i<ac; i++)
      {
!       if(i > 0)
        {
!         strcat(x->x_mem, x->x_sep);
        }
! 
!       if(IS_A_SYMBOL(av, i))
        {
          length = strlen(av->a_w.w_symbol->s_name);
!         if((accu_size + length) > (MAXPDSTRING - 2))
          {
!           strncat(x->x_mem, av->a_w.w_symbol->s_name, MAXPDSTRING - 2 - accu_size);
!           accu_size = MAXPDSTRING - 2;
!           i = ac + 1;
!         }
!         else
!         {
!           strcat(x->x_mem, av->a_w.w_symbol->s_name);
!           accu_size += length;
          }
        }
!       else if(IS_A_FLOAT(av, i))
        {
          sprintf(flt_buf, "%g", av->a_w.w_float);
          length = strlen(flt_buf);
!         if((accu_size + length) > (MAXPDSTRING - 2))
          {
!           strncat(x->x_mem, flt_buf, MAXPDSTRING - 2 - accu_size);
!           accu_size = MAXPDSTRING - 2;
!           i = ac + 1;
!         }
!         else
!         {
!           strcat(x->x_mem, flt_buf);
!           accu_size += length;
          }
        }
      }
***************
*** 156,166 ****
    x->x_mem[0] = 0;
    length = strlen(s->s_name);
!   if((length + accu_size) >= (x->x_size-2))
    {
!     x->x_mem = (char *)resizebytes(x->x_mem, x->x_size*sizeof(char), 2*(length + accu_size)*sizeof(char));
!     x->x_size = 2*(length + accu_size);
    }
!   strcat(x->x_mem, s->s_name);
!   accu_size += length;
    if(ac > 0)
    {
--- 139,154 ----
    x->x_mem[0] = 0;
    length = strlen(s->s_name);
!   if(length > (MAXPDSTRING - 2))
    {
!     strncat(x->x_mem, s->s_name, MAXPDSTRING - 2);
!     accu_size = MAXPDSTRING - 2;
!     i = ac + 1;
    }
!   else
!   {
!     strcat(x->x_mem, s->s_name);
!     accu_size = length;
!   }
! 
    if(ac > 0)
    {
***************
*** 168,195 ****
      {
        strcat(x->x_mem, x->x_sep);
!       if(IS_A_SYMBOL(av, 0))
        {
          length = strlen(av->a_w.w_symbol->s_name);
!         if((length + accu_size) >= (x->x_size-2))
          {
!           x->x_mem = (char *)resizebytes(x->x_mem, x->x_size*sizeof(char), 2*(length + accu_size)*sizeof(char));
!           x->x_size = 2*(length + accu_size);
          }
-         strcat(x->x_mem, av->a_w.w_symbol->s_name);
-         accu_size += length;
        }
!       else if(IS_A_FLOAT(av, 0))
        {
          sprintf(flt_buf, "%g", av->a_w.w_float);
          length = strlen(flt_buf);
!         if((length + accu_size) >= (x->x_size-2))
          {
!           x->x_mem = (char *)resizebytes(x->x_mem, x->x_size*sizeof(char), 2*(length + accu_size)*sizeof(char));
!           x->x_size = 2*(length + accu_size);
          }
-         strcat(x->x_mem, flt_buf);
-         accu_size += length;
        }
-       av++;
      }
    }
--- 156,190 ----
      {
        strcat(x->x_mem, x->x_sep);
!       if(IS_A_SYMBOL(av, i))
        {
          length = strlen(av->a_w.w_symbol->s_name);
!         if((accu_size + length) > (MAXPDSTRING - 2))
          {
!           strncat(x->x_mem, av->a_w.w_symbol->s_name, MAXPDSTRING - 2 - accu_size);
!           accu_size = MAXPDSTRING - 2;
!           i = ac + 1;
!         }
!         else
!         {
!           strcat(x->x_mem, av->a_w.w_symbol->s_name);
!           accu_size += length;
          }
        }
!       else if(IS_A_FLOAT(av, i))
        {
          sprintf(flt_buf, "%g", av->a_w.w_float);
          length = strlen(flt_buf);
!         if((accu_size + length) > (MAXPDSTRING - 2))
          {
!           strncat(x->x_mem, flt_buf, MAXPDSTRING - 2 - accu_size);
!           accu_size = MAXPDSTRING - 2;
!           i = ac + 1;
!         }
!         else
!         {
!           strcat(x->x_mem, flt_buf);
!           accu_size += length;
          }
        }
      }
    }
***************
*** 199,203 ****
  static void mergefilename_free(t_mergefilename *x)
  {
-   freebytes(x->x_mem, x->x_size*sizeof(char));
  }
  
--- 194,197 ----
***************
*** 210,215 ****
    if(ac > 0)
      mergefilename_separator(x, s, ac, av);
!   x->x_size = 400;
!   x->x_mem = (char *)getbytes(x->x_size*sizeof(char));
    outlet_new(&x->x_obj, &s_symbol);
    return (x);
--- 204,208 ----
    if(ac > 0)
      mergefilename_separator(x, s, ac, av);
!   x->x_mem[0] = 0;
    outlet_new(&x->x_obj, &s_symbol);
    return (x);





More information about the Pd-cvs mailing list