case nsIDataType::TYPE_CHAR_STR: case nsIDataType::TYPE_STRING_SIZE_IS:
case nsIDataType::VTYPE_CHAR_STR: case nsIDataType::VTYPE_STRING_SIZE_IS:
static nsresult ToManageableNumber(const nsDiscriminatedUnion& inData,                                    nsDiscriminatedUnion* outData){    nsAutoString tempString;    nsresult rv;    switch(inData.mType)    {    // This group results in a PRInt32...#define CASE__NUMBER_INT32(type_, member_)                                    \    case nsIDataType :: type_ :                                               \        outData->mInt32Value = inData. member_ ;                              \        outData->mType = nsIDataType::TYPE_INT32;                             \        return NS_OK;    CASE__NUMBER_INT32(TYPE_INT8,   mInt8Value)    CASE__NUMBER_INT32(TYPE_INT16,  mInt16Value)    CASE__NUMBER_INT32(TYPE_INT32,  mInt32Value)    CASE__NUMBER_INT32(TYPE_UINT8,  mUint8Value)    CASE__NUMBER_INT32(TYPE_UINT16, mUint16Value)    CASE__NUMBER_INT32(TYPE_BOOL,   mBoolValue)    CASE__NUMBER_INT32(TYPE_CHAR,   mCharValue)    CASE__NUMBER_INT32(TYPE_WCHAR,  mWCharValue)      #undef CASE__NUMBER_INT32                // This group results in a PRUint32...        case nsIDataType::TYPE_UINT32:        outData->mInt32Value = inData.mUint32Value;        outData->mType = nsIDataType::TYPE_INT32;        return NS_OK;                   // This group results in a double...    case nsIDataType::TYPE_INT64:            case nsIDataType::TYPE_UINT64:        // XXX Need boundary checking here.         // We may need to return NS_SUCCESS_LOSS_OF_INSIGNIFICANT_DATA        LL_L2D(outData->mDoubleValue, inData.mInt64Value);        outData->mType = nsIDataType::TYPE_DOUBLE;        return NS_OK;    case nsIDataType::TYPE_FLOAT:                outData->mDoubleValue = inData.mFloatValue;        outData->mType = nsIDataType::TYPE_DOUBLE;        return NS_OK;    case nsIDataType::TYPE_DOUBLE:                outData->mDoubleValue = inData.mDoubleValue;        outData->mType = nsIDataType::TYPE_DOUBLE;        return NS_OK;    case nsIDataType::TYPE_CHAR_STR:    case nsIDataType::TYPE_STRING_SIZE_IS:        rv = String2Double(inData.str.mStringValue, &outData->mDoubleValue);        if(NS_FAILED(rv))            return rv;        outData->mType = nsIDataType::TYPE_DOUBLE;        return NS_OK;    case nsIDataType::TYPE_ASTRING:        rv = AString2Double(*inData.mAStringValue, &outData->mDoubleValue);        if(NS_FAILED(rv))            return rv;        outData->mType = nsIDataType::TYPE_DOUBLE;        return NS_OK;    case nsIDataType::TYPE_WCHAR_STR:    case nsIDataType::TYPE_WSTRING_SIZE_IS:        tempString.Assign(inData.wstr.mWStringValue);        rv = AString2Double(tempString, &outData->mDoubleValue);        if(NS_FAILED(rv))            return rv;        outData->mType = nsIDataType::TYPE_DOUBLE;        return NS_OK;        // This group fails...    case nsIDataType::TYPE_VOID:            case nsIDataType::TYPE_ID:            case nsIDataType::TYPE_INTERFACE:            case nsIDataType::TYPE_INTERFACE_IS:            case nsIDataType::TYPE_ARRAY:            case nsIDataType::TYPE_EMPTY:    default:        return NS_ERROR_CANNOT_CONVERT_DATA;    }}