mirror of
https://github.com/python/cpython
synced 2024-10-18 23:34:15 +00:00
Use c2pstr() in stead of Pstring() to convert C-strings to
Pascal-strings. Safer, because Pstring converts in-place and the pathname may be reused later for error messages.
This commit is contained in:
parent
27489d4c8c
commit
fd0226b327
|
@ -10,6 +10,7 @@
|
|||
#include "TFileSpec.h" /* for Path2FSSpec() */
|
||||
#endif
|
||||
#include <Files.h>
|
||||
#include <TextUtils.h>
|
||||
#include "macdefs.h"
|
||||
#include "macglue.h"
|
||||
|
||||
|
@ -56,12 +57,12 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname,
|
|||
#ifdef USE_GUSI1
|
||||
err = Path2FSSpec(pathname, &libspec);
|
||||
#else
|
||||
(void)FSMakeFSSpec(0, 0, Pstring(pathname), &libspec);
|
||||
c2pstrcpy((unsigned char *)buf, pathname);
|
||||
(void)FSMakeFSSpec(0, 0, (unsigned char *)buf, &libspec);
|
||||
err = ResolveAliasFile(&libspec, 1, &isfolder, &didsomething);
|
||||
#endif
|
||||
if ( err ) {
|
||||
sprintf(buf, "%.255s: %.200s",
|
||||
pathname, PyMac_StrError(err));
|
||||
sprintf(buf, "%.200s: %.200s", pathname, PyMac_StrError(err));
|
||||
PyErr_SetString(PyExc_ImportError, buf);
|
||||
return NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue