Skip to content

Conversation

@jepler
Copy link

@jepler jepler commented Jun 30, 2025

According to Inside Macintosh Volume (IV-148/149) this field must be set to 0 in order to use the name in ioNamePtr.

In my project I noticed that GetFInfo was unreliable. I think this is the cause.

Note: This is not the fix I'm using locally. I actually am using this:

static OSErr GetFInfo_fixed(ConstStr255Param fileName, short vRefNum,
    FInfo *fndrInfo) {
    ParamBlockRec pb = {
        .fileParam.ioVRefNum = vRefNum,
        .fileParam.ioNamePtr = (StringPtr)fileName,
    };
    OSErr err;
    err = PBGetFInfoSync(&pb);
    *fndrInfo = pb.fileParam.ioFlFndrInfo;
    return err;
}

That style of initialization causes ALL other fields to be zero-initialized, according to my understanding of C. However, it may be less compatible with older compilers and/or generate more code.

According to Inside Macintosh Volume (IV-148/149) this field must be
set to 0 in order to use the name in ioNamePtr.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant