[Libreoffice-commits] core.git: 4 commits - dbaccess/source sal/osl sw/inc sw/source
Caolán McNamara
caolanm at redhat.com
Thu Jun 12 02:24:43 PDT 2014
dbaccess/source/core/misc/services.cxx | 8 +----
sal/osl/unx/pipe.c | 18 +++++++-----
sw/inc/helpid.h | 16 -----------
sw/source/ui/dbui/mmaddressblockpage.cxx | 43 ++++++++++++-------------------
4 files changed, 31 insertions(+), 54 deletions(-)
New commits:
commit 111cec826beefffb25f5efa73c7e5004f46a3cd8
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Jun 12 10:23:06 2014 +0100
coverity#982455 Dereference after null check
Change-Id: If4ad2fe763bffdb64119f7f2a5797aae588fbbf8
diff --git a/dbaccess/source/core/misc/services.cxx b/dbaccess/source/core/misc/services.cxx
index 4b0665d..232bd54 100644
--- a/dbaccess/source/core/misc/services.cxx
+++ b/dbaccess/source/core/misc/services.cxx
@@ -75,12 +75,8 @@ extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL dba_component_getFactory(
{
createRegistryInfo_DBA();
- Reference< XInterface > xRet;
- if (pServiceManager && pImplementationName)
- {
- xRet = ::dba::DbaModule::getInstance().getComponentFactory(
- OUString::createFromAscii( pImplementationName ) );
- }
+ Reference<XInterface> xRet(::dba::DbaModule::getInstance().getComponentFactory(
+ OUString::createFromAscii(pImplementationName)));
if (xRet.is())
xRet->acquire();
commit 6ad13d3591304df9957e9c50caf06fb342e3dba7
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Jun 12 10:14:54 2014 +0100
drop helpids that go nowhere
Change-Id: Ie487d86b95f49812cd2f4620d6d652b7422e6139
diff --git a/sw/inc/helpid.h b/sw/inc/helpid.h
index d66cc8ed..0639edf 100644
--- a/sw/inc/helpid.h
+++ b/sw/inc/helpid.h
@@ -367,7 +367,6 @@
#define HID_MM_SELECTDBTABLEDDIALOG "SW_HID_MM_SELECTDBTABLEDDIALOG"
#define HID_MM_SELECTDBTABLEDDIALOG_LISTBOX "SW_HID_MM_SELECTDBTABLEDDIALOG_LISTBOX"
#define HID_MM_DBTABLEPREVIEWDIALOG "SW_HID_MM_DBTABLEPREVIEWDIALOG"
-#define HID_MM_ASSIGNFIELDS "SW_HID_MM_ASSIGNFIELDS"
#define HID_MM_ADDRESSLIST_HB "SW_HID_MM_ADDRESSLIST_HB"
#define HID_MM_MAILBODY "SW_HID_MM_MAILBODY"
#define HID_MM_SENDMAILS "SW_HID_MM_SENDMAILS"
@@ -406,21 +405,6 @@
#define HID_MM_BODY_LB_FEMALECOLUMN "SW_HID_MM_BODY_LB_FEMALECOLUMN"
#define HID_MM_BODY_CB_FEMALEFIELD "SW_HID_MM_BODY_CB_FEMALEFIELD"
#define HID_MM_BODY_CB_NEUTRAL "SW_HID_MM_BODY_CB_NEUTRAL"
-#define HID_MM_ASSIGN_FIELDS "SW_HID_MM_ASSIGN_FIELDS"
-#define HID_MM_HEADER_0 "SW_HID_MM_HEADER_0"
-#define HID_MM_HEADER_1 "SW_HID_MM_HEADER_1"
-#define HID_MM_HEADER_2 "SW_HID_MM_HEADER_2"
-#define HID_MM_HEADER_3 "SW_HID_MM_HEADER_3"
-#define HID_MM_HEADER_4 "SW_HID_MM_HEADER_4"
-#define HID_MM_HEADER_5 "SW_HID_MM_HEADER_5"
-#define HID_MM_HEADER_6 "SW_HID_MM_HEADER_6"
-#define HID_MM_HEADER_7 "SW_HID_MM_HEADER_7"
-#define HID_MM_HEADER_8 "SW_HID_MM_HEADER_8"
-#define HID_MM_HEADER_9 "SW_HID_MM_HEADER_9"
-#define HID_MM_HEADER_10 "SW_HID_MM_HEADER_10"
-#define HID_MM_HEADER_11 "SW_HID_MM_HEADER_11"
-#define HID_MM_HEADER_12 "SW_HID_MM_HEADER_12"
-#define HID_MM_HEADER_13 "SW_HID_MM_HEADER_13"
#define HID_TBX_FORMULA_CALC "SW_HID_TBX_FORMULA_CALC"
#define HID_TBX_FORMULA_CANCEL "SW_HID_TBX_FORMULA_CANCEL"
diff --git a/sw/source/ui/dbui/mmaddressblockpage.cxx b/sw/source/ui/dbui/mmaddressblockpage.cxx
index ed8de3e..00f610a 100644
--- a/sw/source/ui/dbui/mmaddressblockpage.cxx
+++ b/sw/source/ui/dbui/mmaddressblockpage.cxx
@@ -845,7 +845,6 @@ SwAssignFieldsControl::SwAssignFieldsControl(Window* pParent, WinBits nBits) :
m_nYOffset(0),
m_nFirstYPos(0)
{
- SetHelpId(HID_MM_ASSIGN_FIELDS);
long nHBHeight = m_aHeaderHB.CalcWindowSizePixel().Height();
Size aOutputSize(GetOutputSize());
m_aVScroll.Show();
@@ -886,24 +885,6 @@ void SwAssignFieldsControl::Init(SwMailMergeConfigItem& rConfigItem)
Link aMatchHdl = LINK(this, SwAssignFieldsControl, MatchHdl_Impl);
Link aFocusHdl = LINK(this, SwAssignFieldsControl, GotFocusHdl_Impl);
- static const char* aHIDs[] =
- {
- HID_MM_HEADER_0,
- HID_MM_HEADER_1,
- HID_MM_HEADER_2,
- HID_MM_HEADER_3,
- HID_MM_HEADER_4,
- HID_MM_HEADER_5,
- HID_MM_HEADER_6,
- HID_MM_HEADER_7,
- HID_MM_HEADER_8,
- HID_MM_HEADER_9,
- HID_MM_HEADER_10,
- HID_MM_HEADER_11,
- HID_MM_HEADER_12,
- HID_MM_HEADER_13
- };
-
//fill the controls
long nControlWidth = aOutputSize.Width() / 3;
long nControlHeight = -1;
@@ -915,7 +896,6 @@ void SwAssignFieldsControl::Init(SwMailMergeConfigItem& rConfigItem)
ListBox* pNewLB = new ListBox(&m_aWindow, WB_DROPDOWN | WB_VCENTER | WB_TABSTOP);
pNewText->set_mnemonic_widget(pNewLB);
pNewLB->InsertEntry(SW_RESSTR(SW_STR_NONE));
- pNewLB->SetHelpId( aHIDs[i] );
pNewLB->SelectEntryPos(0);
pNewLB->SetDropDownLineCount(5);
commit 2489589a64fbe0e892f3ccf5b86f7fec7dcd89db
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Jun 12 09:57:18 2014 +0100
coverity#982462 Dereference after null check
Change-Id: I5e90d51440afa4e317bc07ccb937f606edbc9eb9
diff --git a/sal/osl/unx/pipe.c b/sal/osl/unx/pipe.c
index b1263c8..10ac932 100644
--- a/sal/osl/unx/pipe.c
+++ b/sal/osl/unx/pipe.c
@@ -147,20 +147,24 @@ cpyBootstrapSocketPath(sal_Char *name, size_t len)
if (rtl_bootstrap_get(pName, &pValue, NULL))
{
- rtl_String *pStrValue = 0;
if (pValue && pValue->length > 0)
{
+ rtl_String *pStrValue = 0;
+
rtl_uString2String(&pStrValue, pValue->buffer,
pValue->length, RTL_TEXTENCODING_UTF8,
OUSTRING_TO_OSTRING_CVTFLAGS);
- if (pStrValue && pStrValue->length > 0)
+ if (pStrValue)
{
- size_t nCopy = (len-1 < (size_t)pStrValue->length) ? len-1 : (size_t)pStrValue->length;
- strncpy (name, pStrValue->buffer, nCopy);
- name[nCopy] = '\0';
- bRet = (size_t)pStrValue->length < len;
+ if (pStrValue->length > 0)
+ {
+ size_t nCopy = (len-1 < (size_t)pStrValue->length) ? len-1 : (size_t)pStrValue->length;
+ strncpy (name, pStrValue->buffer, nCopy);
+ name[nCopy] = '\0';
+ bRet = (size_t)pStrValue->length < len;
+ }
+ rtl_string_release(pStrValue);
}
- rtl_string_release(pStrValue);
}
rtl_uString_release(pName);
}
commit a84fca9a0acebc26af655bdebc984c0d7113ee2c
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Jun 12 09:53:55 2014 +0100
set mnemonic widget and replace 24 with optimal height request
Change-Id: I86bb00f134aaf95a48ac0a5d594c632d03f0e9d5
diff --git a/sw/source/ui/dbui/mmaddressblockpage.cxx b/sw/source/ui/dbui/mmaddressblockpage.cxx
index e7935ed..ed8de3e 100644
--- a/sw/source/ui/dbui/mmaddressblockpage.cxx
+++ b/sw/source/ui/dbui/mmaddressblockpage.cxx
@@ -906,17 +906,25 @@ void SwAssignFieldsControl::Init(SwMailMergeConfigItem& rConfigItem)
//fill the controls
long nControlWidth = aOutputSize.Width() / 3;
- long nControlHeight = 24;
+ long nControlHeight = -1;
for(sal_uInt32 i = 0; i < rHeaders.Count(); ++i)
{
const OUString rHeader = rHeaders.GetString( i );
FixedText* pNewText = new FixedText(&m_aWindow, WB_VCENTER);
pNewText->SetText("<" + rHeader + ">");
ListBox* pNewLB = new ListBox(&m_aWindow, WB_DROPDOWN | WB_VCENTER | WB_TABSTOP);
+ pNewText->set_mnemonic_widget(pNewLB);
pNewLB->InsertEntry(SW_RESSTR(SW_STR_NONE));
pNewLB->SetHelpId( aHIDs[i] );
pNewLB->SelectEntryPos(0);
pNewLB->SetDropDownLineCount(5);
+
+ if (nControlHeight == -1) //first time
+ {
+ nControlHeight = std::max(pNewLB->get_preferred_size().Height(),
+ pNewText->get_preferred_size().Height());
+ }
+
for(sal_Int32 nField = 0; nField < aFields.getLength(); ++nField)
pNewLB->InsertEntry(pFields[nField]);
FixedText* pNewPreview = new FixedText(&m_aWindow, WB_VCENTER);
@@ -997,7 +1005,6 @@ void SwAssignFieldsControl::Resize()
Size aOutputSize = GetOutputSize();
long nHBHeight = m_aHeaderHB.CalcWindowSizePixel().Height();
- long nControlHeight = 24;
m_aWindow.SetSizePixel(Size(aOutputSize.Width() - m_aVScroll.GetSizePixel().Width(), aOutputSize.Height() - nHBHeight));
@@ -1010,9 +1017,15 @@ void SwAssignFieldsControl::Resize()
sal_Int32 nColWidth = aOutputSize.Width() / 3;
m_aHeaderHB.SetSizePixel(Size(aOutputSize.Width(), nHBHeight));
- m_aHeaderHB.SetItemSize( 1, nColWidth);
- m_aHeaderHB.SetItemSize( 2, nColWidth);
- m_aHeaderHB.SetItemSize( 3, nColWidth);
+ m_aHeaderHB.SetItemSize(1, nColWidth);
+ m_aHeaderHB.SetItemSize(2, nColWidth);
+ m_aHeaderHB.SetItemSize(3, nColWidth);
+
+ if (m_aFieldNames.empty() || m_aMatches.empty())
+ return;
+
+ long nControlHeight = std::max(m_aFieldNames[0]->get_preferred_size().Height(),
+ m_aMatches[0]->get_preferred_size().Height());
::std::vector<FixedText*>::iterator aFIIter;
for(aFIIter = m_aFieldNames.begin(); aFIIter != m_aFieldNames.end(); ++aFIIter)
More information about the Libreoffice-commits
mailing list