mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 14:22:01 +00:00
still not part of the build; more work adding the new functions. More to come
This commit is contained in:
parent
5aba41c891
commit
1d41a0a81b
@ -25,18 +25,34 @@
|
||||
|
||||
#include "nsReadableUtils.h"
|
||||
|
||||
char*
|
||||
ToNewCString( const nsAReadableString& aSourceString )
|
||||
template <class CharT>
|
||||
inline
|
||||
CharT*
|
||||
CopyStringToNewZeroTerminatedBuffer( const basic_nsAReadableString<CharT>& aSourceString )
|
||||
{
|
||||
// no conversion needed, just allocate a buffer of the correct length and copy into it
|
||||
|
||||
CharT* result = NS_STATIC_CAST(CharT*, nsMemory::Alloc( (aSourceString.Length()+1) * sizeof(CharT) ));
|
||||
*copy_string(aSourceString.BeginReading(), aSourceString.EndReading(), result) = CharT(0);
|
||||
return result;
|
||||
}
|
||||
|
||||
char*
|
||||
ToNewCString( const nsAReadableCString& aSourceCString )
|
||||
{
|
||||
return CopyStringToNewZeroTerminatedBuffer(aSourceCString);
|
||||
}
|
||||
|
||||
PRUnichar*
|
||||
ToNewUnicode( const nsAReadableString& aSourceString )
|
||||
{
|
||||
return CopyStringToNewZeroTerminatedBuffer(aSourceString);
|
||||
}
|
||||
|
||||
|
||||
|
||||
char*
|
||||
ToNewCString( const nsAReadableString& aSourceString )
|
||||
{
|
||||
}
|
||||
|
||||
@ -45,6 +61,8 @@ ToNewUnicode( const nsAReadableCString& aSourceCString )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
PRBool
|
||||
IsASCII( const nsAReadableString& aSourceString )
|
||||
{
|
||||
|
@ -25,18 +25,34 @@
|
||||
|
||||
#include "nsReadableUtils.h"
|
||||
|
||||
char*
|
||||
ToNewCString( const nsAReadableString& aSourceString )
|
||||
template <class CharT>
|
||||
inline
|
||||
CharT*
|
||||
CopyStringToNewZeroTerminatedBuffer( const basic_nsAReadableString<CharT>& aSourceString )
|
||||
{
|
||||
// no conversion needed, just allocate a buffer of the correct length and copy into it
|
||||
|
||||
CharT* result = NS_STATIC_CAST(CharT*, nsMemory::Alloc( (aSourceString.Length()+1) * sizeof(CharT) ));
|
||||
*copy_string(aSourceString.BeginReading(), aSourceString.EndReading(), result) = CharT(0);
|
||||
return result;
|
||||
}
|
||||
|
||||
char*
|
||||
ToNewCString( const nsAReadableCString& aSourceCString )
|
||||
{
|
||||
return CopyStringToNewZeroTerminatedBuffer(aSourceCString);
|
||||
}
|
||||
|
||||
PRUnichar*
|
||||
ToNewUnicode( const nsAReadableString& aSourceString )
|
||||
{
|
||||
return CopyStringToNewZeroTerminatedBuffer(aSourceString);
|
||||
}
|
||||
|
||||
|
||||
|
||||
char*
|
||||
ToNewCString( const nsAReadableString& aSourceString )
|
||||
{
|
||||
}
|
||||
|
||||
@ -45,6 +61,8 @@ ToNewUnicode( const nsAReadableCString& aSourceCString )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
PRBool
|
||||
IsASCII( const nsAReadableString& aSourceString )
|
||||
{
|
||||
|
@ -25,18 +25,34 @@
|
||||
|
||||
#include "nsReadableUtils.h"
|
||||
|
||||
char*
|
||||
ToNewCString( const nsAReadableString& aSourceString )
|
||||
template <class CharT>
|
||||
inline
|
||||
CharT*
|
||||
CopyStringToNewZeroTerminatedBuffer( const basic_nsAReadableString<CharT>& aSourceString )
|
||||
{
|
||||
// no conversion needed, just allocate a buffer of the correct length and copy into it
|
||||
|
||||
CharT* result = NS_STATIC_CAST(CharT*, nsMemory::Alloc( (aSourceString.Length()+1) * sizeof(CharT) ));
|
||||
*copy_string(aSourceString.BeginReading(), aSourceString.EndReading(), result) = CharT(0);
|
||||
return result;
|
||||
}
|
||||
|
||||
char*
|
||||
ToNewCString( const nsAReadableCString& aSourceCString )
|
||||
{
|
||||
return CopyStringToNewZeroTerminatedBuffer(aSourceCString);
|
||||
}
|
||||
|
||||
PRUnichar*
|
||||
ToNewUnicode( const nsAReadableString& aSourceString )
|
||||
{
|
||||
return CopyStringToNewZeroTerminatedBuffer(aSourceString);
|
||||
}
|
||||
|
||||
|
||||
|
||||
char*
|
||||
ToNewCString( const nsAReadableString& aSourceString )
|
||||
{
|
||||
}
|
||||
|
||||
@ -45,6 +61,8 @@ ToNewUnicode( const nsAReadableCString& aSourceCString )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
PRBool
|
||||
IsASCII( const nsAReadableString& aSourceString )
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user