[Python-checkins] CVS: python/dist/src/Modules structmodule.c,2.49,2.50

Tim Peters tim_one@users.sourceforge.net
Fri, 14 Sep 2001 19:35:17 -0700


Update of /cvsroot/python/python/dist/src/Modules
In directory usw-pr-cvs1:/tmp/cvs-serv24968/python/Modules

Modified Files:
	structmodule.c 
Log Message:
The 'p' (Pascal string) pack code acts unreasonably when the string size
and count exceed 255.  Changed to preserve as much of the string as
possible (instead of count%256 characters).


Index: structmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/structmodule.c,v
retrieving revision 2.49
retrieving revision 2.50
diff -C2 -d -r2.49 -r2.50
*** structmodule.c	2001/07/18 20:47:31	2.49
--- structmodule.c	2001/09/15 02:35:15	2.50
***************
*** 1361,1364 ****
--- 1361,1366 ----
  					/* no real need, just to be nice */
  					memset(res+1+n, '\0', num-n);
+ 				if (n > 255)
+ 					n = 255;
  				*res++ = n; /* store the length byte */
  				res += num;