Re: patch/bug fix - 642

Paul Rohr (paul@abisource.com)
Tue, 09 Nov 1999 12:53:09 -0800


At 09:31 PM 11/7/99 -0600, Stephen Hack wrote:
>Bug fix patch - bug 642
>
>The bug was in placing tabs in non-inches units. If you look at the code,
>it's obvious, for af/util/xp/ut_units.cpp :: UT_convertToDimensionString did
>not actually do the conversion.
>
>If turned out to be a variable problem. We we doing the conversion, the
>returning the value passed in as a parameter.

Argh. You just got bit by the same thing I did. That function needs to be
rethought, and all uses of it rechecked.

this function has served several different purposes over time.

Originally (1.13), it converted from inches to whatever units you wanted.
At the time, I did a lot of testing to make sure that the ruler code used
this logic properly by switching unit systems in code and recompiling.

Later on (1.17), it morphed into a fancy sprintf which didn't convert units.
By the time I started working with Shaw to port the Paragraph dialog (which
does even more unit-conversion work than the ruler), I got bit too. At the
time I tried changing back to the old semantics, but ran across other code
which depended on the new semantics.

Instead (1.21), I added a new function UT_convertInchesToDimension() which
does the other half of the original job, as seen here:

abi/src/wp/ap/xp/ap_Dialog_Paragraph.cpp

What a mess. :-(

At this point, rather than applying your patch, I think we should:

- strip out the last traces of the old semantics from the function,
- rename it to be clearer about its new job, and
- recheck all uses to see which functions should be called.

It's a thankless janitorial task, but it'll help prevent similar confusion
in the future.

Paul



This archive was generated by hypermail 1.03b2.