use for-range on Sequence in cli_ure..connectivity
Change-Id: Ic5254e402d153a13c29928b59738cbe1603d0139 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94399 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
@@ -316,15 +316,15 @@ void Test::testReadCommands()
|
||||
"/org.openoffice.Office.UI.GenericCommands/UserInterface/"
|
||||
"Commands"),
|
||||
css::uno::UNO_QUERY_THROW);
|
||||
css::uno::Sequence< OUString > names(access->getElementNames());
|
||||
const css::uno::Sequence< OUString > names(access->getElementNames());
|
||||
|
||||
/*CPPUNIT_ASSERT_EQUAL(749, names.getLength());*/
|
||||
// testSetSetMemberName() already removed ".uno:FontworkGalleryFloater"
|
||||
sal_uInt32 n = osl_getGlobalTimer();
|
||||
for (int i = 0; i < 8; ++i) {
|
||||
for (sal_Int32 j = 0; j < names.getLength(); ++j) {
|
||||
for (OUString const & childName : names) {
|
||||
css::uno::Reference< css::container::XNameAccess > child;
|
||||
if (access->getByName(names[j]) >>= child) {
|
||||
if (access->getByName(childName) >>= child) {
|
||||
CPPUNIT_ASSERT(child.is());
|
||||
child->getByName("Label");
|
||||
child->getByName("ContextLabel");
|
||||
|
@@ -1264,12 +1264,12 @@ bool addProperty(
|
||||
}
|
||||
case TYPE_STRING_LIST:
|
||||
{
|
||||
css::uno::Sequence<OUString> seq(
|
||||
const css::uno::Sequence<OUString> seq(
|
||||
value.get<css::uno::Sequence<OUString>>());
|
||||
std::vector<GVariant *> vs;
|
||||
for (sal_Int32 i = 0; i != seq.getLength(); ++i) {
|
||||
for (OUString const & s : seq) {
|
||||
children.emplace_front(
|
||||
g_variant_new_string(encodeString(seq[i]).getStr()));
|
||||
g_variant_new_string(encodeString(s).getStr()));
|
||||
if (children.front().get() == nullptr) {
|
||||
SAL_WARN(
|
||||
"configmgr.dconf", "g_variant_new_string failed");
|
||||
@@ -1287,11 +1287,11 @@ bool addProperty(
|
||||
}
|
||||
case TYPE_HEXBINARY_LIST:
|
||||
{
|
||||
css::uno::Sequence<css::uno::Sequence<sal_Int8>> seq(
|
||||
const css::uno::Sequence<css::uno::Sequence<sal_Int8>> seqSeq(
|
||||
value.get<
|
||||
css::uno::Sequence<css::uno::Sequence<sal_Int8>>>());
|
||||
std::vector<GVariant *> vs;
|
||||
for (sal_Int32 i = 0; i != seq.getLength(); ++i) {
|
||||
for (css::uno::Sequence<sal_Int8> const & seq : seqSeq) {
|
||||
static_assert(
|
||||
sizeof(sal_Int32) <= sizeof(gsize),
|
||||
"G_MAXSIZE too small");
|
||||
@@ -1299,8 +1299,8 @@ bool addProperty(
|
||||
sizeof (sal_Int8) == sizeof (guchar), "size mismatch");
|
||||
children.emplace_front(
|
||||
g_variant_new_fixed_array(
|
||||
G_VARIANT_TYPE_BYTE, seq[i].getConstArray(),
|
||||
seq[i].getLength(), sizeof (sal_Int8)));
|
||||
G_VARIANT_TYPE_BYTE, seq.getConstArray(),
|
||||
seq.getLength(), sizeof (sal_Int8)));
|
||||
if (children.front().get() == nullptr) {
|
||||
SAL_WARN(
|
||||
"configmgr.dconf",
|
||||
@@ -1318,7 +1318,7 @@ bool addProperty(
|
||||
sizeof(sal_Int32) <= sizeof(gsize),
|
||||
"G_MAXSIZE too small");
|
||||
v.reset(
|
||||
g_variant_new_array(ty.get(), vs.data(), seq.getLength()));
|
||||
g_variant_new_array(ty.get(), vs.data(), seqSeq.getLength()));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@@ -178,13 +178,13 @@ void writeValueContent_(TempFile &handle, const OUString& value) {
|
||||
void writeValueContent_(
|
||||
TempFile &handle, css::uno::Sequence< sal_Int8 > const & value)
|
||||
{
|
||||
for (sal_Int32 i = 0; i < value.getLength(); ++i) {
|
||||
for (const auto & v : value) {
|
||||
static char const hexDigit[16] = {
|
||||
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C',
|
||||
'D', 'E', 'F' };
|
||||
handle.writeString(
|
||||
std::string_view(hexDigit + ((value[i] >> 4) & 0xF), 1));
|
||||
handle.writeString(std::string_view(hexDigit + (value[i] & 0xF), 1));
|
||||
std::string_view(hexDigit + ((v >> 4) & 0xF), 1));
|
||||
handle.writeString(std::string_view(hexDigit + (v & 0xF), 1));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -219,9 +219,9 @@ template< typename T > void writeItemListValue(
|
||||
handle.writeString(">");
|
||||
css::uno::Sequence< T > val;
|
||||
value >>= val;
|
||||
for (sal_Int32 i = 0; i < val.getLength(); ++i) {
|
||||
for (const auto & i : val) {
|
||||
handle.writeString("<it>");
|
||||
writeValueContent_(handle, val[i]);
|
||||
writeValueContent_(handle, i);
|
||||
handle.writeString("</it>");
|
||||
}
|
||||
handle.writeString("</value>");
|
||||
|
@@ -946,11 +946,10 @@ try
|
||||
Reference< XPropertySetInfo> xOldInfo( xOldProps->getPropertySetInfo());
|
||||
Reference< XPropertySetInfo> xNewInfo( xNewProps->getPropertySetInfo());
|
||||
|
||||
Sequence< Property> aOldProperties = xOldInfo->getProperties();
|
||||
const Sequence< Property> aOldProperties = xOldInfo->getProperties();
|
||||
Sequence< Property> aNewProperties = xNewInfo->getProperties();
|
||||
int nNewLen = aNewProperties.getLength();
|
||||
|
||||
Property* pOldProps = aOldProperties.getArray();
|
||||
Property* pNewProps = aNewProperties.getArray();
|
||||
|
||||
OUString sPropFormatsSupplier("FormatsSupplier");
|
||||
@@ -968,18 +967,18 @@ try
|
||||
OUString sPropClassId("ClassId");
|
||||
OUString sFormattedServiceName( "com.sun.star.form.component.FormattedField" );
|
||||
|
||||
for (sal_Int32 i=0; i<aOldProperties.getLength(); ++i)
|
||||
for (const Property& rOldProp : aOldProperties)
|
||||
{
|
||||
if ( pOldProps[i].Name != "DefaultControl" && pOldProps[i].Name != "LabelControl" )
|
||||
if ( rOldProp.Name != "DefaultControl" && rOldProp.Name != "LabelControl" )
|
||||
{
|
||||
// binary search
|
||||
Property* pResult = std::lower_bound(
|
||||
pNewProps, pNewProps + nNewLen, pOldProps[i], ::comphelper::PropertyCompareByName());
|
||||
pNewProps, pNewProps + nNewLen, rOldProp, ::comphelper::PropertyCompareByName());
|
||||
|
||||
if ( ( pResult != aNewProperties.end() )
|
||||
&& ( pResult->Name == pOldProps[i].Name )
|
||||
&& ( pResult->Name == rOldProp.Name )
|
||||
&& ( (pResult->Attributes & PropertyAttribute::READONLY) == 0 )
|
||||
&& ( pResult->Type.equals(pOldProps[i].Type)) )
|
||||
&& ( pResult->Type.equals(rOldProp.Type)) )
|
||||
{ // Attributes match and the property is not read-only
|
||||
try
|
||||
{
|
||||
|
@@ -1338,13 +1338,13 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables(
|
||||
else
|
||||
{
|
||||
queryBuf.append("( (0 = 1) ");
|
||||
for (int i = 0; i < types.getLength(); i++)
|
||||
for (OUString const & t : types)
|
||||
{
|
||||
if (types[i] == "SYSTEM TABLE")
|
||||
if (t == "SYSTEM TABLE")
|
||||
queryBuf.append("OR (RDB$SYSTEM_FLAG = 1 AND RDB$VIEW_BLR IS NULL) ");
|
||||
else if (types[i] == "TABLE")
|
||||
else if (t == "TABLE")
|
||||
queryBuf.append("OR (RDB$SYSTEM_FLAG IS NULL OR RDB$SYSTEM_FLAG = 0 AND RDB$VIEW_BLR IS NULL) ");
|
||||
else if (types[i] == "VIEW")
|
||||
else if (t == "VIEW")
|
||||
queryBuf.append("OR (RDB$SYSTEM_FLAG IS NULL OR RDB$SYSTEM_FLAG = 0 AND RDB$VIEW_BLR IS NOT NULL) ");
|
||||
else
|
||||
throw SQLException(); // TODO: implement other types, see above.
|
||||
|
@@ -662,7 +662,7 @@ bool OFlatTable::fetchRow(OValueRefRow& _rRow, const OSQLColumns & _rCols, bool
|
||||
}
|
||||
else
|
||||
aBuf.append(cChar);
|
||||
} // for (j = 0; j < aStr.getLength(); ++j)
|
||||
} // for (j = 0; j < aStr.(); ++j)
|
||||
aStrConverted = aBuf.makeStringAndClear();
|
||||
} // if ( DataType::INTEGER != nType )
|
||||
else
|
||||
|
@@ -397,12 +397,12 @@ static void properties2arrays( const Sequence< PropertyValue > & args,
|
||||
"requiressl"
|
||||
};
|
||||
|
||||
for( int i = 0; i < args.getLength() ; ++i )
|
||||
for( PropertyValue const & prop : args )
|
||||
{
|
||||
bool append = false;
|
||||
for(const char* j : keyword_list)
|
||||
{
|
||||
if( args[i].Name.equalsIgnoreAsciiCaseAscii( j ))
|
||||
if( prop.Name.equalsIgnoreAsciiCaseAscii( j ))
|
||||
{
|
||||
keywords.push_back( j, SAL_NO_ACQUIRE );
|
||||
append = true;
|
||||
@@ -413,14 +413,14 @@ static void properties2arrays( const Sequence< PropertyValue > & args,
|
||||
if( append )
|
||||
{
|
||||
OUString value;
|
||||
tc->convertTo( args[i].Value, cppu::UnoType<decltype(value)>::get() ) >>= value;
|
||||
tc->convertTo( prop.Value, cppu::UnoType<decltype(value)>::get() ) >>= value;
|
||||
char *v = strdup(OUStringToOString(value, enc).getStr());
|
||||
values.push_back ( v );
|
||||
}
|
||||
else
|
||||
{
|
||||
// ignore for now
|
||||
SAL_WARN("connectivity.postgresql", "sdbc-postgresql: unknown argument '" << args[i].Name << "' having value: " << args[i].Value );
|
||||
SAL_WARN("connectivity.postgresql", "sdbc-postgresql: unknown argument '" << prop.Name << "' having value: " << prop.Value );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -637,7 +637,7 @@ Reference< XResultSet > getGeneratedValuesFromLastInsert(
|
||||
// TODO: make also unqualified tables names work here. Have a look at 2.8.3. The Schema Search Path
|
||||
// in postgresql doc
|
||||
|
||||
Sequence< OUString > keyColumnNames = getPrimaryKeyColumnNames( connection, schemaName, tableName );
|
||||
const Sequence< OUString > keyColumnNames = getPrimaryKeyColumnNames( connection, schemaName, tableName );
|
||||
if( keyColumnNames.hasElements() )
|
||||
{
|
||||
OUStringBuffer buf( 128 );
|
||||
@@ -646,10 +646,10 @@ Reference< XResultSet > getGeneratedValuesFromLastInsert(
|
||||
buf.append( " WHERE " );
|
||||
bool bAdditionalCondition = false;
|
||||
String2StringMap autoValues;
|
||||
for( int i = 0 ; i < keyColumnNames.getLength() ; i ++ )
|
||||
for( OUString const & columnNameUnicode : keyColumnNames )
|
||||
{
|
||||
OUString value;
|
||||
OString columnName = OUStringToOString( keyColumnNames[i], ConnectionSettings::encoding );
|
||||
OString columnName = OUStringToOString( columnNameUnicode, ConnectionSettings::encoding );
|
||||
bool bColumnMatchNamedValue = false;
|
||||
for (auto const& namedValue : namedValues)
|
||||
{
|
||||
@@ -701,7 +701,7 @@ Reference< XResultSet > getGeneratedValuesFromLastInsert(
|
||||
|
||||
if( bAdditionalCondition )
|
||||
buf.append( " AND " );
|
||||
bufferQuoteIdentifier( buf, keyColumnNames[i], pConnectionSettings );
|
||||
bufferQuoteIdentifier( buf, columnNameUnicode, pConnectionSettings );
|
||||
buf.append( " = " );
|
||||
buf.append( value );
|
||||
bAdditionalCondition = true;
|
||||
|
@@ -178,12 +178,12 @@ void ReflectionBase::copyValuesFrom( const Reference< XPropertySet > & set )
|
||||
{
|
||||
Reference< XPropertySetInfo > myPropInfo = getPropertySetInfo();
|
||||
|
||||
Sequence< Property > props = info->getProperties();
|
||||
for( int i = 0 ; i < props.getLength() ; i ++ )
|
||||
const Sequence< Property > props = info->getProperties();
|
||||
for( Property const & prop : props )
|
||||
{
|
||||
if( myPropInfo->hasPropertyByName( props[i].Name ) )
|
||||
if( myPropInfo->hasPropertyByName( prop.Name ) )
|
||||
setPropertyValue_NoBroadcast_public(
|
||||
props[i].Name, set->getPropertyValue( props[i].Name ) );
|
||||
prop.Name, set->getPropertyValue( prop.Name ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user