diff options
-rwxr-xr-x | connectivity/source/parse/sqlbison.y | 10 | ||||
-rw-r--r-- | lingucomponent/source/spellcheck/macosxspell/macspellimp.cxx | 12 | ||||
-rw-r--r-- | sal/inc/rtl/strbuf.hxx | 36 | ||||
-rw-r--r-- | sal/inc/rtl/ustrbuf.hxx | 36 | ||||
-rw-r--r-- | sal/qa/OStringBuffer/rtl_OStringBuffer.cxx | 321 | ||||
-rw-r--r-- | sal/qa/rtl_strings/rtl_OUStringBuffer.cxx | 172 |
6 files changed, 11 insertions, 576 deletions
diff --git a/connectivity/source/parse/sqlbison.y b/connectivity/source/parse/sqlbison.y index 062b46cdd022..19bb494abf47 100755 --- a/connectivity/source/parse/sqlbison.y +++ b/connectivity/source/parse/sqlbison.y @@ -4529,15 +4529,15 @@ const double fMilliSecondsPerDay = 86400000.0; for (sal_Int32 i = 0; i < nLen; i++) { - const sal_Unicode c = aMatchStr.charAt(i); - if (c == sSearch.charAt(0) || c == sSearch.charAt(1)) + const sal_Unicode c = aMatchStr[i]; + if (c == sSearch[0] || c == sSearch[1]) { - if (i > 0 && aMatchStr.charAt(i-1) == cEscape) + if (i > 0 && aMatchStr[i - 1] == cEscape) continue; else { - const sal_Unicode cCharacter = sReplace.charAt( (c == sSearch.charAt(0)) ? 0 : 1); - aMatchStr.setCharAt(i , cCharacter); + const sal_Unicode cCharacter = sReplace[(c == sSearch[0] ? 0 : 1)]; + aMatchStr[i] = cCharacter; } } } diff --git a/lingucomponent/source/spellcheck/macosxspell/macspellimp.cxx b/lingucomponent/source/spellcheck/macosxspell/macspellimp.cxx index 92aecc534346..5baf4d411cea 100644 --- a/lingucomponent/source/spellcheck/macosxspell/macspellimp.cxx +++ b/lingucomponent/source/spellcheck/macosxspell/macspellimp.cxx @@ -248,9 +248,9 @@ sal_Int16 MacSpellChecker::GetSpellFailure( const OUString &rWord, const Locale sal_Int32 n = rBuf.getLength(); sal_Unicode c; for (sal_Int32 ix=0; ix < n; ix++) { - c = rBuf.charAt(ix); - if ((c == 0x201C) || (c == 0x201D)) rBuf.setCharAt(ix,(sal_Unicode)0x0022); - if ((c == 0x2018) || (c == 0x2019)) rBuf.setCharAt(ix,(sal_Unicode)0x0027); + c = rBuf[ix]; + if ((c == 0x201C) || (c == 0x201D)) rBuf[ix] = (sal_Unicode)0x0022; + if ((c == 0x2018) || (c == 0x2019)) rBuf[ix] = (sal_Unicode)0x0027; } OUString nWord(rBuf.makeStringAndClear()); @@ -356,9 +356,9 @@ Reference< XSpellAlternatives > sal_Int32 n = rBuf.getLength(); sal_Unicode c; for (sal_Int32 ix=0; ix < n; ix++) { - c = rBuf.charAt(ix); - if ((c == 0x201C) || (c == 0x201D)) rBuf.setCharAt(ix,(sal_Unicode)0x0022); - if ((c == 0x2018) || (c == 0x2019)) rBuf.setCharAt(ix,(sal_Unicode)0x0027); + c = rBuf[ix]; + if ((c == 0x201C) || (c == 0x201D)) rBuf[ix] = (sal_Unicode)0x0022; + if ((c == 0x2018) || (c == 0x2019)) rBuf[ix] = (sal_Unicode)0x0027; } OUString nWord(rBuf.makeStringAndClear()); diff --git a/sal/inc/rtl/strbuf.hxx b/sal/inc/rtl/strbuf.hxx index 5f0b9b3fecc0..e3ae74bc3b5f 100644 --- a/sal/inc/rtl/strbuf.hxx +++ b/sal/inc/rtl/strbuf.hxx @@ -269,25 +269,6 @@ public: } /** - Returns the character at a specific index in this string buffer. - - The first character of a string buffer is at index - <code>0</code>, the next at index <code>1</code>, and so on, for - array indexing. - <p> - The index argument must be greater than or equal to - <code>0</code>, and less than the length of this string buffer. - - @param index the index of the desired character. - @return the character at the specified index of this string buffer. - */ - sal_Char charAt( sal_Int32 index ) - { - assert(index >= 0 && index < pData->length); - return pData->buffer[ index ]; - } - - /** Return a null terminated character array. */ const sal_Char* getStr() const { return pData->buffer; } @@ -313,23 +294,6 @@ public: } /** - The character at the specified index of this string buffer is set - to <code>ch</code>. - - The index argument must be greater than or equal to - <code>0</code>, and less than the length of this string buffer. - - @param index the index of the character to modify. - @param ch the new character. - */ - OStringBuffer & setCharAt(sal_Int32 index, sal_Char ch) - { - assert(index >= 0 && index < pData->length); - pData->buffer[ index ] = ch; - return *this; - } - - /** Appends the string to this string buffer. The characters of the <code>String</code> argument are appended, in diff --git a/sal/inc/rtl/ustrbuf.hxx b/sal/inc/rtl/ustrbuf.hxx index 2456316274d2..624b6f046258 100644 --- a/sal/inc/rtl/ustrbuf.hxx +++ b/sal/inc/rtl/ustrbuf.hxx @@ -248,25 +248,6 @@ public: } /** - Returns the character at a specific index in this string buffer. - - The first character of a string buffer is at index - <code>0</code>, the next at index <code>1</code>, and so on, for - array indexing. - <p> - The index argument must be greater than or equal to - <code>0</code>, and less than the length of this string buffer. - - @param index the index of the desired character. - @return the character at the specified index of this string buffer. - */ - sal_Unicode charAt( sal_Int32 index ) const - { - assert(index >= 0 && index < pData->length); - return pData->buffer[ index ]; - } - - /** Return a null terminated unicode character array. */ const sal_Unicode* getStr() const { return pData->buffer; } @@ -292,23 +273,6 @@ public: } /** - The character at the specified index of this string buffer is set - to <code>ch</code>. - - The index argument must be greater than or equal to - <code>0</code>, and less than the length of this string buffer. - - @param index the index of the character to modify. - @param ch the new character. - */ - OUStringBuffer & setCharAt(sal_Int32 index, sal_Unicode ch) - { - assert(index >= 0 && index < pData->length); - pData->buffer[ index ] = ch; - return *this; - } - - /** Appends the string to this string buffer. The characters of the <code>String</code> argument are appended, in diff --git a/sal/qa/OStringBuffer/rtl_OStringBuffer.cxx b/sal/qa/OStringBuffer/rtl_OStringBuffer.cxx index f2843370b42d..85705bea85a1 100644 --- a/sal/qa/OStringBuffer/rtl_OStringBuffer.cxx +++ b/sal/qa/OStringBuffer/rtl_OStringBuffer.cxx @@ -1471,147 +1471,6 @@ namespace rtl_OStringBuffer // ----------------------------------------------------------------------------- - class charAt : public CppUnit::TestFixture - { - OString* arrOUS[4]; - - public: - void setUp() - { - arrOUS[0] = new OString( kTestStr1 ); - arrOUS[1] = new OString( kTestStr27 ); - arrOUS[2] = new OString( kTestStr28 ); - arrOUS[3] = new OString( ); - - } - - void tearDown() - { - delete arrOUS[0]; delete arrOUS[1]; delete arrOUS[2]; - delete arrOUS[3]; - } - - void charAt_001() - { - sal_Unicode expVal = 83; - ::rtl::OStringBuffer aStrBuf( *arrOUS[0] ); - sal_Int32 input = 0; - - CPPUNIT_ASSERT_MESSAGE - ( - "return the first character of OStringBuffer(kTestStr1)", - aStrBuf.charAt(input) == expVal - ); - - } - - void charAt_002() - { - sal_Unicode expVal = 32; - ::rtl::OStringBuffer aStrBuf( *arrOUS[0] ); - sal_Int32 input = 3; - - CPPUNIT_ASSERT_MESSAGE - ( - "return the middle character of OStringBuffer(kTestStr1)", - aStrBuf.charAt(input) == expVal - ); - - } - - void charAt_003() - { - sal_Unicode expVal = 115; - ::rtl::OStringBuffer aStrBuf( *arrOUS[0] ); - sal_Int32 input = 15; - - CPPUNIT_ASSERT_MESSAGE - ( - "return the last character of OStringBuffer(kTestStr1)", - aStrBuf.charAt(input) == expVal - ); - - } - - void charAt_004() - { - sal_Unicode expVal = 115; - ::rtl::OStringBuffer aStrBuf( *arrOUS[1] ); - sal_Int32 input = 0; - - CPPUNIT_ASSERT_MESSAGE - ( - "return the only character of OStringBuffer(kTestStr27)", - aStrBuf.charAt(input) == expVal - ); - - } - - void charAt_005() - { - sal_Unicode expVal = 40; - ::rtl::OStringBuffer aStrBuf( *arrOUS[2] ); - sal_Int32 input = 0; - - CPPUNIT_ASSERT_MESSAGE - ( - "return the first of OStringBuffer(kTestStr28) with special character", - aStrBuf.charAt(input) == expVal - ); - - } - - void charAt_006() - { - sal_Unicode expVal = 11; - ::rtl::OStringBuffer aStrBuf( *arrOUS[2] ); - sal_Int32 input = 5; - - CPPUNIT_ASSERT_MESSAGE - ( - "return the mid of OStringBuffer(kTestStr28) with special character", - aStrBuf.charAt(input) == expVal - ); - - } - - void charAt_007() - { - ::rtl::OStringBuffer aStrBuf( *arrOUS[3] ); - - CPPUNIT_ASSERT_MESSAGE - ( - "invalid character of OStringBuffer()", - sal_True - ); - - } - - void charAt_008() - { - ::rtl::OStringBuffer aStrBuf( *arrOUS[3] ); - - CPPUNIT_ASSERT_MESSAGE - ( - "invalid character of OStringBuffer()", - sal_True - ); - - } - - SAL_CPPUNIT_TEST_SUITE( charAt ); - CPPUNIT_TEST( charAt_001 ); - CPPUNIT_TEST( charAt_002 ); - CPPUNIT_TEST( charAt_003 ); - CPPUNIT_TEST( charAt_004 ); - CPPUNIT_TEST( charAt_005 ); - CPPUNIT_TEST( charAt_006 ); - CPPUNIT_TEST( charAt_007 ); - CPPUNIT_TEST( charAt_008 ); - SAL_CPPUNIT_TEST_SUITE_END(); - }; -// ----------------------------------------------------------------------------- - class csuc : public CppUnit::TestFixture { void csuc_001() @@ -1704,184 +1563,6 @@ namespace rtl_OStringBuffer // ----------------------------------------------------------------------------- - class setCharAt : public CppUnit::TestFixture - { - OString* arrOUS[4]; - - public: - void setUp() - { - arrOUS[0] = new OString( kTestStr1 ); - arrOUS[1] = new OString( kTestStr27 ); - arrOUS[2] = new OString( kTestStr28 ); - arrOUS[3] = new OString( ); - - } - - void tearDown() - { - delete arrOUS[0]; delete arrOUS[1]; delete arrOUS[2]; - delete arrOUS[3]; - } - - void setCharAt_001() - { - OString expVal( kTestStr31 ); - ::rtl::OStringBuffer aStrBuf( *arrOUS[0] ); - sal_Int32 input1 = 0; - sal_Char input2 = 's'; - - CPPUNIT_ASSERT_MESSAGE - ( - "set the first character of OStringBuffer(kTestStr1) with s", - (aStrBuf.setCharAt(input1, input2)).getStr() == expVal - ); - - } - - void setCharAt_002() - { - OString expVal( kTestStr3 ); - ::rtl::OStringBuffer aStrBuf( *arrOUS[0] ); - sal_Int32 input1 = 4; - sal_Char input2 = 'm'; - - CPPUNIT_ASSERT_MESSAGE - ( - "set the middle character of OStringBuffer(kTestStr1) with m", - (aStrBuf.setCharAt(input1, input2)).getStr() == expVal - ); - - } - - void setCharAt_003() - { - OString expVal( kTestStr32 ); - ::rtl::OStringBuffer aStrBuf( *arrOUS[0] ); - sal_Int32 input1 = 15; - sal_Char input2 = ' '; - - CPPUNIT_ASSERT_MESSAGE - ( - "set the last character of OStringBuffer(kTestStr1) with ' '", - (aStrBuf.setCharAt(input1, input2)).getStr() == expVal - ); - - } - - void setCharAt_004() - { - OString expVal( kTestStr33 ); - ::rtl::OStringBuffer aStrBuf( *arrOUS[1] ); - sal_Int32 input1 = 0; - sal_Char input2 = ' '; - - CPPUNIT_ASSERT_MESSAGE - ( - "set the only character of OStringBuffer(kTestStr27) with ' '", - (aStrBuf.setCharAt(input1, input2)).getStr() == expVal - ); - - } - - void setCharAt_005() - { - OString expVal( kTestStr34 ); - ::rtl::OStringBuffer aStrBuf( *arrOUS[2] ); - sal_Int32 input1 = 1; - sal_Char input2 = (sal_Char)5; - - CPPUNIT_ASSERT_MESSAGE - ( - "set the only of OStringBuffer(kTestStr28) with special character", - (aStrBuf.setCharAt(input1, input2)).getStr() == expVal - ); - - } - - void setCharAt_006() - { - OString expVal( kTestStr35 ); - ::rtl::OStringBuffer aStrBuf( *arrOUS[2] ); - sal_Int32 input1 = 1; - sal_Char input2 = (sal_Char)-5; - - CPPUNIT_ASSERT_MESSAGE - ( - "set the only of OStringBuffer(kTestStr28) with special character", - (aStrBuf.setCharAt(input1, input2)).getStr() == expVal - ); - - } -#ifdef WITH_CORE - void setCharAt_007() - { - OString* expVal = 0; - ::rtl::OStringBuffer aStrBuf( *arrOUS[3] ); - sal_Int32 input1 = 0; - sal_Char input2 = (sal_Char)5; - - CPPUNIT_ASSERT_MESSAGE - ( - "invalid character of OStringBuffer()", - sal_True - ); - - delete expVal; - - } - - void setCharAt_008() - { - OString* expVal = 0; - ::rtl::OStringBuffer aStrBuf( *arrOUS[3] ); - sal_Int32 input1 = -2; - sal_Char input2 = (sal_Char)5; - - CPPUNIT_ASSERT_MESSAGE - ( - "invalid character of OStringBuffer()", - sal_True - ); - - delete expVal; - - } - - void setCharAt_009() - { - OString* expVal = 0; - ::rtl::OStringBuffer aStrBuf( *arrOUS[3] ); - sal_Int32 input1 = 3; - sal_Char input2 = (sal_Char)5; - - CPPUNIT_ASSERT_MESSAGE - ( - "invalid character of OStringBuffer()", - sal_True - ); - - delete expVal; - - } -#endif - SAL_CPPUNIT_TEST_SUITE( setCharAt ); - CPPUNIT_TEST( setCharAt_001 ); - CPPUNIT_TEST( setCharAt_002 ); - CPPUNIT_TEST( setCharAt_003 ); - CPPUNIT_TEST( setCharAt_004 ); - CPPUNIT_TEST( setCharAt_005 ); - CPPUNIT_TEST( setCharAt_006 ); -#ifdef WITH_CORE - CPPUNIT_TEST( setCharAt_007 ); - CPPUNIT_TEST( setCharAt_008 ); - CPPUNIT_TEST( setCharAt_009 ); -#endif - SAL_CPPUNIT_TEST_SUITE_END(); - }; - -// ----------------------------------------------------------------------------- - class append_001 : public CppUnit::TestFixture { OString* arrOUS[5]; @@ -16677,10 +16358,8 @@ CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OStringBuffer::getLength); CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OStringBuffer::getCapacity); CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OStringBuffer::ensureCapacity); CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OStringBuffer::setLength); -CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OStringBuffer::charAt); CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OStringBuffer::csuc); CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OStringBuffer::getStr); -CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OStringBuffer::setCharAt); CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OStringBuffer::append_001); CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OStringBuffer::append_002); CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OStringBuffer::append_003); diff --git a/sal/qa/rtl_strings/rtl_OUStringBuffer.cxx b/sal/qa/rtl_strings/rtl_OUStringBuffer.cxx index 210ad024e108..d690d613642d 100644 --- a/sal/qa/rtl_strings/rtl_OUStringBuffer.cxx +++ b/sal/qa/rtl_strings/rtl_OUStringBuffer.cxx @@ -680,95 +680,6 @@ extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUStringBuffer_setLength( // return ( res ); } //------------------------------------------------------------------------ -// testing the method charAt( sal_Int32 index ) -//------------------------------------------------------------------------ - -extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUStringBuffer_charAt( - hTestResult hRtlTestResult) -{ - c_rtl_tres_state_start( hRtlTestResult, "charAt"); - sal_Char methName[MAXBUFLENGTH]; - sal_Char* pMeth = methName; - - OUString arrOUS[4]={OUString( aUStr1 ), // "Sun Microsystems"; - OUString( aUStr27), // "s"; - OUString( aUStr28), // "\50\3\5\7\11\13\15\17sun"; - OUString( )}; - - typedef struct TestCase - { - sal_Char* comments; - sal_Unicode expVal; - OUStringBuffer* input1; - sal_Int32 input2; - ~TestCase() { delete input1;} - } TestCase; - - TestCase arrTestCase[]={ - - {"return the first character of OUStringBuffer(aUStr1)", - 83, new OUStringBuffer(arrOUS[0]), 0 }, - {"return the middle character of OUStringBuffer(aUStr1)", - 32, new OUStringBuffer(arrOUS[0]), 3 }, - {"return the last character of OUStringBuffer(aUStr1)", - 115, new OUStringBuffer(arrOUS[0]), 15 }, - {"return the only character of OUStringBuffer(aUStr27)", - 115, new OUStringBuffer(arrOUS[1]), 0}, - {"return the first of OUStringBuffer(aUStr28) with special character", - 40, new OUStringBuffer(arrOUS[2]), 0}, - /* -{"return the mid of OUStringBuffer(aUStr28) with special character", - 11, new OUStringBuffer(arrOUS[2]), 5}, -*/ -/* - {"invalid character of OUStringBuffer()", - 0, new OUStringBuffer(arrOUS[3]), 0}, -*/ -/* - {"invalid character of OUStringBuffer()", - 0, new OUStringBuffer(arrOUS[3]), -2} -*/ - - }; - - - sal_Bool res = sal_True; - sal_uInt32 i; - - for (i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++) - { - sal_Bool lastRes = - ( arrTestCase[i].input1->charAt(arrTestCase[i].input2) == - arrTestCase[i].expVal ); - // LLA: last case removed, due to the fact of complexity of the test code :-( - // LLA: if(i<=7) - // LLA: { - c_rtl_tres_state - ( - hRtlTestResult, - lastRes, - arrTestCase[i].comments, - createName( pMeth, "charAt", i ) - - ); - // LLA: } - // LLA: else - // LLA: { - // LLA: c_rtl_tres_state - // LLA: ( - // LLA: hRtlTestResult, - // LLA: sal_True, - // LLA: arrTestCase[i].comments, - // LLA: createName( pMeth, "charAt", i ) - // LLA: - // LLA: ); - // LLA: } - res &= lastRes; - } - c_rtl_tres_state_end( hRtlTestResult, "charAt"); -// return ( res ); -} -//------------------------------------------------------------------------ // testing the operator const sal_Unicode * (csuc for short) //------------------------------------------------------------------------ extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUStringBuffer_csuc( @@ -879,87 +790,6 @@ extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUStringBuffer_getStr( // return ( res ); } //------------------------------------------------------------------------ -// testing the method setCharAt(sal_Int32 index, sal_Unicode ch) -//------------------------------------------------------------------------ - -extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUStringBuffer_setCharAt( - hTestResult hRtlTestResult) -{ - c_rtl_tres_state_start( hRtlTestResult, "setCharAt"); - sal_Char methName[MAXBUFLENGTH]; - sal_Char* pMeth = methName; - - OUString arrOUS[4]={OUString( aUStr1 ), - OUString( aUStr27), - OUString( aUStr28), - OUString( )}; - - typedef struct TestCase - { - sal_Char* comments; - OUString* expVal; - OUStringBuffer* input1; - sal_Int32 input2; - sal_Unicode input3; - ~TestCase() { delete input1; delete expVal; } - } TestCase; - - TestCase arrTestCase[]={ - - {"set the first character of OUStringBuffer(aUStr1) with s", - new OUString(aUStr31), - new OUStringBuffer(arrOUS[0]), 0, 115 }, - {"set the middle character of OUStringBuffer(aUStr1) with m", - new OUString(aUStr3), - new OUStringBuffer(arrOUS[0]), 4, 109 }, - {"set the last character of OUStringBuffer(aUStr1) with ' '", - new OUString(aUStr32), - new OUStringBuffer(arrOUS[0]), 15, 32 }, - {"set the only character of OUStringBuffer(aUStr27) with ' '", - new OUString(aUStr33), - new OUStringBuffer(arrOUS[1]), 0, 32}, - {"set the only of OUStringBuffer(aUStr28) with special character", - new OUString(aUStr34), - new OUStringBuffer(arrOUS[2]), 1, 5}, - }; - - - sal_Bool res = sal_True; - sal_uInt32 i; - - for (i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++) - { - sal_Bool lastRes = - ( (arrTestCase[i].input1->setCharAt(arrTestCase[i].input2, - arrTestCase[i].input3)).getStr() == *(arrTestCase[i].expVal) ); - if(i<=4) - { - c_rtl_tres_state - ( - hRtlTestResult, - lastRes, - arrTestCase[i].comments, - createName( pMeth, "setCharAt", i ) - - ); - } - else - { - c_rtl_tres_state - ( - hRtlTestResult, - sal_True, - arrTestCase[i].comments, - createName( pMeth, "setCharAt", i ) - - ); - } - res &= lastRes; - } - c_rtl_tres_state_end( hRtlTestResult, "setCharAt"); -// return ( res ); -} -//------------------------------------------------------------------------ // testing the method append(const OUString &str) //------------------------------------------------------------------------ @@ -1708,10 +1538,8 @@ extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUStringBuffer( hTestResult hRt test_rtl_OUStringBuffer_getCapacity( hRtlTestResult ); test_rtl_OUStringBuffer_ensureCapacity( hRtlTestResult ); test_rtl_OUStringBuffer_setLength( hRtlTestResult ); - test_rtl_OUStringBuffer_charAt( hRtlTestResult ); test_rtl_OUStringBuffer_csuc( hRtlTestResult ); test_rtl_OUStringBuffer_getStr( hRtlTestResult ); - test_rtl_OUStringBuffer_setCharAt( hRtlTestResult ); test_rtl_OUStringBuffer_appends( hRtlTestResult ); test_rtl_OUStringBuffer_appendAsciis( hRtlTestResult ); |