[Python-checkins] CVS: python/dist/src/Objects stringobject.c,2.140,2.141
Tim Peters
tim_one@users.sourceforge.net
Wed, 28 Nov 2001 12:27:44 -0800
- Previous message: [Python-checkins] CVS: python/dist/src/Demo/pysvr pysvr.c,1.9,1.10
- Next message: [Python-checkins] CVS: python/dist/src/Modules _hotshot.c,1.9,1.10 _localemodule.c,2.24,2.25 _testcapimodule.c,1.13,1.14 _tkinter.c,1.119,1.120 arraymodule.c,2.64,2.65 flmodule.c,1.45,1.46 gdbmmodule.c,2.30,2.31 pcremodule.c,2.28,2.29 posixmodule.c,2.209,2.210 pyexpat.c,2.55,2.56 readline.c,2.40,2.41 socketmodule.c,1.197,1.198 stropmodule.c,2.82,2.83
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/python/python/dist/src/Objects
In directory usw-pr-cvs1:/tmp/cvs-serv5054/python/Objects
Modified Files:
stringobject.c
Log Message:
sprintf -> PyOS_snprintf in some "obviously safe" cases.
Also changed <>-style #includes to ""-style in some places where the
former didn't make sense.
Index: stringobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v
retrieving revision 2.140
retrieving revision 2.141
diff -C2 -d -r2.140 -r2.141
*** stringobject.c 2001/10/22 04:12:44 2.140
--- stringobject.c 2001/11/28 20:27:42 2.141
***************
*** 2877,2881 ****
if (type == 'f' && fabs(x)/1e25 >= 1e25)
type = 'g';
! sprintf(fmt, "%%%s.%d%c", (flags&F_ALT) ? "#" : "", prec, type);
/* worst case length calc to ensure no buffer overrun:
fmt = %#.<prec>g
--- 2877,2883 ----
if (type == 'f' && fabs(x)/1e25 >= 1e25)
type = 'g';
! PyOS_snprintf(fmt, sizeof(fmt), "%%%s.%d%c",
! (flags&F_ALT) ? "#" : "",
! prec, type);
/* worst case length calc to ensure no buffer overrun:
fmt = %#.<prec>g
***************
*** 2890,2894 ****
return -1;
}
! sprintf(buf, fmt, x);
return strlen(buf);
}
--- 2892,2896 ----
return -1;
}
! PyOS_snprintf(buf, buflen, fmt, x);
return strlen(buf);
}
***************
*** 3048,3052 ****
if (prec < 0)
prec = 1;
! sprintf(fmt, "%%%s.%dl%c", (flags&F_ALT) ? "#" : "", prec, type);
/* buf = '+'/'-'/'0'/'0x' + '[0-9]'*max(prec, len(x in octal))
worst case buf = '0x' + [0-9]*prec, where prec >= 11 */
--- 3050,3056 ----
if (prec < 0)
prec = 1;
! PyOS_snprintf(fmt, sizeof(fmt), "%%%s.%dl%c",
! (flags&F_ALT) ? "#" : "",
! prec, type);
/* buf = '+'/'-'/'0'/'0x' + '[0-9]'*max(prec, len(x in octal))
worst case buf = '0x' + [0-9]*prec, where prec >= 11 */
***************
*** 3056,3060 ****
return -1;
}
! sprintf(buf, fmt, x);
/* When converting 0 under %#x or %#X, C leaves off the base marker,
* but we want it (for consistency with other %#x conversions, and
--- 3060,3064 ----
return -1;
}
! PyOS_snprintf(buf, buflen, fmt, x);
/* When converting 0 under %#x or %#X, C leaves off the base marker,
* but we want it (for consistency with other %#x conversions, and
- Previous message: [Python-checkins] CVS: python/dist/src/Demo/pysvr pysvr.c,1.9,1.10
- Next message: [Python-checkins] CVS: python/dist/src/Modules _hotshot.c,1.9,1.10 _localemodule.c,2.24,2.25 _testcapimodule.c,1.13,1.14 _tkinter.c,1.119,1.120 arraymodule.c,2.64,2.65 flmodule.c,1.45,1.46 gdbmmodule.c,2.30,2.31 pcremodule.c,2.28,2.29 posixmodule.c,2.209,2.210 pyexpat.c,2.55,2.56 readline.c,2.40,2.41 socketmodule.c,1.197,1.198 stropmodule.c,2.82,2.83
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]