comparison Python/dynload_mac.c @ 15537:50358d64dc43 legacy-trunk

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.
author Jack Jansen <jack.jansen@cwi.nl>
date Tue, 12 Dec 2000 22:36:57 +0000
parents 6f6f965c5e2d
children 90992c82d46e
comparison
equal deleted inserted replaced
15536:c59f645daede 15537:50358d64dc43
8 #include <CodeFragments.h> 8 #include <CodeFragments.h>
9 #ifdef USE_GUSI1 9 #ifdef USE_GUSI1
10 #include "TFileSpec.h" /* for Path2FSSpec() */ 10 #include "TFileSpec.h" /* for Path2FSSpec() */
11 #endif 11 #endif
12 #include <Files.h> 12 #include <Files.h>
13 #include <TextUtils.h>
13 #include "macdefs.h" 14 #include "macdefs.h"
14 #include "macglue.h" 15 #include "macglue.h"
15 16
16 17
17 const struct filedescr _PyImport_DynLoadFiletab[] = { 18 const struct filedescr _PyImport_DynLoadFiletab[] = {
54 55
55 /* First resolve any aliases to find the real file */ 56 /* First resolve any aliases to find the real file */
56 #ifdef USE_GUSI1 57 #ifdef USE_GUSI1
57 err = Path2FSSpec(pathname, &libspec); 58 err = Path2FSSpec(pathname, &libspec);
58 #else 59 #else
59 (void)FSMakeFSSpec(0, 0, Pstring(pathname), &libspec); 60 c2pstrcpy((unsigned char *)buf, pathname);
61 (void)FSMakeFSSpec(0, 0, (unsigned char *)buf, &libspec);
60 err = ResolveAliasFile(&libspec, 1, &isfolder, &didsomething); 62 err = ResolveAliasFile(&libspec, 1, &isfolder, &didsomething);
61 #endif 63 #endif
62 if ( err ) { 64 if ( err ) {
63 sprintf(buf, "%.255s: %.200s", 65 sprintf(buf, "%.200s: %.200s", pathname, PyMac_StrError(err));
64 pathname, PyMac_StrError(err));
65 PyErr_SetString(PyExc_ImportError, buf); 66 PyErr_SetString(PyExc_ImportError, buf);
66 return NULL; 67 return NULL;
67 } 68 }
68 /* Next, determine the fragment name, 69 /* Next, determine the fragment name,
69 by stripping '.slb' and 'module' */ 70 by stripping '.slb' and 'module' */