[Libreoffice-commits] .: 7 commits - i18npool/source toolkit/source tools/source
Caolán McNamara
caolan at kemper.freedesktop.org
Wed Oct 20 05:01:36 PDT 2010
i18npool/source/localedata/LocaleNode.cxx | 140 ++++++++++++++---------------
i18npool/source/localedata/LocaleNode.hxx | 4
i18npool/source/localedata/data/kab_DZ.xml | 36 +++----
i18npool/source/localedata/saxparser.cxx | 9 +
toolkit/source/awt/vclxwindows.cxx | 11 --
toolkit/source/controls/dialogcontrol.cxx | 26 -----
tools/source/ref/globname.cxx | 121 ++++++++++++++++++-------
tools/source/stream/stream.cxx | 29 ++++--
8 files changed, 207 insertions(+), 169 deletions(-)
New commits:
commit 6f6c0415d983e100aeb939c883ef0ac901e966e7
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Oct 20 10:16:51 2010 +0100
remove memory leaks to make this a handy valgrind test case
diff --git a/i18npool/source/localedata/LocaleNode.cxx b/i18npool/source/localedata/LocaleNode.cxx
index 95d06b9..77c5acb 100644
--- a/i18npool/source/localedata/LocaleNode.cxx
+++ b/i18npool/source/localedata/LocaleNode.cxx
@@ -50,7 +50,7 @@ namespace cssi = ::com::sun::star::i18n;
LocaleNode::LocaleNode (const OUString& name, const Reference< XAttributeList > & attr)
: aName(name)
- , xAttribs(new Attr(attr))
+ , aAttribs(attr)
, parent(0)
, children(0)
, nChildren(0)
@@ -85,11 +85,10 @@ void LocaleNode::printR () const {
void LocaleNode::addChild ( LocaleNode * node) {
if (childArrSize <= nChildren) {
- LocaleNode ** arrN = (LocaleNode **)malloc( sizeof (LocaleNode *)*(childArrSize+10) ) ;
- for (sal_Int32 i = 0; i<childArrSize ; i++)
+ LocaleNode ** arrN = new LocaleNode*[childArrSize+10];
+ for (sal_Int32 i = 0; i<childArrSize; ++i)
arrN[i] = children[i];
- if ( childArrSize > 0 )
- free(children);
+ delete [] children;
childArrSize += 10;
children = arrN;
}
@@ -121,9 +120,11 @@ const LocaleNode * LocaleNode::findNode ( const sal_Char *name) const {
return 0;
}
- LocaleNode::~LocaleNode() {
- for (sal_Int32 i=0; i<nChildren;i++)
- delete (children[i]);
+LocaleNode::~LocaleNode()
+{
+ for (sal_Int32 i=0; i < nChildren; ++i)
+ delete children[i];
+ delete [] children;
}
LocaleNode* LocaleNode::createNode (const OUString& name, const Reference< XAttributeList > & attr)
@@ -191,22 +192,19 @@ void print_node( const LocaleNode* p, int depth=0 )
print_color(36);
print_OUString( p->getName() );
print_color(0);
- const Attr* q = p->getAttr();
- if( q )
+ const Attr& q = p->getAttr();
+ for( sal_Int32 j = 0; j < q.getLength(); ++j )
{
- for( sal_Int32 j=0; j<q->getLength(); j++ )
- {
- printf(" ");
- print_color(33);
- print_OUString( q->getTypeByIndex(j) );
- print_color(0);
- printf("=");
- print_color(31);
- printf("'");
- print_OUString( q->getValueByIndex(j) );
- printf("'");
- print_color(0);
- }
+ printf(" ");
+ print_color(33);
+ print_OUString( q.getTypeByIndex(j) );
+ print_color(0);
+ printf("=");
+ print_color(31);
+ printf("'");
+ print_OUString( q.getValueByIndex(j) );
+ printf("'");
+ print_color(0);
}
printf(">");
printf("\n");
@@ -234,7 +232,7 @@ void print_node( const LocaleNode* p, int depth=0 )
void LocaleNode :: generateCode (const OFileWriter &of) const
{
- ::rtl::OUString aDTD = getAttr()->getValueByName("versionDTD");
+ ::rtl::OUString aDTD = getAttr().getValueByName("versionDTD");
if (!aDTD.equalsAscii( LOCALE_VERSION_DTD))
{
++nError;
@@ -380,12 +378,12 @@ void LCInfoNode::generateCode (const OFileWriter &of) const
void LCCTYPENode::generateCode (const OFileWriter &of) const
{
const LocaleNode * sepNode = 0;
- ::rtl::OUString useLocale = getAttr() -> getValueByName("ref");
+ ::rtl::OUString useLocale = getAttr().getValueByName("ref");
if (useLocale.getLength() > 0) {
of.writeRefFunction("getLocaleItem_", useLocale);
return;
}
- ::rtl::OUString str = getAttr() -> getValueByName("unoid");
+ ::rtl::OUString str = getAttr().getValueByName("unoid");
of.writeAsciiString("\n\n");
of.writeParameter("LC_CTYPE_Unoid", str);;
@@ -541,13 +539,13 @@ void LCFormatNode::generateCode (const OFileWriter &of) const
OUString str;
if (mnSection >= 2)
incError("more than 2 LC_FORMAT sections");
- of.writeParameter("replaceFrom", getAttr() -> getValueByName("replaceFrom"), mnSection);
- str = getAttr() -> getValueByName("replaceTo");
+ of.writeParameter("replaceFrom", getAttr().getValueByName("replaceFrom"), mnSection);
+ str = getAttr().getValueByName("replaceTo");
// Locale data generator inserts FFFF for LangID, we need to adapt that.
if (str.endsWithIgnoreAsciiCaseAsciiL( "-FFFF]", 6))
incErrorStr("replaceTo=\"%s\" needs FFFF to be adapted to the real LangID value.", str);
of.writeParameter("replaceTo", str, mnSection);
- ::rtl::OUString useLocale = getAttr() -> getValueByName("ref");
+ ::rtl::OUString useLocale = getAttr().getValueByName("ref");
if (useLocale.getLength() > 0) {
switch (mnSection)
{
@@ -572,25 +570,25 @@ void LCFormatNode::generateCode (const OFileWriter &of) const
OUString aType;
OUString aFormatIndex;
// currNode -> print();
- const Attr * currNodeAttr = currNode->getAttr();
- //printf ("getLen() = %d\n", currNode->getAttr()->getLength());
+ const Attr &currNodeAttr = currNode->getAttr();
+ //printf ("getLen() = %d\n", currNode->getAttr().getLength());
- str = currNodeAttr -> getValueByName("msgid");
+ str = currNodeAttr.getValueByName("msgid");
if (!aMsgIdSet.insert( str).second)
incErrorStr( "Duplicated msgid=\"%s\" in FormatElement.", str);
of.writeParameter("FormatKey", str, formatCount);
- str = currNodeAttr -> getValueByName("default");
+ str = currNodeAttr.getValueByName("default");
bool bDefault = str.equalsAscii( "true");
of.writeDefaultParameter("FormatElement", str, formatCount);
- aType = currNodeAttr -> getValueByName("type");
+ aType = currNodeAttr.getValueByName("type");
of.writeParameter("FormatType", aType, formatCount);
- aUsage = currNodeAttr -> getValueByName("usage");
+ aUsage = currNodeAttr.getValueByName("usage");
of.writeParameter("FormatUsage", aUsage, formatCount);
- aFormatIndex = currNodeAttr -> getValueByName("formatindex");
+ aFormatIndex = currNodeAttr.getValueByName("formatindex");
sal_Int16 formatindex = (sal_Int16)aFormatIndex.toInt32();
if (!aFormatIndexSet.insert( formatindex).second)
incErrorInt( "Duplicated formatindex=\"%d\" in FormatElement.", formatindex);
@@ -635,7 +633,7 @@ void LCFormatNode::generateCode (const OFileWriter &of) const
incError( "No LC_CTYPE found for FormatCode.");
else
{
- OUString aRef( pCtype->getAttr()->getValueByName("ref"));
+ OUString aRef( pCtype->getAttr().getValueByName("ref"));
if (aRef.getLength() > 0)
{
if (!bCtypeIsRef)
@@ -863,7 +861,7 @@ void LCFormatNode::generateCode (const OFileWriter &of) const
void LCCollationNode::generateCode (const OFileWriter &of) const
{
- ::rtl::OUString useLocale = getAttr() -> getValueByName("ref");
+ ::rtl::OUString useLocale = getAttr().getValueByName("ref");
if (useLocale.getLength() > 0) {
of.writeRefFunction("getCollatorImplementation_", useLocale);
of.writeRefFunction("getCollationOptions_", useLocale);
@@ -878,11 +876,11 @@ void LCCollationNode::generateCode (const OFileWriter &of) const
if( currNode->getName().compareToAscii("Collator") == 0 )
{
::rtl::OUString str;
- str = currNode->getAttr() -> getValueByName("unoid");
+ str = currNode->getAttr().getValueByName("unoid");
of.writeParameter("CollatorID", str, j);
str = currNode->getValue();
of.writeParameter("CollatorRule", str, j);
- str = currNode -> getAttr() -> getValueByName("default");
+ str = currNode -> getAttr().getValueByName("default");
of.writeDefaultParameter("Collator", str, j);
of.writeAsciiString("\n");
@@ -936,7 +934,7 @@ void LCCollationNode::generateCode (const OFileWriter &of) const
void LCSearchNode::generateCode (const OFileWriter &of) const
{
- ::rtl::OUString useLocale = getAttr() -> getValueByName("ref");
+ ::rtl::OUString useLocale = getAttr().getValueByName("ref");
if (useLocale.getLength() > 0) {
of.writeRefFunction("getSearchOptions_", useLocale);
return;
@@ -974,7 +972,7 @@ void LCSearchNode::generateCode (const OFileWriter &of) const
void LCIndexNode::generateCode (const OFileWriter &of) const
{
- ::rtl::OUString useLocale = getAttr() -> getValueByName("ref");
+ ::rtl::OUString useLocale = getAttr().getValueByName("ref");
if (useLocale.getLength() > 0) {
of.writeRefFunction("getIndexAlgorithm_", useLocale);
of.writeRefFunction("getUnicodeScripts_", useLocale);
@@ -990,15 +988,15 @@ void LCIndexNode::generateCode (const OFileWriter &of) const
if( currNode->getName().compareToAscii("IndexKey") == 0 )
{
::rtl::OUString str;
- str = currNode->getAttr() -> getValueByName("unoid");
+ str = currNode->getAttr().getValueByName("unoid");
of.writeParameter("IndexID", str, nbOfIndexs);
- str = currNode->getAttr() -> getValueByName("module");
+ str = currNode->getAttr().getValueByName("module");
of.writeParameter("IndexModule", str, nbOfIndexs);
str = currNode->getValue();
of.writeParameter("IndexKey", str, nbOfIndexs);
- str = currNode -> getAttr() -> getValueByName("default");
+ str = currNode -> getAttr().getValueByName("default");
of.writeDefaultParameter("Index", str, nbOfIndexs);
- str = currNode -> getAttr() -> getValueByName("phonetic");
+ str = currNode -> getAttr().getValueByName("phonetic");
of.writeDefaultParameter("Phonetic", str, nbOfIndexs);
of.writeAsciiString("\n");
@@ -1076,7 +1074,7 @@ void LCIndexNode::generateCode (const OFileWriter &of) const
void LCCalendarNode::generateCode (const OFileWriter &of) const
{
- ::rtl::OUString useLocale = getAttr() -> getValueByName("ref");
+ ::rtl::OUString useLocale = getAttr().getValueByName("ref");
if (useLocale.getLength() > 0) {
of.writeRefFunction("getAllCalendars_", useLocale);
return;
@@ -1093,21 +1091,21 @@ void LCCalendarNode::generateCode (const OFileWriter &of) const
for ( i = 0; i < nbOfCalendars; i++) {
LocaleNode * calNode = getChildAt (i);
- OUString calendarID = calNode -> getAttr() -> getValueByName("unoid");
+ OUString calendarID = calNode -> getAttr().getValueByName("unoid");
of.writeParameter( "calendarID", calendarID, i);
bool bGregorian = calendarID.equalsAscii( "gregorian");
if (!bHasGregorian)
bHasGregorian = bGregorian;
- str = calNode -> getAttr() -> getValueByName("default");
+ str = calNode -> getAttr().getValueByName("default");
of.writeDefaultParameter("Calendar", str, i);
// Generate Days of Week
const sal_Char *elementTag;
LocaleNode * daysNode = NULL;
- ::rtl::OUString ref_name = calNode->getChildAt(0)->getAttr()->getValueByName("ref");
+ ::rtl::OUString ref_name = calNode->getChildAt(0)->getAttr().getValueByName("ref");
if (ref_name.getLength() > 0 && i > 0) {
for (j = 0; j < i; j++) {
- str = getChildAt(j)->getAttr()->getValueByName("unoid");
+ str = getChildAt(j)->getAttr().getValueByName("unoid");
if (str.equals(ref_name))
daysNode = getChildAt(j)->getChildAt(0);
}
@@ -1136,10 +1134,10 @@ void LCCalendarNode::generateCode (const OFileWriter &of) const
// Generate Months of Year
LocaleNode * monthsNode = NULL;
- ref_name = calNode->getChildAt(1)->getAttr()->getValueByName("ref");
+ ref_name = calNode->getChildAt(1)->getAttr().getValueByName("ref");
if (ref_name.getLength() > 0 && i > 0) {
for (j = 0; j < i; j++) {
- str = getChildAt(j)->getAttr()->getValueByName("unoid");
+ str = getChildAt(j)->getAttr().getValueByName("unoid");
if (str.equals(ref_name))
monthsNode = getChildAt(j)->getChildAt(1);
}
@@ -1168,10 +1166,10 @@ void LCCalendarNode::generateCode (const OFileWriter &of) const
// Generate Era name
LocaleNode * erasNode = NULL;
- ref_name = calNode -> getChildAt(2) ->getAttr()->getValueByName("ref");
+ ref_name = calNode -> getChildAt(2) ->getAttr().getValueByName("ref");
if (ref_name.getLength() > 0 && i > 0) {
for (j = 0; j < i; j++) {
- str = getChildAt(j)->getAttr()->getValueByName("unoid");
+ str = getChildAt(j)->getAttr().getValueByName("unoid");
if (str.equals(ref_name))
erasNode = getChildAt(j)->getChildAt(2);
}
@@ -1325,7 +1323,7 @@ bool isIso4217( const OUString& rStr )
void LCCurrencyNode :: generateCode (const OFileWriter &of) const
{
- ::rtl::OUString useLocale = getAttr() -> getValueByName("ref");
+ ::rtl::OUString useLocale = getAttr().getValueByName("ref");
if (useLocale.getLength() > 0) {
of.writeRefFunction("getAllCurrencies_", useLocale);
return;
@@ -1338,11 +1336,11 @@ void LCCurrencyNode :: generateCode (const OFileWriter &of) const
bool bTheCompatible = false;
for ( i = 0; i < getNumberOfChildren(); i++,nbOfCurrencies++) {
LocaleNode * calNode = getChildAt (i);
- str = calNode->getAttr() -> getValueByName("default");
+ str = calNode->getAttr().getValueByName("default");
bool bDefault = of.writeDefaultParameter("Currency", str, nbOfCurrencies);
- str = calNode->getAttr() -> getValueByName("usedInCompatibleFormatCodes");
+ str = calNode->getAttr().getValueByName("usedInCompatibleFormatCodes");
bool bCompatible = of.writeDefaultParameter("CurrencyUsedInCompatibleFormatCodes", str, nbOfCurrencies);
- str = calNode->getAttr() -> getValueByName("legacyOnly");
+ str = calNode->getAttr().getValueByName("legacyOnly");
bool bLegacy = of.writeDefaultParameter("CurrencyLegacyOnly", str, nbOfCurrencies);
if (bLegacy && (bDefault || bCompatible))
incError( "Currency: if legacyOnly==true, both 'default' and 'usedInCompatibleFormatCodes' must be false.");
@@ -1420,7 +1418,7 @@ void LCCurrencyNode :: generateCode (const OFileWriter &of) const
void LCTransliterationNode::generateCode (const OFileWriter &of) const
{
- ::rtl::OUString useLocale = getAttr() -> getValueByName("ref");
+ ::rtl::OUString useLocale = getAttr().getValueByName("ref");
if (useLocale.getLength() > 0) {
of.writeRefFunction("getTransliterations_", useLocale);
return;
@@ -1431,7 +1429,7 @@ void LCTransliterationNode::generateCode (const OFileWriter &of) const
for ( i = 0; i < getNumberOfChildren(); i++,nbOfModules++) {
LocaleNode * calNode = getChildAt (i);
- str = calNode->getAttr() -> getValueByIndex(0);
+ str = calNode->getAttr().getValueByIndex(0);
of.writeParameter("Transliteration", str, nbOfModules);
}
of.writeAsciiString("static const sal_Int16 nbOfTransliterations = ");
@@ -1469,7 +1467,7 @@ static NameValuePair ReserveWord[] = {
void LCMiscNode::generateCode (const OFileWriter &of) const
{
- ::rtl::OUString useLocale = getAttr() -> getValueByName("ref");
+ ::rtl::OUString useLocale = getAttr().getValueByName("ref");
if (useLocale.getLength() > 0) {
of.writeRefFunction("getForbiddenCharacters_", useLocale);
of.writeRefFunction("getBreakIteratorRules_", useLocale);
@@ -1566,7 +1564,7 @@ void LCMiscNode::generateCode (const OFileWriter &of) const
void LCNumberingLevelNode::generateCode (const OFileWriter &of) const
{
of.writeAsciiString("// ---> ContinuousNumbering\n");
- ::rtl::OUString useLocale = getAttr() -> getValueByName("ref");
+ ::rtl::OUString useLocale = getAttr().getValueByName("ref");
if (useLocale.getLength() > 0) {
of.writeRefFunction2("getContinuousNumberingLevels_", useLocale);
return;
@@ -1581,13 +1579,13 @@ void LCNumberingLevelNode::generateCode (const OFileWriter &of) const
sal_Int32 nStyles = getNumberOfChildren();
sal_Int32 i;
- for( i = 0; i < nStyles; i++ )
+ for( i = 0; i < nStyles; ++i )
{
- const Attr* q = getChildAt( i )->getAttr();
- for( sal_Int32 j=0; j<nAttributes; j++ )
+ const Attr &q = getChildAt( i )->getAttr();
+ for( sal_Int32 j=0; j<nAttributes; ++j )
{
const char* name = attr[j];
- OUString value = q->getValueByName( name );
+ OUString value = q.getValueByName( name );
of.writeParameter("continuous", name, value, sal::static_int_cast<sal_Int16>(i) );
}
}
@@ -1636,7 +1634,7 @@ void LCNumberingLevelNode::generateCode (const OFileWriter &of) const
void LCOutlineNumberingLevelNode::generateCode (const OFileWriter &of) const
{
of.writeAsciiString("// ---> OutlineNumbering\n");
- ::rtl::OUString useLocale = getAttr() -> getValueByName("ref");
+ ::rtl::OUString useLocale = getAttr().getValueByName("ref");
if (useLocale.getLength() > 0) {
of.writeRefFunction3("getOutlineNumberingLevels_", useLocale);
return;
@@ -1669,11 +1667,11 @@ void LCOutlineNumberingLevelNode::generateCode (const OFileWriter &of) const
nLevels.push_back( p->getNumberOfChildren() );
for( sal_Int32 j=0; j<nLevels.back(); j++ )
{
- const Attr* q = p->getChildAt( j )->getAttr();
- for( sal_Int32 k=0; k<nAttributes; k++ )
+ const Attr& q = p->getChildAt( j )->getAttr();
+ for( sal_Int32 k=0; k<nAttributes; ++k )
{
const char* name = attr[k];
- OUString value = q->getValueByName( name );
+ OUString value = q.getValueByName( name );
of.writeParameter("outline", name, value,
sal::static_int_cast<sal_Int16>(i),
sal::static_int_cast<sal_Int16>(j) );
diff --git a/i18npool/source/localedata/LocaleNode.hxx b/i18npool/source/localedata/LocaleNode.hxx
index 94e9030..3cacc41 100644
--- a/i18npool/source/localedata/LocaleNode.hxx
+++ b/i18npool/source/localedata/LocaleNode.hxx
@@ -108,7 +108,7 @@ class LocaleNode
{
OUString aName;
OUString aValue;
- Attr * xAttribs;
+ Attr aAttribs;
LocaleNode * parent;
LocaleNode* * children;
sal_Int32 nChildren;
@@ -124,7 +124,7 @@ public:
inline void setValue(const OUString &oValue) { aValue += oValue; };
inline const OUString& getName() const { return aName; };
inline const OUString& getValue() const { return aValue; };
- inline const Attr* getAttr() const { return xAttribs; };
+ inline const Attr& getAttr() const { return aAttribs; };
inline sal_Int32 getNumberOfChildren () const { return nChildren; };
inline LocaleNode * getChildAt (sal_Int32 idx) const { return children[idx] ; };
const LocaleNode * findNode ( const sal_Char *name) const;
diff --git a/i18npool/source/localedata/saxparser.cxx b/i18npool/source/localedata/saxparser.cxx
index 9db0669..bd7b5e5 100644
--- a/i18npool/source/localedata/saxparser.cxx
+++ b/i18npool/source/localedata/saxparser.cxx
@@ -157,6 +157,7 @@ public:
~TestDocumentHandler( )
{
of.closeOutput();
+ delete rootNode;
}
@@ -227,24 +228,24 @@ public: // ExtendedDocumentHandler
LocaleNode * l = LocaleNode::createNode (aName, xAttribs);
if (!currentNode.empty() ) {
- LocaleNode * ln = (LocaleNode *) currentNode . top();
+ LocaleNode * ln = (LocaleNode *) currentNode.top();
ln->addChild(l);
} else {
rootNode = l;
}
- currentNode . push (l);
+ currentNode.push (l);
}
virtual void SAL_CALL endElement(const OUString& /*aName*/) throw (SAXException,RuntimeException)
{
- currentNode . pop();
+ currentNode.pop();
}
virtual void SAL_CALL characters(const OUString& aChars) throw (SAXException,RuntimeException)
{
- LocaleNode * l = currentNode . top();
+ LocaleNode * l = currentNode.top();
l->setValue (aChars);
::rtl::OUString str(aChars);
sal_Unicode nonBreakSPace[2]= {0xa, 0x0};
commit a46b3139eef61005be1dbe552531b3dd8fa616f1
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Oct 20 10:12:23 2010 +0100
fdo#30773 Kabyle swap , and . as decimal seperator
diff --git a/i18npool/source/localedata/data/kab_DZ.xml b/i18npool/source/localedata/data/kab_DZ.xml
index 97f0ca7..41e3ab2 100644
--- a/i18npool/source/localedata/data/kab_DZ.xml
+++ b/i18npool/source/localedata/data/kab_DZ.xml
@@ -17,7 +17,7 @@
<ThousandSeparator>.</ThousandSeparator>
<DecimalSeparator>,</DecimalSeparator>
<TimeSeparator>:</TimeSeparator>
-<Time100SecSeparator>.</Time100SecSeparator>
+<Time100SecSeparator>,</Time100SecSeparator>
<ListSeparator>;</ListSeparator>
<LongDateDayOfWeekSeparator>, </LongDateDayOfWeekSeparator>
<LongDateDaySeparator>, </LongDateDaySeparator>
commit a8ea685c6396344f2fc36dee0a894479ad688ee9
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Oct 20 10:11:56 2010 +0100
fdo#30773 Kabyle swap , and . as decimal seperator
diff --git a/i18npool/source/localedata/data/kab_DZ.xml b/i18npool/source/localedata/data/kab_DZ.xml
index 888f722..97f0ca7 100644
--- a/i18npool/source/localedata/data/kab_DZ.xml
+++ b/i18npool/source/localedata/data/kab_DZ.xml
@@ -14,8 +14,8 @@
<LC_CTYPE unoid="generic">
<Separators>
<DateSeparator>/</DateSeparator>
-<ThousandSeparator>,</ThousandSeparator>
-<DecimalSeparator>.</DecimalSeparator>
+<ThousandSeparator>.</ThousandSeparator>
+<DecimalSeparator>,</DecimalSeparator>
<TimeSeparator>:</TimeSeparator>
<Time100SecSeparator>.</Time100SecSeparator>
<ListSeparator>;</ListSeparator>
commit d563a6d994243619594ad58cb9ab84613b171660
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Oct 19 20:52:14 2010 +0100
WaE unused parameter
diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx
index c5bf9f3..0a93ed9 100644
--- a/toolkit/source/awt/vclxwindows.cxx
+++ b/toolkit/source/awt/vclxwindows.cxx
@@ -2303,7 +2303,7 @@ VCLXDialog::~VCLXDialog()
::com::sun::star::uno::Any VCLXDialog::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
{
::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
- SAL_STATIC_CAST( ::com::sun::star::document::XVbaMethodParameter*, this ), //liuchen 2009-6-23
+ SAL_STATIC_CAST( ::com::sun::star::document::XVbaMethodParameter*, this ),
SAL_STATIC_CAST( ::com::sun::star::awt::XDialog2*, this ),
SAL_STATIC_CAST( ::com::sun::star::awt::XDialog*, this ) );
return (aRet.hasValue() ? aRet : VCLXTopWindow::queryInterface( rType ));
@@ -2311,7 +2311,7 @@ VCLXDialog::~VCLXDialog()
// ::com::sun::star::lang::XTypeProvider
IMPL_XTYPEPROVIDER_START( VCLXDialog )
- getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::document::XVbaMethodParameter>* ) NULL ), //liuchen 2009-6-23
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::document::XVbaMethodParameter>* ) NULL ),
getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDialog2>* ) NULL ),
getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDialog>* ) NULL ),
VCLXTopWindow::getTypes()
@@ -2422,7 +2422,6 @@ void SAL_CALL VCLXDialog::draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::s
return aInfo;
}
-//liuchen 2009-7-22
// ::com::sun::star::document::XVbaMethodParameter
void SAL_CALL VCLXDialog::setVbaMethodParameter(
const ::rtl::OUString& PropertyName,
@@ -2444,7 +2443,7 @@ throw(::com::sun::star::uno::RuntimeException)
}
::com::sun::star::uno::Any SAL_CALL VCLXDialog::getVbaMethodParameter(
- const ::rtl::OUString& PropertyName )
+ const ::rtl::OUString& /*PropertyName*/ )
throw(::com::sun::star::uno::RuntimeException)
{
::vos::OGuard aGuard( GetMutex() );
@@ -2452,10 +2451,6 @@ throw(::com::sun::star::uno::RuntimeException)
::com::sun::star::uno::Any aRet;
return aRet;
}
-//liuchen 2009-7-22
-
-
-
void SAL_CALL VCLXDialog::setProperty(
const ::rtl::OUString& PropertyName,
commit 5c5c01d2c514aa12828679f079f12e5e22c0d842
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Oct 19 20:49:24 2010 +0100
remove unused method
diff --git a/toolkit/source/controls/dialogcontrol.cxx b/toolkit/source/controls/dialogcontrol.cxx
index fa6d50a..28ee668 100644
--- a/toolkit/source/controls/dialogcontrol.cxx
+++ b/toolkit/source/controls/dialogcontrol.cxx
@@ -119,32 +119,6 @@ namespace
return s_aLanguageDependentProperties;
}
- static uno::Reference< graphic::XGraphic > lcl_getGraphicFromURL_nothrow( const ::rtl::OUString& _rURL )
- {
- uno::Reference< graphic::XGraphic > xGraphic;
- if ( !_rURL.getLength() )
- return xGraphic;
-
- try
- {
- ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
- uno::Reference< graphic::XGraphicProvider > xProvider;
- if ( aContext.createComponent( "com.sun.star.graphic.GraphicProvider", xProvider ) )
- {
- uno::Sequence< beans::PropertyValue > aMediaProperties(1);
- aMediaProperties[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) );
- aMediaProperties[0].Value <<= _rURL;
- xGraphic = xProvider->queryGraphic( aMediaProperties );
- }
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
-
- return xGraphic;
- }
-
static ::rtl::OUString lcl_GetStringProperty( const ::rtl::OUString& sProperty, const Reference< XPropertySet >& xSet )
{
::rtl::OUString sValue;
commit 3f7fd418648861712530902f5f3ca24eb59e2d65
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Oct 19 20:33:54 2010 +0100
fdo#30773 Kabyle swap , and . as decimal seperator
diff --git a/i18npool/source/localedata/data/kab_DZ.xml b/i18npool/source/localedata/data/kab_DZ.xml
index 9a8c6ae..888f722 100644
--- a/i18npool/source/localedata/data/kab_DZ.xml
+++ b/i18npool/source/localedata/data/kab_DZ.xml
@@ -42,46 +42,46 @@
<FormatCode>0</FormatCode>
</FormatElement>
<FormatElement msgid="FixedFormatskey3" default="false" type="medium" usage="FIXED_NUMBER" formatindex="2">
-<FormatCode>0.00</FormatCode>
+<FormatCode>0,00</FormatCode>
</FormatElement>
<FormatElement msgid="FixedFormatskey4" default="false" type="short" usage="FIXED_NUMBER" formatindex="3">
-<FormatCode>#,##0</FormatCode>
+<FormatCode>#.##0</FormatCode>
</FormatElement>
<FormatElement msgid="FixedFormatskey5" default="false" type="medium" usage="FIXED_NUMBER" formatindex="4">
-<FormatCode>#,##0.00</FormatCode>
+<FormatCode>#.##0,00</FormatCode>
</FormatElement>
<FormatElement msgid="FixedFormatskey6" default="false" type="medium" usage="FIXED_NUMBER" formatindex="5">
-<FormatCode>#,###.00</FormatCode>
+<FormatCode>#.###,00</FormatCode>
</FormatElement>
<FormatElement msgid="ScientificFormatskey1" default="true" type="medium" usage="SCIENTIFIC_NUMBER" formatindex="6">
-<FormatCode>0.00E+00</FormatCode>
+<FormatCode>0,00E+00</FormatCode>
</FormatElement>
<FormatElement msgid="ScientificFormatskey2" default="false" type="medium" usage="SCIENTIFIC_NUMBER" formatindex="7">
-<FormatCode>0.00E+000</FormatCode>
+<FormatCode>0,00E+000</FormatCode>
</FormatElement>
<FormatElement msgid="PercentFormatskey1" default="true" type="short" usage="PERCENT_NUMBER" formatindex="8">
<FormatCode>0%</FormatCode>
</FormatElement>
<FormatElement msgid="PercentFormatskey2" default="true" type="long" usage="PERCENT_NUMBER" formatindex="9">
-<FormatCode>0.00%</FormatCode>
+<FormatCode>0,00%</FormatCode>
</FormatElement>
<FormatElement msgid="CurrencyFormatskey1" default="true" type="short" usage="CURRENCY" formatindex="12">
-<FormatCode>[CURRENCY]#,##0;-[CURRENCY]#,##0</FormatCode>
+<FormatCode>[CURRENCY]#.##0;-[CURRENCY]#.##0</FormatCode>
</FormatElement>
<FormatElement msgid="CurrencyFormatskey2" default="false" type="medium" usage="CURRENCY" formatindex="13">
-<FormatCode>[CURRENCY]#,##0.00;-[CURRENCY]#,##0.00</FormatCode>
+<FormatCode>[CURRENCY]#.##0,00;-[CURRENCY]#,##0,00</FormatCode>
</FormatElement>
<FormatElement msgid="CurrencyFormatskey3" default="false" type="medium" usage="CURRENCY" formatindex="14">
-<FormatCode>[CURRENCY]#,##0;[RED]-[CURRENCY]#,##0</FormatCode>
+<FormatCode>[CURRENCY]#.##0;[RED]-[CURRENCY]#.##0</FormatCode>
</FormatElement>
<FormatElement msgid="CurrencyFormatskey4" default="true" type="medium" usage="CURRENCY" formatindex="15">
-<FormatCode>[CURRENCY]#,##0.00;[RED]-[CURRENCY]#,##0.00</FormatCode>
+<FormatCode>[CURRENCY]#.##0,00;[RED]-[CURRENCY]#.##0,00</FormatCode>
</FormatElement>
<FormatElement msgid="CurrencyFormatskey5" default="false" type="medium" usage="CURRENCY" formatindex="16">
-<FormatCode>CCC#,##0.00</FormatCode>
+<FormatCode>CCC#.##0,00</FormatCode>
</FormatElement>
<FormatElement msgid="CurrencyFormatskey6" default="false" type="medium" usage="CURRENCY" formatindex="17">
-<FormatCode>[CURRENCY]#,##0.--;[RED]-[CURRENCY]#,##0.--</FormatCode>
+<FormatCode>[CURRENCY]#.##0,--;[RED]-[CURRENCY]#.##0,--</FormatCode>
</FormatElement>
<FormatElement msgid="DateFormatskey11" default="true" type="short" usage="DATE" formatindex="18">
<FormatCode>D/MM/YY</FormatCode>
@@ -164,10 +164,10 @@
<FormatCode>[HH]:MM:SS</FormatCode>
</FormatElement>
<FormatElement msgid="TimeFormatskey6" default="false" type="short" usage="TIME" formatindex="44">
-<FormatCode>MM:SS.00</FormatCode>
+<FormatCode>MM:SS,00</FormatCode>
</FormatElement>
<FormatElement msgid="TimeFormatskey7" default="false" type="medium" usage="TIME" formatindex="45">
-<FormatCode>[HH]:MM:SS.00</FormatCode>
+<FormatCode>[HH]:MM:SS,00</FormatCode>
</FormatElement>
<FormatElement msgid="DateTimeFormatskey1" default="true" type="medium" usage="DATE_TIME" formatindex="46">
<FormatCode>DD/MM/YY HH:MM</FormatCode>
commit b4f66faea24f5ed488f046d5bcfc90474e788ca0
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Oct 19 20:27:11 2010 +0100
#i101100# strict-alias clean
diff --git a/tools/source/ref/globname.cxx b/tools/source/ref/globname.cxx
index e4bb85b..7a7f5c5 100644
--- a/tools/source/ref/globname.cxx
+++ b/tools/source/ref/globname.cxx
@@ -95,9 +95,9 @@ SvGlobalName::SvGlobalName( UINT32 n1, USHORT n2, USHORT n3,
pImp = new ImpSvGlobalName();
pImp->nRefCount++;
- *(UINT32 *)pImp->szData = n1;
- *(USHORT *)&pImp->szData[ 4 ] = n2;
- *(USHORT *)&pImp->szData[ 6 ] = n3;
+ memcpy(pImp->szData, &n1, sizeof(n1));
+ memcpy(pImp->szData+4, &n2, sizeof(n2));
+ memcpy(pImp->szData+6, &n3, sizeof(n3));
pImp->szData[ 8 ] = b8;
pImp->szData[ 9 ] = b9;
pImp->szData[ 10 ] = b10;
@@ -150,9 +150,17 @@ void SvGlobalName::NewImp()
*************************************************************************/
SvStream& operator << ( SvStream& rOStr, const SvGlobalName & rObj )
{
- rOStr << *(UINT32 *)rObj.pImp->szData;
- rOStr << *(USHORT *)&rObj.pImp->szData[ 4 ];
- rOStr << *(USHORT *)&rObj.pImp->szData[ 6 ];
+ sal_uInt32 a;
+ memcpy(&a, rObj.pImp->szData, sizeof(sal_uInt32));
+ rOStr << a;
+
+ sal_uInt16 b;
+ memcpy(&b, rObj.pImp->szData+4, sizeof(sal_uInt16));
+ rOStr << b;
+
+ memcpy(&b, rObj.pImp->szData+6, sizeof(sal_uInt16));
+ rOStr << b;
+
rOStr.Write( (sal_Char *)&rObj.pImp->szData[ 8 ], 8 );
return rOStr;
}
@@ -160,9 +168,18 @@ SvStream& operator << ( SvStream& rOStr, const SvGlobalName & rObj )
SvStream& operator >> ( SvStream& rStr, SvGlobalName & rObj )
{
rObj.NewImp(); // kopieren, falls noetig
- rStr >> *(UINT32 *)rObj.pImp->szData;
- rStr >> *(USHORT *)&rObj.pImp->szData[ 4 ];
- rStr >> *(USHORT *)&rObj.pImp->szData[ 6 ];
+
+ sal_uInt32 a;
+ rStr >> a;
+ memcpy(rObj.pImp->szData, &a, sizeof(sal_uInt32));
+
+ sal_uInt16 b;
+ rStr >> b;
+ memcpy(rObj.pImp->szData+4, &b, sizeof(sal_uInt16));
+
+ rStr >> b;
+ memcpy(rObj.pImp->szData+6, &b, sizeof(sal_uInt16));
+
rStr.Read( (sal_Char *)&rObj.pImp->szData[ 8 ], 8 );
return rStr;
}
@@ -179,10 +196,25 @@ BOOL SvGlobalName::operator < ( const SvGlobalName & rObj ) const
return TRUE;
else if( n > 0 )
return FALSE;
- else if( *(USHORT *)&pImp->szData[ 4 ] < *(USHORT *)&rObj.pImp->szData[ 4 ] )
+
+ sal_uInt16 Data2_a;
+ memcpy(&Data2_a, pImp->szData+4, sizeof(sal_uInt16));
+
+ sal_uInt16 Data2_b;
+ memcpy(&Data2_b, rObj.pImp->szData+4, sizeof(sal_uInt16));
+
+ if( Data2_a < Data2_b )
return TRUE;
- else if( *(USHORT *)&pImp->szData[ 4 ] == *(USHORT *)&rObj.pImp->szData[ 4 ] )
- return *(UINT32 *)pImp->szData < *(UINT32 *)rObj.pImp->szData;
+ else if( Data2_a == Data2_b )
+ {
+ sal_uInt32 Data1_a;
+ memcpy(&Data1_a, pImp->szData+4, sizeof(sal_uInt32));
+
+ sal_uInt32 Data1_b;
+ memcpy(&Data1_b, rObj.pImp->szData+4, sizeof(sal_uInt32));
+
+ return Data1_a < Data1_b;
+ }
else
return FALSE;
@@ -194,11 +226,20 @@ BOOL SvGlobalName::operator < ( const SvGlobalName & rObj ) const
SvGlobalName & SvGlobalName::operator += ( UINT32 n )
{
NewImp();
- UINT32 nOld = (*(UINT32 *)pImp->szData);
- (*(UINT32 *)pImp->szData) += n;
- if( nOld > *(UINT32 *)pImp->szData )
- // ueberlauf
- (*(USHORT *)&pImp->szData[ 4 ])++;
+
+ sal_uInt32 nOld;
+ memcpy(&nOld, pImp->szData, sizeof(sal_uInt32));
+ sal_uInt32 nNew = nOld + n;
+ memcpy(pImp->szData, &nNew, sizeof(sal_uInt32));
+
+ if( nOld > nNew )
+ {
+ // overflow
+ sal_uInt16 Data2;
+ memcpy(&Data2, pImp->szData + 4, sizeof(sal_uInt16));
+ ++Data2;
+ memcpy(pImp->szData + 4, &Data2, sizeof(sal_uInt16));
+ }
return *this;
}
@@ -287,10 +328,10 @@ BOOL SvGlobalName::MakeId( const String & rIdStr )
}
NewImp();
- *(UINT32 *)pImp->szData = nFirst;
- *(USHORT *)&pImp->szData[ 4 ] = nSec;
- *(USHORT *)&pImp->szData[ 6 ] = nThird;
- memcpy( &pImp->szData[ 8 ], szRemain, 8 );
+ memcpy(&pImp->szData[0], &nFirst, sizeof(nFirst));
+ memcpy(&pImp->szData[4], &nSec, sizeof(nSec));
+ memcpy(&pImp->szData[6], &nThird, sizeof(nThird));
+ memcpy(&pImp->szData[ 8 ], szRemain, 8);
return TRUE;
}
return FALSE;
@@ -304,13 +345,17 @@ String SvGlobalName::GetctorName() const
ByteString aRet;
sal_Char buf[ 20 ];
- sprintf( buf, "0x%8.8lX", (ULONG)*(UINT32 *)pImp->szData );
+ sal_uInt32 Data1;
+ memcpy(&Data1, pImp->szData, sizeof(sal_uInt32));
+ sprintf( buf, "0x%8.8" SAL_PRIXUINT32, Data1 );
aRet += buf;
USHORT i;
for( i = 4; i < 8; i += 2 )
{
aRet += ',';
- sprintf( buf, "0x%4.4X", *(USHORT *)&pImp->szData[ i ] );
+ sal_uInt16 Data2;
+ memcpy(&Data2, pImp->szData+i, sizeof(sal_uInt16));
+ sprintf( buf, "0x%4.4X", Data2 );
aRet += buf;
}
for( i = 8; i < 16; i++ )
@@ -330,13 +375,17 @@ String SvGlobalName::GetHexName() const
ByteString aRet;
sal_Char buf[ 10 ];
- sprintf( buf, "%8.8lX", (ULONG)*(UINT32 *)pImp->szData );
+ sal_uInt32 Data1;
+ memcpy(&Data1, pImp->szData, sizeof(sal_uInt32));
+ sprintf( buf, "%8.8" SAL_PRIXUINT32, Data1 );
aRet += buf;
aRet += '-';
USHORT i ;
for( i = 4; i < 8; i += 2 )
{
- sprintf( buf, "%4.4X", *(USHORT *)&pImp->szData[ i ] );
+ sal_uInt16 Data2;
+ memcpy(&Data2, pImp->szData+i, sizeof(sal_uInt16));
+ sprintf( buf, "%4.4X", Data2 );
aRet += buf;
aRet += '-';
}
@@ -414,14 +463,20 @@ com::sun::star::uno::Sequence < sal_Int8 > SvGlobalName::GetByteSequence() const
// maybe transported remotely
com::sun::star::uno::Sequence< sal_Int8 > aResult( 16 );
- aResult[0] = (sal_Int8) (*(UINT32 *)pImp->szData >> 24);
- aResult[1] = (sal_Int8) ((*(UINT32 *)pImp->szData << 8 ) >> 24);
- aResult[2] = (sal_Int8) ((*(UINT32 *)pImp->szData << 16 ) >> 24);
- aResult[3] = (sal_Int8) ((*(UINT32 *)pImp->szData << 24 ) >> 24);
- aResult[4] = (sal_Int8) (*(USHORT *)&pImp->szData[ 4 ] >> 8);
- aResult[5] = (sal_Int8) ((*(USHORT *)&pImp->szData[ 4 ] << 8 ) >> 8);
- aResult[6] = (sal_Int8) (*(USHORT *)&pImp->szData[ 6 ] >> 8);
- aResult[7] = (sal_Int8) ((*(USHORT *)&pImp->szData[ 6 ] << 8 ) >> 8);
+ sal_uInt32 Data1;
+ memcpy(&Data1, pImp->szData, sizeof(sal_uInt32));
+ aResult[0] = (sal_Int8) (Data1 >> 24);
+ aResult[1] = (sal_Int8) ((Data1 << 8 ) >> 24);
+ aResult[2] = (sal_Int8) ((Data1 << 16 ) >> 24);
+ aResult[3] = (sal_Int8) ((Data1 << 24 ) >> 24);
+ sal_uInt16 Data2;
+ memcpy(&Data2, pImp->szData+4, sizeof(sal_uInt16));
+ aResult[4] = (sal_Int8) (Data2 >> 8);
+ aResult[5] = (sal_Int8) ((Data2 << 8 ) >> 8);
+ sal_uInt16 Data3;
+ memcpy(&Data3, pImp->szData+6, sizeof(sal_uInt16));
+ aResult[6] = (sal_Int8) (Data3 >> 8);
+ aResult[7] = (sal_Int8) ((Data3 << 8 ) >> 8);
aResult[8] = pImp->szData[ 8 ];
aResult[9] = pImp->szData[ 9 ];
aResult[10] = pImp->szData[ 10 ];
diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx
index 5f0832d..0b13c3e 100644
--- a/tools/source/stream/stream.cxx
+++ b/tools/source/stream/stream.cxx
@@ -96,7 +96,15 @@ inline static void SwapLongUInt( unsigned int& r )
#ifdef UNX
inline static void SwapFloat( float& r )
{
- *((sal_uInt32*)(void*)&r) = SWAPLONG( *((sal_uInt32*)(void*)&r) );
+ union
+ {
+ float f;
+ sal_uInt32 c;
+ } s;
+
+ s.f = r;
+ s.c = SWAPLONG( s.c );
+ r = s.f;
}
inline static void SwapDouble( double& r )
{
@@ -106,12 +114,19 @@ inline static void SwapDouble( double& r )
}
else
{
- sal_uInt32* c = (sal_uInt32*)(void*)&r;
- c[0] ^= c[1]; // zwei 32-Bit-Werte in situ vertauschen
- c[1] ^= c[0];
- c[0] ^= c[1];
- c[0] = SWAPLONG(c[0]); // und die beiden 32-Bit-Werte selbst in situ drehen
- c[1] = SWAPLONG(c[1]);
+ union
+ {
+ double d;
+ sal_uInt32 c[2];
+ } s;
+
+ s.d = r;
+ s.c[0] ^= s.c[1]; // zwei 32-Bit-Werte in situ vertauschen
+ s.c[1] ^= s.c[0];
+ s.c[0] ^= s.c[1];
+ s.c[0] = SWAPLONG(s.c[0]); // und die beiden 32-Bit-Werte selbst in situ drehen
+ s.c[1] = SWAPLONG(s.c[1]);
+ r = s.d;
}
}
#endif
More information about the Libreoffice-commits
mailing list