INTEGRATION: CWS sb70 (1.26.4); FILE MERGED
2007/06/05 14:03:29 sb 1.26.4.3: #i76106# Additional rtl::OUString ASCII functions. 2007/06/04 10:15:54 sb 1.26.4.2: RESYNC: (1.26-1.27); FILE MERGED 2007/04/16 08:09:50 sb 1.26.4.1: #i76322# Gracefully handle rtl_uString_intern with newStr = str (patch by mmeeks).
This commit is contained in:
parent
30c2b88c37
commit
07daa54321
1 changed files with 40 additions and 7 deletions
|
@ -4,9 +4,9 @@
|
|||
*
|
||||
* $RCSfile: ustring.c,v $
|
||||
*
|
||||
* $Revision: 1.27 $
|
||||
* $Revision: 1.28 $
|
||||
*
|
||||
* last change: $Author: vg $ $Date: 2007-04-13 16:02:04 $
|
||||
* last change: $Author: hr $ $Date: 2007-06-27 13:25:42 $
|
||||
*
|
||||
* The Contents of this file are made available subject to
|
||||
* the terms of GNU Lesser General Public License Version 2.1.
|
||||
|
@ -99,6 +99,40 @@ static void internRelease (rtl_uString *pThis);
|
|||
|
||||
#include "strtmpl.c"
|
||||
|
||||
sal_Int32 rtl_ustr_indexOfAscii_WithLength(
|
||||
sal_Unicode const * str, sal_Int32 len,
|
||||
char const * subStr, sal_Int32 subLen)
|
||||
{
|
||||
if (subLen > 0 && subLen <= len) {
|
||||
sal_Int32 i;
|
||||
for (i = 0; i <= len - subLen; ++i) {
|
||||
if (rtl_ustr_asciil_reverseEquals_WithLength(
|
||||
str + i, subStr, subLen))
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
sal_Int32 rtl_ustr_lastIndexOfAscii_WithLength(
|
||||
sal_Unicode const * str, sal_Int32 len,
|
||||
char const * subStr, sal_Int32 subLen)
|
||||
{
|
||||
if (subLen > 0 && subLen <= len) {
|
||||
sal_Int32 i;
|
||||
for (i = len - subLen; i >= 0; --i) {
|
||||
if (rtl_ustr_asciil_reverseEquals_WithLength(
|
||||
str + i, subStr, subLen))
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
sal_Int32 SAL_CALL rtl_ustr_valueOfFloat(sal_Unicode * pStr, float f)
|
||||
{
|
||||
rtl_uString * pResult = NULL;
|
||||
|
@ -711,12 +745,11 @@ void SAL_CALL rtl_uString_intern( rtl_uString ** newStr,
|
|||
}
|
||||
else
|
||||
{
|
||||
if (*newStr)
|
||||
{
|
||||
rtl_uString_release (*newStr);
|
||||
*newStr = NULL;
|
||||
}
|
||||
rtl_uString *pOrg = *newStr;
|
||||
*newStr = NULL;
|
||||
rtl_ustring_intern_internal( newStr, str, CANNOT_RETURN );
|
||||
if (pOrg)
|
||||
rtl_uString_release (pOrg);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue