Moved sal/rtl/source string files from C to C++, for easier maintenance.

This commit is contained in:
Stephan Bergmann 2011-10-31 22:32:07 +01:00
parent e2c6064910
commit 54760dfdc2
11 changed files with 104 additions and 51 deletions

View file

@ -29,8 +29,8 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sal.hxx"
#include "hash.h"
#include "strimp.h"
#include "hash.hxx"
#include "strimp.hxx"
#include <osl/diagnose.h>
#include <sal/macros.h>

View file

@ -1,24 +1,16 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
#ifndef INCLUDED_RTL_SOURCE_HASH_H
#define INCLUDED_RTL_SOURCE_HASH_H
#ifndef INCLUDED_RTL_SOURCE_HASH_HXX
#define INCLUDED_RTL_SOURCE_HASH_HXX
#include <sal/types.h>
#include <rtl/ustring.h>
#if defined __cplusplus
extern "C" {
#endif /* __cplusplus */
/* These functions are not multi-thread safe: */
rtl_uString *rtl_str_hash_intern (rtl_uString *pString,
int can_return);
void rtl_str_hash_remove (rtl_uString *pString);
#if defined __cplusplus
}
#endif /* __cplusplus */
#endif /* INCLUDED_RTL_SOURCE_HASH_H */
#endif /* INCLUDED_RTL_SOURCE_HASH_HXX */
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View file

