Kaydet (Commit) b9446cd4 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

loplugin:cstylecast

Change-Id: I20b7936d2bb11363a701ca649deba31d53c76868
üst 1fca9d18
...@@ -140,7 +140,7 @@ MacabRecords *MacabAddressBook::getMacabRecordsMatch(const OUString& _tableName) ...@@ -140,7 +140,7 @@ MacabRecords *MacabAddressBook::getMacabRecordsMatch(const OUString& _tableName)
/* Go through each group and create a MacabGroup out of it. */ /* Go through each group and create a MacabGroup out of it. */
for(i = 0; i < nGroups; i++) for(i = 0; i < nGroups; i++)
{ {
xGroup = (ABGroupRef) CFArrayGetValueAtIndex(allGroups, i); xGroup = static_cast<ABGroupRef>(const_cast<void *>(CFArrayGetValueAtIndex(allGroups, i)));
m_xMacabGroups[i] = new MacabGroup(m_aAddressBook, m_xMacabRecords, xGroup); m_xMacabGroups[i] = new MacabGroup(m_aAddressBook, m_xMacabRecords, xGroup);
} }
......
...@@ -910,7 +910,7 @@ Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getColumns( ...@@ -910,7 +910,7 @@ Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getColumns(
++aField, ++nPosition) ++aField, ++nPosition)
{ {
sName = CFStringToOUString((CFStringRef) (*aField)->value); sName = CFStringToOUString(static_cast<CFStringRef>((*aField)->value));
if (match(columnNamePattern, sName, '\0')) if (match(columnNamePattern, sName, '\0'))
{ {
aRow[4] = new ORowSetValueDecorator(sName); aRow[4] = new ORowSetValueDecorator(sName);
......
...@@ -66,7 +66,7 @@ namespace ...@@ -66,7 +66,7 @@ namespace
{ {
const OUString sSymbolName = OUString::createFromAscii( _pAsciiSymbolName ); const OUString sSymbolName = OUString::createFromAscii( _pAsciiSymbolName );
_rFunction = (FUNCTION)( osl_getSymbol( _rModule, sSymbolName.pData ) ); _rFunction = reinterpret_cast<FUNCTION>( osl_getSymbol( _rModule, sSymbolName.pData ) );
if ( !_rFunction ) if ( !_rFunction )
{ // did not find the symbol { // did not find the symbol
......
...@@ -43,7 +43,7 @@ MacabGroup::MacabGroup(const ABAddressBookRef _addressBook, const MacabRecords * ...@@ -43,7 +43,7 @@ MacabGroup::MacabGroup(const ABAddressBookRef _addressBook, const MacabRecords *
// Set the group's name (stored in MacabRecords as m_sName) // Set the group's name (stored in MacabRecords as m_sName)
CFStringRef sGroupName; CFStringRef sGroupName;
sGroupName = (CFStringRef) ABRecordCopyValue(_xGroup, kABGroupNameProperty); sGroupName = static_cast<CFStringRef>(ABRecordCopyValue(_xGroup, kABGroupNameProperty));
m_sName = CFStringToOUString(sGroupName); m_sName = CFStringToOUString(sGroupName);
CFRelease(sGroupName); CFRelease(sGroupName);
...@@ -60,10 +60,10 @@ MacabGroup::MacabGroup(const ABAddressBookRef _addressBook, const MacabRecords * ...@@ -60,10 +60,10 @@ MacabGroup::MacabGroup(const ABAddressBookRef _addressBook, const MacabRecords *
nAllRecordsSize = _allRecords->size(); nAllRecordsSize = _allRecords->size();
for(i = 0; i < recordsSize; i++) for(i = 0; i < recordsSize; i++)
{ {
xPerson = (ABPersonRef) CFArrayGetValueAtIndex(xGroupMembers,i); xPerson = static_cast<ABPersonRef>(const_cast<void *>(CFArrayGetValueAtIndex(xGroupMembers,i)));
if(xPerson != NULL) if(xPerson != NULL)
{ {
sGroupMemberUID = (CFStringRef) ABRecordCopyValue(xPerson, kABUIDProperty); sGroupMemberUID = static_cast<CFStringRef>(ABRecordCopyValue(xPerson, kABUIDProperty));
if(sGroupMemberUID != NULL) if(sGroupMemberUID != NULL)
{ {
bFound = false; bFound = false;
......
...@@ -150,7 +150,7 @@ OUString MacabHeader::getString(const sal_Int32 i) const ...@@ -150,7 +150,7 @@ OUString MacabHeader::getString(const sal_Int32 i) const
return OUString(); return OUString();
try try
{ {
nRet = CFStringToOUString( (CFStringRef) fields[i]->value); nRet = CFStringToOUString(static_cast<CFStringRef>(fields[i]->value));
} }
catch(...){ } catch(...){ }
} }
...@@ -256,8 +256,8 @@ sal_Int32 MacabHeader::compareFields(const macabfield *_field1, const macabfield ...@@ -256,8 +256,8 @@ sal_Int32 MacabHeader::compareFields(const macabfield *_field1, const macabfield
return -1; return -1;
CFComparisonResult result = CFStringCompare( CFComparisonResult result = CFStringCompare(
(CFStringRef) _field1->value, static_cast<CFStringRef>(_field1->value),
(CFStringRef) _field2->value, static_cast<CFStringRef>(_field2->value),
0); // 0 = no options (like ignore case) 0); // 0 = no options (like ignore case)
return (sal_Int32) result; return (sal_Int32) result;
......
...@@ -75,7 +75,7 @@ void MacabPreparedStatement::getNextParameter(OUString &rParameter) const throw( ...@@ -75,7 +75,7 @@ void MacabPreparedStatement::getNextParameter(OUString &rParameter) const throw(
const OUString sError( aResources.getResourceString( const OUString sError( aResources.getResourceString(
STR_INVALID_PARA_COUNT STR_INVALID_PARA_COUNT
) ); ) );
::dbtools::throwGenericSQLException(sError,*(MacabPreparedStatement *) this); ::dbtools::throwGenericSQLException(sError,*const_cast<MacabPreparedStatement *>(this));
} }
rParameter = (m_aParameterRow->get())[m_nParameterIndex]; rParameter = (m_aParameterRow->get())[m_nParameterIndex];
......
...@@ -190,23 +190,23 @@ sal_Int32 MacabRecord::compareFields(const macabfield *_field1, const macabfield ...@@ -190,23 +190,23 @@ sal_Int32 MacabRecord::compareFields(const macabfield *_field1, const macabfield
{ {
case kABStringProperty: case kABStringProperty:
result = CFStringCompare( result = CFStringCompare(
(CFStringRef) _field1->value, static_cast<CFStringRef>(_field1->value),
(CFStringRef) _field2->value, static_cast<CFStringRef>(_field2->value),
kCFCompareLocalized); // Specifies that the comparison should take into account differences related to locale, such as the thousands separator character. kCFCompareLocalized); // Specifies that the comparison should take into account differences related to locale, such as the thousands separator character.
break; break;
case kABDateProperty: case kABDateProperty:
result = CFDateCompare( result = CFDateCompare(
(CFDateRef) _field1->value, static_cast<CFDateRef>(_field1->value),
(CFDateRef) _field2->value, static_cast<CFDateRef>(_field2->value),
NULL); // NULL = unused variable NULL); // NULL = unused variable
break; break;
case kABIntegerProperty: case kABIntegerProperty:
case kABRealProperty: case kABRealProperty:
result = CFNumberCompare( result = CFNumberCompare(
(CFNumberRef) _field1->value, static_cast<CFNumberRef>(_field1->value),
(CFNumberRef) _field2->value, static_cast<CFNumberRef>(_field2->value),
NULL); // NULL = unused variable NULL); // NULL = unused variable
break; break;
...@@ -301,30 +301,30 @@ OUString MacabRecord::fieldToString(const macabfield *_aField) ...@@ -301,30 +301,30 @@ OUString MacabRecord::fieldToString(const macabfield *_aField)
switch(_aField->type) switch(_aField->type)
{ {
case kABStringProperty: case kABStringProperty:
fieldString = CFStringToOUString((CFStringRef) _aField->value); fieldString = CFStringToOUString(static_cast<CFStringRef>(_aField->value));
break; break;
case kABDateProperty: case kABDateProperty:
{ {
DateTime aTime = CFDateToDateTime((CFDateRef) _aField->value); DateTime aTime = CFDateToDateTime(static_cast<CFDateRef>(_aField->value));
fieldString = DBTypeConversion::toDateTimeString(aTime); fieldString = DBTypeConversion::toDateTimeString(aTime);
} }
break; break;
case kABIntegerProperty: case kABIntegerProperty:
{ {
CFNumberType numberType = CFNumberGetType( (CFNumberRef) _aField->value ); CFNumberType numberType = CFNumberGetType( static_cast<CFNumberRef>(_aField->value) );
sal_Int64 nVal; sal_Int64 nVal;
// Should we check for the wrong type here, e.g., a float? // Should we check for the wrong type here, e.g., a float?
bool m_bSuccess = !CFNumberGetValue((CFNumberRef) _aField->value, numberType, &nVal); bool m_bSuccess = !CFNumberGetValue(static_cast<CFNumberRef>(_aField->value), numberType, &nVal);
if(m_bSuccess) if(m_bSuccess)
fieldString = OUString::number(nVal); fieldString = OUString::number(nVal);
} }
break; break;
case kABRealProperty: case kABRealProperty:
{ {
CFNumberType numberType = CFNumberGetType( (CFNumberRef) _aField->value ); CFNumberType numberType = CFNumberGetType( static_cast<CFNumberRef>(_aField->value) );
double nVal; double nVal;
// Should we check for the wrong type here, e.g., an int? // Should we check for the wrong type here, e.g., an int?
bool m_bSuccess = !CFNumberGetValue((CFNumberRef) _aField->value, numberType, &nVal); bool m_bSuccess = !CFNumberGetValue(static_cast<CFNumberRef>(_aField->value), numberType, &nVal);
if(m_bSuccess) if(m_bSuccess)
fieldString = OUString::number(nVal); fieldString = OUString::number(nVal);
} }
......
...@@ -219,7 +219,7 @@ OUString SAL_CALL MacabResultSet::getString(sal_Int32 columnIndex) throw(SQLExce ...@@ -219,7 +219,7 @@ OUString SAL_CALL MacabResultSet::getString(sal_Int32 columnIndex) throw(SQLExce
{ {
if(aField->type == kABStringProperty) if(aField->type == kABStringProperty)
{ {
aRet = CFStringToOUString( (CFStringRef) aField->value); aRet = CFStringToOUString(static_cast<CFStringRef>(aField->value));
m_bWasNull = false; m_bWasNull = false;
} }
} }
...@@ -278,10 +278,10 @@ sal_Int32 SAL_CALL MacabResultSet::getInt(sal_Int32 columnIndex) throw(SQLExcept ...@@ -278,10 +278,10 @@ sal_Int32 SAL_CALL MacabResultSet::getInt(sal_Int32 columnIndex) throw(SQLExcept
{ {
if(aField->type == kABIntegerProperty) if(aField->type == kABIntegerProperty)
{ {
CFNumberType numberType = CFNumberGetType( (CFNumberRef) aField->value ); CFNumberType numberType = CFNumberGetType( static_cast<CFNumberRef>(aField->value) );
// m_bWasNull now becomes whether getting the value was successful // m_bWasNull now becomes whether getting the value was successful
// Should we check for the wrong type here, e.g., a float or a 64 bit int? // Should we check for the wrong type here, e.g., a float or a 64 bit int?
m_bWasNull = !CFNumberGetValue((CFNumberRef) aField->value, numberType, &nRet); m_bWasNull = !CFNumberGetValue(static_cast<CFNumberRef>(aField->value), numberType, &nRet);
} }
} }
} }
...@@ -307,10 +307,10 @@ sal_Int64 SAL_CALL MacabResultSet::getLong(sal_Int32 columnIndex) throw(SQLExcep ...@@ -307,10 +307,10 @@ sal_Int64 SAL_CALL MacabResultSet::getLong(sal_Int32 columnIndex) throw(SQLExcep
{ {
if(aField->type == kABIntegerProperty) if(aField->type == kABIntegerProperty)
{ {
CFNumberType numberType = CFNumberGetType( (CFNumberRef) aField->value ); CFNumberType numberType = CFNumberGetType( static_cast<CFNumberRef>(aField->value) );
// m_bWasNull now becomes whether getting the value was successful // m_bWasNull now becomes whether getting the value was successful
// Should we check for the wrong type here, e.g., a float or a 32 bit int? // Should we check for the wrong type here, e.g., a float or a 32 bit int?
m_bWasNull = !CFNumberGetValue((CFNumberRef) aField->value, numberType, &nRet); m_bWasNull = !CFNumberGetValue(static_cast<CFNumberRef>(aField->value), numberType, &nRet);
} }
} }
} }
...@@ -336,10 +336,10 @@ float SAL_CALL MacabResultSet::getFloat(sal_Int32 columnIndex) throw(SQLExceptio ...@@ -336,10 +336,10 @@ float SAL_CALL MacabResultSet::getFloat(sal_Int32 columnIndex) throw(SQLExceptio
{ {
if(aField->type == kABRealProperty) if(aField->type == kABRealProperty)
{ {
CFNumberType numberType = CFNumberGetType( (CFNumberRef) aField->value ); CFNumberType numberType = CFNumberGetType( static_cast<CFNumberRef>(aField->value) );
// m_bWasNull now becomes whether getting the value was successful // m_bWasNull now becomes whether getting the value was successful
// Should we check for the wrong type here, e.g., an int or a double? // Should we check for the wrong type here, e.g., an int or a double?
m_bWasNull = !CFNumberGetValue((CFNumberRef) aField->value, numberType, &nVal); m_bWasNull = !CFNumberGetValue(static_cast<CFNumberRef>(aField->value), numberType, &nVal);
} }
} }
} }
...@@ -365,10 +365,10 @@ double SAL_CALL MacabResultSet::getDouble(sal_Int32 columnIndex) throw(SQLExcept ...@@ -365,10 +365,10 @@ double SAL_CALL MacabResultSet::getDouble(sal_Int32 columnIndex) throw(SQLExcept
{ {
if(aField->type == kABRealProperty) if(aField->type == kABRealProperty)
{ {
CFNumberType numberType = CFNumberGetType( (CFNumberRef) aField->value ); CFNumberType numberType = CFNumberGetType( static_cast<CFNumberRef>(aField->value) );
// m_bWasNull now becomes whether getting the value was successful // m_bWasNull now becomes whether getting the value was successful
// Should we check for the wrong type here, e.g., an int or a float? // Should we check for the wrong type here, e.g., an int or a float?
m_bWasNull = !CFNumberGetValue((CFNumberRef) aField->value, numberType, &nVal); m_bWasNull = !CFNumberGetValue(static_cast<CFNumberRef>(aField->value), numberType, &nVal);
} }
} }
} }
...@@ -426,7 +426,7 @@ DateTime SAL_CALL MacabResultSet::getTimestamp(sal_Int32 columnIndex) throw(SQLE ...@@ -426,7 +426,7 @@ DateTime SAL_CALL MacabResultSet::getTimestamp(sal_Int32 columnIndex) throw(SQLE
{ {
if(aField->type == kABDateProperty) if(aField->type == kABDateProperty)
{ {
nRet = CFDateToDateTime((CFDateRef) aField->value); nRet = CFDateToDateTime(static_cast<CFDateRef>(aField->value));
m_bWasNull = false; m_bWasNull = false;
} }
} }
...@@ -885,7 +885,7 @@ Any SAL_CALL MacabResultSet::getBookmark() throw( SQLException, RuntimeExceptio ...@@ -885,7 +885,7 @@ Any SAL_CALL MacabResultSet::getBookmark() throw( SQLException, RuntimeExceptio
{ {
if(uidField->type == kABStringProperty) if(uidField->type == kABStringProperty)
{ {
return makeAny(CFStringToOUString( (CFStringRef) uidField->value )); return makeAny(CFStringToOUString( static_cast<CFStringRef>(uidField->value) ));
} }
} }
} }
...@@ -907,7 +907,7 @@ sal_Bool SAL_CALL MacabResultSet::moveToBookmark(const Any& bookmark) throw( SQ ...@@ -907,7 +907,7 @@ sal_Bool SAL_CALL MacabResultSet::moveToBookmark(const Any& bookmark) throw( SQ
{ {
if(uidField->type == kABStringProperty) if(uidField->type == kABStringProperty)
{ {
OUString sUniqueIdentifier = CFStringToOUString( (CFStringRef) uidField->value ); OUString sUniqueIdentifier = CFStringToOUString( static_cast<CFStringRef>(uidField->value) );
if (sUniqueIdentifier == sBookmark) if (sUniqueIdentifier == sBookmark)
{ {
m_nRowPos = nRow; m_nRowPos = nRow;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment