While adding FontBucket support to BinaryClock, I found an incredibly annoying bug in the FontBucket.c file. It concerns the routine FmValidFont, and the annoying thing is that a program built around the routine compiles well and all, but simply doesnt work.

Here is the original code excerpt from FontBucket.c:

Err FmValidFont(FmPtr fmPtr, FmFontID fmFontId)
{
FmParamType params;
Err err = 0;

if (fmPtr->localID) {
params.err = 0;
params.fmFontId = fmFontId;
params.version = kFontBucketVersion;

err = _FmCallFontBucket (fmPtr, FmValidateFontLaunchCode, &params);
}
return 0;
} /* FmValidFont */

As you can see, the developers forgot to return the value that FontBucket returns from the call. So, the routine always returns 0, meaning as much as nothing. The corrected version looks like this:


Err FmValidFont(FmPtr fmPtr, FmFontID fmFontId)
{
FmParamType params;
Err err = 0;

if (fmPtr->localID) {
params.err = 0;
params.fmFontId = fmFontId;
params.version = kFontBucketVersion;

err = _FmCallFontBucket (fmPtr, FmValidateFontLaunchCode, &params);
}
//BUG is here
return err; //was 0
} /* FmValidFont */

So, when developing with FontBucket, dont be angry about why FmValidFont doesnt work. Rather, read TamsPalm and fix the routine yourself;).

Related posts:

  1. Compiling FontBucket with PODS Part 4
  2. Compiling FontBucket with PODS Part 2
  3. Compiling FontBucket with PODS Part 3
  4. Using FontBucket with OnBoardC
  5. Compiling FontBucket with PODS 1.2

4 Responses to “A little bug in FontBucket.c, routine FmValidFont”

  1. Oh, some little faggot using four-letter-words!

    If i were the author of that sample, you’d better run as i’d kick your balls until you’d be choking from pubic hair. OK, in far future, when you have developed some…

    What is this bullshit blog? Are you trying to be cool by being insulting???

    You do not need to forward the corrected version to handshigh, i took care of this.

  2. Hi tampax,
    thank you for pointing this out; the comment slipped by my editing unnoticed. I am very sorry!

    By the way, you have pretty great posts. What about getting yourself an account here at TamsPalm so that your name can’t be abused?

    Best regards
    Tam Hanna

  3. Thanks. Tam.

    /john

  4. Hi,
    its always a pleasure to help!

    Best regards
    Tam Hanna

Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Subscribe without commenting

© 2013 TamsPalm - the Palm OS / web OS Blog Suffusion theme by Sayontan Sinha