@ -26,7 +26,7 @@
*
************************************************************************/
#include "strimp.h"
#include "strimp.hxx"
sal_Int16 rtl_ImplGetDigit( sal_Unicode ch, sal_Int16 nRadix )
{

View file

@ -26,8 +26,8 @@
*
************************************************************************/
#ifndef INCLUDED_RTL_SOURCE_STRIMP_H
#define INCLUDED_RTL_SOURCE_STRIMP_H
#ifndef INCLUDED_RTL_SOURCE_STRIMP_HXX
#define INCLUDED_RTL_SOURCE_STRIMP_HXX
#include <osl/interlck.h>
@ -37,10 +37,6 @@
/* Help functions for String and UString */
/* ======================================================================= */
#if defined __cplusplus
extern "C" {
#endif /* __cplusplus */
/*
* refCount is opaqueincludes 2 bit-fields;
* MSB: 'interned' - is stored in the intern hash
@ -58,10 +54,6 @@ sal_Int16 rtl_ImplGetDigit( sal_Unicode ch, sal_Int16 nRadix );
sal_Bool rtl_ImplIsWhitespace( sal_Unicode c );
#if defined __cplusplus
}
#endif /* __cplusplus */
#endif /* INCLUDED_RTL_SOURCE_STRIMP_H */
#endif /* INCLUDED_RTL_SOURCE_STRIMP_HXX */
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View file

@ -35,8 +35,8 @@
#include <osl/diagnose.h>
#include <rtl/tencinfo.h>
#include "strimp.h"
#include "surrogates.h"
#include "strimp.hxx"
#include "surrogates.hxx"
#include <rtl/string.h>
#include "rtl/math.h"
@ -69,9 +69,10 @@ static rtl_String const aImplEmpty_rtl_String =
/* Include String/UString template code */
#include "strtmpl.c"
#include "strtmpl.cxx"
sal_Int32 SAL_CALL rtl_str_valueOfFloat(sal_Char * pStr, float f)
SAL_THROW_EXTERN_C()
{
rtl_String * pResult = NULL;
sal_Int32 nLen;
@ -87,6 +88,7 @@ sal_Int32 SAL_CALL rtl_str_valueOfFloat(sal_Char * pStr, float f)
}
sal_Int32 SAL_CALL rtl_str_valueOfDouble(sal_Char * pStr, double d)
SAL_THROW_EXTERN_C()
{
rtl_String * pResult = NULL;
sal_Int32 nLen;
@ -101,13 +103,13 @@ sal_Int32 SAL_CALL rtl_str_valueOfDouble(sal_Char * pStr, double d)
return nLen;
}
float SAL_CALL rtl_str_toFloat(sal_Char const * pStr)
float SAL_CALL rtl_str_toFloat(sal_Char const * pStr) SAL_THROW_EXTERN_C()
{
return (float) rtl_math_stringToDouble(pStr, pStr + rtl_str_getLength(pStr),
'.', 0, 0, 0);
}
double SAL_CALL rtl_str_toDouble(sal_Char const * pStr)
double SAL_CALL rtl_str_toDouble(sal_Char const * pStr) SAL_THROW_EXTERN_C()
{
return rtl_math_stringToDouble(pStr, pStr + rtl_str_getLength(pStr), '.', 0,
0, 0);
@ -305,6 +307,7 @@ void SAL_CALL rtl_uString2String( rtl_String** ppThis,
sal_Int32 nULen,
rtl_TextEncoding eTextEncoding,
sal_uInt32 nCvtFlags )
SAL_THROW_EXTERN_C()
{
rtl_impl_convertUStringToString(ppThis, pUStr, nULen, eTextEncoding,
nCvtFlags, sal_False);
@ -315,6 +318,7 @@ sal_Bool SAL_CALL rtl_convertUStringToString(rtl_String ** pTarget,
sal_Int32 nLength,
rtl_TextEncoding nEncoding,
sal_uInt32 nFlags)
SAL_THROW_EXTERN_C()
{
return rtl_impl_convertUStringToString(pTarget, pSource, nLength, nEncoding,
nFlags, sal_True);

View file

@ -67,6 +67,7 @@ inline void rtl_str_ImplCopy( IMPL_RTL_STRCODE* pDest,
/* ======================================================================= */
sal_Int32 SAL_CALL IMPL_RTL_STRNAME( getLength )( const IMPL_RTL_STRCODE* pStr )
SAL_THROW_EXTERN_C()
{
const IMPL_RTL_STRCODE* pTempStr = pStr;
while( *pTempStr )
@ -78,6 +79,7 @@ sal_Int32 SAL_CALL IMPL_RTL_STRNAME( getLength )( const IMPL_RTL_STRCODE* pStr )
sal_Int32 SAL_CALL IMPL_RTL_STRNAME( compare )( const IMPL_RTL_STRCODE* pStr1,
const IMPL_RTL_STRCODE* pStr2 )
SAL_THROW_EXTERN_C()
{
sal_Int32 nRet;
while ( ((nRet = ((sal_Int32)(IMPL_RTL_USTRCODE(*pStr1)))-
@ -97,6 +99,7 @@ sal_Int32 SAL_CALL IMPL_RTL_STRNAME( compare_WithLength )( const IMPL_RTL_STRCOD
sal_Int32 nStr1Len,
const IMPL_RTL_STRCODE* pStr2,
sal_Int32 nStr2Len )
SAL_THROW_EXTERN_C()
{
sal_Int32 nRet = nStr1Len - nStr2Len;
int nCount = (nRet <= 0) ? nStr1Len : nStr2Len;
@ -119,6 +122,7 @@ sal_Int32 SAL_CALL IMPL_RTL_STRNAME( shortenedCompare_WithLength )( const IMPL_R
const IMPL_RTL_STRCODE* pStr2,
sal_Int32 nStr2Len,
sal_Int32 nShortenedLength )
SAL_THROW_EXTERN_C()
{
const IMPL_RTL_STRCODE* pStr1End = pStr1 + nStr1Len;
const IMPL_RTL_STRCODE* pStr2End = pStr2 + nStr2Len;
@ -147,6 +151,7 @@ sal_Int32 SAL_CALL IMPL_RTL_STRNAME( reverseCompare_WithLength )( const IMPL_RTL
sal_Int32 nStr1Len,
const IMPL_RTL_STRCODE* pStr2,
sal_Int32 nStr2Len )
SAL_THROW_EXTERN_C()
{
const IMPL_RTL_STRCODE* pStr1Run = pStr1+nStr1Len;
const IMPL_RTL_STRCODE* pStr2Run = pStr2+nStr2Len;
@ -168,6 +173,7 @@ sal_Int32 SAL_CALL IMPL_RTL_STRNAME( reverseCompare_WithLength )( const IMPL_RTL
sal_Int32 SAL_CALL IMPL_RTL_STRNAME( compareIgnoreAsciiCase )( const IMPL_RTL_STRCODE* pStr1,
const IMPL_RTL_STRCODE* pStr2 )
SAL_THROW_EXTERN_C()
{
sal_Int32 nRet;
sal_Int32 c1;
@ -199,6 +205,7 @@ sal_Int32 SAL_CALL IMPL_RTL_STRNAME( compareIgnoreAsciiCase_WithLength )( const
sal_Int32 nStr1Len,
const IMPL_RTL_STRCODE* pStr2,
sal_Int32 nStr2Len )
SAL_THROW_EXTERN_C()
{
const IMPL_RTL_STRCODE* pStr1End = pStr1 + nStr1Len;
const IMPL_RTL_STRCODE* pStr2End = pStr2 + nStr2Len;
@ -232,6 +239,7 @@ sal_Int32 SAL_CALL IMPL_RTL_STRNAME( shortenedCompareIgnoreAsciiCase_WithLength
const IMPL_RTL_STRCODE* pStr2,
sal_Int32 nStr2Len,
sal_Int32 nShortenedLength )
SAL_THROW_EXTERN_C()
{
const IMPL_RTL_STRCODE* pStr1End = pStr1 + nStr1Len;
const IMPL_RTL_STRCODE* pStr2End = pStr2 + nStr2Len;
@ -265,6 +273,7 @@ sal_Int32 SAL_CALL IMPL_RTL_STRNAME( shortenedCompareIgnoreAsciiCase_WithLength
/* ----------------------------------------------------------------------- */
sal_Int32 SAL_CALL IMPL_RTL_STRNAME( hashCode )( const IMPL_RTL_STRCODE* pStr )
SAL_THROW_EXTERN_C()
{
return IMPL_RTL_STRNAME( hashCode_WithLength )( pStr, IMPL_RTL_STRNAME( getLength )( pStr ) );
}
@ -273,6 +282,7 @@ sal_Int32 SAL_CALL IMPL_RTL_STRNAME( hashCode )( const IMPL_RTL_STRCODE* pStr )
sal_Int32 SAL_CALL IMPL_RTL_STRNAME( hashCode_WithLength )( const IMPL_RTL_STRCODE* pStr,
sal_Int32 nLen )
SAL_THROW_EXTERN_C()
{
sal_Int32 h = nLen;
@ -329,6 +339,7 @@ sal_Int32 SAL_CALL IMPL_RTL_STRNAME( hashCode_WithLength )( const IMPL_RTL_STRCO
sal_Int32 SAL_CALL IMPL_RTL_STRNAME( indexOfChar )( const IMPL_RTL_STRCODE* pStr,
IMPL_RTL_STRCODE c )
SAL_THROW_EXTERN_C()
{
const IMPL_RTL_STRCODE* pTempStr = pStr;
while ( *pTempStr )
@ -347,6 +358,7 @@ sal_Int32 SAL_CALL IMPL_RTL_STRNAME( indexOfChar )( const IMPL_RTL_STRCODE* pStr
sal_Int32 SAL_CALL IMPL_RTL_STRNAME( indexOfChar_WithLength )( const IMPL_RTL_STRCODE* pStr,
sal_Int32 nLen,
IMPL_RTL_STRCODE c )
SAL_THROW_EXTERN_C()
{
const IMPL_RTL_STRCODE* pTempStr = pStr;
while ( nLen > 0 )
@ -365,6 +377,7 @@ sal_Int32 SAL_CALL IMPL_RTL_STRNAME( indexOfChar_WithLength )( const IMPL_RTL_ST
sal_Int32 SAL_CALL IMPL_RTL_STRNAME( lastIndexOfChar )( const IMPL_RTL_STRCODE* pStr,
IMPL_RTL_STRCODE c )
SAL_THROW_EXTERN_C()
{
return IMPL_RTL_STRNAME( lastIndexOfChar_WithLength )( pStr, IMPL_RTL_STRNAME( getLength )( pStr ), c );
}
@ -374,6 +387,7 @@ sal_Int32 SAL_CALL IMPL_RTL_STRNAME( lastIndexOfChar )( const IMPL_RTL_STRCODE*
sal_Int32 SAL_CALL IMPL_RTL_STRNAME( lastIndexOfChar_WithLength )( const IMPL_RTL_STRCODE* pStr,
sal_Int32 nLen,
IMPL_RTL_STRCODE c )
SAL_THROW_EXTERN_C()
{
pStr += nLen;
while ( nLen > 0 )
@ -392,6 +406,7 @@ sal_Int32 SAL_CALL IMPL_RTL_STRNAME( lastIndexOfChar_WithLength )( const IMPL_RT
sal_Int32 SAL_CALL IMPL_RTL_STRNAME( indexOfStr )( const IMPL_RTL_STRCODE* pStr,
const IMPL_RTL_STRCODE* pSubStr )
SAL_THROW_EXTERN_C()
{
return IMPL_RTL_STRNAME( indexOfStr_WithLength )( pStr, IMPL_RTL_STRNAME( getLength )( pStr ),
pSubStr, IMPL_RTL_STRNAME( getLength )( pSubStr ) );
@ -403,6 +418,7 @@ sal_Int32 SAL_CALL IMPL_RTL_STRNAME( indexOfStr_WithLength )( const IMPL_RTL_STR
sal_Int32 nStrLen,
const IMPL_RTL_STRCODE* pSubStr,
sal_Int32 nSubLen )
SAL_THROW_EXTERN_C()
{
/* faster search for a single character */
if ( nSubLen < 2 )
@ -464,6 +480,7 @@ sal_Int32 SAL_CALL IMPL_RTL_STRNAME( indexOfStr_WithLength )( const IMPL_RTL_STR
sal_Int32 SAL_CALL IMPL_RTL_STRNAME( lastIndexOfStr )( const IMPL_RTL_STRCODE* pStr,
const IMPL_RTL_STRCODE* pSubStr )
SAL_THROW_EXTERN_C()
{
return IMPL_RTL_STRNAME( lastIndexOfStr_WithLength )( pStr, IMPL_RTL_STRNAME( getLength )( pStr ),
pSubStr, IMPL_RTL_STRNAME( getLength )( pSubStr ) );
@ -475,6 +492,7 @@ sal_Int32 SAL_CALL IMPL_RTL_STRNAME( lastIndexOfStr_WithLength )( const IMPL_RTL
sal_Int32 nStrLen,
const IMPL_RTL_STRCODE* pSubStr,
sal_Int32 nSubLen )
SAL_THROW_EXTERN_C()
{
/* faster search for a single character */
if ( nSubLen < 2 )
@ -530,6 +548,7 @@ sal_Int32 SAL_CALL IMPL_RTL_STRNAME( lastIndexOfStr_WithLength )( const IMPL_RTL
void SAL_CALL IMPL_RTL_STRNAME( replaceChar )( IMPL_RTL_STRCODE* pStr,
IMPL_RTL_STRCODE cOld,
IMPL_RTL_STRCODE cNew )
SAL_THROW_EXTERN_C()
{
while ( *pStr )
{
@ -546,6 +565,7 @@ void SAL_CALL IMPL_RTL_STRNAME( replaceChar_WithLength )( IMPL_RTL_STRCODE* pStr
sal_Int32 nLen,
IMPL_RTL_STRCODE cOld,
IMPL_RTL_STRCODE cNew )
SAL_THROW_EXTERN_C()
{
while ( nLen > 0 )
{
@ -560,6 +580,7 @@ void SAL_CALL IMPL_RTL_STRNAME( replaceChar_WithLength )( IMPL_RTL_STRCODE* pStr
/* ----------------------------------------------------------------------- */
void SAL_CALL IMPL_RTL_STRNAME( toAsciiLowerCase )( IMPL_RTL_STRCODE* pStr )
SAL_THROW_EXTERN_C()
{
while ( *pStr )
{
@ -575,6 +596,7 @@ void SAL_CALL IMPL_RTL_STRNAME( toAsciiLowerCase )( IMPL_RTL_STRCODE* pStr )
void SAL_CALL IMPL_RTL_STRNAME( toAsciiLowerCase_WithLength )( IMPL_RTL_STRCODE* pStr,
sal_Int32 nLen )
SAL_THROW_EXTERN_C()
{
while ( nLen > 0 )
{
@ -590,6 +612,7 @@ void SAL_CALL IMPL_RTL_STRNAME( toAsciiLowerCase_WithLength )( IMPL_RTL_STRCODE*
/* ----------------------------------------------------------------------- */
void SAL_CALL IMPL_RTL_STRNAME( toAsciiUpperCase )( IMPL_RTL_STRCODE* pStr )
SAL_THROW_EXTERN_C()
{
while ( *pStr )
{
@ -605,6 +628,7 @@ void SAL_CALL IMPL_RTL_STRNAME( toAsciiUpperCase )( IMPL_RTL_STRCODE* pStr )
void SAL_CALL IMPL_RTL_STRNAME( toAsciiUpperCase_WithLength )( IMPL_RTL_STRCODE* pStr,
sal_Int32 nLen )
SAL_THROW_EXTERN_C()
{
while ( nLen > 0 )
{
@ -620,6 +644,7 @@ void SAL_CALL IMPL_RTL_STRNAME( toAsciiUpperCase_WithLength )( IMPL_RTL_STRCODE*
/* ----------------------------------------------------------------------- */
sal_Int32 SAL_CALL IMPL_RTL_STRNAME( trim )( IMPL_RTL_STRCODE* pStr )
SAL_THROW_EXTERN_C()
{
return IMPL_RTL_STRNAME( trim_WithLength )( pStr, IMPL_RTL_STRNAME( getLength )( pStr ) );
}
@ -627,6 +652,7 @@ sal_Int32 SAL_CALL IMPL_RTL_STRNAME( trim )( IMPL_RTL_STRCODE* pStr )
/* ----------------------------------------------------------------------- */
sal_Int32 SAL_CALL IMPL_RTL_STRNAME( trim_WithLength )( IMPL_RTL_STRCODE* pStr, sal_Int32 nLen )
SAL_THROW_EXTERN_C()
{
sal_Int32 nPreSpaces = 0;
sal_Int32 nPostSpaces = 0;
@ -670,6 +696,7 @@ sal_Int32 SAL_CALL IMPL_RTL_STRNAME( trim_WithLength )( IMPL_RTL_STRCODE* pStr,
/* ----------------------------------------------------------------------- */
sal_Int32 SAL_CALL IMPL_RTL_STRNAME( valueOfBoolean )( IMPL_RTL_STRCODE* pStr, sal_Bool b )
SAL_THROW_EXTERN_C()
{
if ( b )
{
@ -705,6 +732,7 @@ sal_Int32 SAL_CALL IMPL_RTL_STRNAME( valueOfBoolean )( IMPL_RTL_STRCODE* pStr, s
sal_Int32 SAL_CALL IMPL_RTL_STRNAME( valueOfChar )( IMPL_RTL_STRCODE* pStr,
IMPL_RTL_STRCODE c )
SAL_THROW_EXTERN_C()
{
*pStr++ = c;
*pStr = 0;
@ -716,6 +744,7 @@ sal_Int32 SAL_CALL IMPL_RTL_STRNAME( valueOfChar )( IMPL_RTL_STRCODE* pStr,
sal_Int32 SAL_CALL IMPL_RTL_STRNAME( valueOfInt32 )( IMPL_RTL_STRCODE* pStr,
sal_Int32 n,
sal_Int16 nRadix )
SAL_THROW_EXTERN_C()
{
sal_Char aBuf[RTL_STR_MAX_VALUEOFINT32];
sal_Char* pBuf = aBuf;
@ -770,6 +799,7 @@ sal_Int32 SAL_CALL IMPL_RTL_STRNAME( valueOfInt32 )( IMPL_RTL_STRCODE* pStr,
sal_Int32 SAL_CALL IMPL_RTL_STRNAME( valueOfInt64 )( IMPL_RTL_STRCODE* pStr,
sal_Int64 n,
sal_Int16 nRadix )
SAL_THROW_EXTERN_C()
{
sal_Char aBuf[RTL_STR_MAX_VALUEOFINT64];
sal_Char* pBuf = aBuf;
@ -823,6 +853,7 @@ sal_Int32 SAL_CALL IMPL_RTL_STRNAME( valueOfInt64 )( IMPL_RTL_STRCODE* pStr,
/* ----------------------------------------------------------------------- */
sal_Bool SAL_CALL IMPL_RTL_STRNAME( toBoolean )( const IMPL_RTL_STRCODE* pStr )
SAL_THROW_EXTERN_C()
{
if ( *pStr == '1' )
return sal_True;
@ -849,6 +880,7 @@ sal_Bool SAL_CALL IMPL_RTL_STRNAME( toBoolean )( const IMPL_RTL_STRCODE* pStr )
sal_Int32 SAL_CALL IMPL_RTL_STRNAME( toInt32 )( const IMPL_RTL_STRCODE* pStr,
sal_Int16 nRadix )
SAL_THROW_EXTERN_C()
{
sal_Bool bNeg;
sal_Int16 nDigit;
@ -895,6 +927,7 @@ sal_Int32 SAL_CALL IMPL_RTL_STRNAME( toInt32 )( const IMPL_RTL_STRCODE* pStr,
sal_Int64 SAL_CALL IMPL_RTL_STRNAME( toInt64 )( const IMPL_RTL_STRCODE* pStr,
sal_Int16 nRadix )
SAL_THROW_EXTERN_C()
{
sal_Bool bNeg;
sal_Int16 nDigit;
@ -944,7 +977,7 @@ sal_Int64 SAL_CALL IMPL_RTL_STRNAME( toInt64 )( const IMPL_RTL_STRCODE* pStr,
static IMPL_RTL_STRINGDATA* IMPL_RTL_STRINGNAME( ImplAlloc )( sal_Int32 nLen )
{
IMPL_RTL_STRINGDATA * pData
= (SAL_INT_CAST(sal_uInt32, nLen)
= (sal::static_int_cast< sal_uInt32 >(nLen)
<= ((SAL_MAX_UINT32 - sizeof (IMPL_RTL_STRINGDATA))
/ sizeof (IMPL_RTL_STRCODE)))
? (IMPL_RTL_STRINGDATA *) rtl_allocateMemory(
@ -996,6 +1029,7 @@ static IMPL_RTL_STRCODE* IMPL_RTL_STRINGNAME( ImplNewCopy )( IMPL_RTL_STRINGDATA
/* ----------------------------------------------------------------------- */
void SAL_CALL IMPL_RTL_STRINGNAME( acquire )( IMPL_RTL_STRINGDATA* pThis )
SAL_THROW_EXTERN_C()
{
IMPL_RTL_AQUIRE( pThis );
}
@ -1003,6 +1037,7 @@ void SAL_CALL IMPL_RTL_STRINGNAME( acquire )( IMPL_RTL_STRINGDATA* pThis )
/* ----------------------------------------------------------------------- */
void SAL_CALL IMPL_RTL_STRINGNAME( release )( IMPL_RTL_STRINGDATA* pThis )
SAL_THROW_EXTERN_C()
{
if (SAL_STRING_IS_STATIC (pThis))
return;
@ -1026,6 +1061,7 @@ void SAL_CALL IMPL_RTL_STRINGNAME( release )( IMPL_RTL_STRINGDATA* pThis )
/* ----------------------------------------------------------------------- */
void SAL_CALL IMPL_RTL_STRINGNAME( new )( IMPL_RTL_STRINGDATA** ppThis )
SAL_THROW_EXTERN_C()
{
if ( *ppThis)
IMPL_RTL_STRINGNAME( release )( *ppThis );
@ -1037,6 +1073,7 @@ void SAL_CALL IMPL_RTL_STRINGNAME( new )( IMPL_RTL_STRINGDATA** ppThis )
/* ----------------------------------------------------------------------- */
void SAL_CALL IMPL_RTL_STRINGNAME( new_WithLength )( IMPL_RTL_STRINGDATA** ppThis, sal_Int32 nLen )
SAL_THROW_EXTERN_C()
{
if ( nLen <= 0 )
IMPL_RTL_STRINGNAME( new )( ppThis );
@ -1060,6 +1097,7 @@ void SAL_CALL IMPL_RTL_STRINGNAME( new_WithLength )( IMPL_RTL_STRINGDATA** ppThi
void SAL_CALL IMPL_RTL_STRINGNAME( newFromString )( IMPL_RTL_STRINGDATA** ppThis,
const IMPL_RTL_STRINGDATA* pStr )
SAL_THROW_EXTERN_C()
{
IMPL_RTL_STRINGDATA* pOrg;
@ -1083,6 +1121,7 @@ void SAL_CALL IMPL_RTL_STRINGNAME( newFromString )( IMPL_RTL_STRINGDATA** ppThis
void SAL_CALL IMPL_RTL_STRINGNAME( newFromStr )( IMPL_RTL_STRINGDATA** ppThis,
const IMPL_RTL_STRCODE* pCharStr )
SAL_THROW_EXTERN_C()
{
IMPL_RTL_STRCODE* pBuffer;
IMPL_RTL_STRINGDATA* pOrg;
@ -1126,6 +1165,7 @@ void SAL_CALL IMPL_RTL_STRINGNAME( newFromStr )( IMPL_RTL_STRINGDATA** ppThis,
void SAL_CALL IMPL_RTL_STRINGNAME( newFromStr_WithLength )( IMPL_RTL_STRINGDATA** ppThis,
const IMPL_RTL_STRCODE* pCharStr,
sal_Int32 nLen )
SAL_THROW_EXTERN_C()
{
IMPL_RTL_STRINGDATA* pOrg;
@ -1149,6 +1189,7 @@ void SAL_CALL IMPL_RTL_STRINGNAME( newFromStr_WithLength )( IMPL_RTL_STRINGDATA*
void SAL_CALL IMPL_RTL_STRINGNAME( assign )( IMPL_RTL_STRINGDATA** ppThis,
IMPL_RTL_STRINGDATA* pStr )
SAL_THROW_EXTERN_C()
{
/* must be done at first, if pStr == *ppThis */
IMPL_RTL_AQUIRE( pStr );
@ -1162,6 +1203,7 @@ void SAL_CALL IMPL_RTL_STRINGNAME( assign )( IMPL_RTL_STRINGDATA** ppThis,
/* ----------------------------------------------------------------------- */
sal_Int32 SAL_CALL IMPL_RTL_STRINGNAME( getLength )( const IMPL_RTL_STRINGDATA* pThis )
SAL_THROW_EXTERN_C()
{
return pThis->length;
}
@ -1169,6 +1211,7 @@ sal_Int32 SAL_CALL IMPL_RTL_STRINGNAME( getLength )( const IMPL_RTL_STRINGDATA*
/* ----------------------------------------------------------------------- */
IMPL_RTL_STRCODE* SAL_CALL IMPL_RTL_STRINGNAME( getStr )( IMPL_RTL_STRINGDATA * pThis )
SAL_THROW_EXTERN_C()
{
return pThis->buffer;
}
@ -1178,6 +1221,7 @@ IMPL_RTL_STRCODE* SAL_CALL IMPL_RTL_STRINGNAME( getStr )( IMPL_RTL_STRINGDATA *
void SAL_CALL IMPL_RTL_STRINGNAME( newConcat )( IMPL_RTL_STRINGDATA** ppThis,
IMPL_RTL_STRINGDATA* pLeft,
IMPL_RTL_STRINGDATA* pRight )
SAL_THROW_EXTERN_C()
{
IMPL_RTL_STRINGDATA* pOrg = *ppThis;
@ -1213,6 +1257,7 @@ void SAL_CALL IMPL_RTL_STRINGNAME( newReplaceStrAt )( IMPL_RTL_STRINGDATA** ppTh
sal_Int32 nIndex,
sal_Int32 nCount,
IMPL_RTL_STRINGDATA* pNewSubStr )
SAL_THROW_EXTERN_C()
{
/* Append? */
if ( nIndex >= pStr->length )
@ -1290,6 +1335,7 @@ void SAL_CALL IMPL_RTL_STRINGNAME( newReplace )( IMPL_RTL_STRINGDATA** ppThis,
IMPL_RTL_STRINGDATA* pStr,
IMPL_RTL_STRCODE cOld,
IMPL_RTL_STRCODE cNew )
SAL_THROW_EXTERN_C()
{
IMPL_RTL_STRINGDATA* pOrg = *ppThis;
int bChanged = 0;
@ -1347,6 +1393,7 @@ void SAL_CALL IMPL_RTL_STRINGNAME( newReplace )( IMPL_RTL_STRINGDATA** ppThis,
void SAL_CALL IMPL_RTL_STRINGNAME( newToAsciiLowerCase )( IMPL_RTL_STRINGDATA** ppThis,
IMPL_RTL_STRINGDATA* pStr )
SAL_THROW_EXTERN_C()
{
IMPL_RTL_STRINGDATA* pOrg = *ppThis;
int bChanged = 0;
@ -1407,6 +1454,7 @@ void SAL_CALL IMPL_RTL_STRINGNAME( newToAsciiLowerCase )( IMPL_RTL_STRINGDATA**
void SAL_CALL IMPL_RTL_STRINGNAME( newToAsciiUpperCase )( IMPL_RTL_STRINGDATA** ppThis,
IMPL_RTL_STRINGDATA* pStr )
SAL_THROW_EXTERN_C()
{
IMPL_RTL_STRINGDATA* pOrg = *ppThis;
int bChanged = 0;
@ -1467,6 +1515,7 @@ void SAL_CALL IMPL_RTL_STRINGNAME( newToAsciiUpperCase )( IMPL_RTL_STRINGDATA**
void SAL_CALL IMPL_RTL_STRINGNAME( newTrim )( IMPL_RTL_STRINGDATA** ppThis,
IMPL_RTL_STRINGDATA* pStr )
SAL_THROW_EXTERN_C()
{
IMPL_RTL_STRINGDATA* pOrg = *ppThis;
const IMPL_RTL_STRCODE* pCharStr = pStr->buffer;
@ -1510,6 +1559,7 @@ sal_Int32 SAL_CALL IMPL_RTL_STRINGNAME( getToken )( IMPL_RTL_STRINGDATA** ppThis
sal_Int32 nToken,
IMPL_RTL_STRCODE cTok,
sal_Int32 nIndex )
SAL_THROW_EXTERN_C()
{
const IMPL_RTL_STRCODE* pCharStr = pStr->buffer;
const IMPL_RTL_STRCODE* pCharStrStart;

View file

@ -26,8 +26,8 @@
*
************************************************************************/
#ifndef INCLUDED_SAL_RTL_SOURCE_SURROGATES_H
#define INCLUDED_SAL_RTL_SOURCE_SURROGATES_H
#ifndef INCLUDED_SAL_RTL_SOURCE_SURROGATES_HXX
#define INCLUDED_SAL_RTL_SOURCE_SURROGATES_HXX
#include "sal/config.h"

View file

@ -31,7 +31,7 @@
#include "rtl/uri.h"
#include "surrogates.h"
#include "surrogates.hxx"
#include "osl/diagnose.h"
#include "rtl/strbuf.hxx"

View file

@ -148,6 +148,7 @@ void SAL_CALL rtl_uStringbuffer_insert( rtl_uString ** This,
void rtl_uStringbuffer_insertUtf32(
rtl_uString ** pThis, sal_Int32 * capacity, sal_Int32 offset, sal_uInt32 c)
SAL_THROW_EXTERN_C()
{
sal_Unicode buf[2];
sal_Int32 len;

View file

@ -40,9 +40,9 @@
#include <string.h>
#include <sal/alloca.h>
#include "hash.h"
#include "strimp.h"
#include "surrogates.h"
#include "hash.hxx"
#include "strimp.hxx"
#include "surrogates.hxx"
#include <rtl/ustring.h>
#include "rtl/math.h"
@ -76,11 +76,11 @@ static void internRelease (rtl_uString *pThis);
/* Include String/UString template code */
#include "strtmpl.c"
#include "strtmpl.cxx"
sal_Int32 rtl_ustr_indexOfAscii_WithLength(
sal_Unicode const * str, sal_Int32 len,
char const * subStr, sal_Int32 subLen)
char const * subStr, sal_Int32 subLen) SAL_THROW_EXTERN_C()
{
if (subLen > 0 && subLen <= len) {
sal_Int32 i;
@ -97,7 +97,7 @@ sal_Int32 rtl_ustr_indexOfAscii_WithLength(
sal_Int32 rtl_ustr_lastIndexOfAscii_WithLength(
sal_Unicode const * str, sal_Int32 len,
char const * subStr, sal_Int32 subLen)
char const * subStr, sal_Int32 subLen) SAL_THROW_EXTERN_C()
{
if (subLen > 0 && subLen <= len) {
sal_Int32 i;
@ -113,6 +113,7 @@ sal_Int32 rtl_ustr_lastIndexOfAscii_WithLength(
}
sal_Int32 SAL_CALL rtl_ustr_valueOfFloat(sal_Unicode * pStr, float f)
SAL_THROW_EXTERN_C()
{
rtl_uString * pResult = NULL;
sal_Int32 nLen;
@ -128,6 +129,7 @@ sal_Int32 SAL_CALL rtl_ustr_valueOfFloat(sal_Unicode * pStr, float f)
}
sal_Int32 SAL_CALL rtl_ustr_valueOfDouble(sal_Unicode * pStr, double d)
SAL_THROW_EXTERN_C()
{
rtl_uString * pResult = NULL;
sal_Int32 nLen;
@ -142,14 +144,14 @@ sal_Int32 SAL_CALL rtl_ustr_valueOfDouble(sal_Unicode * pStr, double d)
return nLen;
}
float SAL_CALL rtl_ustr_toFloat(sal_Unicode const * pStr)
float SAL_CALL rtl_ustr_toFloat(sal_Unicode const * pStr) SAL_THROW_EXTERN_C()
{
return (float) rtl_math_uStringToDouble(pStr,
pStr + rtl_ustr_getLength(pStr),
'.', 0, 0, 0);
}
double SAL_CALL rtl_ustr_toDouble(sal_Unicode const * pStr)
double SAL_CALL rtl_ustr_toDouble(sal_Unicode const * pStr) SAL_THROW_EXTERN_C()
{
return rtl_math_uStringToDouble(pStr, pStr + rtl_ustr_getLength(pStr), '.',
0, 0, 0);
@ -159,6 +161,7 @@ double SAL_CALL rtl_ustr_toDouble(sal_Unicode const * pStr)
sal_Int32 SAL_CALL rtl_ustr_ascii_compare( const sal_Unicode* pStr1,
const sal_Char* pStr2 )
SAL_THROW_EXTERN_C()
{
sal_Int32 nRet;
while ( ((nRet = ((sal_Int32)(*pStr1))-
@ -177,6 +180,7 @@ sal_Int32 SAL_CALL rtl_ustr_ascii_compare( const sal_Unicode* pStr1,
sal_Int32 SAL_CALL rtl_ustr_ascii_compare_WithLength( const sal_Unicode* pStr1,
sal_Int32 nStr1Len,
const sal_Char* pStr2 )
SAL_THROW_EXTERN_C()
{
sal_Int32 nRet = 0;
while( ((nRet = (nStr1Len ? (sal_Int32)(*pStr1) : 0)-
@ -197,6 +201,7 @@ sal_Int32 SAL_CALL rtl_ustr_ascii_shortenedCompare_WithLength( const sal_Unicode
sal_Int32 nStr1Len,
const sal_Char* pStr2,
sal_Int32 nShortenedLength )
SAL_THROW_EXTERN_C()
{
const sal_Unicode* pStr1End = pStr1 + nStr1Len;
sal_Int32 nRet;
@ -240,6 +245,7 @@ sal_Int32 SAL_CALL rtl_ustr_asciil_reverseCompare_WithLength( const sal_Unicode*
sal_Int32 nStr1Len,
const sal_Char* pStr2,
sal_Int32 nStr2Len )
SAL_THROW_EXTERN_C()
{
const sal_Unicode* pStr1Run = pStr1+nStr1Len;
const sal_Char* pStr2Run = pStr2+nStr2Len;
@ -261,6 +267,7 @@ sal_Int32 SAL_CALL rtl_ustr_asciil_reverseCompare_WithLength( const sal_Unicode*
sal_Bool SAL_CALL rtl_ustr_asciil_reverseEquals_WithLength( const sal_Unicode* pStr1,
const sal_Char* pStr2,
sal_Int32 nStrLen )
SAL_THROW_EXTERN_C()
{
const sal_Unicode* pStr1Run = pStr1+nStrLen;
const sal_Char* pStr2Run = pStr2+nStrLen;
@ -279,6 +286,7 @@ sal_Bool SAL_CALL rtl_ustr_asciil_reverseEquals_WithLength( const sal_Unicode* p
sal_Int32 SAL_CALL rtl_ustr_ascii_compareIgnoreAsciiCase( const sal_Unicode* pStr1,
const sal_Char* pStr2 )
SAL_THROW_EXTERN_C()
{
sal_Int32 nRet;
sal_Int32 c1;
@ -309,6 +317,7 @@ sal_Int32 SAL_CALL rtl_ustr_ascii_compareIgnoreAsciiCase( const sal_Unicode* pSt
sal_Int32 SAL_CALL rtl_ustr_ascii_compareIgnoreAsciiCase_WithLength( const sal_Unicode* pStr1,
sal_Int32 nStr1Len,
const sal_Char* pStr2 )
SAL_THROW_EXTERN_C()
{
sal_Int32 nRet;
sal_Int32 c1;
@ -340,7 +349,7 @@ sal_Int32 SAL_CALL rtl_ustr_ascii_compareIgnoreAsciiCase_WithLength( const sal_U
sal_Int32 rtl_ustr_ascii_compareIgnoreAsciiCase_WithLengths(
sal_Unicode const * first, sal_Int32 firstLen,
char const * second, sal_Int32 secondLen)
char const * second, sal_Int32 secondLen) SAL_THROW_EXTERN_C()
{
sal_Int32 i;
sal_Int32 len = firstLen < secondLen ? firstLen : secondLen;
@ -368,6 +377,7 @@ sal_Int32 SAL_CALL rtl_ustr_ascii_shortenedCompareIgnoreAsciiCase_WithLength( co
sal_Int32 nStr1Len,
const sal_Char* pStr2,
sal_Int32 nShortenedLength )
SAL_THROW_EXTERN_C()
{
const sal_Unicode* pStr1End = pStr1 + nStr1Len;
sal_Int32 nRet;
@ -417,6 +427,7 @@ sal_Int32 SAL_CALL rtl_ustr_ascii_shortenedCompareIgnoreAsciiCase_WithLength( co
void SAL_CALL rtl_uString_newFromAscii( rtl_uString** ppThis,
const sal_Char* pCharStr )
SAL_THROW_EXTERN_C()
{
sal_Int32 nLen;
@ -460,7 +471,7 @@ void SAL_CALL rtl_uString_newFromAscii( rtl_uString** ppThis,
void SAL_CALL rtl_uString_newFromCodePoints(
rtl_uString ** newString, sal_uInt32 const * codePoints,
sal_Int32 codePointCount)
sal_Int32 codePointCount) SAL_THROW_EXTERN_C()
{
sal_Int32 n;
sal_Int32 i;
@ -724,7 +735,7 @@ void SAL_CALL rtl_string2UString( rtl_uString** ppThis,
const sal_Char* pStr,
sal_Int32 nLen,
rtl_TextEncoding eTextEncoding,
sal_uInt32 nCvtFlags )
sal_uInt32 nCvtFlags ) SAL_THROW_EXTERN_C()
{
rtl_string2UString_status( ppThis, pStr, nLen, eTextEncoding,
nCvtFlags, NULL );
@ -732,10 +743,10 @@ void SAL_CALL rtl_string2UString( rtl_uString** ppThis,
/* ----------------------------------------------------------------------- */
typedef enum {
enum StrLifecycle {
CANNOT_RETURN,
CAN_RETURN = 1
} StrLifecycle;
};
static oslMutex
getInternMutex()
@ -784,7 +795,7 @@ static void rtl_ustring_intern_internal( rtl_uString ** newStr,
}
void SAL_CALL rtl_uString_intern( rtl_uString ** newStr,
rtl_uString * str)
rtl_uString * str) SAL_THROW_EXTERN_C()
{
if (SAL_STRING_IS_INTERN(str))
{
@ -830,6 +841,7 @@ void SAL_CALL rtl_uString_internConvert( rtl_uString ** newStr,
rtl_TextEncoding eTextEncoding,
sal_uInt32 convertFlags,
sal_uInt32 * pInfo )
SAL_THROW_EXTERN_C()
{
rtl_uString *scratch;
@ -848,8 +860,8 @@ void SAL_CALL rtl_uString_internConvert( rtl_uString ** newStr,
{
int i;
rtl_uString *pScratch;
pScratch = alloca( sizeof( rtl_uString )
+ len * sizeof (IMPL_RTL_STRCODE ) );
pScratch = static_cast< rtl_uString * >(
alloca(sizeof (rtl_uString) + len * sizeof (IMPL_RTL_STRCODE)));
for (i = 0; i < len; i++)
{
/* Check ASCII range */
@ -868,7 +880,9 @@ void SAL_CALL rtl_uString_internConvert( rtl_uString ** newStr,
sal_Size nSrcBytes;
sal_uInt32 nInfo;
pScratch = alloca( sizeof(rtl_uString) + ulen * sizeof (IMPL_RTL_STRCODE) );
pScratch = static_cast< rtl_uString * >(
alloca(
sizeof (rtl_uString) + ulen * sizeof (IMPL_RTL_STRCODE)));
hConverter = rtl_createTextToUnicodeConverter( eTextEncoding );
rtl_convertTextToUnicode(