Kaydet (Commit) 8cf32d61 authored tarafından Luboš Luňák's avatar Luboš Luňák

int vs oslInterlockedCount ambiguity

Change-Id: I096b1232427ad6996e0b2cfafc9ba38386e19208
üst f0d75874
...@@ -60,7 +60,7 @@ CPPUNIT_TEST_SUITE_END(); ...@@ -60,7 +60,7 @@ CPPUNIT_TEST_SUITE_END();
void test::ostring::StringConcat::checkConcat() void test::ostring::StringConcat::checkConcat()
{ {
// All the extra () are to protect commas againsts being treated as separators of macro arguments. // All the extra () are to protect commas againsts being treated as separators of macro arguments.
CPPUNIT_ASSERT_EQUAL( OString(), OString(OString() + OString()) ); CPPUNIT_ASSERT_EQUAL( OString(), OString(OString() + OString()));
CPPUNIT_ASSERT_EQUAL( OString( "foobar" ), OString( OString( "foo" ) + OString( "bar" ))); CPPUNIT_ASSERT_EQUAL( OString( "foobar" ), OString( OString( "foo" ) + OString( "bar" )));
TYPES_ASSERT_EQUAL(( typeid( OStringConcat< OString, OString > )), typeid( OString( "foo" ) + OString( "bar" ))); TYPES_ASSERT_EQUAL(( typeid( OStringConcat< OString, OString > )), typeid( OString( "foo" ) + OString( "bar" )));
CPPUNIT_ASSERT_EQUAL( OString( "foobar" ), OString( OString( "foo" ) + "bar" )); CPPUNIT_ASSERT_EQUAL( OString( "foobar" ), OString( OString( "foo" ) + "bar" ));
...@@ -93,33 +93,33 @@ void test::ostring::StringConcat::checkEnsureCapacity() ...@@ -93,33 +93,33 @@ void test::ostring::StringConcat::checkEnsureCapacity()
rtl_String* str = NULL; rtl_String* str = NULL;
rtl_string_newFromLiteral( &str, "test", strlen( "test" ), 0 ); rtl_string_newFromLiteral( &str, "test", strlen( "test" ), 0 );
CPPUNIT_ASSERT_EQUAL( sal_Int32( 4 ), str->length ); CPPUNIT_ASSERT_EQUAL( sal_Int32( 4 ), str->length );
CPPUNIT_ASSERT_EQUAL( 1, str->refCount ); CPPUNIT_ASSERT_EQUAL( 1, int( str->refCount ));
rtl_String* oldStr = str; rtl_String* oldStr = str;
rtl_string_ensureCapacity( &str, 4 ); // should be no-op rtl_string_ensureCapacity( &str, 4 ); // should be no-op
CPPUNIT_ASSERT_EQUAL( sal_Int32( 4 ), str->length ); CPPUNIT_ASSERT_EQUAL( sal_Int32( 4 ), str->length );
CPPUNIT_ASSERT_EQUAL( 1, str->refCount ); CPPUNIT_ASSERT_EQUAL( 1, int( str->refCount ));
CPPUNIT_ASSERT( oldStr == str ); CPPUNIT_ASSERT( oldStr == str );
rtl_string_acquire( oldStr ); rtl_string_acquire( oldStr );
CPPUNIT_ASSERT_EQUAL( 2, str->refCount ); CPPUNIT_ASSERT_EQUAL( 2, int( str->refCount ));
rtl_string_ensureCapacity( &str, 4 ); rtl_string_ensureCapacity( &str, 4 );
CPPUNIT_ASSERT_EQUAL( sal_Int32( 4 ), str->length ); CPPUNIT_ASSERT_EQUAL( sal_Int32( 4 ), str->length );
CPPUNIT_ASSERT_EQUAL( 1, str->refCount ); CPPUNIT_ASSERT_EQUAL( 1, int( str->refCount ));
// a copy was forced because of refcount // a copy was forced because of refcount
CPPUNIT_ASSERT( oldStr != str ); CPPUNIT_ASSERT( oldStr != str );
CPPUNIT_ASSERT( strcmp( oldStr->buffer, str->buffer ) == 0 ); CPPUNIT_ASSERT( strcmp( oldStr->buffer, str->buffer ) == 0 );
CPPUNIT_ASSERT_EQUAL( 1, oldStr->refCount ); CPPUNIT_ASSERT_EQUAL( 1, int( oldStr->refCount ));
rtl_string_release( str ); rtl_string_release( str );
str = oldStr; str = oldStr;
rtl_string_acquire( oldStr ); rtl_string_acquire( oldStr );
rtl_string_ensureCapacity( &str, 1024 ); rtl_string_ensureCapacity( &str, 1024 );
CPPUNIT_ASSERT_EQUAL( sal_Int32( 4 ), str->length ); // size is still 4 CPPUNIT_ASSERT_EQUAL( sal_Int32( 4 ), str->length ); // size is still 4
CPPUNIT_ASSERT_EQUAL( 1, str->refCount ); CPPUNIT_ASSERT_EQUAL( 1, int( str->refCount ));
CPPUNIT_ASSERT( oldStr != str ); CPPUNIT_ASSERT( oldStr != str );
CPPUNIT_ASSERT( strcmp( oldStr->buffer, str->buffer ) == 0 ); CPPUNIT_ASSERT( strcmp( oldStr->buffer, str->buffer ) == 0 );
CPPUNIT_ASSERT_EQUAL( 1, oldStr->refCount ); CPPUNIT_ASSERT_EQUAL( 1, int( oldStr->refCount ));
strcpy( str->buffer, "01234567890123456789" ); // but there should be extra capacity strcpy( str->buffer, "01234567890123456789" ); // but there should be extra capacity
str->length += 20; str->length += 20;
rtl_string_release( str ); rtl_string_release( str );
......
...@@ -60,7 +60,7 @@ CPPUNIT_TEST_SUITE_END(); ...@@ -60,7 +60,7 @@ CPPUNIT_TEST_SUITE_END();
void test::oustring::StringConcat::checkConcat() void test::oustring::StringConcat::checkConcat()
{ {
// All the extra () are to protect commas againsts being treated as separators of macro arguments. // All the extra () are to protect commas againsts being treated as separators of macro arguments.
CPPUNIT_ASSERT_EQUAL( OUString(), OUString(OUString() + OUString()) ); CPPUNIT_ASSERT_EQUAL( OUString(), OUString(OUString() + OUString()));
CPPUNIT_ASSERT_EQUAL( OUString( "foobar" ), OUString( OUString( "foo" ) + OUString( "bar" ))); CPPUNIT_ASSERT_EQUAL( OUString( "foobar" ), OUString( OUString( "foo" ) + OUString( "bar" )));
TYPES_ASSERT_EQUAL(( typeid( OUStringConcat< OUString, OUString > )), typeid( OUString( "foo" ) + OUString( "bar" ))); TYPES_ASSERT_EQUAL(( typeid( OUStringConcat< OUString, OUString > )), typeid( OUString( "foo" ) + OUString( "bar" )));
CPPUNIT_ASSERT_EQUAL( OUString( "foobar" ), OUString( OUString( "foo" ) + "bar" )); CPPUNIT_ASSERT_EQUAL( OUString( "foobar" ), OUString( OUString( "foo" ) + "bar" ));
...@@ -81,33 +81,33 @@ void test::oustring::StringConcat::checkEnsureCapacity() ...@@ -81,33 +81,33 @@ void test::oustring::StringConcat::checkEnsureCapacity()
rtl_uString* str = NULL; rtl_uString* str = NULL;
rtl_uString_newFromLiteral( &str, "test", strlen( "test" ), 0 ); rtl_uString_newFromLiteral( &str, "test", strlen( "test" ), 0 );
CPPUNIT_ASSERT_EQUAL( sal_Int32( 4 ), str->length ); CPPUNIT_ASSERT_EQUAL( sal_Int32( 4 ), str->length );
CPPUNIT_ASSERT_EQUAL( 1, str->refCount ); CPPUNIT_ASSERT_EQUAL( 1, int( str->refCount ));
rtl_uString* oldStr = str; rtl_uString* oldStr = str;
rtl_uString_ensureCapacity( &str, 4 ); // should be no-op rtl_uString_ensureCapacity( &str, 4 ); // should be no-op
CPPUNIT_ASSERT_EQUAL( sal_Int32( 4 ), str->length ); CPPUNIT_ASSERT_EQUAL( sal_Int32( 4 ), str->length );
CPPUNIT_ASSERT_EQUAL( 1, str->refCount ); CPPUNIT_ASSERT_EQUAL( 1, int( str->refCount ));
CPPUNIT_ASSERT( oldStr == str ); CPPUNIT_ASSERT( oldStr == str );
rtl_uString_acquire( oldStr ); rtl_uString_acquire( oldStr );
CPPUNIT_ASSERT_EQUAL( 2, str->refCount ); CPPUNIT_ASSERT_EQUAL( 2, int( str->refCount ));
rtl_uString_ensureCapacity( &str, 4 ); rtl_uString_ensureCapacity( &str, 4 );
CPPUNIT_ASSERT_EQUAL( sal_Int32( 4 ), str->length ); CPPUNIT_ASSERT_EQUAL( sal_Int32( 4 ), str->length );
CPPUNIT_ASSERT_EQUAL( 1, str->refCount ); CPPUNIT_ASSERT_EQUAL( 1, int( str->refCount ));
// a copy was forced because of refcount // a copy was forced because of refcount
CPPUNIT_ASSERT( oldStr != str ); CPPUNIT_ASSERT( oldStr != str );
CPPUNIT_ASSERT( rtl_ustr_compare( oldStr->buffer, str->buffer ) == 0 ); CPPUNIT_ASSERT( rtl_ustr_compare( oldStr->buffer, str->buffer ) == 0 );
CPPUNIT_ASSERT_EQUAL( 1, oldStr->refCount ); CPPUNIT_ASSERT_EQUAL( 1, int( oldStr->refCount ));
rtl_uString_release( str ); rtl_uString_release( str );
str = oldStr; str = oldStr;
rtl_uString_acquire( oldStr ); rtl_uString_acquire( oldStr );
rtl_uString_ensureCapacity( &str, 1024 ); rtl_uString_ensureCapacity( &str, 1024 );
CPPUNIT_ASSERT_EQUAL( sal_Int32( 4 ), str->length ); // size is still 4 CPPUNIT_ASSERT_EQUAL( sal_Int32( 4 ), str->length ); // size is still 4
CPPUNIT_ASSERT_EQUAL( 1, str->refCount ); CPPUNIT_ASSERT_EQUAL( 1, int( str->refCount ));
CPPUNIT_ASSERT( oldStr != str ); CPPUNIT_ASSERT( oldStr != str );
CPPUNIT_ASSERT( rtl_ustr_compare( oldStr->buffer, str->buffer ) == 0 ); CPPUNIT_ASSERT( rtl_ustr_compare( oldStr->buffer, str->buffer ) == 0 );
CPPUNIT_ASSERT_EQUAL( 1, oldStr->refCount ); CPPUNIT_ASSERT_EQUAL( 1, int( oldStr->refCount ));
// but there should be extra capacity // but there should be extra capacity
for( int i = 0; for( int i = 0;
i < 20; i < 20;
......
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