bug 334167 : make NS_IsNativeUTF8 inline where appropriate r/sr=darin

This commit is contained in:
jshin%mailaps.org 2006-04-16 23:58:38 +00:00
parent 392ceea3d4
commit e1e2c27685
2 changed files with 26 additions and 30 deletions

View File

@ -65,12 +65,6 @@ NS_CopyUnicodeToNative(const nsAString &input, nsACString &output)
return NS_OK;
}
NS_COM PRBool
NS_IsNativeUTF8()
{
return PR_TRUE;
}
void
NS_StartupNativeCharsetUtils()
{
@ -972,12 +966,6 @@ NS_CopyUnicodeToNative(const nsAString &input, nsACString &output)
return NS_OK;
}
NS_COM PRBool
NS_IsNativeUTF8()
{
return PR_FALSE;
}
// moved from widget/src/windows/nsToolkit.cpp
NS_COM PRInt32
NS_ConvertAtoW(const char *aStrInA, int aBufferSize, PRUnichar *aStrOutW)
@ -1107,12 +1095,6 @@ NS_CopyUnicodeToNative(const nsAString &input, nsACString &output)
return NS_OK;
}
NS_COM PRBool
NS_IsNativeUTF8()
{
return PR_FALSE;
}
void
NS_StartupNativeCharsetUtils()
{
@ -1316,12 +1298,6 @@ NS_CopyUnicodeToNative(const nsAString &input, nsACString &output)
return nsFSStringConversionMac::UCSToFS(input, output);
}
NS_COM PRBool
NS_IsNativeUTF8()
{
return PR_FALSE;
}
void
NS_StartupNativeCharsetUtils()
{
@ -1354,12 +1330,6 @@ NS_CopyUnicodeToNative(const nsAString &input, nsACString &output)
return NS_OK;
}
NS_COM PRBool
NS_IsNativeUTF8()
{
return PR_FALSE;
}
void
NS_StartupNativeCharsetUtils()
{

View File

@ -65,7 +65,33 @@ NS_COM PRInt32 NS_ConvertWtoA(const PRUnichar *aStrInW, int aBufferSizeOut,
#endif
NS_COM nsresult NS_CopyNativeToUnicode(const nsACString &input, nsAString &output);
NS_COM nsresult NS_CopyUnicodeToNative(const nsAString &input, nsACString &output);
/*
* This function indicates whether the character encoding used in the file
* system (more exactly what's used for |GetNativeFoo| and |SetNativeFoo|
* of |nsILocalFile|) is UTF-8 or not. Knowing that helps us avoid an
* unncessary encoding conversion in some cases. For instance, to get the leaf
* name in UTF-8 out of nsILocalFile, we can just use |GetNativeLeafName| rather
* than using |GetLeafName| and converting the result to UTF-8 if the file
* system encoding is UTF-8.
* On Unix (but not on Mac OS X), it depends on the locale and is not known
* in advance (at the compilation time) so that this function needs to be
* a real function. On Mac OS X and BeOS, it's always UTF-8 while on Windows
* and other platforms (e.g. OS2), it's never UTF-8.
*/
#if defined(XP_UNIX) && !defined(XP_MACOSX)
NS_COM PRBool NS_IsNativeUTF8();
#else
inline PRBool NS_IsNativeUTF8()
{
#if defined(XP_MACOSX) || defined(XP_BEOS)
return PR_TRUE;
#else
return PR_FALSE;
#endif
}
#endif
/**
* internal