[Python-checkins] CVS: python/dist/src/Python dynload_mac.c,2.11,2.12 dynload_next.c,2.8,2.9 dynload_os2.c,2.6,2.7 dynload_shlib.c,2.12,2.13 dynload_win.c,2.9,2.10
Jeremy Hylton
jhylton@users.sourceforge.net
Wed, 28 Nov 2001 12:40:49 -0800
Update of /cvsroot/python/python/dist/src/Python
In directory usw-pr-cvs1:/tmp/cvs-serv9366/Python
Modified Files:
dynload_mac.c dynload_next.c dynload_os2.c dynload_shlib.c
dynload_win.c
Log Message:
Use PyOS_snprintf instead of sprintf.
Index: dynload_mac.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/dynload_mac.c,v
retrieving revision 2.11
retrieving revision 2.12
diff -C2 -d -r2.11 -r2.12
*** dynload_mac.c 2001/01/19 23:34:06 2.11
--- dynload_mac.c 2001/11/28 20:40:47 2.12
***************
*** 67,71 ****
#endif
if ( err ) {
! sprintf(buf, "%.200s: %.200s", pathname, PyMac_StrError(err));
PyErr_SetString(PyExc_ImportError, buf);
return NULL;
--- 67,72 ----
#endif
if ( err ) {
! PyOS_snprintf(buf, sizeof(buf),
! "%.200s: %.200s", pathname, PyMac_StrError(err));
PyErr_SetString(PyExc_ImportError, buf);
return NULL;
***************
*** 92,97 ****
*/
if (errMessage[0] == 10 && strncmp((char *)errMessage+1, "PythonCore", 10) == 0 ) {
! sprintf(buf, "Dynamic module was built for %s version of MacPython",
! (err == cfragImportTooOldErr ? "a newer" : "an older"));
PyErr_SetString(PyExc_ImportError, buf);
return NULL;
--- 93,99 ----
*/
if (errMessage[0] == 10 && strncmp((char *)errMessage+1, "PythonCore", 10) == 0 ) {
! PyOS_snprintf(buf, sizeof(buf),
! "Dynamic module was built for %s version of MacPython",
! (err == cfragImportTooOldErr ? "a newer" : "an older"));
PyErr_SetString(PyExc_ImportError, buf);
return NULL;
***************
*** 99,103 ****
}
if ( err ) {
! sprintf(buf, "%.*s: %.200s",
errMessage[0], errMessage+1,
PyMac_StrError(err));
--- 101,105 ----
}
if ( err ) {
! PyOS_snprintf(buf, sizeof(buf), "%.*s: %.200s",
errMessage[0], errMessage+1,
PyMac_StrError(err));
***************
*** 106,114 ****
}
/* Locate the address of the correct init function */
! sprintf(funcname, "init%.200s", shortname);
err = FindSymbol(connID, Pstring(funcname), &symAddr, &class);
if ( err ) {
! sprintf(buf, "%s: %.200s",
! funcname, PyMac_StrError(err));
PyErr_SetString(PyExc_ImportError, buf);
return NULL;
--- 108,116 ----
}
/* Locate the address of the correct init function */
! PyOS_snprintf(funcname, sizeof(funcname), "init%.200s", shortname);
err = FindSymbol(connID, Pstring(funcname), &symAddr, &class);
if ( err ) {
! PyOS_snprintf(buf, sizeof(buf), "%s: %.200s",
! funcname, PyMac_StrError(err));
PyErr_SetString(PyExc_ImportError, buf);
return NULL;
Index: dynload_next.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/dynload_next.c,v
retrieving revision 2.8
retrieving revision 2.9
diff -C2 -d -r2.8 -r2.9
*** dynload_next.c 2001/08/11 21:54:11 2.8
--- dynload_next.c 2001/11/28 20:40:47 2.9
***************
*** 45,49 ****
char funcname[258];
! sprintf(funcname, "_init%.200s", shortname);
#ifdef USE_RLD
--- 45,49 ----
char funcname[258];
! PyOS_snprintf(funcname, sizeof(funcname), "_init%.200s", shortname);
#ifdef USE_RLD
Index: dynload_os2.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/dynload_os2.c,v
retrieving revision 2.6
retrieving revision 2.7
diff -C2 -d -r2.6 -r2.7
*** dynload_os2.c 2001/11/28 11:47:00 2.6
--- dynload_os2.c 2001/11/28 20:40:47 2.7
***************
*** 32,43 ****
if (rc != NO_ERROR) {
char errBuf[256];
! sprintf(errBuf,
! "DLL load failed, rc = %d: %.200s",
! rc, failreason);
PyErr_SetString(PyExc_ImportError, errBuf);
return NULL;
}
! sprintf(funcname, "init%.200s", shortname);
rc = DosQueryProcAddr(hDLL, 0L, funcname, &p);
if (rc != NO_ERROR)
--- 32,43 ----
if (rc != NO_ERROR) {
char errBuf[256];
! PyOS_snprintf(errBuf, sizeof(errBuf),
! "DLL load failed, rc = %d: %.200s",
! rc, failreason);
PyErr_SetString(PyExc_ImportError, errBuf);
return NULL;
}
! PyOS_snprintf(funcname, sizeof(funcname), "init%.200s", shortname);
rc = DosQueryProcAddr(hDLL, 0L, funcname, &p);
if (rc != NO_ERROR)
Index: dynload_shlib.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/dynload_shlib.c,v
retrieving revision 2.12
retrieving revision 2.13
diff -C2 -d -r2.12 -r2.13
*** dynload_shlib.c 2001/10/18 21:24:04 2.12
--- dynload_shlib.c 2001/11/28 20:40:47 2.13
***************
*** 58,66 ****
if (strchr(pathname, '/') == NULL) {
/* Prefix bare filename with "./" */
! sprintf(pathbuf, "./%-.255s", pathname);
pathname = pathbuf;
}
! sprintf(funcname, LEAD_UNDERSCORE "init%.200s", shortname);
if (fp != NULL) {
--- 58,67 ----
if (strchr(pathname, '/') == NULL) {
/* Prefix bare filename with "./" */
! PyOS_snprintf(pathbuf, sizeof(pathbuf), "./%-.255s", pathname);
pathname = pathbuf;
}
! PyOS_snprintf(funcname, sizeof(funcname),
! LEAD_UNDERSCORE "init%.200s", shortname);
if (fp != NULL) {
Index: dynload_win.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/dynload_win.c,v
retrieving revision 2.9
retrieving revision 2.10
diff -C2 -d -r2.9 -r2.10
*** dynload_win.c 2001/11/28 11:47:00 2.9
--- dynload_win.c 2001/11/28 20:40:47 2.10
***************
*** 160,164 ****
char funcname[258], *import_python;
! sprintf(funcname, "init%.200s", shortname);
#ifdef MS_WIN32
--- 160,164 ----
char funcname[258], *import_python;
! PyOS_snprintf(funcname, sizeof(funcname), "init%.200s", shortname);
#ifdef MS_WIN32
***************
*** 202,208 ****
This should not happen if called correctly. */
if (theLength == 0) {
! sprintf(errBuf,
! "DLL load failed with error code %d",
! errorCode);
} else {
size_t len;
--- 202,208 ----
This should not happen if called correctly. */
if (theLength == 0) {
! PyOS_snprintf(errBuf, sizeof(errBuf),
! "DLL load failed with error code %d",
! errorCode);
} else {
size_t len;
***************
*** 226,230 ****
char buffer[256];
! sprintf(buffer,"python%d%d.dll",
PY_MAJOR_VERSION,PY_MINOR_VERSION);
import_python = GetPythonImport(hDLL);
--- 226,230 ----
char buffer[256];
! PyOS_snprintf(buffer, sizeof(buffer), "python%d%d.dll",
PY_MAJOR_VERSION,PY_MINOR_VERSION);
import_python = GetPythonImport(hDLL);
***************
*** 232,239 ****
if (import_python &&
strcasecmp(buffer,import_python)) {
! sprintf(buffer,
! "Module use of %.150s conflicts "
! "with this version of Python.",
! import_python);
PyErr_SetString(PyExc_ImportError,buffer);
FreeLibrary(hDLL);
--- 232,239 ----
if (import_python &&
strcasecmp(buffer,import_python)) {
! PyOS_snprintf(buffer, sizeof(buffer),
! "Module use of %.150s conflicts "
! "with this version of Python.",
! import_python);
PyErr_SetString(PyExc_ImportError,buffer);
FreeLibrary(hDLL);
***************
*** 252,256 ****
{
/* Prefix bare filename with ".\" */
! sprintf(pathbuf, ".\\%-.13s", pathname);
pathname = pathbuf;
}
--- 252,257 ----
{
/* Prefix bare filename with ".\" */
! PyOS_snprintf(pathbuf, sizeof(pathbuf),
! ".\\%-.13s", pathname);
pathname = pathbuf;
}
***************
*** 258,263 ****
if (hDLL < HINSTANCE_ERROR){
char errBuf[256];
! sprintf(errBuf,
! "DLL load failed with error code %d", hDLL);
PyErr_SetString(PyExc_ImportError, errBuf);
return NULL;
--- 259,265 ----
if (hDLL < HINSTANCE_ERROR){
char errBuf[256];
! PyOS_snprintf(errBuf, sizeof(errBuf),
! "DLL load failed with error code %d",
! hDLL);
PyErr_SetString(PyExc_ImportError, errBuf);
return NULL;