@@ -205,44 +205,44 @@ def getargsCheck(self, name):
205205static OSErr
206206_PyMac_GetFullPathname(FSSpec *fss, char *path, int len)
207207{
208- FSRef fsr;
209- OSErr err;
210-
211- *path = '\0 ';
212- err = FSpMakeFSRef(fss, &fsr);
213- if (err == fnfErr) {
214- /* FSSpecs can point to non-existing files, fsrefs can't. */
215- FSSpec fss2;
216- int tocopy;
217-
218- err = FSMakeFSSpec(fss->vRefNum, fss->parID, "", &fss2);
219- if (err)
220- return err;
221- err = FSpMakeFSRef(&fss2, &fsr);
222- if (err)
223- return err;
224- err = (OSErr)FSRefMakePath(&fsr, path, len-1);
225- if (err)
226- return err;
227- /* This part is not 100% safe: we append the filename part, but
228- ** I'm not sure that we don't run afoul of the various 8bit
229- ** encodings here. Will have to look this up at some point...
230- */
231- strcat(path, "/");
232- tocopy = fss->name[0];
233- if ((strlen(path) + tocopy) >= len)
234- tocopy = len - strlen(path) - 1;
235- if (tocopy > 0)
236- strncat(path, fss->name+1, tocopy);
237- }
238- else {
239- if (err)
240- return err;
241- err = (OSErr)FSRefMakePath(&fsr, path, len);
242- if (err)
243- return err;
244- }
245- return 0;
208+ FSRef fsr;
209+ OSErr err;
210+
211+ *path = '\0 ';
212+ err = FSpMakeFSRef(fss, &fsr);
213+ if (err == fnfErr) {
214+ /* FSSpecs can point to non-existing files, fsrefs can't. */
215+ FSSpec fss2;
216+ int tocopy;
217+
218+ err = FSMakeFSSpec(fss->vRefNum, fss->parID, "", &fss2);
219+ if (err)
220+ return err;
221+ err = FSpMakeFSRef(&fss2, &fsr);
222+ if (err)
223+ return err;
224+ err = (OSErr)FSRefMakePath(&fsr, path, len-1);
225+ if (err)
226+ return err;
227+ /* This part is not 100% safe: we append the filename part, but
228+ ** I'm not sure that we don't run afoul of the various 8bit
229+ ** encodings here. Will have to look this up at some point...
230+ */
231+ strcat(path, "/");
232+ tocopy = fss->name[0];
233+ if ((strlen(path) + tocopy) >= len)
234+ tocopy = len - strlen(path) - 1;
235+ if (tocopy > 0)
236+ strncat(path, fss->name+1, tocopy);
237+ }
238+ else {
239+ if (err)
240+ return err;
241+ err = (OSErr)FSRefMakePath(&fsr, path, len);
242+ if (err)
243+ return err;
244+ }
245+ return 0;
246246}
247247
248248"""
0 commit comments