Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 017e0ff

Browse files
committed
The PYD resource should now contain 2 strings: one for the ppc
fragment name and one for the cfm68k fragment name (Just). Also, some unused variables removed.
1 parent abdf93c commit 017e0ff

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

Mac/Python/macimport.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,16 @@ findnamedresource(
122122
ok = (h != NULL);
123123
if ( ok && dataptr != NULL ) {
124124
HLock(h);
125+
/* XXXX Unsafe if resource not correctly formatted! */
126+
#ifdef __CFM68K__
127+
/* for cfm68k we take the second pstring */
128+
*dataptr = *((*h)+(**h)+1);
129+
memcpy(dataptr+1, (*h)+(**h)+2, (int)*dataptr);
130+
#else
131+
/* for ppc we take the first pstring */
125132
*dataptr = **h;
126133
memcpy(dataptr+1, (*h)+1, (int)*dataptr);
134+
#endif
127135
HUnlock(h);
128136
}
129137
if ( filerh != -1 )
@@ -173,7 +181,7 @@ PyMac_LoadCodeResourceModule(name, pathname)
173181
char *name;
174182
char *pathname;
175183
{
176-
PyObject *m;
184+
PyObject *m, *d, *s;
177185
char funcname[258];
178186
char *lastdot, *shortname, *packagecontext;
179187
dl_funcptr p = NULL;
@@ -246,7 +254,7 @@ PyMac_LoadCodeResourceModule(name, pathname)
246254
"dynamic module not initialized properly");
247255
return NULL;
248256
}
249-
#if 0
257+
#if 1
250258
/* Remember the filename as the __file__ attribute */
251259
d = PyModule_GetDict(m);
252260
s = PyString_FromString(pathname);

0 commit comments

Comments
 (0)