One of our applications needs to use TxtParamString. Since it wasn't
available until OS 3.5, and our app runs on 3.0 or later, we use
TxtGlueParamString instead. It's always worked perfectly, and we've never
had a complaint about it, until yesterday. A customer is running our app on
a Sony S300, which he says is running 3.5.2. When it gets to the
TxtGlueParamString call, it crashes his handheld. Running this in the
CLIEpose emulator (which reports the OS version to be 3.5.1), I am told that
our application:

... is close to overflowing the stack. The functions currently using the
stack are: IntlGetRoutineAddressPatch(0), IntlGetRoutineAddressPatch(10),
IntlGetRoutineAddressPatch(10), IntlGetRoutineAddressPatch(10)....

This does not happen on the Palm OS 3.0 or 3.5 emulator, so it seems to
somehow be specific to the S300. If I change the code to call TxtParamString
instead of TxtGlueParamString, it works just fine. But of course, I can't
leave it that way, because we need to support older devices.

The problem is that Sony's 3.5.x ROM has a bug in it. They patched IntlDisplatch to support the TxtConvertEncoding call needed by their early release of VFS, but when this patched version is called to handle IntlGetRoutineAddress(), it calls IntlGetRoutineAddress() versus the pre-patched version. So you wind up in an infinite loop, with the patch code calling back into itself, and eventually (OK, pretty quickly) you wind up overflowing the stack.


We fixed this in TxtGlueConvertEncoding by calling FtrGet(sysFtrCreator, sysFtrNumOEMCompanyID) when the OS version was <= 3.5 and < 4.0. If the result is hwrOEMCompanyIDSony, then we know they did in fact implement TxtConvertEncoding, otherwise it doesn't exist.

For your case, it's a bit harder if you want to still be able to use the current glue code. Here's one approach:

#typedef Char* _TxtParamStringF(const Char* iTemplateP, const Char* iParam0,
const Char* iParam1, const Char* iParam2, const Char* iParam3);
typedef _TxtParamStringF * TxtParamStringF;


MyTxtParamString(const Char* iTemplateP, const Char* iParam0,
const Char* iParam1, const Char* iParam2, const Char* iParam3)
{
If (BuggySonyV35())
{
TxtParamStringF* procP;
procP = (TxtParamStringF*)TxtLatinParamString;
return(proc(const Char* iTemplateP, const Char* iParam0,
const Char* iParam1, const Char* iParam2, const Char* iParam3));
}
else
{
return(TxtGlueParamString(const Char* iTemplateP, const Char* iParam0,
const Char* iParam1, const Char* iParam2, const Char* iParam3);
}
}



I found this post in the archives, from April 2000:

http://news.palmos.com/read/messages?id=7599#7599

which mentions problems with PalmOSGlue, though not exactly the same issue,
so I'm not sure it's relevant. (Ken Krugler, if you're reading this, did
this problem ever get resolved?)

I'll check. But I don't believe it's related.

-- Ken
--
Ken Krugler
TransPac Software, Inc.
<http://www.transpac.com>
+1 530-470-9200

--
For information on using the Palm Developer Forums, or to unsubscribe, please 
see http://www.palmos.com/dev/support/forums/

Reply via email to