mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1213130 - Make several string function to accept char16ptr_t instead of char16_t*, and remove redundant overloads. rs=froydnj
This commit is contained in:
parent
958a06e546
commit
8799153d89
@ -1218,21 +1218,13 @@ public:
|
||||
NS_UTF16ToCString(aStr, NS_CSTRING_ENCODING_UTF8, *this);
|
||||
}
|
||||
|
||||
explicit NS_ConvertUTF16toUTF8(const char16_t* aData,
|
||||
explicit NS_ConvertUTF16toUTF8(const char16ptr_t aData,
|
||||
uint32_t aLength = UINT32_MAX)
|
||||
{
|
||||
NS_UTF16ToCString(nsDependentString(aData, aLength),
|
||||
NS_CSTRING_ENCODING_UTF8, *this);
|
||||
}
|
||||
|
||||
#ifdef MOZ_USE_CHAR16_WRAPPER
|
||||
explicit NS_ConvertUTF16toUTF8(char16ptr_t aString,
|
||||
uint32_t aLength = UINT32_MAX)
|
||||
: NS_ConvertUTF16toUTF8(static_cast<const char16_t*>(aString), aLength)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
private:
|
||||
self_type& operator=(const self_type& aString) = delete;
|
||||
};
|
||||
@ -1247,7 +1239,7 @@ public:
|
||||
NS_UTF16ToCString(aStr, NS_CSTRING_ENCODING_ASCII, *this);
|
||||
}
|
||||
|
||||
explicit NS_LossyConvertUTF16toASCII(const char16_t* aData,
|
||||
explicit NS_LossyConvertUTF16toASCII(const char16ptr_t aData,
|
||||
uint32_t aLength = UINT32_MAX)
|
||||
{
|
||||
NS_UTF16ToCString(nsDependentString(aData, aLength),
|
||||
|
@ -26,7 +26,7 @@ CopyASCIItoUTF16(const nsACString& aSource, nsAString& aDest)
|
||||
}
|
||||
|
||||
void
|
||||
LossyCopyUTF16toASCII(const char16_t* aSource, nsACString& aDest)
|
||||
LossyCopyUTF16toASCII(const char16ptr_t aSource, nsACString& aDest)
|
||||
{
|
||||
aDest.Truncate();
|
||||
if (aSource) {
|
||||
@ -72,7 +72,7 @@ CopyUTF8toUTF16(const nsACString& aSource, nsAString& aDest)
|
||||
}
|
||||
|
||||
void
|
||||
CopyUTF16toUTF8(const char16_t* aSource, nsACString& aDest)
|
||||
CopyUTF16toUTF8(const char16ptr_t aSource, nsACString& aDest)
|
||||
{
|
||||
aDest.Truncate();
|
||||
AppendUTF16toUTF8(aSource, aDest);
|
||||
@ -139,7 +139,7 @@ AppendASCIItoUTF16(const nsACString& aSource, nsAString& aDest,
|
||||
}
|
||||
|
||||
void
|
||||
LossyAppendUTF16toASCII(const char16_t* aSource, nsACString& aDest)
|
||||
LossyAppendUTF16toASCII(const char16ptr_t aSource, nsACString& aDest)
|
||||
{
|
||||
if (aSource) {
|
||||
LossyAppendUTF16toASCII(nsDependentString(aSource), aDest);
|
||||
@ -255,7 +255,7 @@ AppendUTF8toUTF16(const nsACString& aSource, nsAString& aDest,
|
||||
}
|
||||
|
||||
void
|
||||
AppendUTF16toUTF8(const char16_t* aSource, nsACString& aDest)
|
||||
AppendUTF16toUTF8(const char16ptr_t aSource, nsACString& aDest)
|
||||
{
|
||||
if (aSource) {
|
||||
AppendUTF16toUTF8(nsDependentString(aSource), aDest);
|
||||
|
@ -36,7 +36,7 @@ Distance(const nsReadingIterator<char>& aStart,
|
||||
void LossyCopyUTF16toASCII(const nsAString& aSource, nsACString& aDest);
|
||||
void CopyASCIItoUTF16(const nsACString& aSource, nsAString& aDest);
|
||||
|
||||
void LossyCopyUTF16toASCII(const char16_t* aSource, nsACString& aDest);
|
||||
void LossyCopyUTF16toASCII(const char16ptr_t aSource, nsACString& aDest);
|
||||
void CopyASCIItoUTF16(const char* aSource, nsAString& aDest);
|
||||
|
||||
void CopyUTF16toUTF8(const nsAString& aSource, nsACString& aDest);
|
||||
@ -45,7 +45,7 @@ MOZ_WARN_UNUSED_RESULT bool CopyUTF16toUTF8(const nsAString& aSource,
|
||||
const mozilla::fallible_t&);
|
||||
void CopyUTF8toUTF16(const nsACString& aSource, nsAString& aDest);
|
||||
|
||||
void CopyUTF16toUTF8(const char16_t* aSource, nsACString& aDest);
|
||||
void CopyUTF16toUTF8(const char16ptr_t aSource, nsACString& aDest);
|
||||
void CopyUTF8toUTF16(const char* aSource, nsAString& aDest);
|
||||
|
||||
void LossyAppendUTF16toASCII(const nsAString& aSource, nsACString& aDest);
|
||||
@ -54,7 +54,7 @@ MOZ_WARN_UNUSED_RESULT bool AppendASCIItoUTF16(const nsACString& aSource,
|
||||
nsAString& aDest,
|
||||
const mozilla::fallible_t&);
|
||||
|
||||
void LossyAppendUTF16toASCII(const char16_t* aSource, nsACString& aDest);
|
||||
void LossyAppendUTF16toASCII(const char16ptr_t aSource, nsACString& aDest);
|
||||
MOZ_WARN_UNUSED_RESULT bool AppendASCIItoUTF16(const char* aSource,
|
||||
nsAString& aDest,
|
||||
const mozilla::fallible_t&);
|
||||
@ -69,16 +69,9 @@ MOZ_WARN_UNUSED_RESULT bool AppendUTF8toUTF16(const nsACString& aSource,
|
||||
nsAString& aDest,
|
||||
const mozilla::fallible_t&);
|
||||
|
||||
void AppendUTF16toUTF8(const char16_t* aSource, nsACString& aDest);
|
||||
void AppendUTF16toUTF8(const char16ptr_t aSource, nsACString& aDest);
|
||||
void AppendUTF8toUTF16(const char* aSource, nsAString& aDest);
|
||||
|
||||
#ifdef MOZ_USE_CHAR16_WRAPPER
|
||||
inline void AppendUTF16toUTF8(char16ptr_t aSource, nsACString& aDest)
|
||||
{
|
||||
return AppendUTF16toUTF8(static_cast<const char16_t*>(aSource), aDest);
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Returns a new |char| buffer containing a zero-terminated copy of |aSource|.
|
||||
*
|
||||
|
@ -55,28 +55,16 @@ static_assert(sizeof(nsCString::char_type) == 1,
|
||||
class NS_LossyConvertUTF16toASCII : public nsAutoCString
|
||||
{
|
||||
public:
|
||||
explicit NS_LossyConvertUTF16toASCII(const char16_t* aString)
|
||||
explicit NS_LossyConvertUTF16toASCII(const char16ptr_t aString)
|
||||
{
|
||||
LossyAppendUTF16toASCII(aString, *this);
|
||||
}
|
||||
|
||||
NS_LossyConvertUTF16toASCII(const char16_t* aString, uint32_t aLength)
|
||||
NS_LossyConvertUTF16toASCII(const char16ptr_t aString, uint32_t aLength)
|
||||
{
|
||||
LossyAppendUTF16toASCII(Substring(aString, aLength), *this);
|
||||
}
|
||||
|
||||
#ifdef MOZ_USE_CHAR16_WRAPPER
|
||||
explicit NS_LossyConvertUTF16toASCII(char16ptr_t aString)
|
||||
: NS_LossyConvertUTF16toASCII(static_cast<const char16_t*>(aString))
|
||||
{
|
||||
}
|
||||
|
||||
NS_LossyConvertUTF16toASCII(char16ptr_t aString, uint32_t aLength)
|
||||
: NS_LossyConvertUTF16toASCII(static_cast<const char16_t*>(aString), aLength)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
explicit NS_LossyConvertUTF16toASCII(const nsAString& aString)
|
||||
{
|
||||
LossyAppendUTF16toASCII(aString, *this);
|
||||
@ -118,28 +106,16 @@ private:
|
||||
class NS_ConvertUTF16toUTF8 : public nsAutoCString
|
||||
{
|
||||
public:
|
||||
explicit NS_ConvertUTF16toUTF8(const char16_t* aString)
|
||||
explicit NS_ConvertUTF16toUTF8(const char16ptr_t aString)
|
||||
{
|
||||
AppendUTF16toUTF8(aString, *this);
|
||||
}
|
||||
|
||||
NS_ConvertUTF16toUTF8(const char16_t* aString, uint32_t aLength)
|
||||
NS_ConvertUTF16toUTF8(const char16ptr_t aString, uint32_t aLength)
|
||||
{
|
||||
AppendUTF16toUTF8(Substring(aString, aLength), *this);
|
||||
}
|
||||
|
||||
#ifdef MOZ_USE_CHAR16_WRAPPER
|
||||
NS_ConvertUTF16toUTF8(char16ptr_t aString)
|
||||
: NS_ConvertUTF16toUTF8(static_cast<const char16_t*>(aString))
|
||||
{
|
||||
}
|
||||
|
||||
NS_ConvertUTF16toUTF8(char16ptr_t aString, uint32_t aLength)
|
||||
: NS_ConvertUTF16toUTF8(static_cast<const char16_t*>(aString), aLength)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
explicit NS_ConvertUTF16toUTF8(const nsAString& aString)
|
||||
{
|
||||
AppendUTF16toUTF8(aString, *this);
|
||||
|
Loading…
Reference in New Issue
Block a user