Jim Wilson wrote: > Hmmm...I wonder if this relates to some of the effects I've seen > recently with the delta time and fdms. If you could put up a > separate patch for this (before the "massive checkin" :-)), I'd like > to run some tests to confirm. BTW, thanks for tracking this down.
This is what I did last night. It works for the bug I was seeing, but I didn't go through the code looking for other printf's that might blow up with the same values. The hard-coded "8" should be unified with the static definition of SliderText, of course. As Norman and I pointed out, though, a better solution would probably be to sanify the values before use if possible. Sometimes, if they come from arbitrary user input, you can't and have to resort to buffer size checking with snprintf and the like. But since these are angles, it should be possible. Andy RCS file: /var/cvs/FlightGear-0.7/FlightGear/src/Autopilot/auto_gui.cxx,v retrieving revision 1.29 diff -u -r1.29 auto_gui.cxx --- auto_gui.cxx 26 Mar 2002 01:38:11 -0000 1.29 +++ auto_gui.cxx 24 Jun 2002 17:04:59 -0000 @@ -510,7 +510,7 @@ APAdjustHS0-> setCBMode ( PUSLIDER_DELTA ) ; APAdjustHS0-> setCallback ( maxroll_adj ) ; - sprintf( SliderText[ 0 ], "%05.2f", globals->get_autopilot()->get_MaxRoll() ); + snprintf( SliderText[ 0 ], 8, "%05.2f", globals->get_autopilot()->get_MaxRoll() ); APAdjustMaxRollTitle = new puText ( slider_title_x, slider_y ) ; APAdjustMaxRollTitle-> setDefaultValue ( "MaxRoll" ) ; APAdjustMaxRollTitle-> getDefaultValue ( &s ) ; @@ -527,7 +527,7 @@ APAdjustHS1-> setCBMode ( PUSLIDER_DELTA ) ; APAdjustHS1-> setCallback ( rollout_adj ) ; - sprintf( SliderText[ 1 ], "%05.2f", globals->get_autopilot()->get_RollOut() ); + snprintf( SliderText[ 1 ], 8, "%05.2f", globals->get_autopilot()->get_RollOut() ); APAdjustRollOutTitle = new puText ( slider_title_x, slider_y ) ; APAdjustRollOutTitle-> setDefaultValue ( "AdjustRollOut" ) ; APAdjustRollOutTitle-> getDefaultValue ( &s ) ; @@ -544,7 +544,7 @@ APAdjustHS2-> setCBMode ( PUSLIDER_DELTA ) ; APAdjustHS2-> setCallback ( rolloutsmooth_adj ) ; - sprintf( SliderText[ 2 ], "%5.2f", + snprintf( SliderText[ 2 ], 8, "%5.2f", globals->get_autopilot()->get_RollOutSmooth() ); APAdjustRollOutSmoothTitle = new puText ( slider_title_x, slider_y ) ; APAdjustRollOutSmoothTitle-> setDefaultValue ( "RollOutSmooth" ) ; @@ -562,7 +562,7 @@ APAdjustHS3-> setCBMode ( PUSLIDER_DELTA ) ; APAdjustHS3-> setCallback ( maxaileron_adj ) ; - sprintf( SliderText[ 3 ], "%05.2f", + snprintf( SliderText[ 3 ], 8, "%05.2f", globals->get_autopilot()->get_MaxAileron() ); APAdjustMaxAileronTitle = new puText ( slider_title_x, slider_y ) ; APAdjustMaxAileronTitle-> setDefaultValue ( "MaxAileron" ) ; -- Andrew J. Ross NextBus Information Systems Senior Software Engineer Emeryville, CA [EMAIL PROTECTED] http://www.nextbus.com "Men go crazy in conflagrations. They only get better one by one." - Sting (misquoted) _______________________________________________ Flightgear-devel mailing list [EMAIL PROTECTED] http://mail.flightgear.org/mailman/listinfo/flightgear-devel