I've got a custom drawing routine for an item in a table that need to draw quite a bit of stuff, so I thought I'd modularize the code into some different drawing functions. In the process, some calls to the following conversion function were moved from the table callback out to the drawing functions. This function didn't cause problems when it was called from inside the callback routine, but if it's called from the drawing functions I get a bus error when the calling function returns control to the table callback routine.
OK, so here's a quick idea. Set a breakpoint on the call to this SecondsToString
function. Bring up the register view, click on A7 (the stack pointer), then do Debug/View Data in the CW debugger. This will show you your stack. Step over the function. Since the caller defines
Char strTime[6];
I bet TimeToAscii is writing more than five characters and a NUL and is overwriting the return address. It may not have been a problem in your original code due to having more variables on the stack. There is a reason why DateTime.h defines
#define timeStringLength 9
You should be sure to use that value as the minimum length of a buffer you pass to TimeToAscii.
--
Ben Combee <[EMAIL PROTECTED]>
CodeWarrior for Palm OS technical lead
Palm OS programming help @ www.palmoswerks.com
-- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
