mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1201468: Map UErrorCode to nsresult, r=jfkthame
This commit is contained in:
parent
2915f16fc6
commit
5381d57cba
@ -175,6 +175,25 @@ ICUUtils::AssignUCharArrayToString(UChar* aICUString,
|
||||
NS_ASSERTION((int32_t)aMozString.Length() == aLength, "Conversion failed");
|
||||
}
|
||||
|
||||
/* static */ nsresult
|
||||
ICUUtils::UErrorToNsResult(const UErrorCode aErrorCode)
|
||||
{
|
||||
if (U_SUCCESS(aErrorCode)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
switch(aErrorCode) {
|
||||
case U_ILLEGAL_ARGUMENT_ERROR:
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
case U_MEMORY_ALLOCATION_ERROR:
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
default:
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* static */ Locale
|
||||
ICUUtils::BCP47CodeToLocale(const nsAString& aBCP47Code)
|
||||
|
@ -88,6 +88,11 @@ public:
|
||||
int32_t aLength,
|
||||
nsAString& aMozString);
|
||||
|
||||
/**
|
||||
* Map ICU UErrorCode to nsresult
|
||||
*/
|
||||
static nsresult UErrorToNsResult(const UErrorCode aErrorCode);
|
||||
|
||||
#if 0
|
||||
// Currently disabled because using C++ API doesn't play nicely with enabling
|
||||
// system ICU.
|
||||
|
Loading…
Reference in New Issue
Block a user