Re: vincent - r31445 - abiword/branches/gsoc2012dialogs/src/wp/ap/xp
Hubert Figuière <[email protected]>
| Newsgroups | gmane.editors.abiword.devel |
|---|---|
| Message-ID | <[email protected]> |
On 28/06/12 09:00 AM, [email protected] wrote: > > Author: vincent > Date: 2012-06-28 18:00:39 +0200 (Thu, 28 Jun 2012) > New Revision: 31445 > > Modified: > abiword/branches/gsoc2012dialogs/src/wp/ap/xp/ap_Dialog_FormatFrame.cpp > abiword/branches/gsoc2012dialogs/src/wp/ap/xp/ap_Dialog_FormatFrame.h > Log: > per Hub & Pradeeban's coding suggestions: > 1. using UT_String_sprintf instead of sprintf > 2. rename 'getFrameWidth_Str' to initFrameWidthStr > > Modified: abiword/branches/gsoc2012dialogs/src/wp/ap/xp/ap_Dialog_FormatFrame.cpp > =================================================================== > --- abiword/branches/gsoc2012dialogs/src/wp/ap/xp/ap_Dialog_FormatFrame.cpp 2012-06-28 14:07:08 UTC (rev 31444) > +++ abiword/branches/gsoc2012dialogs/src/wp/ap/xp/ap_Dialog_FormatFrame.cpp 2012-06-28 16:00:39 UTC (rev 31445) > @@ -946,7 +946,7 @@ > else { > char buf[16]; > UT_LocaleTransactor t(LC_NUMERIC, "C"); > - sprintf(buf, "%.2fpt", thickness); > + UT_String_sprintf(buf, "%.2fpt", thickness); No. Have you even tested it? This will NOT work. This actually should crash, if you are lucky. I said that you should be using std::string for buf and use UT_std_string_sprintf. > @@ -1115,7 +1115,7 @@ > m_bSettingsChanged = true; > } > > -const UT_UTF8String & AP_Dialog_FormatFrame::getFrameWidth_Str() > +const UT_UTF8String & AP_Dialog_FormatFrame::initFrameWidthStr() > { > UT_UTF8String thickness; > const gchar * pszStyle = 0; > @@ -1127,7 +1127,7 @@ > return thickness; > } You still don't address the "return reference to temporary" bug I mentioned. Hub